Skip to content

Commit 55fcd44

Browse files
committed
Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
Pull i2c fixes from Wolfram Sang: "Three more driver bugfixes and an annotation fix for the core" * 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: i2c: robotfuzz-osif: fix control-request directions i2c: dev: Add __user annotation i2c: cp2615: check for allocation failure in cp2615_i2c_recv() i2c: i801: Ensure that SMBHSTSTS_INUSE_STS is cleared when leaving i801_access
2 parents 7764c62 + 4ca070e commit 55fcd44

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

drivers/i2c/busses/i2c-cp2615.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,17 +138,23 @@ cp2615_i2c_send(struct usb_interface *usbif, struct cp2615_i2c_transfer *i2c_w)
138138
static int
139139
cp2615_i2c_recv(struct usb_interface *usbif, unsigned char tag, void *buf)
140140
{
141-
struct cp2615_iop_msg *msg = kzalloc(sizeof(*msg), GFP_KERNEL);
142-
struct cp2615_i2c_transfer_result *i2c_r = (struct cp2615_i2c_transfer_result *)&msg->data;
143141
struct usb_device *usbdev = interface_to_usbdev(usbif);
144-
int res = usb_bulk_msg(usbdev, usb_rcvbulkpipe(usbdev, IOP_EP_IN),
145-
msg, sizeof(struct cp2615_iop_msg), NULL, 0);
142+
struct cp2615_iop_msg *msg;
143+
struct cp2615_i2c_transfer_result *i2c_r;
144+
int res;
145+
146+
msg = kzalloc(sizeof(*msg), GFP_KERNEL);
147+
if (!msg)
148+
return -ENOMEM;
146149

150+
res = usb_bulk_msg(usbdev, usb_rcvbulkpipe(usbdev, IOP_EP_IN), msg,
151+
sizeof(struct cp2615_iop_msg), NULL, 0);
147152
if (res < 0) {
148153
kfree(msg);
149154
return res;
150155
}
151156

157+
i2c_r = (struct cp2615_i2c_transfer_result *)&msg->data;
152158
if (msg->msg != htons(iop_I2cTransferResult) || i2c_r->tag != tag) {
153159
kfree(msg);
154160
return -EIO;

drivers/i2c/busses/i2c-i801.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -978,6 +978,9 @@ static s32 i801_access(struct i2c_adapter *adap, u16 addr,
978978
}
979979

980980
out:
981+
/* Unlock the SMBus device for use by BIOS/ACPI */
982+
outb_p(SMBHSTSTS_INUSE_STS, SMBHSTSTS(priv));
983+
981984
pm_runtime_mark_last_busy(&priv->pci_dev->dev);
982985
pm_runtime_put_autosuspend(&priv->pci_dev->dev);
983986
mutex_unlock(&priv->acpi_lock);

drivers/i2c/busses/i2c-robotfuzz-osif.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ static int osif_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs,
8383
}
8484
}
8585

86-
ret = osif_usb_read(adapter, OSIFI2C_STOP, 0, 0, NULL, 0);
86+
ret = osif_usb_write(adapter, OSIFI2C_STOP, 0, 0, NULL, 0);
8787
if (ret) {
8888
dev_err(&adapter->dev, "failure sending STOP\n");
8989
return -EREMOTEIO;
@@ -153,7 +153,7 @@ static int osif_probe(struct usb_interface *interface,
153153
* Set bus frequency. The frequency is:
154154
* 120,000,000 / ( 16 + 2 * div * 4^prescale).
155155
* Using dev = 52, prescale = 0 give 100KHz */
156-
ret = osif_usb_read(&priv->adapter, OSIFI2C_SET_BIT_RATE, 52, 0,
156+
ret = osif_usb_write(&priv->adapter, OSIFI2C_SET_BIT_RATE, 52, 0,
157157
NULL, 0);
158158
if (ret) {
159159
dev_err(&interface->dev, "failure sending bit rate");

drivers/i2c/i2c-dev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ static long compat_i2cdev_ioctl(struct file *file, unsigned int cmd, unsigned lo
526526
return put_user(funcs, (compat_ulong_t __user *)arg);
527527
case I2C_RDWR: {
528528
struct i2c_rdwr_ioctl_data32 rdwr_arg;
529-
struct i2c_msg32 *p;
529+
struct i2c_msg32 __user *p;
530530
struct i2c_msg *rdwr_pa;
531531
int i;
532532

0 commit comments

Comments
 (0)