Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'i2c/for-current-fixed' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux

Pull i2c fixes from Wolfram Sang:

- a revert because of bugzilla #200045 (and some documentation about
it)

- another regression fix in the i2c-gpio driver

- a leak fix for the i2c core

* 'i2c/for-current-fixed' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
i2c: gpio: initialize SCL to HIGH again
i2c: smbus: kill memory leak on emulated and failed DMA SMBus xfers
i2c: algos: bit: mention our experience about initial states
Revert "i2c: algo-bit: init the bus to a known state"

+15 -11
+4 -4
drivers/i2c/algos/i2c-algo-bit.c
··· 647 647 if (bit_adap->getscl == NULL) 648 648 adap->quirks = &i2c_bit_quirk_no_clk_stretch; 649 649 650 - /* Bring bus to a known state. Looks like STOP if bus is not free yet */ 651 - setscl(bit_adap, 1); 652 - udelay(bit_adap->udelay); 653 - setsda(bit_adap, 1); 650 + /* 651 + * We tried forcing SCL/SDA to an initial state here. But that caused a 652 + * regression, sadly. Check Bugzilla #200045 for details. 653 + */ 654 654 655 655 ret = add_adapter(adap); 656 656 if (ret < 0)
+2 -2
drivers/i2c/busses/i2c-gpio.c
··· 279 279 * required for an I2C bus. 280 280 */ 281 281 if (pdata->scl_is_open_drain) 282 - gflags = GPIOD_OUT_LOW; 282 + gflags = GPIOD_OUT_HIGH; 283 283 else 284 - gflags = GPIOD_OUT_LOW_OPEN_DRAIN; 284 + gflags = GPIOD_OUT_HIGH_OPEN_DRAIN; 285 285 priv->scl = i2c_gpio_get_desc(dev, "scl", 1, gflags); 286 286 if (IS_ERR(priv->scl)) 287 287 return PTR_ERR(priv->scl);
+9 -5
drivers/i2c/i2c-core-smbus.c
··· 465 465 466 466 status = i2c_transfer(adapter, msg, num); 467 467 if (status < 0) 468 - return status; 469 - if (status != num) 470 - return -EIO; 468 + goto cleanup; 469 + if (status != num) { 470 + status = -EIO; 471 + goto cleanup; 472 + } 473 + status = 0; 471 474 472 475 /* Check PEC if last message is a read */ 473 476 if (i && (msg[num-1].flags & I2C_M_RD)) { 474 477 status = i2c_smbus_check_pec(partial_pec, &msg[num-1]); 475 478 if (status < 0) 476 - return status; 479 + goto cleanup; 477 480 } 478 481 479 482 if (read_write == I2C_SMBUS_READ) ··· 502 499 break; 503 500 } 504 501 502 + cleanup: 505 503 if (msg[0].flags & I2C_M_DMA_SAFE) 506 504 kfree(msg[0].buf); 507 505 if (msg[1].flags & I2C_M_DMA_SAFE) 508 506 kfree(msg[1].buf); 509 507 510 - return 0; 508 + return status; 511 509 } 512 510 513 511 /**