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' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux

Pull i2c fixes from Wolfram Sang:
"The ismt driver had a problem with a rarely used transaction type and
the designware driver was made even more robust against non standard
ACPI tables"

* 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
i2c: designware: Round down ACPI provided clk to nearest supported clk
i2c: ismt: Return EMSGSIZE for block reads with bogus length
i2c: ismt: Don't duplicate the receive length for block reads

+16 -6
+12 -4
drivers/i2c/busses/i2c-designware-platdrv.c
··· 256 256 struct dw_i2c_dev *dev; 257 257 u32 acpi_speed, ht = 0; 258 258 struct resource *mem; 259 - int irq, ret; 259 + int i, irq, ret; 260 + const int supported_speeds[] = { 0, 100000, 400000, 1000000, 3400000 }; 260 261 261 262 irq = platform_get_irq(pdev, 0); 262 263 if (irq < 0) ··· 298 297 } 299 298 300 299 acpi_speed = i2c_acpi_find_bus_speed(&pdev->dev); 301 - /* Some broken DSTDs use 1MiHz instead of 1MHz */ 302 - if (acpi_speed == 1048576) 303 - acpi_speed = 1000000; 300 + /* 301 + * Some DSTDs use a non standard speed, round down to the lowest 302 + * standard speed. 303 + */ 304 + for (i = 1; i < ARRAY_SIZE(supported_speeds); i++) { 305 + if (acpi_speed < supported_speeds[i]) 306 + break; 307 + } 308 + acpi_speed = supported_speeds[i - 1]; 309 + 304 310 /* 305 311 * Find bus speed from the "clock-frequency" device property, ACPI 306 312 * or by using fast mode if neither is set.
+4 -2
drivers/i2c/busses/i2c-ismt.c
··· 341 341 break; 342 342 case I2C_SMBUS_BLOCK_DATA: 343 343 case I2C_SMBUS_I2C_BLOCK_DATA: 344 - memcpy(&data->block[1], dma_buffer, desc->rxbytes); 345 - data->block[0] = desc->rxbytes; 344 + if (desc->rxbytes != dma_buffer[0] + 1) 345 + return -EMSGSIZE; 346 + 347 + memcpy(data->block, dma_buffer, desc->rxbytes); 346 348 break; 347 349 } 348 350 return 0;