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:
"Fix the i2c-designware regression of rc2.

Also, a DMA buffer fix for the tiny-usb driver where the USB core now
loudly complains about the non DMA-capable buffer"

[ I had cherry-picked the designware fix separately because it hit my
laptop, but here is the proper sync with the i2c tree - Linus ]

* 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
i2c: designware: Fix bogus sda_hold_time due to uninitialized vars
i2c: i2c-tiny-usb: fix buffer not being DMA capable

+21 -4
+21 -4
drivers/i2c/busses/i2c-tiny-usb.c
··· 178 178 int value, int index, void *data, int len) 179 179 { 180 180 struct i2c_tiny_usb *dev = (struct i2c_tiny_usb *)adapter->algo_data; 181 + void *dmadata = kmalloc(len, GFP_KERNEL); 182 + int ret; 183 + 184 + if (!dmadata) 185 + return -ENOMEM; 181 186 182 187 /* do control transfer */ 183 - return usb_control_msg(dev->usb_dev, usb_rcvctrlpipe(dev->usb_dev, 0), 188 + ret = usb_control_msg(dev->usb_dev, usb_rcvctrlpipe(dev->usb_dev, 0), 184 189 cmd, USB_TYPE_VENDOR | USB_RECIP_INTERFACE | 185 - USB_DIR_IN, value, index, data, len, 2000); 190 + USB_DIR_IN, value, index, dmadata, len, 2000); 191 + 192 + memcpy(data, dmadata, len); 193 + kfree(dmadata); 194 + return ret; 186 195 } 187 196 188 197 static int usb_write(struct i2c_adapter *adapter, int cmd, 189 198 int value, int index, void *data, int len) 190 199 { 191 200 struct i2c_tiny_usb *dev = (struct i2c_tiny_usb *)adapter->algo_data; 201 + void *dmadata = kmemdup(data, len, GFP_KERNEL); 202 + int ret; 203 + 204 + if (!dmadata) 205 + return -ENOMEM; 192 206 193 207 /* do control transfer */ 194 - return usb_control_msg(dev->usb_dev, usb_sndctrlpipe(dev->usb_dev, 0), 208 + ret = usb_control_msg(dev->usb_dev, usb_sndctrlpipe(dev->usb_dev, 0), 195 209 cmd, USB_TYPE_VENDOR | USB_RECIP_INTERFACE, 196 - value, index, data, len, 2000); 210 + value, index, dmadata, len, 2000); 211 + 212 + kfree(dmadata); 213 + return ret; 197 214 } 198 215 199 216 static void i2c_tiny_usb_free(struct i2c_tiny_usb *dev)