aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2008-10-22 14:21:32 -0400
committerJean Delvare <khali@linux-fr.org>2008-10-22 14:21:32 -0400
commit3ae70deef0a5cc34a96aa1972697d01606bc7933 (patch)
tree13ab2c527eca67d267078daa5fe1e0351590300c /include
parent0e47858da4b6825e1f1aede74742c7dd6d4ee476 (diff)
i2c: Clean up <linux/i2c.h>
Fix most checkpatch.pl errors and warnings. This includes replacing spaces with tabs in many places, adding and removing spaces, and folding long lines. Also complete a couple prototypes to make it clearer what the parameters represent. Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/i2c.h149
1 files changed, 75 insertions, 74 deletions
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 7d21aba819ff..12d7364ad3f3 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -53,45 +53,44 @@ struct i2c_board_info;
53 * transmit one message at a time, a more complex version can be used to 53 * transmit one message at a time, a more complex version can be used to
54 * transmit an arbitrary number of messages without interruption. 54 * transmit an arbitrary number of messages without interruption.
55 */ 55 */
56extern int i2c_master_send(struct i2c_client *,const char* ,int); 56extern int i2c_master_send(struct i2c_client *client, const char *buf,
57extern int i2c_master_recv(struct i2c_client *,char* ,int); 57 int count);
58extern int i2c_master_recv(struct i2c_client *client, char *buf, int count);
58 59
59/* Transfer num messages. 60/* Transfer num messages.
60 */ 61 */
61extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num); 62extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
62 63 int num);
63 64
64/* This is the very generalized SMBus access routine. You probably do not 65/* This is the very generalized SMBus access routine. You probably do not
65 want to use this, though; one of the functions below may be much easier, 66 want to use this, though; one of the functions below may be much easier,
66 and probably just as fast. 67 and probably just as fast.
67 Note that we use i2c_adapter here, because you do not need a specific 68 Note that we use i2c_adapter here, because you do not need a specific
68 smbus adapter to call this function. */ 69 smbus adapter to call this function. */
69extern s32 i2c_smbus_xfer (struct i2c_adapter * adapter, u16 addr, 70extern s32 i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr,
70 unsigned short flags, 71 unsigned short flags, char read_write, u8 command,
71 char read_write, u8 command, int size, 72 int size, union i2c_smbus_data *data);
72 union i2c_smbus_data * data);
73 73
74/* Now follow the 'nice' access routines. These also document the calling 74/* Now follow the 'nice' access routines. These also document the calling
75 conventions of i2c_smbus_xfer. */ 75 conventions of i2c_smbus_xfer. */
76 76
77extern s32 i2c_smbus_read_byte(struct i2c_client * client); 77extern s32 i2c_smbus_read_byte(struct i2c_client *client);
78extern s32 i2c_smbus_write_byte(struct i2c_client * client, u8 value); 78extern s32 i2c_smbus_write_byte(struct i2c_client *client, u8 value);
79extern s32 i2c_smbus_read_byte_data(struct i2c_client * client, u8 command); 79extern s32 i2c_smbus_read_byte_data(struct i2c_client *client, u8 command);
80extern s32 i2c_smbus_write_byte_data(struct i2c_client * client, 80extern s32 i2c_smbus_write_byte_data(struct i2c_client *client,
81 u8 command, u8 value); 81 u8 command, u8 value);
82extern s32 i2c_smbus_read_word_data(struct i2c_client * client, u8 command); 82extern s32 i2c_smbus_read_word_data(struct i2c_client *client, u8 command);
83extern s32 i2c_smbus_write_word_data(struct i2c_client * client, 83extern s32 i2c_smbus_write_word_data(struct i2c_client *client,
84 u8 command, u16 value); 84 u8 command, u16 value);
85/* Returns the number of read bytes */ 85/* Returns the number of read bytes */
86extern s32 i2c_smbus_read_block_data(struct i2c_client *client, 86extern s32 i2c_smbus_read_block_data(struct i2c_client *client,
87 u8 command, u8 *values); 87 u8 command, u8 *values);
88extern s32 i2c_smbus_write_block_data(struct i2c_client * client, 88extern s32 i2c_smbus_write_block_data(struct i2c_client *client,
89 u8 command, u8 length, 89 u8 command, u8 length, const u8 *values);
90 const u8 *values);
91/* Returns the number of read bytes */ 90/* Returns the number of read bytes */
92extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client * client, 91extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client *client,
93 u8 command, u8 length, u8 *values); 92 u8 command, u8 length, u8 *values);
94extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client * client, 93extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client,
95 u8 command, u8 length, 94 u8 command, u8 length,
96 const u8 *values); 95 const u8 *values);
97 96
@@ -169,7 +168,7 @@ struct i2c_driver {
169 /* a ioctl like command that can be used to perform specific functions 168 /* a ioctl like command that can be used to perform specific functions
170 * with the device. 169 * with the device.
171 */ 170 */
172 int (*command)(struct i2c_client *client,unsigned int cmd, void *arg); 171 int (*command)(struct i2c_client *client, unsigned int cmd, void *arg);
173 172
174 struct device_driver driver; 173 struct device_driver driver;
175 const struct i2c_device_id *id_table; 174 const struct i2c_device_id *id_table;
@@ -226,12 +225,12 @@ static inline struct i2c_client *kobj_to_i2c_client(struct kobject *kobj)
226 225
227static inline void *i2c_get_clientdata(const struct i2c_client *dev) 226static inline void *i2c_get_clientdata(const struct i2c_client *dev)
228{ 227{
229 return dev_get_drvdata (&dev->dev); 228 return dev_get_drvdata(&dev->dev);
230} 229}
231 230
232static inline void i2c_set_clientdata (struct i2c_client *dev, void *data) 231static inline void i2c_set_clientdata(struct i2c_client *dev, void *data)
233{ 232{
234 dev_set_drvdata (&dev->dev, data); 233 dev_set_drvdata(&dev->dev, data);
235} 234}
236 235
237/** 236/**
@@ -272,7 +271,7 @@ struct i2c_board_info {
272 * fields (such as associated irq, or device-specific platform_data) 271 * fields (such as associated irq, or device-specific platform_data)
273 * are provided using conventional syntax. 272 * are provided using conventional syntax.
274 */ 273 */
275#define I2C_BOARD_INFO(dev_type,dev_addr) \ 274#define I2C_BOARD_INFO(dev_type, dev_addr) \
276 .type = (dev_type), .addr = (dev_addr) 275 .type = (dev_type), .addr = (dev_addr)
277 276
278 277
@@ -306,10 +305,12 @@ extern void i2c_unregister_device(struct i2c_client *);
306 */ 305 */
307#ifdef CONFIG_I2C_BOARDINFO 306#ifdef CONFIG_I2C_BOARDINFO
308extern int 307extern int
309i2c_register_board_info(int busnum, struct i2c_board_info const *info, unsigned n); 308i2c_register_board_info(int busnum, struct i2c_board_info const *info,
309 unsigned n);
310#else 310#else
311static inline int 311static inline int
312i2c_register_board_info(int busnum, struct i2c_board_info const *info, unsigned n) 312i2c_register_board_info(int busnum, struct i2c_board_info const *info,
313 unsigned n)
313{ 314{
314 return 0; 315 return 0;
315} 316}
@@ -328,11 +329,11 @@ struct i2c_algorithm {
328 using common I2C messages */ 329 using common I2C messages */
329 /* master_xfer should return the number of messages successfully 330 /* master_xfer should return the number of messages successfully
330 processed, or a negative value on error */ 331 processed, or a negative value on error */
331 int (*master_xfer)(struct i2c_adapter *adap,struct i2c_msg *msgs, 332 int (*master_xfer)(struct i2c_adapter *adap, struct i2c_msg *msgs,
332 int num); 333 int num);
333 int (*smbus_xfer) (struct i2c_adapter *adap, u16 addr, 334 int (*smbus_xfer) (struct i2c_adapter *adap, u16 addr,
334 unsigned short flags, char read_write, 335 unsigned short flags, char read_write,
335 u8 command, int size, union i2c_smbus_data * data); 336 u8 command, int size, union i2c_smbus_data *data);
336 337
337 /* To determine what the adapter supports */ 338 /* To determine what the adapter supports */
338 u32 (*functionality) (struct i2c_adapter *); 339 u32 (*functionality) (struct i2c_adapter *);
@@ -371,12 +372,12 @@ struct i2c_adapter {
371 372
372static inline void *i2c_get_adapdata(const struct i2c_adapter *dev) 373static inline void *i2c_get_adapdata(const struct i2c_adapter *dev)
373{ 374{
374 return dev_get_drvdata (&dev->dev); 375 return dev_get_drvdata(&dev->dev);
375} 376}
376 377
377static inline void i2c_set_adapdata (struct i2c_adapter *dev, void *data) 378static inline void i2c_set_adapdata(struct i2c_adapter *dev, void *data)
378{ 379{
379 dev_set_drvdata (&dev->dev, data); 380 dev_set_drvdata(&dev->dev, data);
380} 381}
381 382
382/*flags for the client struct: */ 383/*flags for the client struct: */
@@ -449,7 +450,7 @@ extern int i2c_probe(struct i2c_adapter *adapter,
449 const struct i2c_client_address_data *address_data, 450 const struct i2c_client_address_data *address_data,
450 int (*found_proc) (struct i2c_adapter *, int, int)); 451 int (*found_proc) (struct i2c_adapter *, int, int));
451 452
452extern struct i2c_adapter* i2c_get_adapter(int id); 453extern struct i2c_adapter *i2c_get_adapter(int id);
453extern void i2c_put_adapter(struct i2c_adapter *adap); 454extern void i2c_put_adapter(struct i2c_adapter *adap);
454 455
455 456
@@ -465,7 +466,7 @@ static inline int i2c_check_functionality(struct i2c_adapter *adap, u32 func)
465 return (func & i2c_get_functionality(adap)) == func; 466 return (func & i2c_get_functionality(adap)) == func;
466} 467}
467 468
468/* Return id number for a specific adapter */ 469/* Return the adapter number for a specific adapter */
469static inline int i2c_adapter_id(struct i2c_adapter *adap) 470static inline int i2c_adapter_id(struct i2c_adapter *adap)
470{ 471{
471 return adap->nr; 472 return adap->nr;
@@ -526,7 +527,7 @@ struct i2c_msg {
526 527
527#define I2C_FUNC_I2C 0x00000001 528#define I2C_FUNC_I2C 0x00000001
528#define I2C_FUNC_10BIT_ADDR 0x00000002 529#define I2C_FUNC_10BIT_ADDR 0x00000002
529#define I2C_FUNC_PROTOCOL_MANGLING 0x00000004 /* I2C_M_{REV_DIR_ADDR,NOSTART,..} */ 530#define I2C_FUNC_PROTOCOL_MANGLING 0x00000004 /* I2C_M_NOSTART etc. */
530#define I2C_FUNC_SMBUS_PEC 0x00000008 531#define I2C_FUNC_SMBUS_PEC 0x00000008
531#define I2C_FUNC_SMBUS_BLOCK_PROC_CALL 0x00008000 /* SMBus 2.0 */ 532#define I2C_FUNC_SMBUS_BLOCK_PROC_CALL 0x00008000 /* SMBus 2.0 */
532#define I2C_FUNC_SMBUS_QUICK 0x00010000 533#define I2C_FUNC_SMBUS_QUICK 0x00010000
@@ -542,25 +543,25 @@ struct i2c_msg {
542#define I2C_FUNC_SMBUS_READ_I2C_BLOCK 0x04000000 /* I2C-like block xfer */ 543#define I2C_FUNC_SMBUS_READ_I2C_BLOCK 0x04000000 /* I2C-like block xfer */
543#define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK 0x08000000 /* w/ 1-byte reg. addr. */ 544#define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK 0x08000000 /* w/ 1-byte reg. addr. */
544 545
545#define I2C_FUNC_SMBUS_BYTE (I2C_FUNC_SMBUS_READ_BYTE | \ 546#define I2C_FUNC_SMBUS_BYTE (I2C_FUNC_SMBUS_READ_BYTE | \
546 I2C_FUNC_SMBUS_WRITE_BYTE) 547 I2C_FUNC_SMBUS_WRITE_BYTE)
547#define I2C_FUNC_SMBUS_BYTE_DATA (I2C_FUNC_SMBUS_READ_BYTE_DATA | \ 548#define I2C_FUNC_SMBUS_BYTE_DATA (I2C_FUNC_SMBUS_READ_BYTE_DATA | \
548 I2C_FUNC_SMBUS_WRITE_BYTE_DATA) 549 I2C_FUNC_SMBUS_WRITE_BYTE_DATA)
549#define I2C_FUNC_SMBUS_WORD_DATA (I2C_FUNC_SMBUS_READ_WORD_DATA | \ 550#define I2C_FUNC_SMBUS_WORD_DATA (I2C_FUNC_SMBUS_READ_WORD_DATA | \
550 I2C_FUNC_SMBUS_WRITE_WORD_DATA) 551 I2C_FUNC_SMBUS_WRITE_WORD_DATA)
551#define I2C_FUNC_SMBUS_BLOCK_DATA (I2C_FUNC_SMBUS_READ_BLOCK_DATA | \ 552#define I2C_FUNC_SMBUS_BLOCK_DATA (I2C_FUNC_SMBUS_READ_BLOCK_DATA | \
552 I2C_FUNC_SMBUS_WRITE_BLOCK_DATA) 553 I2C_FUNC_SMBUS_WRITE_BLOCK_DATA)
553#define I2C_FUNC_SMBUS_I2C_BLOCK (I2C_FUNC_SMBUS_READ_I2C_BLOCK | \ 554#define I2C_FUNC_SMBUS_I2C_BLOCK (I2C_FUNC_SMBUS_READ_I2C_BLOCK | \
554 I2C_FUNC_SMBUS_WRITE_I2C_BLOCK) 555 I2C_FUNC_SMBUS_WRITE_I2C_BLOCK)
555 556
556#define I2C_FUNC_SMBUS_EMUL (I2C_FUNC_SMBUS_QUICK | \ 557#define I2C_FUNC_SMBUS_EMUL (I2C_FUNC_SMBUS_QUICK | \
557 I2C_FUNC_SMBUS_BYTE | \ 558 I2C_FUNC_SMBUS_BYTE | \
558 I2C_FUNC_SMBUS_BYTE_DATA | \ 559 I2C_FUNC_SMBUS_BYTE_DATA | \
559 I2C_FUNC_SMBUS_WORD_DATA | \ 560 I2C_FUNC_SMBUS_WORD_DATA | \
560 I2C_FUNC_SMBUS_PROC_CALL | \ 561 I2C_FUNC_SMBUS_PROC_CALL | \
561 I2C_FUNC_SMBUS_WRITE_BLOCK_DATA | \ 562 I2C_FUNC_SMBUS_WRITE_BLOCK_DATA | \
562 I2C_FUNC_SMBUS_I2C_BLOCK | \ 563 I2C_FUNC_SMBUS_I2C_BLOCK | \
563 I2C_FUNC_SMBUS_PEC) 564 I2C_FUNC_SMBUS_PEC)
564 565
565/* 566/*
566 * Data for SMBus Messages 567 * Data for SMBus Messages
@@ -570,7 +571,7 @@ union i2c_smbus_data {
570 __u8 byte; 571 __u8 byte;
571 __u16 word; 572 __u16 word;
572 __u8 block[I2C_SMBUS_BLOCK_MAX + 2]; /* block[0] is used for length */ 573 __u8 block[I2C_SMBUS_BLOCK_MAX + 2]; /* block[0] is used for length */
573 /* and one more for user-space compatibility */ 574 /* and one more for user-space compatibility */
574}; 575};
575 576
576/* i2c_smbus_xfer read or write markers */ 577/* i2c_smbus_xfer read or write markers */
@@ -598,21 +599,21 @@ union i2c_smbus_data {
598 599
599/* Default fill of many variables */ 600/* Default fill of many variables */
600#define I2C_CLIENT_DEFAULTS {I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ 601#define I2C_CLIENT_DEFAULTS {I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
601 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ 602 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
602 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ 603 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
603 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ 604 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
604 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ 605 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
605 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ 606 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
606 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ 607 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
607 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ 608 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
608 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ 609 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
609 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ 610 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
610 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ 611 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
611 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ 612 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
612 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ 613 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
613 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ 614 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
614 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ 615 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
615 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END} 616 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END}
616 617
617/* I2C_CLIENT_MODULE_PARM creates a module parameter, and puts it in the 618/* I2C_CLIENT_MODULE_PARM creates a module parameter, and puts it in the
618 module header */ 619 module header */
@@ -621,7 +622,7 @@ union i2c_smbus_data {
621 static unsigned short var[I2C_CLIENT_MAX_OPTS] = I2C_CLIENT_DEFAULTS; \ 622 static unsigned short var[I2C_CLIENT_MAX_OPTS] = I2C_CLIENT_DEFAULTS; \
622 static unsigned int var##_num; \ 623 static unsigned int var##_num; \
623 module_param_array(var, short, &var##_num, 0); \ 624 module_param_array(var, short, &var##_num, 0); \
624 MODULE_PARM_DESC(var,desc) 625 MODULE_PARM_DESC(var, desc)
625 626
626#define I2C_CLIENT_MODULE_PARM_FORCE(name) \ 627#define I2C_CLIENT_MODULE_PARM_FORCE(name) \
627I2C_CLIENT_MODULE_PARM(force_##name, \ 628I2C_CLIENT_MODULE_PARM(force_##name, \