diff options
Diffstat (limited to 'drivers/i2c/i2c-dev.c')
-rw-r--r-- | drivers/i2c/i2c-dev.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c index 206e8052f90f..2ce083391292 100644 --- a/drivers/i2c/i2c-dev.c +++ b/drivers/i2c/i2c-dev.c | |||
@@ -37,7 +37,7 @@ | |||
37 | #include <linux/i2c-dev.h> | 37 | #include <linux/i2c-dev.h> |
38 | #include <asm/uaccess.h> | 38 | #include <asm/uaccess.h> |
39 | 39 | ||
40 | static struct i2c_client i2cdev_client_template; | 40 | static struct i2c_driver i2cdev_driver; |
41 | 41 | ||
42 | struct i2c_dev { | 42 | struct i2c_dev { |
43 | struct list_head list; | 43 | struct list_head list; |
@@ -365,12 +365,13 @@ static int i2cdev_open(struct inode *inode, struct file *file) | |||
365 | if (!adap) | 365 | if (!adap) |
366 | return -ENODEV; | 366 | return -ENODEV; |
367 | 367 | ||
368 | client = kmalloc(sizeof(*client), GFP_KERNEL); | 368 | client = kzalloc(sizeof(*client), GFP_KERNEL); |
369 | if (!client) { | 369 | if (!client) { |
370 | i2c_put_adapter(adap); | 370 | i2c_put_adapter(adap); |
371 | return -ENOMEM; | 371 | return -ENOMEM; |
372 | } | 372 | } |
373 | memcpy(client, &i2cdev_client_template, sizeof(*client)); | 373 | snprintf(client->name, I2C_NAME_SIZE, "i2c-dev %d", adap->nr); |
374 | client->driver = &i2cdev_driver; | ||
374 | 375 | ||
375 | /* registered with adapter, passed as client to user */ | 376 | /* registered with adapter, passed as client to user */ |
376 | client->adapter = adap; | 377 | client->adapter = adap; |
@@ -459,12 +460,6 @@ static struct i2c_driver i2cdev_driver = { | |||
459 | .detach_client = i2cdev_detach_client, | 460 | .detach_client = i2cdev_detach_client, |
460 | }; | 461 | }; |
461 | 462 | ||
462 | static struct i2c_client i2cdev_client_template = { | ||
463 | .name = "I2C /dev entry", | ||
464 | .addr = -1, | ||
465 | .driver = &i2cdev_driver, | ||
466 | }; | ||
467 | |||
468 | static int __init i2c_dev_init(void) | 463 | static int __init i2c_dev_init(void) |
469 | { | 464 | { |
470 | int res; | 465 | int res; |