Commit 55fcd449 authored by Linus Torvalds's avatar Linus Torvalds

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
parents 7764c62f 4ca070ef
...@@ -138,17 +138,23 @@ cp2615_i2c_send(struct usb_interface *usbif, struct cp2615_i2c_transfer *i2c_w) ...@@ -138,17 +138,23 @@ cp2615_i2c_send(struct usb_interface *usbif, struct cp2615_i2c_transfer *i2c_w)
static int static int
cp2615_i2c_recv(struct usb_interface *usbif, unsigned char tag, void *buf) 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); struct usb_device *usbdev = interface_to_usbdev(usbif);
int res = usb_bulk_msg(usbdev, usb_rcvbulkpipe(usbdev, IOP_EP_IN), struct cp2615_iop_msg *msg;
msg, sizeof(struct cp2615_iop_msg), NULL, 0); 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) { if (res < 0) {
kfree(msg); kfree(msg);
return res; return res;
} }
i2c_r = (struct cp2615_i2c_transfer_result *)&msg->data;
if (msg->msg != htons(iop_I2cTransferResult) || i2c_r->tag != tag) { if (msg->msg != htons(iop_I2cTransferResult) || i2c_r->tag != tag) {
kfree(msg); kfree(msg);
return -EIO; return -EIO;
......
...@@ -978,6 +978,9 @@ static s32 i801_access(struct i2c_adapter *adap, u16 addr, ...@@ -978,6 +978,9 @@ static s32 i801_access(struct i2c_adapter *adap, u16 addr,
} }
out: 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_mark_last_busy(&priv->pci_dev->dev);
pm_runtime_put_autosuspend(&priv->pci_dev->dev); pm_runtime_put_autosuspend(&priv->pci_dev->dev);
mutex_unlock(&priv->acpi_lock); mutex_unlock(&priv->acpi_lock);
......
...@@ -83,7 +83,7 @@ static int osif_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, ...@@ -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) { if (ret) {
dev_err(&adapter->dev, "failure sending STOP\n"); dev_err(&adapter->dev, "failure sending STOP\n");
return -EREMOTEIO; return -EREMOTEIO;
...@@ -153,7 +153,7 @@ static int osif_probe(struct usb_interface *interface, ...@@ -153,7 +153,7 @@ static int osif_probe(struct usb_interface *interface,
* Set bus frequency. The frequency is: * Set bus frequency. The frequency is:
* 120,000,000 / ( 16 + 2 * div * 4^prescale). * 120,000,000 / ( 16 + 2 * div * 4^prescale).
* Using dev = 52, prescale = 0 give 100KHz */ * 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); NULL, 0);
if (ret) { if (ret) {
dev_err(&interface->dev, "failure sending bit rate"); 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 ...@@ -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); return put_user(funcs, (compat_ulong_t __user *)arg);
case I2C_RDWR: { case I2C_RDWR: {
struct i2c_rdwr_ioctl_data32 rdwr_arg; struct i2c_rdwr_ioctl_data32 rdwr_arg;
struct i2c_msg32 *p; struct i2c_msg32 __user *p;
struct i2c_msg *rdwr_pa; struct i2c_msg *rdwr_pa;
int i; int i;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment