Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 172368
b: refs/heads/master
c: 9669f54
h: refs/heads/master
v: v3
  • Loading branch information
Vincent Sanders authored and Jean Delvare committed Dec 6, 2009
1 parent e33d192 commit c2a6595
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 17 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c2e90e9b6835d71cbadd42fe5b38704acaccf8aa
refs/heads/master: 9669f54194b4df34c96478d696d9ba2b977545f5
22 changes: 6 additions & 16 deletions trunk/drivers/i2c/i2c-dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include <linux/list.h>
#include <linux/i2c.h>
#include <linux/i2c-dev.h>
#include <linux/smp_lock.h>
#include <linux/jiffies.h>
#include <asm/uaccess.h>

Expand Down Expand Up @@ -445,20 +444,14 @@ static int i2cdev_open(struct inode *inode, struct file *file)
struct i2c_client *client;
struct i2c_adapter *adap;
struct i2c_dev *i2c_dev;
int ret = 0;

lock_kernel();
i2c_dev = i2c_dev_get_by_minor(minor);
if (!i2c_dev) {
ret = -ENODEV;
goto out;
}
if (!i2c_dev)
return -ENODEV;

adap = i2c_get_adapter(i2c_dev->adap->nr);
if (!adap) {
ret = -ENODEV;
goto out;
}
if (!adap)
return -ENODEV;

/* This creates an anonymous i2c_client, which may later be
* pointed to some address using I2C_SLAVE or I2C_SLAVE_FORCE.
Expand All @@ -470,18 +463,15 @@ static int i2cdev_open(struct inode *inode, struct file *file)
client = kzalloc(sizeof(*client), GFP_KERNEL);
if (!client) {
i2c_put_adapter(adap);
ret = -ENOMEM;
goto out;
return -ENOMEM;
}
snprintf(client->name, I2C_NAME_SIZE, "i2c-dev %d", adap->nr);
client->driver = &i2cdev_driver;

client->adapter = adap;
file->private_data = client;

out:
unlock_kernel();
return ret;
return 0;
}

static int i2cdev_release(struct inode *inode, struct file *file)
Expand Down

0 comments on commit c2a6595

Please sign in to comment.