• R/O
  • HTTP
  • SSH
  • HTTPS

linux-2.4.36: コミット

2.4.36-stable kernel tree


コミットメタ情報

リビジョンca07ecdcc55e695edda3cee07541f89baaeea183 (tree)
日時2006-12-05 17:22:51
作者Jean Delvare <khali@linu...>
コミッターWilly Tarreau

ログメッセージ

[PATCH] i2c cleanup : c99 struct init

Switch all i2c drivers to use the C99-style structure initialization,
as it is way safer.

Note that some hardcoded 100 are converted to HZ in the process,
as this was the true intent of the original code.

Signed-off-by: Jean Delvare <khali@linux-fr.org>

変更サマリ

差分

--- a/drivers/i2c/i2c-algo-bit.c
+++ b/drivers/i2c/i2c-algo-bit.c
@@ -523,14 +523,11 @@ static u32 bit_func(struct i2c_adapter *adap)
523523 /* -----exported algorithm data: ------------------------------------- */
524524
525525 static struct i2c_algorithm i2c_bit_algo = {
526- "Bit-shift algorithm",
527- I2C_ALGO_BIT,
528- bit_xfer,
529- NULL,
530- NULL, /* slave_xmit */
531- NULL, /* slave_recv */
532- algo_control, /* ioctl */
533- bit_func, /* functionality */
526+ .name = "Bit-shift algorithm",
527+ .id = I2C_ALGO_BIT,
528+ .master_xfer = bit_xfer,
529+ .algo_control = algo_control,
530+ .functionality = bit_func,
534531 };
535532
536533 /*
--- a/drivers/i2c/i2c-algo-pcf.c
+++ b/drivers/i2c/i2c-algo-pcf.c
@@ -440,14 +440,11 @@ static u32 pcf_func(struct i2c_adapter *adap)
440440 /* -----exported algorithm data: ------------------------------------- */
441441
442442 static struct i2c_algorithm pcf_algo = {
443- "PCF8584 algorithm",
444- I2C_ALGO_PCF,
445- pcf_xfer,
446- NULL,
447- NULL, /* slave_xmit */
448- NULL, /* slave_recv */
449- algo_control, /* ioctl */
450- pcf_func, /* functionality */
443+ .name = "PCF8584 algorithm",
444+ .id = I2C_ALGO_PCF,
445+ .master_xfer = pcf_xfer,
446+ .algo_control = algo_control,
447+ .functionality = pcf_func,
451448 };
452449
453450 /*
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -87,7 +87,7 @@ static int read_bus_i2c(char *buf, char **start, off_t offset, int len,
8787 /* To implement the dynamic /proc/bus/i2c-? files, we need our own
8888 implementation of the read hook */
8989 static struct file_operations i2cproc_operations = {
90- read: i2cproc_bus_read,
90+ .read = i2cproc_bus_read,
9191 };
9292
9393 static int i2cproc_initialized = 0;
--- a/drivers/i2c/i2c-dev.c
+++ b/drivers/i2c/i2c-dev.c
@@ -80,13 +80,13 @@ extern
8080 static int i2cdev_cleanup(void);
8181
8282 static struct file_operations i2cdev_fops = {
83- owner: THIS_MODULE,
84- llseek: no_llseek,
85- read: i2cdev_read,
86- write: i2cdev_write,
87- ioctl: i2cdev_ioctl,
88- open: i2cdev_open,
89- release: i2cdev_release,
83+ .owner = THIS_MODULE,
84+ .llseek = no_llseek,
85+ .read = i2cdev_read,
86+ .write = i2cdev_write,
87+ .ioctl = i2cdev_ioctl,
88+ .open = i2cdev_open,
89+ .release = i2cdev_release,
9090 };
9191
9292 #define I2CDEV_ADAPS_MAX I2C_ADAP_MAX
@@ -97,24 +97,20 @@ static devfs_handle_t devfs_handle = NULL;
9797 #endif
9898
9999 static struct i2c_driver i2cdev_driver = {
100- name: "i2c-dev dummy driver",
101- id: I2C_DRIVERID_I2CDEV,
102- flags: I2C_DF_DUMMY,
103- attach_adapter: i2cdev_attach_adapter,
104- detach_client: i2cdev_detach_client,
105- command: i2cdev_command,
106-/* inc_use: NULL,
107- dec_use: NULL, */
100+ .name = "i2c-dev dummy driver",
101+ .id = I2C_DRIVERID_I2CDEV,
102+ .flags = I2C_DF_DUMMY,
103+ .attach_adapter = i2cdev_attach_adapter,
104+ .detach_client = i2cdev_detach_client,
105+ .command = i2cdev_command,
108106 };
109107
110108 static struct i2c_client i2cdev_client_template = {
111- name: "I2C /dev entry",
112- id: 1,
113- flags: 0,
114- addr: -1,
115-/* adapter: NULL, */
116- driver: &i2cdev_driver,
117-/* data: NULL */
109+ .name = "I2C /dev entry",
110+ .id = 1,
111+ .flags = 0,
112+ .addr = -1,
113+ .driver = &i2cdev_driver,
118114 };
119115
120116 static int i2cdev_initialized;
--- a/drivers/i2c/i2c-elektor.c
+++ b/drivers/i2c/i2c-elektor.c
@@ -199,24 +199,24 @@ static void pcf_isa_dec_use(struct i2c_adapter *adap)
199199 * This is only done when more than one hardware adapter is supported.
200200 */
201201 static struct i2c_algo_pcf_data pcf_isa_data = {
202- NULL,
203- pcf_isa_setbyte,
204- pcf_isa_getbyte,
205- pcf_isa_getown,
206- pcf_isa_getclock,
207- pcf_isa_waitforpin,
208- 10, 10, 100, /* waits, timeout */
202+ .setpcf = pcf_isa_setbyte,
203+ .getpcf = pcf_isa_getbyte,
204+ .getown = pcf_isa_getown,
205+ .getclock = pcf_isa_getclock,
206+ .waitforpin = pcf_isa_waitforpin,
207+ .udelay = 10,
208+ .mdelay = 10,
209+ .timeout = HZ,
209210 };
210211
211212 static struct i2c_adapter pcf_isa_ops = {
212- "PCF8584 ISA adapter",
213- I2C_HW_P_ELEK,
214- NULL,
215- &pcf_isa_data,
216- pcf_isa_inc_use,
217- pcf_isa_dec_use,
218- pcf_isa_reg,
219- pcf_isa_unreg,
213+ .name = "PCF8584 ISA adapter",
214+ .id = I2C_HW_P_ELEK,
215+ .algo_data = &pcf_isa_data,
216+ .inc_use = pcf_isa_inc_use,
217+ .dec_use = pcf_isa_dec_use,
218+ .client_register = pcf_isa_reg,
219+ .client_unregister = pcf_isa_unreg,
220220 };
221221
222222 int __init i2c_pcfisa_init(void)
--- a/drivers/i2c/i2c-elv.c
+++ b/drivers/i2c/i2c-elv.c
@@ -145,23 +145,23 @@ static void bit_elv_dec_use(struct i2c_adapter *adap)
145145 * This is only done when more than one hardware adapter is supported.
146146 */
147147 static struct i2c_algo_bit_data bit_elv_data = {
148- NULL,
149- bit_elv_setsda,
150- bit_elv_setscl,
151- bit_elv_getsda,
152- bit_elv_getscl,
153- 80, 80, 100, /* waits, timeout */
148+ .setsda = bit_elv_setsda,
149+ .setscl = bit_elv_setscl,
150+ .getsda = bit_elv_getsda,
151+ .getscl = bit_elv_getscl,
152+ .udelay = 80,
153+ .mdelay = 80,
154+ .timeout = HZ
154155 };
155156
156157 static struct i2c_adapter bit_elv_ops = {
157- "ELV Parallel port adaptor",
158- I2C_HW_B_ELV,
159- NULL,
160- &bit_elv_data,
161- bit_elv_inc_use,
162- bit_elv_dec_use,
163- bit_elv_reg,
164- bit_elv_unreg,
158+ .name = "ELV Parallel port adaptor",
159+ .id = I2C_HW_B_ELV,
160+ .algo_data = &bit_elv_data,
161+ .inc_use = bit_elv_inc_use,
162+ .dec_use = bit_elv_dec_use,
163+ .client_register = bit_elv_reg,
164+ .client_unregister = bit_elv_unreg,
165165 };
166166
167167 int __init i2c_bitelv_init(void)
--- a/drivers/i2c/i2c-philips-par.c
+++ b/drivers/i2c/i2c-philips-par.c
@@ -156,33 +156,31 @@ static void bit_lp_dec_use(struct i2c_adapter *adap)
156156 */
157157
158158 static struct i2c_algo_bit_data bit_lp_data = {
159- NULL,
160- bit_lp_setsda,
161- bit_lp_setscl,
162- bit_lp_getsda,
163- bit_lp_getscl,
164- 80, 80, 100, /* waits, timeout */
159+ .setsda = bit_lp_setsda,
160+ .setscl = bit_lp_setscl,
161+ .getsda = bit_lp_getsda,
162+ .getscl = bit_lp_getscl,
163+ .udelay = 80,
164+ .mdelay = 80,
165+ .timeout = HZ
165166 };
166167
167168 static struct i2c_algo_bit_data bit_lp_data2 = {
168- NULL,
169- bit_lp_setsda2,
170- bit_lp_setscl2,
171- bit_lp_getsda2,
172- NULL,
173- 80, 80, 100, /* waits, timeout */
169+ .setsda = bit_lp_setsda2,
170+ .setscl = bit_lp_setscl2,
171+ .getsda = bit_lp_getsda2,
172+ .udelay = 80,
173+ .mdelay = 80,
174+ .timeout = HZ
174175 };
175176
176177 static struct i2c_adapter bit_lp_ops = {
177- "Philips Parallel port adapter",
178- I2C_HW_B_LP,
179- NULL,
180- NULL,
181- bit_lp_inc_use,
182- bit_lp_dec_use,
183- bit_lp_reg,
184-
185- bit_lp_unreg,
178+ .name = "Philips Parallel port adapter",
179+ .id = I2C_HW_B_LP,
180+ .inc_use = bit_lp_inc_use,
181+ .dec_use = bit_lp_dec_use,
182+ .client_register = bit_lp_reg,
183+ .client_unregister = bit_lp_unreg,
186184 };
187185
188186 static void i2c_parport_attach (struct parport *port)
--- a/drivers/i2c/i2c-velleman.c
+++ b/drivers/i2c/i2c-velleman.c
@@ -139,23 +139,23 @@ static void bit_velle_dec_use(struct i2c_adapter *adap)
139139 */
140140
141141 static struct i2c_algo_bit_data bit_velle_data = {
142- NULL,
143- bit_velle_setsda,
144- bit_velle_setscl,
145- bit_velle_getsda,
146- bit_velle_getscl,
147- 10, 10, 100, /* waits, timeout */
142+ .setsda = bit_velle_setsda,
143+ .setscl = bit_velle_setscl,
144+ .getsda = bit_velle_getsda,
145+ .getscl = bit_velle_getscl,
146+ .udelay = 10,
147+ .mdelay = 10,
148+ .timeout = HZ
148149 };
149150
150151 static struct i2c_adapter bit_velle_ops = {
151- "Velleman K8000",
152- I2C_HW_B_VELLE,
153- NULL,
154- &bit_velle_data,
155- bit_velle_inc_use,
156- bit_velle_dec_use,
157- bit_velle_reg,
158- bit_velle_unreg,
152+ .name = "Velleman K8000",
153+ .id = I2C_HW_B_VELLE,
154+ .algo_data = &bit_velle_data,
155+ .inc_use = bit_velle_inc_use,
156+ .dec_use = bit_velle_dec_use,
157+ .client_register = bit_velle_reg,
158+ .client_unregister = bit_velle_unreg,
159159 };
160160
161161 int __init i2c_bitvelle_init(void)
旧リポジトリブラウザで表示