aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/i2c/i2c-dev.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
index c507204a8c7d..e0694e4d86c7 100644
--- a/drivers/i2c/i2c-dev.c
+++ b/drivers/i2c/i2c-dev.c
@@ -35,7 +35,7 @@
35#include <linux/i2c.h> 35#include <linux/i2c.h>
36#include <linux/i2c-dev.h> 36#include <linux/i2c-dev.h>
37#include <linux/jiffies.h> 37#include <linux/jiffies.h>
38#include <asm/uaccess.h> 38#include <linux/uaccess.h>
39 39
40static struct i2c_driver i2cdev_driver; 40static struct i2c_driver i2cdev_driver;
41 41
@@ -132,8 +132,8 @@ static DEVICE_ATTR(name, S_IRUGO, show_adapter_name, NULL);
132 * needed by those system calls and by this SMBus interface. 132 * needed by those system calls and by this SMBus interface.
133 */ 133 */
134 134
135static ssize_t i2cdev_read (struct file *file, char __user *buf, size_t count, 135static ssize_t i2cdev_read(struct file *file, char __user *buf, size_t count,
136 loff_t *offset) 136 loff_t *offset)
137{ 137{
138 char *tmp; 138 char *tmp;
139 int ret; 139 int ret;
@@ -143,22 +143,22 @@ static ssize_t i2cdev_read (struct file *file, char __user *buf, size_t count,
143 if (count > 8192) 143 if (count > 8192)
144 count = 8192; 144 count = 8192;
145 145
146 tmp = kmalloc(count,GFP_KERNEL); 146 tmp = kmalloc(count, GFP_KERNEL);
147 if (tmp==NULL) 147 if (tmp == NULL)
148 return -ENOMEM; 148 return -ENOMEM;
149 149
150 pr_debug("i2c-dev: i2c-%d reading %zu bytes.\n", 150 pr_debug("i2c-dev: i2c-%d reading %zu bytes.\n",
151 iminor(file->f_path.dentry->d_inode), count); 151 iminor(file->f_path.dentry->d_inode), count);
152 152
153 ret = i2c_master_recv(client,tmp,count); 153 ret = i2c_master_recv(client, tmp, count);
154 if (ret >= 0) 154 if (ret >= 0)
155 ret = copy_to_user(buf,tmp,count)?-EFAULT:ret; 155 ret = copy_to_user(buf, tmp, count) ? -EFAULT : ret;
156 kfree(tmp); 156 kfree(tmp);
157 return ret; 157 return ret;
158} 158}
159 159
160static ssize_t i2cdev_write (struct file *file, const char __user *buf, size_t count, 160static ssize_t i2cdev_write(struct file *file, const char __user *buf,
161 loff_t *offset) 161 size_t count, loff_t *offset)
162{ 162{
163 int ret; 163 int ret;
164 char *tmp; 164 char *tmp;
@@ -167,10 +167,10 @@ static ssize_t i2cdev_write (struct file *file, const char __user *buf, size_t c
167 if (count > 8192) 167 if (count > 8192)
168 count = 8192; 168 count = 8192;
169 169
170 tmp = kmalloc(count,GFP_KERNEL); 170 tmp = kmalloc(count, GFP_KERNEL);
171 if (tmp==NULL) 171 if (tmp == NULL)
172 return -ENOMEM; 172 return -ENOMEM;
173 if (copy_from_user(tmp,buf,count)) { 173 if (copy_from_user(tmp, buf, count)) {
174 kfree(tmp); 174 kfree(tmp);
175 return -EFAULT; 175 return -EFAULT;
176 } 176 }
@@ -178,7 +178,7 @@ static ssize_t i2cdev_write (struct file *file, const char __user *buf, size_t c
178 pr_debug("i2c-dev: i2c-%d writing %zu bytes.\n", 178 pr_debug("i2c-dev: i2c-%d writing %zu bytes.\n",
179 iminor(file->f_path.dentry->d_inode), count); 179 iminor(file->f_path.dentry->d_inode), count);
180 180
181 ret = i2c_master_send(client,tmp,count); 181 ret = i2c_master_send(client, tmp, count);
182 kfree(tmp); 182 kfree(tmp);
183 return ret; 183 return ret;
184} 184}
@@ -375,7 +375,7 @@ static long i2cdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
375 dev_dbg(&client->adapter->dev, "ioctl, cmd=0x%02x, arg=0x%02lx\n", 375 dev_dbg(&client->adapter->dev, "ioctl, cmd=0x%02x, arg=0x%02lx\n",
376 cmd, arg); 376 cmd, arg);
377 377
378 switch ( cmd ) { 378 switch (cmd) {
379 case I2C_SLAVE: 379 case I2C_SLAVE:
380 case I2C_SLAVE_FORCE: 380 case I2C_SLAVE_FORCE:
381 /* NOTE: devices set up to work with "new style" drivers 381 /* NOTE: devices set up to work with "new style" drivers
@@ -601,7 +601,7 @@ static void __exit i2c_dev_exit(void)
601{ 601{
602 i2c_del_driver(&i2cdev_driver); 602 i2c_del_driver(&i2cdev_driver);
603 class_destroy(i2c_dev_class); 603 class_destroy(i2c_dev_class);
604 unregister_chrdev(I2C_MAJOR,"i2c"); 604 unregister_chrdev(I2C_MAJOR, "i2c");
605} 605}
606 606
607MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl> and " 607MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl> and "