diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2009-12-07 16:11:45 -0500 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2009-12-07 16:23:40 -0500 |
commit | 9fea84f46a821aa1ff2d034ffda8ad33bff48015 (patch) | |
tree | fba7293e771309970d3f20fc9d3ce73f49f90a33 /drivers/pcmcia/ds.c | |
parent | e15c1c1f3f903f679c9782b540f9d52c80c99610 (diff) |
pcmcia: CodingStyle fixes
Fix several CodingStyle issues in drivers/pcmcia/ . checkpatch.pl no longer
reports errors in the PCMCIA core. The remaining warnings mostly relate to
wrong indent -- PCMCIA historically used 4 spaces --, to lines over 80
characters and to hundreds of typedefs. The cleanup of those will follow
in the future.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/pcmcia/ds.c')
-rw-r--r-- | drivers/pcmcia/ds.c | 66 |
1 files changed, 34 insertions, 32 deletions
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 05893d41dd41..1a4a3c49cc15 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c | |||
@@ -57,7 +57,7 @@ static void pcmcia_check_driver(struct pcmcia_driver *p_drv) | |||
57 | "function\n", p_drv->drv.name); | 57 | "function\n", p_drv->drv.name); |
58 | 58 | ||
59 | while (did && did->match_flags) { | 59 | while (did && did->match_flags) { |
60 | for (i=0; i<4; i++) { | 60 | for (i = 0; i < 4; i++) { |
61 | if (!did->prod_id[i]) | 61 | if (!did->prod_id[i]) |
62 | continue; | 62 | continue; |
63 | 63 | ||
@@ -105,7 +105,7 @@ pcmcia_store_new_id(struct device_driver *driver, const char *buf, size_t count) | |||
105 | __u16 match_flags, manf_id, card_id; | 105 | __u16 match_flags, manf_id, card_id; |
106 | __u8 func_id, function, device_no; | 106 | __u8 func_id, function, device_no; |
107 | __u32 prod_id_hash[4] = {0, 0, 0, 0}; | 107 | __u32 prod_id_hash[4] = {0, 0, 0, 0}; |
108 | int fields=0; | 108 | int fields = 0; |
109 | int retval = 0; | 109 | int retval = 0; |
110 | 110 | ||
111 | fields = sscanf(buf, "%hx %hx %hx %hhx %hhx %hhx %x %x %x %x", | 111 | fields = sscanf(buf, "%hx %hx %hx %hhx %hhx %hhx %x %x %x %x", |
@@ -214,7 +214,7 @@ EXPORT_SYMBOL(pcmcia_unregister_driver); | |||
214 | 214 | ||
215 | /* pcmcia_device handling */ | 215 | /* pcmcia_device handling */ |
216 | 216 | ||
217 | struct pcmcia_device * pcmcia_get_dev(struct pcmcia_device *p_dev) | 217 | struct pcmcia_device *pcmcia_get_dev(struct pcmcia_device *p_dev) |
218 | { | 218 | { |
219 | struct device *tmp_dev; | 219 | struct device *tmp_dev; |
220 | tmp_dev = get_device(&p_dev->dev); | 220 | tmp_dev = get_device(&p_dev->dev); |
@@ -258,7 +258,7 @@ static void pcmcia_add_device_later(struct pcmcia_socket *s, int mfc) | |||
258 | return; | 258 | return; |
259 | } | 259 | } |
260 | 260 | ||
261 | static int pcmcia_device_probe(struct device * dev) | 261 | static int pcmcia_device_probe(struct device *dev) |
262 | { | 262 | { |
263 | struct pcmcia_device *p_dev; | 263 | struct pcmcia_device *p_dev; |
264 | struct pcmcia_driver *p_drv; | 264 | struct pcmcia_driver *p_drv; |
@@ -325,7 +325,7 @@ put_module: | |||
325 | put_dev: | 325 | put_dev: |
326 | if (ret) | 326 | if (ret) |
327 | put_device(dev); | 327 | put_device(dev); |
328 | return (ret); | 328 | return ret; |
329 | } | 329 | } |
330 | 330 | ||
331 | 331 | ||
@@ -354,7 +354,7 @@ static void pcmcia_card_remove(struct pcmcia_socket *s, struct pcmcia_device *le | |||
354 | 354 | ||
355 | spin_lock_irqsave(&pcmcia_dev_list_lock, flags); | 355 | spin_lock_irqsave(&pcmcia_dev_list_lock, flags); |
356 | list_del(&p_dev->socket_device_list); | 356 | list_del(&p_dev->socket_device_list); |
357 | p_dev->_removed=1; | 357 | p_dev->_removed = 1; |
358 | spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); | 358 | spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); |
359 | 359 | ||
360 | dev_dbg(&p_dev->dev, "unregistering device\n"); | 360 | dev_dbg(&p_dev->dev, "unregistering device\n"); |
@@ -364,7 +364,7 @@ static void pcmcia_card_remove(struct pcmcia_socket *s, struct pcmcia_device *le | |||
364 | return; | 364 | return; |
365 | } | 365 | } |
366 | 366 | ||
367 | static int pcmcia_device_remove(struct device * dev) | 367 | static int pcmcia_device_remove(struct device *dev) |
368 | { | 368 | { |
369 | struct pcmcia_device *p_dev; | 369 | struct pcmcia_device *p_dev; |
370 | struct pcmcia_driver *p_drv; | 370 | struct pcmcia_driver *p_drv; |
@@ -391,7 +391,7 @@ static int pcmcia_device_remove(struct device * dev) | |||
391 | return 0; | 391 | return 0; |
392 | 392 | ||
393 | if (p_drv->remove) | 393 | if (p_drv->remove) |
394 | p_drv->remove(p_dev); | 394 | p_drv->remove(p_dev); |
395 | 395 | ||
396 | p_dev->dev_node = NULL; | 396 | p_dev->dev_node = NULL; |
397 | 397 | ||
@@ -499,7 +499,7 @@ static int pcmcia_device_query(struct pcmcia_device *p_dev) | |||
499 | */ | 499 | */ |
500 | static DEFINE_MUTEX(device_add_lock); | 500 | static DEFINE_MUTEX(device_add_lock); |
501 | 501 | ||
502 | struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int function) | 502 | struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s, unsigned int function) |
503 | { | 503 | { |
504 | struct pcmcia_device *p_dev, *tmp_dev; | 504 | struct pcmcia_device *p_dev, *tmp_dev; |
505 | unsigned long flags; | 505 | unsigned long flags; |
@@ -545,8 +545,8 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f | |||
545 | * Note that this is serialized by the device_add_lock, so that | 545 | * Note that this is serialized by the device_add_lock, so that |
546 | * only one such struct will be created. | 546 | * only one such struct will be created. |
547 | */ | 547 | */ |
548 | list_for_each_entry(tmp_dev, &s->devices_list, socket_device_list) | 548 | list_for_each_entry(tmp_dev, &s->devices_list, socket_device_list) |
549 | if (p_dev->func == tmp_dev->func) { | 549 | if (p_dev->func == tmp_dev->func) { |
550 | p_dev->function_config = tmp_dev->function_config; | 550 | p_dev->function_config = tmp_dev->function_config; |
551 | p_dev->io = tmp_dev->io; | 551 | p_dev->io = tmp_dev->io; |
552 | p_dev->irq = tmp_dev->irq; | 552 | p_dev->irq = tmp_dev->irq; |
@@ -627,10 +627,10 @@ static int pcmcia_card_add(struct pcmcia_socket *s) | |||
627 | no_funcs = 1; | 627 | no_funcs = 1; |
628 | s->functions = no_funcs; | 628 | s->functions = no_funcs; |
629 | 629 | ||
630 | for (i=0; i < no_funcs; i++) | 630 | for (i = 0; i < no_funcs; i++) |
631 | pcmcia_device_add(s, i); | 631 | pcmcia_device_add(s, i); |
632 | 632 | ||
633 | return (ret); | 633 | return ret; |
634 | } | 634 | } |
635 | 635 | ||
636 | 636 | ||
@@ -756,7 +756,7 @@ static int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename) | |||
756 | release: | 756 | release: |
757 | release_firmware(fw); | 757 | release_firmware(fw); |
758 | 758 | ||
759 | return (ret); | 759 | return ret; |
760 | } | 760 | } |
761 | 761 | ||
762 | #else /* !CONFIG_PCMCIA_LOAD_CIS */ | 762 | #else /* !CONFIG_PCMCIA_LOAD_CIS */ |
@@ -852,7 +852,7 @@ static inline int pcmcia_devmatch(struct pcmcia_device *dev, | |||
852 | 852 | ||
853 | if (did->match_flags & PCMCIA_DEV_ID_MATCH_ANONYMOUS) { | 853 | if (did->match_flags & PCMCIA_DEV_ID_MATCH_ANONYMOUS) { |
854 | int i; | 854 | int i; |
855 | for (i=0; i<4; i++) | 855 | for (i = 0; i < 4; i++) |
856 | if (dev->prod_id[i]) | 856 | if (dev->prod_id[i]) |
857 | return 0; | 857 | return 0; |
858 | if (dev->has_manf_id || dev->has_card_id || dev->has_func_id) | 858 | if (dev->has_manf_id || dev->has_card_id || dev->has_func_id) |
@@ -865,9 +865,10 @@ static inline int pcmcia_devmatch(struct pcmcia_device *dev, | |||
865 | } | 865 | } |
866 | 866 | ||
867 | 867 | ||
868 | static int pcmcia_bus_match(struct device * dev, struct device_driver * drv) { | 868 | static int pcmcia_bus_match(struct device *dev, struct device_driver *drv) |
869 | struct pcmcia_device * p_dev = to_pcmcia_dev(dev); | 869 | { |
870 | struct pcmcia_driver * p_drv = to_pcmcia_drv(drv); | 870 | struct pcmcia_device *p_dev = to_pcmcia_dev(dev); |
871 | struct pcmcia_driver *p_drv = to_pcmcia_drv(drv); | ||
871 | struct pcmcia_device_id *did = p_drv->id_table; | 872 | struct pcmcia_device_id *did = p_drv->id_table; |
872 | struct pcmcia_dynid *dynid; | 873 | struct pcmcia_dynid *dynid; |
873 | 874 | ||
@@ -917,7 +918,7 @@ static int pcmcia_bus_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
917 | p_dev = to_pcmcia_dev(dev); | 918 | p_dev = to_pcmcia_dev(dev); |
918 | 919 | ||
919 | /* calculate hashes */ | 920 | /* calculate hashes */ |
920 | for (i=0; i<4; i++) { | 921 | for (i = 0; i < 4; i++) { |
921 | if (!p_dev->prod_id[i]) | 922 | if (!p_dev->prod_id[i]) |
922 | continue; | 923 | continue; |
923 | hash[i] = crc32(0, p_dev->prod_id[i], strlen(p_dev->prod_id[i])); | 924 | hash[i] = crc32(0, p_dev->prod_id[i], strlen(p_dev->prod_id[i])); |
@@ -984,14 +985,14 @@ static void runtime_resume(struct device *dev) | |||
984 | static ssize_t field##_show (struct device *dev, struct device_attribute *attr, char *buf) \ | 985 | static ssize_t field##_show (struct device *dev, struct device_attribute *attr, char *buf) \ |
985 | { \ | 986 | { \ |
986 | struct pcmcia_device *p_dev = to_pcmcia_dev(dev); \ | 987 | struct pcmcia_device *p_dev = to_pcmcia_dev(dev); \ |
987 | return p_dev->test ? sprintf (buf, format, p_dev->field) : -ENODEV; \ | 988 | return p_dev->test ? sprintf(buf, format, p_dev->field) : -ENODEV; \ |
988 | } | 989 | } |
989 | 990 | ||
990 | #define pcmcia_device_stringattr(name, field) \ | 991 | #define pcmcia_device_stringattr(name, field) \ |
991 | static ssize_t name##_show (struct device *dev, struct device_attribute *attr, char *buf) \ | 992 | static ssize_t name##_show (struct device *dev, struct device_attribute *attr, char *buf) \ |
992 | { \ | 993 | { \ |
993 | struct pcmcia_device *p_dev = to_pcmcia_dev(dev); \ | 994 | struct pcmcia_device *p_dev = to_pcmcia_dev(dev); \ |
994 | return p_dev->field ? sprintf (buf, "%s\n", p_dev->field) : -ENODEV; \ | 995 | return p_dev->field ? sprintf(buf, "%s\n", p_dev->field) : -ENODEV; \ |
995 | } | 996 | } |
996 | 997 | ||
997 | pcmcia_device_attr(func, socket, "0x%02x\n"); | 998 | pcmcia_device_attr(func, socket, "0x%02x\n"); |
@@ -1020,8 +1021,8 @@ static ssize_t pcmcia_store_pm_state(struct device *dev, struct device_attribute | |||
1020 | struct pcmcia_device *p_dev = to_pcmcia_dev(dev); | 1021 | struct pcmcia_device *p_dev = to_pcmcia_dev(dev); |
1021 | int ret = 0; | 1022 | int ret = 0; |
1022 | 1023 | ||
1023 | if (!count) | 1024 | if (!count) |
1024 | return -EINVAL; | 1025 | return -EINVAL; |
1025 | 1026 | ||
1026 | if ((!p_dev->suspended) && !strncmp(buf, "off", 3)) | 1027 | if ((!p_dev->suspended) && !strncmp(buf, "off", 3)) |
1027 | ret = runtime_suspend(dev); | 1028 | ret = runtime_suspend(dev); |
@@ -1039,10 +1040,11 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, | |||
1039 | u32 hash[4] = { 0, 0, 0, 0}; | 1040 | u32 hash[4] = { 0, 0, 0, 0}; |
1040 | 1041 | ||
1041 | /* calculate hashes */ | 1042 | /* calculate hashes */ |
1042 | for (i=0; i<4; i++) { | 1043 | for (i = 0; i < 4; i++) { |
1043 | if (!p_dev->prod_id[i]) | 1044 | if (!p_dev->prod_id[i]) |
1044 | continue; | 1045 | continue; |
1045 | hash[i] = crc32(0,p_dev->prod_id[i],strlen(p_dev->prod_id[i])); | 1046 | hash[i] = crc32(0, p_dev->prod_id[i], |
1047 | strlen(p_dev->prod_id[i])); | ||
1046 | } | 1048 | } |
1047 | return sprintf(buf, "pcmcia:m%04Xc%04Xf%02Xfn%02Xpfn%02X" | 1049 | return sprintf(buf, "pcmcia:m%04Xc%04Xf%02Xfn%02Xpfn%02X" |
1048 | "pa%08Xpb%08Xpc%08Xpd%08X\n", | 1050 | "pa%08Xpb%08Xpc%08Xpd%08X\n", |
@@ -1091,7 +1093,7 @@ static struct device_attribute pcmcia_dev_attrs[] = { | |||
1091 | 1093 | ||
1092 | /* PM support, also needed for reset */ | 1094 | /* PM support, also needed for reset */ |
1093 | 1095 | ||
1094 | static int pcmcia_dev_suspend(struct device * dev, pm_message_t state) | 1096 | static int pcmcia_dev_suspend(struct device *dev, pm_message_t state) |
1095 | { | 1097 | { |
1096 | struct pcmcia_device *p_dev = to_pcmcia_dev(dev); | 1098 | struct pcmcia_device *p_dev = to_pcmcia_dev(dev); |
1097 | struct pcmcia_driver *p_drv = NULL; | 1099 | struct pcmcia_driver *p_drv = NULL; |
@@ -1131,10 +1133,10 @@ static int pcmcia_dev_suspend(struct device * dev, pm_message_t state) | |||
1131 | } | 1133 | } |
1132 | 1134 | ||
1133 | 1135 | ||
1134 | static int pcmcia_dev_resume(struct device * dev) | 1136 | static int pcmcia_dev_resume(struct device *dev) |
1135 | { | 1137 | { |
1136 | struct pcmcia_device *p_dev = to_pcmcia_dev(dev); | 1138 | struct pcmcia_device *p_dev = to_pcmcia_dev(dev); |
1137 | struct pcmcia_driver *p_drv = NULL; | 1139 | struct pcmcia_driver *p_drv = NULL; |
1138 | int ret = 0; | 1140 | int ret = 0; |
1139 | 1141 | ||
1140 | if (!p_dev->suspended) | 1142 | if (!p_dev->suspended) |
@@ -1211,7 +1213,7 @@ static int pcmcia_bus_suspend(struct pcmcia_socket *skt) | |||
1211 | /*====================================================================== | 1213 | /*====================================================================== |
1212 | 1214 | ||
1213 | The card status event handler. | 1215 | The card status event handler. |
1214 | 1216 | ||
1215 | ======================================================================*/ | 1217 | ======================================================================*/ |
1216 | 1218 | ||
1217 | /* Normally, the event is passed to individual drivers after | 1219 | /* Normally, the event is passed to individual drivers after |
@@ -1264,7 +1266,7 @@ static int ds_event(struct pcmcia_socket *skt, event_t event, int priority) | |||
1264 | } /* ds_event */ | 1266 | } /* ds_event */ |
1265 | 1267 | ||
1266 | 1268 | ||
1267 | struct pcmcia_device * pcmcia_dev_present(struct pcmcia_device *_p_dev) | 1269 | struct pcmcia_device *pcmcia_dev_present(struct pcmcia_device *_p_dev) |
1268 | { | 1270 | { |
1269 | struct pcmcia_device *p_dev; | 1271 | struct pcmcia_device *p_dev; |
1270 | struct pcmcia_device *ret = NULL; | 1272 | struct pcmcia_device *ret = NULL; |
@@ -1329,7 +1331,7 @@ static int __devinit pcmcia_bus_add_socket(struct device *dev, | |||
1329 | if (ret) { | 1331 | if (ret) { |
1330 | dev_printk(KERN_ERR, dev, "PCMCIA registration failed\n"); | 1332 | dev_printk(KERN_ERR, dev, "PCMCIA registration failed\n"); |
1331 | pcmcia_put_socket(socket); | 1333 | pcmcia_put_socket(socket); |
1332 | return (ret); | 1334 | return ret; |
1333 | } | 1335 | } |
1334 | 1336 | ||
1335 | return 0; | 1337 | return 0; |
@@ -1400,7 +1402,7 @@ static int __init init_pcmcia_bus(void) | |||
1400 | 1402 | ||
1401 | return 0; | 1403 | return 0; |
1402 | } | 1404 | } |
1403 | fs_initcall(init_pcmcia_bus); /* one level after subsys_initcall so that | 1405 | fs_initcall(init_pcmcia_bus); /* one level after subsys_initcall so that |
1404 | * pcmcia_socket_class is already registered */ | 1406 | * pcmcia_socket_class is already registered */ |
1405 | 1407 | ||
1406 | 1408 | ||