Skip to content

Commit 07d4e9a

Browse files
Bjorn HelgaasLinus Torvalds
Bjorn Helgaas
authored and
Linus Torvalds
committed
PNP: fix up after Lindent
These are manual fixups after running Lindent. No functional change. Signed-off-by: Bjorn Helgaas <[email protected]> Cc: Len Brown <[email protected]> Cc: Adam Belay <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 9dd7846 commit 07d4e9a

20 files changed

+312
-634
lines changed

drivers/pnp/card.c

+15-18
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
* card.c - contains functions for managing groups of PnP devices
33
*
44
* Copyright 2002 Adam Belay <[email protected]>
5-
*
65
*/
76

87
#include <linux/module.h>
@@ -17,12 +16,15 @@ static const struct pnp_card_device_id *match_card(struct pnp_card_driver *drv,
1716
struct pnp_card *card)
1817
{
1918
const struct pnp_card_device_id *drv_id = drv->id_table;
19+
2020
while (*drv_id->id) {
2121
if (compare_pnp_id(card->id, drv_id->id)) {
2222
int i = 0;
23+
2324
for (;;) {
2425
int found;
2526
struct pnp_dev *dev;
27+
2628
if (i == PNP_MAX_DEVICES
2729
|| !*drv_id->devs[i].id)
2830
return drv_id;
@@ -52,6 +54,7 @@ static void card_remove(struct pnp_dev *dev)
5254
static void card_remove_first(struct pnp_dev *dev)
5355
{
5456
struct pnp_card_driver *drv = to_pnp_card_driver(dev->driver);
57+
5558
if (!dev->card || !drv)
5659
return;
5760
if (drv->remove)
@@ -96,12 +99,11 @@ static int card_probe(struct pnp_card *card, struct pnp_card_driver *drv)
9699
* pnp_add_card_id - adds an EISA id to the specified card
97100
* @id: pointer to a pnp_id structure
98101
* @card: pointer to the desired card
99-
*
100102
*/
101-
102103
int pnp_add_card_id(struct pnp_id *id, struct pnp_card *card)
103104
{
104105
struct pnp_id *ptr;
106+
105107
if (!id)
106108
return -EINVAL;
107109
if (!card)
@@ -121,6 +123,7 @@ static void pnp_free_card_ids(struct pnp_card *card)
121123
{
122124
struct pnp_id *id;
123125
struct pnp_id *next;
126+
124127
if (!card)
125128
return;
126129
id = card->id;
@@ -134,6 +137,7 @@ static void pnp_free_card_ids(struct pnp_card *card)
134137
static void pnp_release_card(struct device *dmdev)
135138
{
136139
struct pnp_card *card = to_pnp_card(dmdev);
140+
137141
pnp_free_card_ids(card);
138142
kfree(card);
139143
}
@@ -143,6 +147,7 @@ static ssize_t pnp_show_card_name(struct device *dmdev,
143147
{
144148
char *str = buf;
145149
struct pnp_card *card = to_pnp_card(dmdev);
150+
146151
str += sprintf(str, "%s\n", card->name);
147152
return (str - buf);
148153
}
@@ -168,6 +173,7 @@ static DEVICE_ATTR(card_id, S_IRUGO, pnp_show_card_ids, NULL);
168173
static int pnp_interface_attach_card(struct pnp_card *card)
169174
{
170175
int rc = device_create_file(&card->dev, &dev_attr_name);
176+
171177
if (rc)
172178
return rc;
173179

@@ -186,11 +192,11 @@ static int pnp_interface_attach_card(struct pnp_card *card)
186192
* pnp_add_card - adds a PnP card to the PnP Layer
187193
* @card: pointer to the card to add
188194
*/
189-
190195
int pnp_add_card(struct pnp_card *card)
191196
{
192197
int error;
193198
struct list_head *pos, *temp;
199+
194200
if (!card || !card->protocol)
195201
return -EINVAL;
196202

@@ -233,10 +239,10 @@ int pnp_add_card(struct pnp_card *card)
233239
* pnp_remove_card - removes a PnP card from the PnP Layer
234240
* @card: pointer to the card to remove
235241
*/
236-
237242
void pnp_remove_card(struct pnp_card *card)
238243
{
239244
struct list_head *pos, *temp;
245+
240246
if (!card)
241247
return;
242248
device_unregister(&card->dev);
@@ -255,7 +261,6 @@ void pnp_remove_card(struct pnp_card *card)
255261
* @card: pointer to the card to add to
256262
* @dev: pointer to the device to add
257263
*/
258-
259264
int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev)
260265
{
261266
if (!card || !dev || !dev->protocol)
@@ -275,7 +280,6 @@ int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev)
275280
* pnp_remove_card_device- removes a device from the specified card
276281
* @dev: pointer to the device to remove
277282
*/
278-
279283
void pnp_remove_card_device(struct pnp_dev *dev)
280284
{
281285
spin_lock(&pnp_lock);
@@ -291,14 +295,14 @@ void pnp_remove_card_device(struct pnp_dev *dev)
291295
* @id: pointer to a PnP ID structure that explains the rules for finding the device
292296
* @from: Starting place to search from. If NULL it will start from the begining.
293297
*/
294-
295298
struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink,
296299
const char *id, struct pnp_dev *from)
297300
{
298301
struct list_head *pos;
299302
struct pnp_dev *dev;
300303
struct pnp_card_driver *drv;
301304
struct pnp_card *card;
305+
302306
if (!clink || !id)
303307
goto done;
304308
card = clink->card;
@@ -340,10 +344,10 @@ struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink,
340344
* pnp_release_card_device - call this when the driver no longer needs the device
341345
* @dev: pointer to the PnP device stucture
342346
*/
343-
344347
void pnp_release_card_device(struct pnp_dev *dev)
345348
{
346349
struct pnp_card_driver *drv = dev->card_link->driver;
350+
347351
if (!drv)
348352
return;
349353
drv->link.remove = &card_remove;
@@ -357,6 +361,7 @@ void pnp_release_card_device(struct pnp_dev *dev)
357361
static int card_suspend(struct pnp_dev *dev, pm_message_t state)
358362
{
359363
struct pnp_card_link *link = dev->card_link;
364+
360365
if (link->pm_state.event == state.event)
361366
return 0;
362367
link->pm_state = state;
@@ -366,6 +371,7 @@ static int card_suspend(struct pnp_dev *dev, pm_message_t state)
366371
static int card_resume(struct pnp_dev *dev)
367372
{
368373
struct pnp_card_link *link = dev->card_link;
374+
369375
if (link->pm_state.event == PM_EVENT_ON)
370376
return 0;
371377
link->pm_state = PMSG_ON;
@@ -377,7 +383,6 @@ static int card_resume(struct pnp_dev *dev)
377383
* pnp_register_card_driver - registers a PnP card driver with the PnP Layer
378384
* @drv: pointer to the driver to register
379385
*/
380-
381386
int pnp_register_card_driver(struct pnp_card_driver *drv)
382387
{
383388
int error;
@@ -411,7 +416,6 @@ int pnp_register_card_driver(struct pnp_card_driver *drv)
411416
* pnp_unregister_card_driver - unregisters a PnP card driver from the PnP Layer
412417
* @drv: pointer to the driver to unregister
413418
*/
414-
415419
void pnp_unregister_card_driver(struct pnp_card_driver *drv)
416420
{
417421
spin_lock(&pnp_lock);
@@ -420,13 +424,6 @@ void pnp_unregister_card_driver(struct pnp_card_driver *drv)
420424
pnp_unregister_driver(&drv->link);
421425
}
422426

423-
#if 0
424-
EXPORT_SYMBOL(pnp_add_card);
425-
EXPORT_SYMBOL(pnp_remove_card);
426-
EXPORT_SYMBOL(pnp_add_card_device);
427-
EXPORT_SYMBOL(pnp_remove_card_device);
428-
EXPORT_SYMBOL(pnp_add_card_id);
429-
#endif /* 0 */
430427
EXPORT_SYMBOL(pnp_request_card_device);
431428
EXPORT_SYMBOL(pnp_release_card_device);
432429
EXPORT_SYMBOL(pnp_register_card_driver);

drivers/pnp/core.c

+3-26
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
* core.c - contains all core device and protocol registration functions
33
*
44
* Copyright 2002 Adam Belay <[email protected]>
5-
*
65
*/
76

87
#include <linux/pnp.h>
@@ -48,7 +47,6 @@ void *pnp_alloc(long size)
4847
*
4948
* Ex protocols: ISAPNP, PNPBIOS, etc
5049
*/
51-
5250
int pnp_register_protocol(struct pnp_protocol *protocol)
5351
{
5452
int nodenum;
@@ -82,7 +80,6 @@ int pnp_register_protocol(struct pnp_protocol *protocol)
8280
/**
8381
* pnp_protocol_unregister - removes a pnp protocol from the pnp layer
8482
* @protocol: pointer to the corresponding pnp_protocol structure
85-
*
8683
*/
8784
void pnp_unregister_protocol(struct pnp_protocol *protocol)
8885
{
@@ -96,6 +93,7 @@ static void pnp_free_ids(struct pnp_dev *dev)
9693
{
9794
struct pnp_id *id;
9895
struct pnp_id *next;
96+
9997
if (!dev)
10098
return;
10199
id = dev->id;
@@ -109,6 +107,7 @@ static void pnp_free_ids(struct pnp_dev *dev)
109107
static void pnp_release_device(struct device *dmdev)
110108
{
111109
struct pnp_dev *dev = to_pnp_dev(dmdev);
110+
112111
pnp_free_option(dev->independent);
113112
pnp_free_option(dev->dependent);
114113
pnp_free_ids(dev);
@@ -118,6 +117,7 @@ static void pnp_release_device(struct device *dmdev)
118117
int __pnp_add_device(struct pnp_dev *dev)
119118
{
120119
int ret;
120+
121121
pnp_fixup_device(dev);
122122
dev->dev.bus = &pnp_bus_type;
123123
dev->dev.dma_mask = &dev->dma_mask;
@@ -141,7 +141,6 @@ int __pnp_add_device(struct pnp_dev *dev)
141141
*
142142
* adds to driver model, name database, fixups, interface, etc.
143143
*/
144-
145144
int pnp_add_device(struct pnp_dev *dev)
146145
{
147146
if (!dev || !dev->protocol || dev->card)
@@ -161,32 +160,10 @@ void __pnp_remove_device(struct pnp_dev *dev)
161160
device_unregister(&dev->dev);
162161
}
163162

164-
/**
165-
* pnp_remove_device - removes a pnp device from the pnp layer
166-
* @dev: pointer to dev to add
167-
*
168-
* this function will free all mem used by dev
169-
*/
170-
#if 0
171-
void pnp_remove_device(struct pnp_dev *dev)
172-
{
173-
if (!dev || dev->card)
174-
return;
175-
__pnp_remove_device(dev);
176-
}
177-
#endif /* 0 */
178-
179163
static int __init pnp_init(void)
180164
{
181165
printk(KERN_INFO "Linux Plug and Play Support v0.97 (c) Adam Belay\n");
182166
return bus_register(&pnp_bus_type);
183167
}
184168

185169
subsys_initcall(pnp_init);
186-
187-
#if 0
188-
EXPORT_SYMBOL(pnp_register_protocol);
189-
EXPORT_SYMBOL(pnp_unregister_protocol);
190-
EXPORT_SYMBOL(pnp_add_device);
191-
EXPORT_SYMBOL(pnp_remove_device);
192-
#endif /* 0 */

drivers/pnp/driver.c

+9-11
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
* driver.c - device id matching, driver model, etc.
33
*
44
* Copyright 2002 Adam Belay <[email protected]>
5-
*
65
*/
76

87
#include <linux/string.h>
@@ -16,6 +15,7 @@
1615
static int compare_func(const char *ida, const char *idb)
1716
{
1817
int i;
18+
1919
/* we only need to compare the last 4 chars */
2020
for (i = 3; i < 7; i++) {
2121
if (ida[i] != 'X' &&
@@ -44,6 +44,7 @@ static const struct pnp_device_id *match_device(struct pnp_driver *drv,
4444
struct pnp_dev *dev)
4545
{
4646
const struct pnp_device_id *drv_id = drv->id_table;
47+
4748
if (!drv_id)
4849
return NULL;
4950

@@ -140,6 +141,7 @@ static int pnp_bus_match(struct device *dev, struct device_driver *drv)
140141
{
141142
struct pnp_dev *pnp_dev = to_pnp_dev(dev);
142143
struct pnp_driver *pnp_drv = to_pnp_driver(drv);
144+
143145
if (match_device(pnp_drv, pnp_dev) == NULL)
144146
return 0;
145147
return 1;
@@ -197,12 +199,12 @@ static int pnp_bus_resume(struct device *dev)
197199
}
198200

199201
struct bus_type pnp_bus_type = {
200-
.name = "pnp",
201-
.match = pnp_bus_match,
202-
.probe = pnp_device_probe,
203-
.remove = pnp_device_remove,
202+
.name = "pnp",
203+
.match = pnp_bus_match,
204+
.probe = pnp_device_probe,
205+
.remove = pnp_device_remove,
204206
.suspend = pnp_bus_suspend,
205-
.resume = pnp_bus_resume,
207+
.resume = pnp_bus_resume,
206208
};
207209

208210
int pnp_register_driver(struct pnp_driver *drv)
@@ -225,12 +227,11 @@ void pnp_unregister_driver(struct pnp_driver *drv)
225227
* pnp_add_id - adds an EISA id to the specified device
226228
* @id: pointer to a pnp_id structure
227229
* @dev: pointer to the desired device
228-
*
229230
*/
230-
231231
int pnp_add_id(struct pnp_id *id, struct pnp_dev *dev)
232232
{
233233
struct pnp_id *ptr;
234+
234235
if (!id)
235236
return -EINVAL;
236237
if (!dev)
@@ -248,8 +249,5 @@ int pnp_add_id(struct pnp_id *id, struct pnp_dev *dev)
248249

249250
EXPORT_SYMBOL(pnp_register_driver);
250251
EXPORT_SYMBOL(pnp_unregister_driver);
251-
#if 0
252-
EXPORT_SYMBOL(pnp_add_id);
253-
#endif
254252
EXPORT_SYMBOL(pnp_device_attach);
255253
EXPORT_SYMBOL(pnp_device_detach);

drivers/pnp/interface.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
*
44
* Some code, especially possible resource dumping is based on isapnp_proc.c (c) Jaroslav Kysela <[email protected]>
55
* Copyright 2002 Adam Belay <[email protected]>
6-
*
76
*/
87

98
#include <linux/pnp.h>
@@ -488,6 +487,7 @@ static DEVICE_ATTR(id, S_IRUGO, pnp_show_current_ids, NULL);
488487
int pnp_interface_attach_device(struct pnp_dev *dev)
489488
{
490489
int rc = device_create_file(&dev->dev, &dev_attr_options);
490+
491491
if (rc)
492492
goto err;
493493
rc = device_create_file(&dev->dev, &dev_attr_resources);

0 commit comments

Comments
 (0)