2.4.36-stable kernel tree
リビジョン | b498501d3c388903c5daa26634e1225116ca4228 (tree) |
---|---|
日時 | 2006-12-05 17:22:47 |
作者 | Jean Delvare <khali@linu...> |
コミッター | Willy Tarreau |
[PATCH] i2c cleanup : typos and whitespace
Trivial changes picked from the i2c SVN repository. This includes:
* Documentation updates
* Comment updates
* Whitespace changes
* Typo fixes in strings and comments
* Includes reordering
* Drop of includes and comments relative to kernel version 2.0 to 2.3
The idea is to minimize the meaningless differences between both theres
so that real differences are easier to see.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
@@ -92,10 +92,10 @@ ioctl(file,I2C_TENBIT,long select) | ||
92 | 92 | ioctl(file,I2C_FUNCS,unsigned long *funcs) |
93 | 93 | Gets the adapter functionality and puts it in *funcs. |
94 | 94 | |
95 | -ioctl(file,I2C_RDWR,struct i2c_ioctl_rdwr_data *msgset) | |
95 | +ioctl(file,I2C_RDWR,struct i2c_rdwr_ioctl_data *msgset) | |
96 | 96 | |
97 | 97 | Do combined read/write transaction without stop in between. |
98 | - The argument is a pointer to a struct i2c_ioctl_rdwr_data { | |
98 | + The argument is a pointer to a struct i2c_rdwr_ioctl_data { | |
99 | 99 | |
100 | 100 | struct i2c_msg *msgs; /* ptr to array of simple messages */ |
101 | 101 | int nmsgs; /* number of messages to exchange */ |
@@ -17,8 +17,8 @@ For the most up-to-date list of functionality constants, please check | ||
17 | 17 | I2C_FUNC_I2C Plain i2c-level commands (Pure SMBus |
18 | 18 | adapters typically can not do these) |
19 | 19 | I2C_FUNC_10BIT_ADDR Handles the 10-bit address extensions |
20 | - I2C_FUNC_PROTOCOL_MANGLING Knows about the I2C_M_REV_DIR_ADDR, | |
21 | - I2C_M_REV_DIR_ADDR and I2C_M_REV_DIR_NOSTART | |
20 | + I2C_FUNC_PROTOCOL_MANGLING Knows about the | |
21 | + I2C_M_REV_DIR_ADDR and I2C_M_NOSTART | |
22 | 22 | flags (which modify the i2c protocol!) |
23 | 23 | I2C_FUNC_SMBUS_QUICK Handles the SMBus write_quick command |
24 | 24 | I2C_FUNC_SMBUS_READ_BYTE Handles the SMBus read_byte command |
@@ -115,7 +115,7 @@ CHECKING THROUGH /DEV | ||
115 | 115 | If you try to access an adapter from a userspace program, you will have |
116 | 116 | to use the /dev interface. You will still have to check whether the |
117 | 117 | functionality you need is supported, of course. This is done using |
118 | -the I2C_FUNCS ioctl. An example, adapted from the lm_sensors i2c_detect | |
118 | +the I2C_FUNCS ioctl. An example, adapted from the lm_sensors i2cdetect | |
119 | 119 | program, is below: |
120 | 120 | |
121 | 121 | int file; |
@@ -28,14 +28,14 @@ static struct i2c_driver foo_driver = { | ||
28 | 28 | .name = "Foo version 2.3 driver", |
29 | 29 | .id = I2C_DRIVERID_FOO, /* from i2c-id.h, optional */ |
30 | 30 | .flags = I2C_DF_NOTIFY, |
31 | - .attach_adapter = &foo_attach_adapter, | |
32 | - .detach_client = &foo_detach_client, | |
33 | - .command = &foo_command, /* may be NULL */ | |
34 | - .inc_use = &foo_inc_use, /* May be NULL */ | |
35 | - .dec_use = &foo_dec_use, /* May be NULL */ | |
31 | + .attach_adapter = foo_attach_adapter, | |
32 | + .detach_client = foo_detach_client, | |
33 | + .command = foo_command, /* may be NULL */ | |
34 | + .inc_use = foo_inc_use, /* May be NULL */ | |
35 | + .dec_use = foo_dec_use, /* May be NULL */ | |
36 | 36 | } |
37 | 37 | |
38 | -The name can be chosen freely, and may be upto 40 characters long. Please | |
38 | +The name can be chosen freely, and may be up to 31 characters long. Please | |
39 | 39 | use something descriptive here. |
40 | 40 | |
41 | 41 | If used, the id should be a unique ID. The range 0xf000 to 0xffff is |
@@ -64,26 +64,27 @@ main reason why these call-backs were introduced). | ||
64 | 64 | To increase or decrease the module usage count, you can use the |
65 | 65 | MOD_{INC,DEC}_USE_COUNT macros. They must be called from the module |
66 | 66 | which needs to get its usage count changed; that is why each driver |
67 | -module has to implement its own callback. | |
67 | +module has to implement its own callback functions. | |
68 | 68 | |
69 | - void foo_inc_use (struct i2c_client *client) | |
70 | - { | |
71 | - #ifdef MODULE | |
72 | - MOD_INC_USE_COUNT; | |
73 | - #endif | |
74 | - } | |
69 | +static void foo_inc_use (struct i2c_client *client) | |
70 | +{ | |
71 | +#ifdef MODULE | |
72 | + MOD_INC_USE_COUNT; | |
73 | +#endif | |
74 | +} | |
75 | 75 | |
76 | - void foo_dec_use (struct i2c_client *client) | |
77 | - { | |
78 | - #ifdef MODULE | |
79 | - MOD_DEC_USE_COUNT; | |
80 | - #endif | |
81 | - } | |
76 | +static void foo_dec_use (struct i2c_client *client) | |
77 | +{ | |
78 | +#ifdef MODULE | |
79 | + MOD_DEC_USE_COUNT; | |
80 | +#endif | |
81 | +} | |
82 | 82 | |
83 | -Do not call these call-back functions directly; instead, use one of the | |
83 | +Do not call these callback functions directly; instead, use the | |
84 | 84 | following functions defined in i2c.h: |
85 | - void i2c_inc_use_client(struct i2c_client *); | |
86 | - void i2c_dec_use_client(struct i2c_client *); | |
85 | + | |
86 | +void i2c_inc_use_client(struct i2c_client *); | |
87 | +void i2c_dec_use_client(struct i2c_client *); | |
87 | 88 | |
88 | 89 | You should *not* increase the module count just because a device is |
89 | 90 | detected and a client created. This would make it impossible to remove |
@@ -302,7 +303,7 @@ Also used is a list of pointers to sensors_force_data structures: | ||
302 | 303 | These are automatically translated to insmod variables of the form |
303 | 304 | force_foo. |
304 | 305 | |
305 | -So we have a generic insmod variabled `force', and chip-specific variables | |
306 | +So we have a generic insmod variable `force', and chip-specific variables | |
306 | 307 | `force_CHIPNAME'. |
307 | 308 | |
308 | 309 | Fortunately, as a module writer, you just have to define the `normal' |
@@ -609,8 +609,6 @@ int __init i2c_algo_bit_init (void) | ||
609 | 609 | return 0; |
610 | 610 | } |
611 | 611 | |
612 | - | |
613 | - | |
614 | 612 | EXPORT_SYMBOL(i2c_bit_add_bus); |
615 | 613 | EXPORT_SYMBOL(i2c_bit_del_bus); |
616 | 614 |
@@ -524,7 +524,6 @@ int __init i2c_algo_pcf_init (void) | ||
524 | 524 | return 0; |
525 | 525 | } |
526 | 526 | |
527 | - | |
528 | 527 | EXPORT_SYMBOL(i2c_pcf_add_bus); |
529 | 528 | EXPORT_SYMBOL(i2c_pcf_del_bus); |
530 | 529 |
@@ -208,14 +208,14 @@ int i2c_del_adapter(struct i2c_adapter *adap) | ||
208 | 208 | if ((res = drivers[j]->attach_adapter(adap))) { |
209 | 209 | printk(KERN_WARNING "i2c-core.o: can't detach adapter %s " |
210 | 210 | "while detaching driver %s: driver not " |
211 | - "detached!",adap->name,drivers[j]->name); | |
211 | + "detached!\n", adap->name, drivers[j]->name); | |
212 | 212 | goto ERROR1; |
213 | 213 | } |
214 | 214 | DRV_UNLOCK(); |
215 | 215 | |
216 | 216 | |
217 | 217 | /* detach any active clients. This must be done first, because |
218 | - * it can fail; in which case we give upp. */ | |
218 | + * it can fail; in which case we give up. */ | |
219 | 219 | for (j=0;j<I2C_CLIENT_MAX;j++) { |
220 | 220 | struct i2c_client *client = adap->clients[j]; |
221 | 221 | if (client!=NULL) |
@@ -226,11 +226,12 @@ int i2c_del_adapter(struct i2c_adapter *adap) | ||
226 | 226 | if ((res=client->driver->detach_client(client))) { |
227 | 227 | printk(KERN_ERR "i2c-core.o: adapter %s not " |
228 | 228 | "unregistered, because client at " |
229 | - "address %02x can't be detached. ", | |
229 | + "address %02x can't be detached\n", | |
230 | 230 | adap->name, client->addr); |
231 | 231 | goto ERROR0; |
232 | 232 | } |
233 | 233 | } |
234 | + | |
234 | 235 | #ifdef CONFIG_PROC_FS |
235 | 236 | if (i2cproc_initialized) { |
236 | 237 | char name[8]; |
@@ -339,7 +340,7 @@ int i2c_del_driver(struct i2c_driver *driver) | ||
339 | 340 | printk(KERN_WARNING "i2c-core.o: while unregistering " |
340 | 341 | "dummy driver %s, adapter %s could " |
341 | 342 | "not be detached properly; driver " |
342 | - "not unloaded!",driver->name, | |
343 | + "not unloaded!\n", driver->name, | |
343 | 344 | adap->name); |
344 | 345 | ADAP_UNLOCK(); |
345 | 346 | return res; |
@@ -359,9 +360,9 @@ int i2c_del_driver(struct i2c_driver *driver) | ||
359 | 360 | "unregistering driver " |
360 | 361 | "`%s', the client at " |
361 | 362 | "address %02x of " |
362 | - "adapter `%s' could not" | |
363 | - "be detached; driver" | |
364 | - "not unloaded!", | |
363 | + "adapter `%s' could not " | |
364 | + "be detached; driver " | |
365 | + "not unloaded!\n", | |
365 | 366 | driver->name, |
366 | 367 | client->addr, |
367 | 368 | adap->name); |
@@ -448,7 +449,7 @@ int i2c_detach_client(struct i2c_client *client) | ||
448 | 449 | if (adapter->client_unregister != NULL) |
449 | 450 | if ((res = adapter->client_unregister(client))) { |
450 | 451 | printk(KERN_ERR "i2c-core.o: client_unregister [%s] failed, " |
451 | - "client not detached",client->name); | |
452 | + "client not detached\n", client->name); | |
452 | 453 | return res; |
453 | 454 | } |
454 | 455 |
@@ -461,20 +462,16 @@ int i2c_detach_client(struct i2c_client *client) | ||
461 | 462 | |
462 | 463 | void i2c_inc_use_client(struct i2c_client *client) |
463 | 464 | { |
464 | - | |
465 | 465 | if (client->driver->inc_use != NULL) |
466 | 466 | client->driver->inc_use(client); |
467 | - | |
468 | 467 | if (client->adapter->inc_use != NULL) |
469 | 468 | client->adapter->inc_use(client->adapter); |
470 | 469 | } |
471 | 470 | |
472 | 471 | void i2c_dec_use_client(struct i2c_client *client) |
473 | 472 | { |
474 | - | |
475 | 473 | if (client->driver->dec_use != NULL) |
476 | 474 | client->driver->dec_use(client); |
477 | - | |
478 | 475 | if (client->adapter->dec_use != NULL) |
479 | 476 | client->adapter->dec_use(client->adapter); |
480 | 477 | } |
@@ -548,8 +545,8 @@ struct i2c_client *i2c_get_client(int driver_id, int adapter_id, | ||
548 | 545 | |
549 | 546 | int i2c_use_client(struct i2c_client *client) |
550 | 547 | { |
551 | - if(client->flags & I2C_CLIENT_ALLOW_USE) { | |
552 | - if (client->flags & I2C_CLIENT_ALLOW_MULTIPLE_USE) | |
548 | + if (client->flags & I2C_CLIENT_ALLOW_USE) { | |
549 | + if (client->flags & I2C_CLIENT_ALLOW_MULTIPLE_USE) | |
553 | 550 | client->usage_count++; |
554 | 551 | else { |
555 | 552 | if(client->usage_count > 0) |
@@ -712,7 +709,6 @@ int i2cproc_cleanup(void) | ||
712 | 709 | return 0; |
713 | 710 | } |
714 | 711 | |
715 | - | |
716 | 712 | #endif /* def CONFIG_PROC_FS */ |
717 | 713 | |
718 | 714 | /* ---------------------------------------------------- |
@@ -984,7 +980,7 @@ extern s32 i2c_smbus_read_byte(struct i2c_client * client) | ||
984 | 980 | extern s32 i2c_smbus_write_byte(struct i2c_client * client, u8 value) |
985 | 981 | { |
986 | 982 | return i2c_smbus_xfer(client->adapter,client->addr,client->flags, |
987 | - I2C_SMBUS_WRITE,value, I2C_SMBUS_BYTE,NULL); | |
983 | + I2C_SMBUS_WRITE, value, I2C_SMBUS_BYTE, NULL); | |
988 | 984 | } |
989 | 985 | |
990 | 986 | extern s32 i2c_smbus_read_byte_data(struct i2c_client * client, u8 command) |
@@ -1193,7 +1189,9 @@ s32 i2c_smbus_xfer(struct i2c_adapter * adapter, u16 addr, unsigned short flags, | ||
1193 | 1189 | union i2c_smbus_data * data) |
1194 | 1190 | { |
1195 | 1191 | s32 res; |
1192 | + | |
1196 | 1193 | flags = flags & I2C_M_TEN; |
1194 | + | |
1197 | 1195 | if (adapter->algo->smbus_xfer) { |
1198 | 1196 | I2C_LOCK(adapter); |
1199 | 1197 | res = adapter->algo->smbus_xfer(adapter,addr,flags,read_write, |
@@ -1202,6 +1200,7 @@ s32 i2c_smbus_xfer(struct i2c_adapter * adapter, u16 addr, unsigned short flags, | ||
1202 | 1200 | } else |
1203 | 1201 | res = i2c_smbus_xfer_emulated(adapter,addr,flags,read_write, |
1204 | 1202 | command,size,data); |
1203 | + | |
1205 | 1204 | return res; |
1206 | 1205 | } |
1207 | 1206 |
@@ -39,16 +39,14 @@ | ||
39 | 39 | #ifdef CONFIG_DEVFS_FS |
40 | 40 | #include <linux/devfs_fs_kernel.h> |
41 | 41 | #endif |
42 | - | |
42 | +#include <linux/init.h> | |
43 | +#include <linux/i2c.h> | |
44 | +#include <linux/i2c-dev.h> | |
45 | +#include <asm/uaccess.h> | |
43 | 46 | |
44 | 47 | /* If you want debugging uncomment: */ |
45 | 48 | /* #define DEBUG */ |
46 | 49 | |
47 | -#include <linux/init.h> | |
48 | -#include <asm/uaccess.h> | |
49 | - | |
50 | -#include <linux/i2c.h> | |
51 | -#include <linux/i2c-dev.h> | |
52 | 50 | |
53 | 51 | #ifdef MODULE |
54 | 52 | extern int init_module(void); |
@@ -229,7 +227,7 @@ int i2cdev_ioctl (struct inode *inode, struct file *file, unsigned int cmd, | ||
229 | 227 | sizeof(rdwr_arg))) |
230 | 228 | return -EFAULT; |
231 | 229 | |
232 | - /* Put an arbritrary limit on the number of messages that can | |
230 | + /* Put an arbitrary limit on the number of messages that can | |
233 | 231 | * be sent at once */ |
234 | 232 | if (rdwr_arg.nmsgs > 42) |
235 | 233 | return -EINVAL; |
@@ -28,14 +28,11 @@ | ||
28 | 28 | #include <linux/delay.h> |
29 | 29 | #include <linux/slab.h> |
30 | 30 | #include <linux/init.h> |
31 | - | |
32 | -#include <asm/uaccess.h> | |
33 | - | |
34 | 31 | #include <linux/ioport.h> |
35 | -#include <asm/io.h> | |
36 | 32 | #include <linux/errno.h> |
37 | 33 | #include <linux/i2c.h> |
38 | 34 | #include <linux/i2c-algo-bit.h> |
35 | +#include <asm/io.h> | |
39 | 36 | |
40 | 37 | #define DEFAULT_BASE 0x378 |
41 | 38 | static int base=0; |
@@ -29,13 +29,11 @@ | ||
29 | 29 | #include <linux/ctype.h> |
30 | 30 | #include <linux/sysctl.h> |
31 | 31 | #include <linux/proc_fs.h> |
32 | +#include <linux/init.h> | |
32 | 33 | #include <linux/ioport.h> |
33 | -#include <asm/uaccess.h> | |
34 | - | |
35 | 34 | #include <linux/i2c.h> |
36 | 35 | #include <linux/i2c-proc.h> |
37 | - | |
38 | -#include <linux/init.h> | |
36 | +#include <asm/uaccess.h> | |
39 | 37 | |
40 | 38 | #ifndef THIS_MODULE |
41 | 39 | #define THIS_MODULE NULL |
@@ -126,11 +124,9 @@ int i2c_create_name(char **name, const char *prefix, | ||
126 | 124 | If any driver wants subdirectories within the newly created directory, |
127 | 125 | this function must be updated! |
128 | 126 | controlling_mod is the controlling module. It should usually be |
129 | - THIS_MODULE when calling. Note that this symbol is not defined in | |
130 | - kernels before 2.3.13; define it to NULL in that case. We will not use it | |
131 | - for anything older than 2.3.27 anyway. */ | |
127 | + THIS_MODULE when calling. */ | |
132 | 128 | int i2c_register_entry(struct i2c_client *client, const char *prefix, |
133 | - ctl_table * ctl_template, | |
129 | + ctl_table *ctl_template, | |
134 | 130 | struct module *controlling_mod) |
135 | 131 | { |
136 | 132 | int i, res, len, id; |
@@ -24,12 +24,12 @@ | ||
24 | 24 | #include <linux/ioport.h> |
25 | 25 | #include <linux/module.h> |
26 | 26 | #include <linux/init.h> |
27 | -#include <linux/string.h> /* for 2.0 kernels to get NULL */ | |
28 | -#include <asm/errno.h> /* for 2.0 kernels to get ENODEV */ | |
29 | -#include <asm/io.h> | |
30 | - | |
27 | +#include <linux/errno.h> | |
28 | +#include <linux/delay.h> | |
31 | 29 | #include <linux/i2c.h> |
32 | 30 | #include <linux/i2c-algo-bit.h> |
31 | +#include <asm/io.h> | |
32 | +#include <asm/param.h> /* for HZ */ | |
33 | 33 | |
34 | 34 | /* ----- global defines ----------------------------------------------- */ |
35 | 35 | #define DEB(x) /* should be reasonable open, close &c. */ |
@@ -42,9 +42,10 @@ struct i2c_algo_bit_data { | ||
42 | 42 | int (*getscl) (void *data); |
43 | 43 | |
44 | 44 | /* local settings */ |
45 | - int udelay; | |
46 | - int mdelay; | |
47 | - int timeout; | |
45 | + int udelay; /* half-clock-cycle time in microsecs */ | |
46 | + /* i.e. clock is (500 / udelay) KHz */ | |
47 | + int mdelay; /* in millisecs, unused */ | |
48 | + int timeout; /* in jiffies */ | |
48 | 49 | }; |
49 | 50 | |
50 | 51 | #define I2C_BIT_ADAP_MAX 16 |
@@ -91,9 +91,9 @@ | ||
91 | 91 | #define I2C_DRIVERID_SP5055 44 /* Satellite tuner */ |
92 | 92 | #define I2C_DRIVERID_STV0030 45 /* Multipurpose switch */ |
93 | 93 | #define I2C_DRIVERID_ADV7175 48 /* ADV 7175/7176 video encoder */ |
94 | -#define I2C_DRIVERID_MAX1617 56 /* temp sensor */ | |
95 | -#define I2C_DRIVERID_SAA7191 57 /* video decoder */ | |
96 | -#define I2C_DRIVERID_INDYCAM 58 /* SGI IndyCam */ | |
94 | +#define I2C_DRIVERID_MAX1617 56 /* temp sensor */ | |
95 | +#define I2C_DRIVERID_SAA7191 57 /* video decoder */ | |
96 | +#define I2C_DRIVERID_INDYCAM 58 /* SGI IndyCam */ | |
97 | 97 | |
98 | 98 | #define I2C_DRIVERID_EXP0 0xF0 /* experimental use id's */ |
99 | 99 | #define I2C_DRIVERID_EXP1 0xF1 |
@@ -1,6 +1,7 @@ | ||
1 | 1 | /* |
2 | - sensors.h - Part of lm_sensors, Linux kernel modules for hardware | |
3 | - monitoring | |
2 | + i2c-proc.h - Part of the i2c package | |
3 | + was originally sensors.h - Part of lm_sensors, Linux kernel modules | |
4 | + for hardware monitoring | |
4 | 5 | Copyright (c) 1998, 1999 Frodo Looijaard <frodol@dds.nl> |
5 | 6 | |
6 | 7 | This program is free software; you can redistribute it and/or modify |
@@ -23,9 +24,6 @@ | ||
23 | 24 | |
24 | 25 | #ifdef __KERNEL__ |
25 | 26 | |
26 | -/* Next two must be included before sysctl.h can be included, in 2.0 kernels */ | |
27 | -#include <linux/types.h> | |
28 | -#include <linux/fs.h> | |
29 | 27 | #include <linux/sysctl.h> |
30 | 28 | |
31 | 29 | /* The type of callback functions used in sensors_{proc,sysctl}_real */ |
@@ -362,7 +360,7 @@ extern int i2c_detect(struct i2c_adapter *adapter, | ||
362 | 360 | |
363 | 361 | /* This macro is used to scale user-input to sensible values in almost all |
364 | 362 | chip drivers. */ |
365 | -extern inline int SENSORS_LIMIT(long value, long low, long high) | |
363 | +static inline int SENSORS_LIMIT(long value, long low, long high) | |
366 | 364 | { |
367 | 365 | if (value < low) |
368 | 366 | return low; |
@@ -139,14 +139,14 @@ struct i2c_driver { | ||
139 | 139 | */ |
140 | 140 | int (*command)(struct i2c_client *client,unsigned int cmd, void *arg); |
141 | 141 | |
142 | - /* These two are mainly used for bookkeeping & dynamic unloading of | |
142 | + /* These two are used for bookkeeping & dynamic unloading of | |
143 | 143 | * kernel modules. inc_use tells the driver that a client is being |
144 | 144 | * used by another module & that it should increase its ref. counter. |
145 | 145 | * dec_use is the inverse operation. |
146 | 146 | * NB: Make sure you have no circular dependencies, or else you get a |
147 | 147 | * deadlock when trying to unload the modules. |
148 | - * You should use the i2c_{inc,dec}_use_client functions instead of | |
149 | - * calling this function directly. | |
148 | + * You should use the i2c_{inc,dec}_use_client functions instead of | |
149 | + * calling this function directly. | |
150 | 150 | */ |
151 | 151 | void (*inc_use)(struct i2c_client *client); |
152 | 152 | void (*dec_use)(struct i2c_client *client); |