aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDavid Brownell <david-b@pacbell.net>2007-05-01 17:26:28 -0400
committerJean Delvare <khali@hyperion.delvare>2007-05-01 17:26:28 -0400
commit2096b956d24c4b5950b808fc23b218425d79ebb1 (patch)
tree9e2c09c2e40c65bd56cbfd50955d5c7355474655 /include
parent4ad4eac60667f7c321faae28a3437f7a8b3d17cb (diff)
i2c: Shrink struct i2c_client
This shrinks the size of "struct i2c_client" by 40 bytes: - Substantially shrinks the string used to identify the chip type - The "flags" don't need to be so big - Removes some internal padding It also adds kerneldoc for that struct, explaining how "name" is really a chip type identifier; it's otherwise potentially confusing. Because the I2C_NAME_SIZE symbol was abused for both i2c_client.name and for i2c_adapter.name, this needed to affect i2c_adapter too. The adapters which used that symbol now use the more-obviously-correct idiom of taking the size of that field. JD: Shorten i2c_adapter.name from 50 to 48 bytes while we're here, to avoid wasting space in padding. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/i2c.h23
1 files changed, 14 insertions, 9 deletions
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 47c2a1907372..953e71fb07b4 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -140,25 +140,30 @@ struct i2c_driver {
140}; 140};
141#define to_i2c_driver(d) container_of(d, struct i2c_driver, driver) 141#define to_i2c_driver(d) container_of(d, struct i2c_driver, driver)
142 142
143#define I2C_NAME_SIZE 50 143#define I2C_NAME_SIZE 20
144 144
145/* 145/**
146 * i2c_client identifies a single device (i.e. chip) that is connected to an 146 * struct i2c_client - represent an I2C slave device
147 * i2c bus. The behaviour is defined by the routines of the driver. This 147 * @addr: Address used on the I2C bus connected to the parent adapter.
148 * function is mainly used for lookup & other admin. functions. 148 * @name: Indicates the type of the device, usually a chip name that's
149 * generic enough to hide second-sourcing and compatible revisions.
150 * @dev: Driver model device node for the slave.
151 *
152 * An i2c_client identifies a single device (i.e. chip) connected to an
153 * i2c bus. The behaviour is defined by the routines of the driver.
149 */ 154 */
150struct i2c_client { 155struct i2c_client {
151 unsigned int flags; /* div., see below */ 156 unsigned short flags; /* div., see below */
152 unsigned short addr; /* chip address - NOTE: 7bit */ 157 unsigned short addr; /* chip address - NOTE: 7bit */
153 /* addresses are stored in the */ 158 /* addresses are stored in the */
154 /* _LOWER_ 7 bits */ 159 /* _LOWER_ 7 bits */
160 char name[I2C_NAME_SIZE];
155 struct i2c_adapter *adapter; /* the adapter we sit on */ 161 struct i2c_adapter *adapter; /* the adapter we sit on */
156 struct i2c_driver *driver; /* and our access routines */ 162 struct i2c_driver *driver; /* and our access routines */
157 int usage_count; /* How many accesses currently */ 163 int usage_count; /* How many accesses currently */
158 /* to the client */ 164 /* to the client */
159 struct device dev; /* the device structure */ 165 struct device dev; /* the device structure */
160 struct list_head list; 166 struct list_head list;
161 char name[I2C_NAME_SIZE];
162 struct completion released; 167 struct completion released;
163}; 168};
164#define to_i2c_client(d) container_of(d, struct i2c_client, dev) 169#define to_i2c_client(d) container_of(d, struct i2c_client, dev)
@@ -231,7 +236,7 @@ struct i2c_adapter {
231 int nr; 236 int nr;
232 struct list_head clients; 237 struct list_head clients;
233 struct list_head list; 238 struct list_head list;
234 char name[I2C_NAME_SIZE]; 239 char name[48];
235 struct completion dev_released; 240 struct completion dev_released;
236}; 241};
237#define dev_to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev) 242#define dev_to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev)