aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp/card.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2007-07-26 13:41:21 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-26 14:35:21 -0400
commit07d4e9af109221ab731c5aaf832e89776c64b013 (patch)
tree05d05620af7b1b009f48dbad5f38004b682db271 /drivers/pnp/card.c
parent9dd78466c956ac4b4f38e12032dc4249ccf57ad1 (diff)
PNP: fix up after Lindent
These are manual fixups after running Lindent. No functional change. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Cc: Len Brown <lenb@kernel.org> Cc: Adam Belay <ambx1@neo.rr.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/pnp/card.c')
-rw-r--r--drivers/pnp/card.c33
1 files changed, 15 insertions, 18 deletions
diff --git a/drivers/pnp/card.c b/drivers/pnp/card.c
index a379a38c196c..b6a4f02b01d1 100644
--- a/drivers/pnp/card.c
+++ b/drivers/pnp/card.c
@@ -2,7 +2,6 @@
2 * card.c - contains functions for managing groups of PnP devices 2 * card.c - contains functions for managing groups of PnP devices
3 * 3 *
4 * Copyright 2002 Adam Belay <ambx1@neo.rr.com> 4 * Copyright 2002 Adam Belay <ambx1@neo.rr.com>
5 *
6 */ 5 */
7 6
8#include <linux/module.h> 7#include <linux/module.h>
@@ -17,12 +16,15 @@ static const struct pnp_card_device_id *match_card(struct pnp_card_driver *drv,
17 struct pnp_card *card) 16 struct pnp_card *card)
18{ 17{
19 const struct pnp_card_device_id *drv_id = drv->id_table; 18 const struct pnp_card_device_id *drv_id = drv->id_table;
19
20 while (*drv_id->id) { 20 while (*drv_id->id) {
21 if (compare_pnp_id(card->id, drv_id->id)) { 21 if (compare_pnp_id(card->id, drv_id->id)) {
22 int i = 0; 22 int i = 0;
23
23 for (;;) { 24 for (;;) {
24 int found; 25 int found;
25 struct pnp_dev *dev; 26 struct pnp_dev *dev;
27
26 if (i == PNP_MAX_DEVICES 28 if (i == PNP_MAX_DEVICES
27 || !*drv_id->devs[i].id) 29 || !*drv_id->devs[i].id)
28 return drv_id; 30 return drv_id;
@@ -52,6 +54,7 @@ static void card_remove(struct pnp_dev *dev)
52static void card_remove_first(struct pnp_dev *dev) 54static void card_remove_first(struct pnp_dev *dev)
53{ 55{
54 struct pnp_card_driver *drv = to_pnp_card_driver(dev->driver); 56 struct pnp_card_driver *drv = to_pnp_card_driver(dev->driver);
57
55 if (!dev->card || !drv) 58 if (!dev->card || !drv)
56 return; 59 return;
57 if (drv->remove) 60 if (drv->remove)
@@ -96,12 +99,11 @@ static int card_probe(struct pnp_card *card, struct pnp_card_driver *drv)
96 * pnp_add_card_id - adds an EISA id to the specified card 99 * pnp_add_card_id - adds an EISA id to the specified card
97 * @id: pointer to a pnp_id structure 100 * @id: pointer to a pnp_id structure
98 * @card: pointer to the desired card 101 * @card: pointer to the desired card
99 *
100 */ 102 */
101
102int pnp_add_card_id(struct pnp_id *id, struct pnp_card *card) 103int pnp_add_card_id(struct pnp_id *id, struct pnp_card *card)
103{ 104{
104 struct pnp_id *ptr; 105 struct pnp_id *ptr;
106
105 if (!id) 107 if (!id)
106 return -EINVAL; 108 return -EINVAL;
107 if (!card) 109 if (!card)
@@ -121,6 +123,7 @@ static void pnp_free_card_ids(struct pnp_card *card)
121{ 123{
122 struct pnp_id *id; 124 struct pnp_id *id;
123 struct pnp_id *next; 125 struct pnp_id *next;
126
124 if (!card) 127 if (!card)
125 return; 128 return;
126 id = card->id; 129 id = card->id;
@@ -134,6 +137,7 @@ static void pnp_free_card_ids(struct pnp_card *card)
134static void pnp_release_card(struct device *dmdev) 137static void pnp_release_card(struct device *dmdev)
135{ 138{
136 struct pnp_card *card = to_pnp_card(dmdev); 139 struct pnp_card *card = to_pnp_card(dmdev);
140
137 pnp_free_card_ids(card); 141 pnp_free_card_ids(card);
138 kfree(card); 142 kfree(card);
139} 143}
@@ -143,6 +147,7 @@ static ssize_t pnp_show_card_name(struct device *dmdev,
143{ 147{
144 char *str = buf; 148 char *str = buf;
145 struct pnp_card *card = to_pnp_card(dmdev); 149 struct pnp_card *card = to_pnp_card(dmdev);
150
146 str += sprintf(str, "%s\n", card->name); 151 str += sprintf(str, "%s\n", card->name);
147 return (str - buf); 152 return (str - buf);
148} 153}
@@ -168,6 +173,7 @@ static DEVICE_ATTR(card_id, S_IRUGO, pnp_show_card_ids, NULL);
168static int pnp_interface_attach_card(struct pnp_card *card) 173static int pnp_interface_attach_card(struct pnp_card *card)
169{ 174{
170 int rc = device_create_file(&card->dev, &dev_attr_name); 175 int rc = device_create_file(&card->dev, &dev_attr_name);
176
171 if (rc) 177 if (rc)
172 return rc; 178 return rc;
173 179
@@ -186,11 +192,11 @@ static int pnp_interface_attach_card(struct pnp_card *card)
186 * pnp_add_card - adds a PnP card to the PnP Layer 192 * pnp_add_card - adds a PnP card to the PnP Layer
187 * @card: pointer to the card to add 193 * @card: pointer to the card to add
188 */ 194 */
189
190int pnp_add_card(struct pnp_card *card) 195int pnp_add_card(struct pnp_card *card)
191{ 196{
192 int error; 197 int error;
193 struct list_head *pos, *temp; 198 struct list_head *pos, *temp;
199
194 if (!card || !card->protocol) 200 if (!card || !card->protocol)
195 return -EINVAL; 201 return -EINVAL;
196 202
@@ -233,10 +239,10 @@ int pnp_add_card(struct pnp_card *card)
233 * pnp_remove_card - removes a PnP card from the PnP Layer 239 * pnp_remove_card - removes a PnP card from the PnP Layer
234 * @card: pointer to the card to remove 240 * @card: pointer to the card to remove
235 */ 241 */
236
237void pnp_remove_card(struct pnp_card *card) 242void pnp_remove_card(struct pnp_card *card)
238{ 243{
239 struct list_head *pos, *temp; 244 struct list_head *pos, *temp;
245
240 if (!card) 246 if (!card)
241 return; 247 return;
242 device_unregister(&card->dev); 248 device_unregister(&card->dev);
@@ -255,7 +261,6 @@ void pnp_remove_card(struct pnp_card *card)
255 * @card: pointer to the card to add to 261 * @card: pointer to the card to add to
256 * @dev: pointer to the device to add 262 * @dev: pointer to the device to add
257 */ 263 */
258
259int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev) 264int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev)
260{ 265{
261 if (!card || !dev || !dev->protocol) 266 if (!card || !dev || !dev->protocol)
@@ -275,7 +280,6 @@ int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev)
275 * pnp_remove_card_device- removes a device from the specified card 280 * pnp_remove_card_device- removes a device from the specified card
276 * @dev: pointer to the device to remove 281 * @dev: pointer to the device to remove
277 */ 282 */
278
279void pnp_remove_card_device(struct pnp_dev *dev) 283void pnp_remove_card_device(struct pnp_dev *dev)
280{ 284{
281 spin_lock(&pnp_lock); 285 spin_lock(&pnp_lock);
@@ -291,7 +295,6 @@ void pnp_remove_card_device(struct pnp_dev *dev)
291 * @id: pointer to a PnP ID structure that explains the rules for finding the device 295 * @id: pointer to a PnP ID structure that explains the rules for finding the device
292 * @from: Starting place to search from. If NULL it will start from the begining. 296 * @from: Starting place to search from. If NULL it will start from the begining.
293 */ 297 */
294
295struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink, 298struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink,
296 const char *id, struct pnp_dev *from) 299 const char *id, struct pnp_dev *from)
297{ 300{
@@ -299,6 +302,7 @@ struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink,
299 struct pnp_dev *dev; 302 struct pnp_dev *dev;
300 struct pnp_card_driver *drv; 303 struct pnp_card_driver *drv;
301 struct pnp_card *card; 304 struct pnp_card *card;
305
302 if (!clink || !id) 306 if (!clink || !id)
303 goto done; 307 goto done;
304 card = clink->card; 308 card = clink->card;
@@ -340,10 +344,10 @@ struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink,
340 * pnp_release_card_device - call this when the driver no longer needs the device 344 * pnp_release_card_device - call this when the driver no longer needs the device
341 * @dev: pointer to the PnP device stucture 345 * @dev: pointer to the PnP device stucture
342 */ 346 */
343
344void pnp_release_card_device(struct pnp_dev *dev) 347void pnp_release_card_device(struct pnp_dev *dev)
345{ 348{
346 struct pnp_card_driver *drv = dev->card_link->driver; 349 struct pnp_card_driver *drv = dev->card_link->driver;
350
347 if (!drv) 351 if (!drv)
348 return; 352 return;
349 drv->link.remove = &card_remove; 353 drv->link.remove = &card_remove;
@@ -357,6 +361,7 @@ void pnp_release_card_device(struct pnp_dev *dev)
357static int card_suspend(struct pnp_dev *dev, pm_message_t state) 361static int card_suspend(struct pnp_dev *dev, pm_message_t state)
358{ 362{
359 struct pnp_card_link *link = dev->card_link; 363 struct pnp_card_link *link = dev->card_link;
364
360 if (link->pm_state.event == state.event) 365 if (link->pm_state.event == state.event)
361 return 0; 366 return 0;
362 link->pm_state = state; 367 link->pm_state = state;
@@ -366,6 +371,7 @@ static int card_suspend(struct pnp_dev *dev, pm_message_t state)
366static int card_resume(struct pnp_dev *dev) 371static int card_resume(struct pnp_dev *dev)
367{ 372{
368 struct pnp_card_link *link = dev->card_link; 373 struct pnp_card_link *link = dev->card_link;
374
369 if (link->pm_state.event == PM_EVENT_ON) 375 if (link->pm_state.event == PM_EVENT_ON)
370 return 0; 376 return 0;
371 link->pm_state = PMSG_ON; 377 link->pm_state = PMSG_ON;
@@ -377,7 +383,6 @@ static int card_resume(struct pnp_dev *dev)
377 * pnp_register_card_driver - registers a PnP card driver with the PnP Layer 383 * pnp_register_card_driver - registers a PnP card driver with the PnP Layer
378 * @drv: pointer to the driver to register 384 * @drv: pointer to the driver to register
379 */ 385 */
380
381int pnp_register_card_driver(struct pnp_card_driver *drv) 386int pnp_register_card_driver(struct pnp_card_driver *drv)
382{ 387{
383 int error; 388 int error;
@@ -411,7 +416,6 @@ int pnp_register_card_driver(struct pnp_card_driver *drv)
411 * pnp_unregister_card_driver - unregisters a PnP card driver from the PnP Layer 416 * pnp_unregister_card_driver - unregisters a PnP card driver from the PnP Layer
412 * @drv: pointer to the driver to unregister 417 * @drv: pointer to the driver to unregister
413 */ 418 */
414
415void pnp_unregister_card_driver(struct pnp_card_driver *drv) 419void pnp_unregister_card_driver(struct pnp_card_driver *drv)
416{ 420{
417 spin_lock(&pnp_lock); 421 spin_lock(&pnp_lock);
@@ -420,13 +424,6 @@ void pnp_unregister_card_driver(struct pnp_card_driver *drv)
420 pnp_unregister_driver(&drv->link); 424 pnp_unregister_driver(&drv->link);
421} 425}
422 426
423#if 0
424EXPORT_SYMBOL(pnp_add_card);
425EXPORT_SYMBOL(pnp_remove_card);
426EXPORT_SYMBOL(pnp_add_card_device);
427EXPORT_SYMBOL(pnp_remove_card_device);
428EXPORT_SYMBOL(pnp_add_card_id);
429#endif /* 0 */
430EXPORT_SYMBOL(pnp_request_card_device); 427EXPORT_SYMBOL(pnp_request_card_device);
431EXPORT_SYMBOL(pnp_release_card_device); 428EXPORT_SYMBOL(pnp_release_card_device);
432EXPORT_SYMBOL(pnp_register_card_driver); 429EXPORT_SYMBOL(pnp_register_card_driver);