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/yenta_socket.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/yenta_socket.c')
-rw-r--r-- | drivers/pcmcia/yenta_socket.c | 147 |
1 files changed, 96 insertions, 51 deletions
diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c index 8be4cc447a17..fe02cfd4b5e9 100644 --- a/drivers/pcmcia/yenta_socket.c +++ b/drivers/pcmcia/yenta_socket.c | |||
@@ -6,7 +6,7 @@ | |||
6 | * Changelog: | 6 | * Changelog: |
7 | * Aug 2002: Manfred Spraul <manfred@colorfullife.com> | 7 | * Aug 2002: Manfred Spraul <manfred@colorfullife.com> |
8 | * Dynamically adjust the size of the bridge resource | 8 | * Dynamically adjust the size of the bridge resource |
9 | * | 9 | * |
10 | * May 2003: Dominik Brodowski <linux@brodo.de> | 10 | * May 2003: Dominik Brodowski <linux@brodo.de> |
11 | * Merge pci_socket.c and yenta.c into one file | 11 | * Merge pci_socket.c and yenta.c into one file |
12 | */ | 12 | */ |
@@ -16,13 +16,12 @@ | |||
16 | #include <linux/interrupt.h> | 16 | #include <linux/interrupt.h> |
17 | #include <linux/delay.h> | 17 | #include <linux/delay.h> |
18 | #include <linux/module.h> | 18 | #include <linux/module.h> |
19 | #include <linux/io.h> | ||
19 | 20 | ||
20 | #include <pcmcia/cs_types.h> | 21 | #include <pcmcia/cs_types.h> |
21 | #include <pcmcia/ss.h> | 22 | #include <pcmcia/ss.h> |
22 | #include <pcmcia/cs.h> | 23 | #include <pcmcia/cs.h> |
23 | 24 | ||
24 | #include <asm/io.h> | ||
25 | |||
26 | #include "yenta_socket.h" | 25 | #include "yenta_socket.h" |
27 | #include "i82365.h" | 26 | #include "i82365.h" |
28 | 27 | ||
@@ -55,7 +54,7 @@ static int yenta_probe_cb_irq(struct yenta_socket *socket); | |||
55 | 54 | ||
56 | static unsigned int override_bios; | 55 | static unsigned int override_bios; |
57 | module_param(override_bios, uint, 0000); | 56 | module_param(override_bios, uint, 0000); |
58 | MODULE_PARM_DESC (override_bios, "yenta ignore bios resource allocation"); | 57 | MODULE_PARM_DESC(override_bios, "yenta ignore bios resource allocation"); |
59 | 58 | ||
60 | /* | 59 | /* |
61 | * Generate easy-to-use ways of reading a cardbus sockets | 60 | * Generate easy-to-use ways of reading a cardbus sockets |
@@ -237,24 +236,42 @@ static void yenta_set_power(struct yenta_socket *socket, socket_state_t *state) | |||
237 | /* i82365SL-DF style */ | 236 | /* i82365SL-DF style */ |
238 | if (socket->flags & YENTA_16BIT_POWER_DF) { | 237 | if (socket->flags & YENTA_16BIT_POWER_DF) { |
239 | switch (state->Vcc) { | 238 | switch (state->Vcc) { |
240 | case 33: reg |= I365_VCC_3V; break; | 239 | case 33: |
241 | case 50: reg |= I365_VCC_5V; break; | 240 | reg |= I365_VCC_3V; |
242 | default: reg = 0; break; | 241 | break; |
242 | case 50: | ||
243 | reg |= I365_VCC_5V; | ||
244 | break; | ||
245 | default: | ||
246 | reg = 0; | ||
247 | break; | ||
243 | } | 248 | } |
244 | switch (state->Vpp) { | 249 | switch (state->Vpp) { |
245 | case 33: | 250 | case 33: |
246 | case 50: reg |= I365_VPP1_5V; break; | 251 | case 50: |
247 | case 120: reg |= I365_VPP1_12V; break; | 252 | reg |= I365_VPP1_5V; |
253 | break; | ||
254 | case 120: | ||
255 | reg |= I365_VPP1_12V; | ||
256 | break; | ||
248 | } | 257 | } |
249 | } else { | 258 | } else { |
250 | /* i82365SL-B style */ | 259 | /* i82365SL-B style */ |
251 | switch (state->Vcc) { | 260 | switch (state->Vcc) { |
252 | case 50: reg |= I365_VCC_5V; break; | 261 | case 50: |
253 | default: reg = 0; break; | 262 | reg |= I365_VCC_5V; |
263 | break; | ||
264 | default: | ||
265 | reg = 0; | ||
266 | break; | ||
254 | } | 267 | } |
255 | switch (state->Vpp) { | 268 | switch (state->Vpp) { |
256 | case 50: reg |= I365_VPP1_5V | I365_VPP2_5V; break; | 269 | case 50: |
257 | case 120: reg |= I365_VPP1_12V | I365_VPP2_12V; break; | 270 | reg |= I365_VPP1_5V | I365_VPP2_5V; |
271 | break; | ||
272 | case 120: | ||
273 | reg |= I365_VPP1_12V | I365_VPP2_12V; | ||
274 | break; | ||
258 | } | 275 | } |
259 | } | 276 | } |
260 | 277 | ||
@@ -263,14 +280,26 @@ static void yenta_set_power(struct yenta_socket *socket, socket_state_t *state) | |||
263 | } else { | 280 | } else { |
264 | u32 reg = 0; /* CB_SC_STPCLK? */ | 281 | u32 reg = 0; /* CB_SC_STPCLK? */ |
265 | switch (state->Vcc) { | 282 | switch (state->Vcc) { |
266 | case 33: reg = CB_SC_VCC_3V; break; | 283 | case 33: |
267 | case 50: reg = CB_SC_VCC_5V; break; | 284 | reg = CB_SC_VCC_3V; |
268 | default: reg = 0; break; | 285 | break; |
286 | case 50: | ||
287 | reg = CB_SC_VCC_5V; | ||
288 | break; | ||
289 | default: | ||
290 | reg = 0; | ||
291 | break; | ||
269 | } | 292 | } |
270 | switch (state->Vpp) { | 293 | switch (state->Vpp) { |
271 | case 33: reg |= CB_SC_VPP_3V; break; | 294 | case 33: |
272 | case 50: reg |= CB_SC_VPP_5V; break; | 295 | reg |= CB_SC_VPP_3V; |
273 | case 120: reg |= CB_SC_VPP_12V; break; | 296 | break; |
297 | case 50: | ||
298 | reg |= CB_SC_VPP_5V; | ||
299 | break; | ||
300 | case 120: | ||
301 | reg |= CB_SC_VPP_12V; | ||
302 | break; | ||
274 | } | 303 | } |
275 | if (reg != cb_readl(socket, CB_SOCKET_CONTROL)) | 304 | if (reg != cb_readl(socket, CB_SOCKET_CONTROL)) |
276 | cb_writel(socket, CB_SOCKET_CONTROL, reg); | 305 | cb_writel(socket, CB_SOCKET_CONTROL, reg); |
@@ -314,23 +343,29 @@ static int yenta_set_socket(struct pcmcia_socket *sock, socket_state_t *state) | |||
314 | 343 | ||
315 | reg = exca_readb(socket, I365_POWER) & (I365_VCC_MASK|I365_VPP1_MASK); | 344 | reg = exca_readb(socket, I365_POWER) & (I365_VCC_MASK|I365_VPP1_MASK); |
316 | reg |= I365_PWR_NORESET; | 345 | reg |= I365_PWR_NORESET; |
317 | if (state->flags & SS_PWR_AUTO) reg |= I365_PWR_AUTO; | 346 | if (state->flags & SS_PWR_AUTO) |
318 | if (state->flags & SS_OUTPUT_ENA) reg |= I365_PWR_OUT; | 347 | reg |= I365_PWR_AUTO; |
348 | if (state->flags & SS_OUTPUT_ENA) | ||
349 | reg |= I365_PWR_OUT; | ||
319 | if (exca_readb(socket, I365_POWER) != reg) | 350 | if (exca_readb(socket, I365_POWER) != reg) |
320 | exca_writeb(socket, I365_POWER, reg); | 351 | exca_writeb(socket, I365_POWER, reg); |
321 | 352 | ||
322 | /* CSC interrupt: no ISA irq for CSC */ | 353 | /* CSC interrupt: no ISA irq for CSC */ |
323 | reg = I365_CSC_DETECT; | 354 | reg = I365_CSC_DETECT; |
324 | if (state->flags & SS_IOCARD) { | 355 | if (state->flags & SS_IOCARD) { |
325 | if (state->csc_mask & SS_STSCHG) reg |= I365_CSC_STSCHG; | 356 | if (state->csc_mask & SS_STSCHG) |
357 | reg |= I365_CSC_STSCHG; | ||
326 | } else { | 358 | } else { |
327 | if (state->csc_mask & SS_BATDEAD) reg |= I365_CSC_BVD1; | 359 | if (state->csc_mask & SS_BATDEAD) |
328 | if (state->csc_mask & SS_BATWARN) reg |= I365_CSC_BVD2; | 360 | reg |= I365_CSC_BVD1; |
329 | if (state->csc_mask & SS_READY) reg |= I365_CSC_READY; | 361 | if (state->csc_mask & SS_BATWARN) |
362 | reg |= I365_CSC_BVD2; | ||
363 | if (state->csc_mask & SS_READY) | ||
364 | reg |= I365_CSC_READY; | ||
330 | } | 365 | } |
331 | exca_writeb(socket, I365_CSCINT, reg); | 366 | exca_writeb(socket, I365_CSCINT, reg); |
332 | exca_readb(socket, I365_CSC); | 367 | exca_readb(socket, I365_CSC); |
333 | if(sock->zoom_video) | 368 | if (sock->zoom_video) |
334 | sock->zoom_video(sock, state->flags & SS_ZVCARD); | 369 | sock->zoom_video(sock, state->flags & SS_ZVCARD); |
335 | } | 370 | } |
336 | config_writew(socket, CB_BRIDGE_CONTROL, bridge); | 371 | config_writew(socket, CB_BRIDGE_CONTROL, bridge); |
@@ -368,9 +403,12 @@ static int yenta_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *io | |||
368 | exca_writew(socket, I365_IO(map)+I365_W_STOP, io->stop); | 403 | exca_writew(socket, I365_IO(map)+I365_W_STOP, io->stop); |
369 | 404 | ||
370 | ioctl = exca_readb(socket, I365_IOCTL) & ~I365_IOCTL_MASK(map); | 405 | ioctl = exca_readb(socket, I365_IOCTL) & ~I365_IOCTL_MASK(map); |
371 | if (io->flags & MAP_0WS) ioctl |= I365_IOCTL_0WS(map); | 406 | if (io->flags & MAP_0WS) |
372 | if (io->flags & MAP_16BIT) ioctl |= I365_IOCTL_16BIT(map); | 407 | ioctl |= I365_IOCTL_0WS(map); |
373 | if (io->flags & MAP_AUTOSZ) ioctl |= I365_IOCTL_IOCS16(map); | 408 | if (io->flags & MAP_16BIT) |
409 | ioctl |= I365_IOCTL_16BIT(map); | ||
410 | if (io->flags & MAP_AUTOSZ) | ||
411 | ioctl |= I365_IOCTL_IOCS16(map); | ||
374 | exca_writeb(socket, I365_IOCTL, ioctl); | 412 | exca_writeb(socket, I365_IOCTL, ioctl); |
375 | 413 | ||
376 | if (io->flags & MAP_ACTIVE) | 414 | if (io->flags & MAP_ACTIVE) |
@@ -416,10 +454,17 @@ static int yenta_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map * | |||
416 | 454 | ||
417 | word = (stop >> 12) & 0x0fff; | 455 | word = (stop >> 12) & 0x0fff; |
418 | switch (to_cycles(mem->speed)) { | 456 | switch (to_cycles(mem->speed)) { |
419 | case 0: break; | 457 | case 0: |
420 | case 1: word |= I365_MEM_WS0; break; | 458 | break; |
421 | case 2: word |= I365_MEM_WS1; break; | 459 | case 1: |
422 | default: word |= I365_MEM_WS1 | I365_MEM_WS0; break; | 460 | word |= I365_MEM_WS0; |
461 | break; | ||
462 | case 2: | ||
463 | word |= I365_MEM_WS1; | ||
464 | break; | ||
465 | default: | ||
466 | word |= I365_MEM_WS1 | I365_MEM_WS0; | ||
467 | break; | ||
423 | } | 468 | } |
424 | exca_writew(socket, I365_MEM(map) + I365_W_STOP, word); | 469 | exca_writew(socket, I365_MEM(map) + I365_W_STOP, word); |
425 | 470 | ||
@@ -547,9 +592,9 @@ static int yenta_sock_suspend(struct pcmcia_socket *sock) | |||
547 | * max 4 MB, min 16 kB. We try very hard to not get below | 592 | * max 4 MB, min 16 kB. We try very hard to not get below |
548 | * the "ACC" values, though. | 593 | * the "ACC" values, though. |
549 | */ | 594 | */ |
550 | #define BRIDGE_MEM_MAX 4*1024*1024 | 595 | #define BRIDGE_MEM_MAX (4*1024*1024) |
551 | #define BRIDGE_MEM_ACC 128*1024 | 596 | #define BRIDGE_MEM_ACC (128*1024) |
552 | #define BRIDGE_MEM_MIN 16*1024 | 597 | #define BRIDGE_MEM_MIN (16*1024) |
553 | 598 | ||
554 | #define BRIDGE_IO_MAX 512 | 599 | #define BRIDGE_IO_MAX 512 |
555 | #define BRIDGE_IO_ACC 256 | 600 | #define BRIDGE_IO_ACC 256 |
@@ -574,7 +619,7 @@ static int yenta_search_one_res(struct resource *root, struct resource *res, | |||
574 | int i; | 619 | int i; |
575 | size = BRIDGE_MEM_MAX; | 620 | size = BRIDGE_MEM_MAX; |
576 | if (size > avail/8) { | 621 | if (size > avail/8) { |
577 | size=(avail+1)/8; | 622 | size = (avail+1)/8; |
578 | /* round size down to next power of 2 */ | 623 | /* round size down to next power of 2 */ |
579 | i = 0; | 624 | i = 0; |
580 | while ((size /= 2) != 0) | 625 | while ((size /= 2) != 0) |
@@ -590,7 +635,7 @@ static int yenta_search_one_res(struct resource *root, struct resource *res, | |||
590 | 635 | ||
591 | do { | 636 | do { |
592 | if (allocate_resource(root, res, size, start, end, align, | 637 | if (allocate_resource(root, res, size, start, end, align, |
593 | NULL, NULL)==0) { | 638 | NULL, NULL) == 0) { |
594 | return 1; | 639 | return 1; |
595 | } | 640 | } |
596 | size = size/2; | 641 | size = size/2; |
@@ -605,8 +650,8 @@ static int yenta_search_res(struct yenta_socket *socket, struct resource *res, | |||
605 | u32 min) | 650 | u32 min) |
606 | { | 651 | { |
607 | int i; | 652 | int i; |
608 | for (i=0; i<PCI_BUS_NUM_RESOURCES; i++) { | 653 | for (i = 0; i < PCI_BUS_NUM_RESOURCES; i++) { |
609 | struct resource * root = socket->dev->bus->resource[i]; | 654 | struct resource *root = socket->dev->bus->resource[i]; |
610 | if (!root) | 655 | if (!root) |
611 | continue; | 656 | continue; |
612 | 657 | ||
@@ -704,7 +749,7 @@ static void yenta_allocate_resources(struct yenta_socket *socket) | |||
704 | static void yenta_free_resources(struct yenta_socket *socket) | 749 | static void yenta_free_resources(struct yenta_socket *socket) |
705 | { | 750 | { |
706 | int i; | 751 | int i; |
707 | for (i=0;i<4;i++) { | 752 | for (i = 0; i < 4; i++) { |
708 | struct resource *res; | 753 | struct resource *res; |
709 | res = socket->dev->resource + PCI_BRIDGE_RESOURCES + i; | 754 | res = socket->dev->resource + PCI_BRIDGE_RESOURCES + i; |
710 | if (res->start != 0 && res->end != 0) | 755 | if (res->start != 0 && res->end != 0) |
@@ -726,7 +771,7 @@ static void __devexit yenta_close(struct pci_dev *dev) | |||
726 | 771 | ||
727 | /* we don't want a dying socket registered */ | 772 | /* we don't want a dying socket registered */ |
728 | pcmcia_unregister_socket(&sock->socket); | 773 | pcmcia_unregister_socket(&sock->socket); |
729 | 774 | ||
730 | /* Disable all events so we don't die in an IRQ storm */ | 775 | /* Disable all events so we don't die in an IRQ storm */ |
731 | cb_writel(sock, CB_SOCKET_MASK, 0x0); | 776 | cb_writel(sock, CB_SOCKET_MASK, 0x0); |
732 | exca_writeb(sock, I365_CSCINT, 0); | 777 | exca_writeb(sock, I365_CSCINT, 0); |
@@ -898,7 +943,7 @@ static irqreturn_t yenta_probe_handler(int irq, void *dev_id) | |||
898 | { | 943 | { |
899 | struct yenta_socket *socket = (struct yenta_socket *) dev_id; | 944 | struct yenta_socket *socket = (struct yenta_socket *) dev_id; |
900 | u8 csc; | 945 | u8 csc; |
901 | u32 cb_event; | 946 | u32 cb_event; |
902 | 947 | ||
903 | /* Clear interrupt status for the event */ | 948 | /* Clear interrupt status for the event */ |
904 | cb_event = cb_readl(socket, CB_SOCKET_EVENT); | 949 | cb_event = cb_readl(socket, CB_SOCKET_EVENT); |
@@ -1019,7 +1064,7 @@ static void yenta_fixup_parent_bridge(struct pci_bus *cardbus_bridge) | |||
1019 | { | 1064 | { |
1020 | struct list_head *tmp; | 1065 | struct list_head *tmp; |
1021 | unsigned char upper_limit; | 1066 | unsigned char upper_limit; |
1022 | /* | 1067 | /* |
1023 | * We only check and fix the parent bridge: All systems which need | 1068 | * We only check and fix the parent bridge: All systems which need |
1024 | * this fixup that have been reviewed are laptops and the only bridge | 1069 | * this fixup that have been reviewed are laptops and the only bridge |
1025 | * which needed fixing was the parent bridge of the CardBus bridge: | 1070 | * which needed fixing was the parent bridge of the CardBus bridge: |
@@ -1038,7 +1083,7 @@ static void yenta_fixup_parent_bridge(struct pci_bus *cardbus_bridge) | |||
1038 | 1083 | ||
1039 | /* check the bus ranges of all silbling bridges to prevent overlap */ | 1084 | /* check the bus ranges of all silbling bridges to prevent overlap */ |
1040 | list_for_each(tmp, &bridge_to_fix->parent->children) { | 1085 | list_for_each(tmp, &bridge_to_fix->parent->children) { |
1041 | struct pci_bus * silbling = pci_bus_b(tmp); | 1086 | struct pci_bus *silbling = pci_bus_b(tmp); |
1042 | /* | 1087 | /* |
1043 | * If the silbling has a higher secondary bus number | 1088 | * If the silbling has a higher secondary bus number |
1044 | * and it's secondary is equal or smaller than our | 1089 | * and it's secondary is equal or smaller than our |
@@ -1083,7 +1128,7 @@ static void yenta_fixup_parent_bridge(struct pci_bus *cardbus_bridge) | |||
1083 | * interrupt, and that we can map the cardbus area. Fill in the | 1128 | * interrupt, and that we can map the cardbus area. Fill in the |
1084 | * socket information structure.. | 1129 | * socket information structure.. |
1085 | */ | 1130 | */ |
1086 | static int __devinit yenta_probe (struct pci_dev *dev, const struct pci_device_id *id) | 1131 | static int __devinit yenta_probe(struct pci_dev *dev, const struct pci_device_id *id) |
1087 | { | 1132 | { |
1088 | struct yenta_socket *socket; | 1133 | struct yenta_socket *socket; |
1089 | int ret; | 1134 | int ret; |
@@ -1302,7 +1347,7 @@ static struct dev_pm_ops yenta_pm_ops = { | |||
1302 | #define YENTA_PM_OPS NULL | 1347 | #define YENTA_PM_OPS NULL |
1303 | #endif | 1348 | #endif |
1304 | 1349 | ||
1305 | #define CB_ID(vend,dev,type) \ | 1350 | #define CB_ID(vend, dev, type) \ |
1306 | { \ | 1351 | { \ |
1307 | .vendor = vend, \ | 1352 | .vendor = vend, \ |
1308 | .device = dev, \ | 1353 | .device = dev, \ |
@@ -1313,7 +1358,7 @@ static struct dev_pm_ops yenta_pm_ops = { | |||
1313 | .driver_data = CARDBUS_TYPE_##type, \ | 1358 | .driver_data = CARDBUS_TYPE_##type, \ |
1314 | } | 1359 | } |
1315 | 1360 | ||
1316 | static struct pci_device_id yenta_table [] = { | 1361 | static struct pci_device_id yenta_table[] = { |
1317 | CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1031, TI), | 1362 | CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1031, TI), |
1318 | 1363 | ||
1319 | /* | 1364 | /* |
@@ -1403,13 +1448,13 @@ static struct pci_driver yenta_cardbus_driver = { | |||
1403 | 1448 | ||
1404 | static int __init yenta_socket_init(void) | 1449 | static int __init yenta_socket_init(void) |
1405 | { | 1450 | { |
1406 | return pci_register_driver (¥ta_cardbus_driver); | 1451 | return pci_register_driver(¥ta_cardbus_driver); |
1407 | } | 1452 | } |
1408 | 1453 | ||
1409 | 1454 | ||
1410 | static void __exit yenta_socket_exit (void) | 1455 | static void __exit yenta_socket_exit(void) |
1411 | { | 1456 | { |
1412 | pci_unregister_driver (¥ta_cardbus_driver); | 1457 | pci_unregister_driver(¥ta_cardbus_driver); |
1413 | } | 1458 | } |
1414 | 1459 | ||
1415 | 1460 | ||