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
This commit is contained in:
commit
55fcd4493d
4 changed files with 16 additions and 7 deletions
|
|
@ -138,17 +138,23 @@ cp2615_i2c_send(struct usb_interface *usbif, struct cp2615_i2c_transfer *i2c_w)
|
|||
static int
|
||||
cp2615_i2c_recv(struct usb_interface *usbif, unsigned char tag, void *buf)
|
||||
{
|
||||
struct cp2615_iop_msg *msg = kzalloc(sizeof(*msg), GFP_KERNEL);
|
||||
struct cp2615_i2c_transfer_result *i2c_r = (struct cp2615_i2c_transfer_result *)&msg->data;
|
||||
struct usb_device *usbdev = interface_to_usbdev(usbif);
|
||||
int res = usb_bulk_msg(usbdev, usb_rcvbulkpipe(usbdev, IOP_EP_IN),
|
||||
msg, sizeof(struct cp2615_iop_msg), NULL, 0);
|
||||
struct cp2615_iop_msg *msg;
|
||||
struct cp2615_i2c_transfer_result *i2c_r;
|
||||
int res;
|
||||
|
||||
msg = kzalloc(sizeof(*msg), GFP_KERNEL);
|
||||
if (!msg)
|
||||
return -ENOMEM;
|
||||
|
||||
res = usb_bulk_msg(usbdev, usb_rcvbulkpipe(usbdev, IOP_EP_IN), msg,
|
||||
sizeof(struct cp2615_iop_msg), NULL, 0);
|
||||
if (res < 0) {
|
||||
kfree(msg);
|
||||
return res;
|
||||
}
|
||||
|
||||
i2c_r = (struct cp2615_i2c_transfer_result *)&msg->data;
|
||||
if (msg->msg != htons(iop_I2cTransferResult) || i2c_r->tag != tag) {
|
||||
kfree(msg);
|
||||
return -EIO;
|
||||
|
|
|
|||
|
|
@ -978,6 +978,9 @@ static s32 i801_access(struct i2c_adapter *adap, u16 addr,
|
|||
}
|
||||
|
||||
out:
|
||||
/* Unlock the SMBus device for use by BIOS/ACPI */
|
||||
outb_p(SMBHSTSTS_INUSE_STS, SMBHSTSTS(priv));
|
||||
|
||||
pm_runtime_mark_last_busy(&priv->pci_dev->dev);
|
||||
pm_runtime_put_autosuspend(&priv->pci_dev->dev);
|
||||
mutex_unlock(&priv->acpi_lock);
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ static int osif_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs,
|
|||
}
|
||||
}
|
||||
|
||||
ret = osif_usb_read(adapter, OSIFI2C_STOP, 0, 0, NULL, 0);
|
||||
ret = osif_usb_write(adapter, OSIFI2C_STOP, 0, 0, NULL, 0);
|
||||
if (ret) {
|
||||
dev_err(&adapter->dev, "failure sending STOP\n");
|
||||
return -EREMOTEIO;
|
||||
|
|
@ -153,7 +153,7 @@ static int osif_probe(struct usb_interface *interface,
|
|||
* Set bus frequency. The frequency is:
|
||||
* 120,000,000 / ( 16 + 2 * div * 4^prescale).
|
||||
* Using dev = 52, prescale = 0 give 100KHz */
|
||||
ret = osif_usb_read(&priv->adapter, OSIFI2C_SET_BIT_RATE, 52, 0,
|
||||
ret = osif_usb_write(&priv->adapter, OSIFI2C_SET_BIT_RATE, 52, 0,
|
||||
NULL, 0);
|
||||
if (ret) {
|
||||
dev_err(&interface->dev, "failure sending bit rate");
|
||||
|
|
|
|||
|
|
@ -526,7 +526,7 @@ static long compat_i2cdev_ioctl(struct file *file, unsigned int cmd, unsigned lo
|
|||
return put_user(funcs, (compat_ulong_t __user *)arg);
|
||||
case I2C_RDWR: {
|
||||
struct i2c_rdwr_ioctl_data32 rdwr_arg;
|
||||
struct i2c_msg32 *p;
|
||||
struct i2c_msg32 __user *p;
|
||||
struct i2c_msg *rdwr_pa;
|
||||
int i;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue