aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2006-07-01 11:20:57 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-09-26 18:38:50 -0400
commit22f76e744dc41096987c6df8270b5c249511cde5 (patch)
tree16afa3c645afb5a22fbe7095b1fe2311c6684d01 /drivers
parentf3b3aadbbd66d8a020550b01b37d9b1ea559f2c3 (diff)
i2c-dev: Drop the client template
i2c-dev: Drop the client template Drop the i2c-dev client template. This saves about 360 bytes of memory. I got the idea from a similar cleanup Hans-Frieder Vogt made to i2c-nforce2 recently. Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/i2c/i2c-dev.c13
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
40static struct i2c_client i2cdev_client_template; 40static struct i2c_driver i2cdev_driver;
41 41
42struct i2c_dev { 42struct 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
462static struct i2c_client i2cdev_client_template = {
463 .name = "I2C /dev entry",
464 .addr = -1,
465 .driver = &i2cdev_driver,
466};
467
468static int __init i2c_dev_init(void) 463static int __init i2c_dev_init(void)
469{ 464{
470 int res; 465 int res;