mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	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>
This commit is contained in:
		
							parent
							
								
									f3b3aadbbd
								
							
						
					
					
						commit
						22f76e744d
					
				
					 1 changed files with 4 additions and 9 deletions
				
			
		| 
						 | 
					@ -37,7 +37,7 @@
 | 
				
			||||||
#include <linux/i2c-dev.h>
 | 
					#include <linux/i2c-dev.h>
 | 
				
			||||||
#include <asm/uaccess.h>
 | 
					#include <asm/uaccess.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct i2c_client i2cdev_client_template;
 | 
					static struct i2c_driver i2cdev_driver;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct i2c_dev {
 | 
					struct i2c_dev {
 | 
				
			||||||
	struct list_head list;
 | 
						struct list_head list;
 | 
				
			||||||
| 
						 | 
					@ -365,12 +365,13 @@ static int i2cdev_open(struct inode *inode, struct file *file)
 | 
				
			||||||
	if (!adap)
 | 
						if (!adap)
 | 
				
			||||||
		return -ENODEV;
 | 
							return -ENODEV;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	client = kmalloc(sizeof(*client), GFP_KERNEL);
 | 
						client = kzalloc(sizeof(*client), GFP_KERNEL);
 | 
				
			||||||
	if (!client) {
 | 
						if (!client) {
 | 
				
			||||||
		i2c_put_adapter(adap);
 | 
							i2c_put_adapter(adap);
 | 
				
			||||||
		return -ENOMEM;
 | 
							return -ENOMEM;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	memcpy(client, &i2cdev_client_template, sizeof(*client));
 | 
						snprintf(client->name, I2C_NAME_SIZE, "i2c-dev %d", adap->nr);
 | 
				
			||||||
 | 
						client->driver = &i2cdev_driver;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* registered with adapter, passed as client to user */
 | 
						/* registered with adapter, passed as client to user */
 | 
				
			||||||
	client->adapter = adap;
 | 
						client->adapter = adap;
 | 
				
			||||||
| 
						 | 
					@ -459,12 +460,6 @@ static struct i2c_driver i2cdev_driver = {
 | 
				
			||||||
	.detach_client	= i2cdev_detach_client,
 | 
						.detach_client	= i2cdev_detach_client,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct i2c_client i2cdev_client_template = {
 | 
					 | 
				
			||||||
	.name		= "I2C /dev entry",
 | 
					 | 
				
			||||||
	.addr		= -1,
 | 
					 | 
				
			||||||
	.driver		= &i2cdev_driver,
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static int __init i2c_dev_init(void)
 | 
					static int __init i2c_dev_init(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int res;
 | 
						int res;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue