diff options
author | Jean Delvare <khali@linux-fr.org> | 2011-05-24 14:58:49 -0400 |
---|---|---|
committer | Jean Delvare <khali@endymion.delvare> | 2011-05-24 14:58:49 -0400 |
commit | 07da0372dd6ca5517400ce95040861def25930c8 (patch) | |
tree | 417c8b0a982f8d24cce4550bfa78acdb11bcea8d /drivers/i2c/busses/i2c-parport.c | |
parent | 8eacfcebf0274310a751924c02c5c31cbdf057b3 (diff) |
i2c-parport: Various cleanups
* Fix white space.
* Rename labels to something meaningful.
* Prefix defines with PORT_ to avoid collision with macros from
<linux/parport.h>.
* Add const markers where possible.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/i2c/busses/i2c-parport.c')
-rw-r--r-- | drivers/i2c/busses/i2c-parport.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/drivers/i2c/busses/i2c-parport.c b/drivers/i2c/busses/i2c-parport.c index 2dbba163b102..24565687ac9b 100644 --- a/drivers/i2c/busses/i2c-parport.c +++ b/drivers/i2c/busses/i2c-parport.c | |||
@@ -2,13 +2,13 @@ | |||
2 | * i2c-parport.c I2C bus over parallel port * | 2 | * i2c-parport.c I2C bus over parallel port * |
3 | * ------------------------------------------------------------------------ * | 3 | * ------------------------------------------------------------------------ * |
4 | Copyright (C) 2003-2011 Jean Delvare <khali@linux-fr.org> | 4 | Copyright (C) 2003-2011 Jean Delvare <khali@linux-fr.org> |
5 | 5 | ||
6 | Based on older i2c-philips-par.c driver | 6 | Based on older i2c-philips-par.c driver |
7 | Copyright (C) 1995-2000 Simon G. Vogl | 7 | Copyright (C) 1995-2000 Simon G. Vogl |
8 | With some changes from: | 8 | With some changes from: |
9 | Frodo Looijaard <frodol@dds.nl> | 9 | Frodo Looijaard <frodol@dds.nl> |
10 | Kyösti Mälkki <kmalkki@cc.hut.fi> | 10 | Kyösti Mälkki <kmalkki@cc.hut.fi> |
11 | 11 | ||
12 | This program is free software; you can redistribute it and/or modify | 12 | This program is free software; you can redistribute it and/or modify |
13 | it under the terms of the GNU General Public License as published by | 13 | it under the terms of the GNU General Public License as published by |
14 | the Free Software Foundation; either version 2 of the License, or | 14 | the Free Software Foundation; either version 2 of the License, or |
@@ -78,13 +78,13 @@ static unsigned char port_read_control(struct parport *p) | |||
78 | return parport_read_control(p); | 78 | return parport_read_control(p); |
79 | } | 79 | } |
80 | 80 | ||
81 | static void (*port_write[])(struct parport *, unsigned char) = { | 81 | static void (* const port_write[])(struct parport *, unsigned char) = { |
82 | port_write_data, | 82 | port_write_data, |
83 | NULL, | 83 | NULL, |
84 | port_write_control, | 84 | port_write_control, |
85 | }; | 85 | }; |
86 | 86 | ||
87 | static unsigned char (*port_read[])(struct parport *) = { | 87 | static unsigned char (* const port_read[])(struct parport *) = { |
88 | port_read_data, | 88 | port_read_data, |
89 | port_read_status, | 89 | port_read_status, |
90 | port_read_control, | 90 | port_read_control, |
@@ -147,7 +147,7 @@ static const struct i2c_algo_bit_data parport_algo_data = { | |||
147 | .getscl = parport_getscl, | 147 | .getscl = parport_getscl, |
148 | .udelay = 10, /* ~50 kbps */ | 148 | .udelay = 10, /* ~50 kbps */ |
149 | .timeout = HZ, | 149 | .timeout = HZ, |
150 | }; | 150 | }; |
151 | 151 | ||
152 | /* ----- I2c and parallel port call-back functions and structures --------- */ | 152 | /* ----- I2c and parallel port call-back functions and structures --------- */ |
153 | 153 | ||
@@ -164,10 +164,10 @@ void i2c_parport_irq(void *data) | |||
164 | "SMBus alert received but no ARA client!\n"); | 164 | "SMBus alert received but no ARA client!\n"); |
165 | } | 165 | } |
166 | 166 | ||
167 | static void i2c_parport_attach (struct parport *port) | 167 | static void i2c_parport_attach(struct parport *port) |
168 | { | 168 | { |
169 | struct i2c_par *adapter; | 169 | struct i2c_par *adapter; |
170 | 170 | ||
171 | adapter = kzalloc(sizeof(struct i2c_par), GFP_KERNEL); | 171 | adapter = kzalloc(sizeof(struct i2c_par), GFP_KERNEL); |
172 | if (adapter == NULL) { | 172 | if (adapter == NULL) { |
173 | printk(KERN_ERR "i2c-parport: Failed to kzalloc\n"); | 173 | printk(KERN_ERR "i2c-parport: Failed to kzalloc\n"); |
@@ -180,7 +180,7 @@ static void i2c_parport_attach (struct parport *port) | |||
180 | NULL, NULL, i2c_parport_irq, PARPORT_FLAG_EXCL, adapter); | 180 | NULL, NULL, i2c_parport_irq, PARPORT_FLAG_EXCL, adapter); |
181 | if (!adapter->pdev) { | 181 | if (!adapter->pdev) { |
182 | printk(KERN_ERR "i2c-parport: Unable to register with parport\n"); | 182 | printk(KERN_ERR "i2c-parport: Unable to register with parport\n"); |
183 | goto ERROR0; | 183 | goto err_free; |
184 | } | 184 | } |
185 | 185 | ||
186 | /* Fill the rest of the structure */ | 186 | /* Fill the rest of the structure */ |
@@ -200,7 +200,7 @@ static void i2c_parport_attach (struct parport *port) | |||
200 | 200 | ||
201 | if (parport_claim_or_block(adapter->pdev) < 0) { | 201 | if (parport_claim_or_block(adapter->pdev) < 0) { |
202 | printk(KERN_ERR "i2c-parport: Could not claim parallel port\n"); | 202 | printk(KERN_ERR "i2c-parport: Could not claim parallel port\n"); |
203 | goto ERROR1; | 203 | goto err_unregister; |
204 | } | 204 | } |
205 | 205 | ||
206 | /* Reset hardware to a sane state (SCL and SDA high) */ | 206 | /* Reset hardware to a sane state (SCL and SDA high) */ |
@@ -215,7 +215,7 @@ static void i2c_parport_attach (struct parport *port) | |||
215 | 215 | ||
216 | if (i2c_bit_add_bus(&adapter->adapter) < 0) { | 216 | if (i2c_bit_add_bus(&adapter->adapter) < 0) { |
217 | printk(KERN_ERR "i2c-parport: Unable to register with I2C\n"); | 217 | printk(KERN_ERR "i2c-parport: Unable to register with I2C\n"); |
218 | goto ERROR1; | 218 | goto err_unregister; |
219 | } | 219 | } |
220 | 220 | ||
221 | /* Setup SMBus alert if supported */ | 221 | /* Setup SMBus alert if supported */ |
@@ -234,16 +234,16 @@ static void i2c_parport_attach (struct parport *port) | |||
234 | mutex_lock(&adapter_list_lock); | 234 | mutex_lock(&adapter_list_lock); |
235 | list_add_tail(&adapter->node, &adapter_list); | 235 | list_add_tail(&adapter->node, &adapter_list); |
236 | mutex_unlock(&adapter_list_lock); | 236 | mutex_unlock(&adapter_list_lock); |
237 | return; | 237 | return; |
238 | 238 | ||
239 | ERROR1: | 239 | err_unregister: |
240 | parport_release(adapter->pdev); | 240 | parport_release(adapter->pdev); |
241 | parport_unregister_device(adapter->pdev); | 241 | parport_unregister_device(adapter->pdev); |
242 | ERROR0: | 242 | err_free: |
243 | kfree(adapter); | 243 | kfree(adapter); |
244 | } | 244 | } |
245 | 245 | ||
246 | static void i2c_parport_detach (struct parport *port) | 246 | static void i2c_parport_detach(struct parport *port) |
247 | { | 247 | { |
248 | struct i2c_par *adapter, *_n; | 248 | struct i2c_par *adapter, *_n; |
249 | 249 | ||
@@ -260,7 +260,7 @@ static void i2c_parport_detach (struct parport *port) | |||
260 | /* Un-init if needed (power off...) */ | 260 | /* Un-init if needed (power off...) */ |
261 | if (adapter_parm[type].init.val) | 261 | if (adapter_parm[type].init.val) |
262 | line_set(port, 0, &adapter_parm[type].init); | 262 | line_set(port, 0, &adapter_parm[type].init); |
263 | 263 | ||
264 | parport_release(adapter->pdev); | 264 | parport_release(adapter->pdev); |
265 | parport_unregister_device(adapter->pdev); | 265 | parport_unregister_device(adapter->pdev); |
266 | list_del(&adapter->node); | 266 | list_del(&adapter->node); |