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
Unified · Split
| @@ -138,17 +138,23 @@ cp2615_i2c_send(struct usb_interface *usbif, struct cp2615_i2c_transfer *i2c_w) · 137 unmodified lines | ||
| 138 | 138 | static int |
| 139 | 139 | cp2615_i2c_recv(struct usb_interface *usbif, unsigned char tag, void *buf) |
| 140 | 140 | { |
| 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; | |
| 143 | 141 | 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; | |
| 146 | 149 | |
| 150 | + res = usb_bulk_msg(usbdev, usb_rcvbulkpipe(usbdev, IOP_EP_IN), msg, | |
| 151 | + sizeof(struct cp2615_iop_msg), NULL, 0); | |
| 147 | 152 | if (res < 0) { |
| 148 | 153 | kfree(msg); |
| 149 | 154 | return res; |
| 150 | 155 | } |
| 151 | 156 | |
| 157 | + i2c_r = (struct cp2615_i2c_transfer_result *)&msg->data; | |
| 152 | 158 | if (msg->msg != htons(iop_I2cTransferResult) || i2c_r->tag != tag) { |
| 153 | 159 | kfree(msg); |
| 154 | 160 | return -EIO; |
| @@ -978,6 +978,9 @@ static s32 i801_access(struct i2c_adapter *adap, u16 addr, · 977 unmodified lines | ||
| 978 | 978 | } |
| 979 | 979 | |
| 980 | 980 | out: |
| 981 | + /* Unlock the SMBus device for use by BIOS/ACPI */ | |
| 982 | + outb_p(SMBHSTSTS_INUSE_STS, SMBHSTSTS(priv)); | |
| 983 | + | |
| 981 | 984 | pm_runtime_mark_last_busy(&priv->pci_dev->dev); |
| 982 | 985 | pm_runtime_put_autosuspend(&priv->pci_dev->dev); |
| 983 | 986 | mutex_unlock(&priv->acpi_lock); |
| @@ -83,7 +83,7 @@ static int osif_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, · 82 unmodified lines | ||
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | − ret = osif_usb_read(adapter, OSIFI2C_STOP, 0, 0, NULL, 0); | |
| 86 | + ret = osif_usb_write(adapter, OSIFI2C_STOP, 0, 0, NULL, 0); | |
| 87 | 87 | if (ret) { |
| 88 | 88 | dev_err(&adapter->dev, "failure sending STOP\n"); |
| 89 | 89 | return -EREMOTEIO; |
| @@ -153,7 +153,7 @@ static int osif_probe(struct usb_interface *interface, · 63 unmodified lines | ||
| 153 | 153 | * Set bus frequency. The frequency is: |
| 154 | 154 | * 120,000,000 / ( 16 + 2 * div * 4^prescale). |
| 155 | 155 | * 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, | |
| 157 | 157 | NULL, 0); |
| 158 | 158 | if (ret) { |
| 159 | 159 | 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 · 525 unmodified lines | ||
| 526 | 526 | return put_user(funcs, (compat_ulong_t __user *)arg); |
| 527 | 527 | case I2C_RDWR: { |
| 528 | 528 | struct i2c_rdwr_ioctl_data32 rdwr_arg; |
| 529 | − struct i2c_msg32 *p; | |
| 529 | + struct i2c_msg32 __user *p; | |
| 530 | 530 | struct i2c_msg *rdwr_pa; |
| 531 | 531 | int i; |
| 532 | 532 | |