aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/pd6729.c
diff options
context:
space:
mode:
authorKomuro <komurojun-mbn@nifty.com>2010-03-19 17:39:19 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2010-03-23 11:33:55 -0400
commit5cbb2b941d2cc77e6b915e8e55d375be632c9f6a (patch)
treec42b7b0a4774d81df991c293d004cd213311389a /drivers/pcmcia/pd6729.c
parentae6be51ed01d6c4aaf249a207b4434bc7785853b (diff)
pd6729: Coding Style fixes
Signed-off-by: Komuro <komurojun-mbn@nifty.com> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/pcmcia/pd6729.c')
-rw-r--r--drivers/pcmcia/pd6729.c64
1 files changed, 39 insertions, 25 deletions
diff --git a/drivers/pcmcia/pd6729.c b/drivers/pcmcia/pd6729.c
index 7ba57a565cd7..47f342f1b0fc 100644
--- a/drivers/pcmcia/pd6729.c
+++ b/drivers/pcmcia/pd6729.c
@@ -14,13 +14,13 @@
14#include <linux/workqueue.h> 14#include <linux/workqueue.h>
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16#include <linux/device.h> 16#include <linux/device.h>
17#include <linux/io.h>
17 18
18#include <pcmcia/cs_types.h> 19#include <pcmcia/cs_types.h>
19#include <pcmcia/ss.h> 20#include <pcmcia/ss.h>
20#include <pcmcia/cs.h> 21#include <pcmcia/cs.h>
21 22
22#include <asm/system.h> 23#include <asm/system.h>
23#include <asm/io.h>
24 24
25#include "pd6729.h" 25#include "pd6729.h"
26#include "i82365.h" 26#include "i82365.h"
@@ -222,9 +222,9 @@ static irqreturn_t pd6729_interrupt(int irq, void *dev)
222 ? SS_READY : 0; 222 ? SS_READY : 0;
223 } 223 }
224 224
225 if (events) { 225 if (events)
226 pcmcia_parse_events(&socket[i].socket, events); 226 pcmcia_parse_events(&socket[i].socket, events);
227 } 227
228 active |= events; 228 active |= events;
229 } 229 }
230 230
@@ -256,9 +256,8 @@ static int pd6729_get_status(struct pcmcia_socket *sock, u_int *value)
256 status = indirect_read(socket, I365_STATUS); 256 status = indirect_read(socket, I365_STATUS);
257 *value = 0; 257 *value = 0;
258 258
259 if ((status & I365_CS_DETECT) == I365_CS_DETECT) { 259 if ((status & I365_CS_DETECT) == I365_CS_DETECT)
260 *value |= SS_DETECT; 260 *value |= SS_DETECT;
261 }
262 261
263 /* 262 /*
264 * IO cards have a different meaning of bits 0,1 263 * IO cards have a different meaning of bits 0,1
@@ -308,7 +307,7 @@ static int pd6729_set_socket(struct pcmcia_socket *sock, socket_state_t *state)
308 socket->card_irq = state->io_irq; 307 socket->card_irq = state->io_irq;
309 308
310 reg = 0; 309 reg = 0;
311 /* The reset bit has "inverse" logic */ 310 /* The reset bit has "inverse" logic */
312 if (!(state->flags & SS_RESET)) 311 if (!(state->flags & SS_RESET))
313 reg |= I365_PC_RESET; 312 reg |= I365_PC_RESET;
314 if (state->flags & SS_IOCARD) 313 if (state->flags & SS_IOCARD)
@@ -380,7 +379,7 @@ static int pd6729_set_socket(struct pcmcia_socket *sock, socket_state_t *state)
380 indirect_write(socket, I365_POWER, reg); 379 indirect_write(socket, I365_POWER, reg);
381 380
382 if (irq_mode == 1) { 381 if (irq_mode == 1) {
383 /* all interrupts are to be done as PCI interrupts */ 382 /* all interrupts are to be done as PCI interrupts */
384 data = PD67_EC1_INV_MGMT_IRQ | PD67_EC1_INV_CARD_IRQ; 383 data = PD67_EC1_INV_MGMT_IRQ | PD67_EC1_INV_CARD_IRQ;
385 } else 384 } else
386 data = 0; 385 data = 0;
@@ -391,9 +390,9 @@ static int pd6729_set_socket(struct pcmcia_socket *sock, socket_state_t *state)
391 /* Enable specific interrupt events */ 390 /* Enable specific interrupt events */
392 391
393 reg = 0x00; 392 reg = 0x00;
394 if (state->csc_mask & SS_DETECT) { 393 if (state->csc_mask & SS_DETECT)
395 reg |= I365_CSC_DETECT; 394 reg |= I365_CSC_DETECT;
396 } 395
397 if (state->flags & SS_IOCARD) { 396 if (state->flags & SS_IOCARD) {
398 if (state->csc_mask & SS_STSCHG) 397 if (state->csc_mask & SS_STSCHG)
399 reg |= I365_CSC_STSCHG; 398 reg |= I365_CSC_STSCHG;
@@ -450,9 +449,12 @@ static int pd6729_set_io_map(struct pcmcia_socket *sock,
450 449
451 ioctl = indirect_read(socket, I365_IOCTL) & ~I365_IOCTL_MASK(map); 450 ioctl = indirect_read(socket, I365_IOCTL) & ~I365_IOCTL_MASK(map);
452 451
453 if (io->flags & MAP_0WS) ioctl |= I365_IOCTL_0WS(map); 452 if (io->flags & MAP_0WS)
454 if (io->flags & MAP_16BIT) ioctl |= I365_IOCTL_16BIT(map); 453 ioctl |= I365_IOCTL_0WS(map);
455 if (io->flags & MAP_AUTOSZ) ioctl |= I365_IOCTL_IOCS16(map); 454 if (io->flags & MAP_16BIT)
455 ioctl |= I365_IOCTL_16BIT(map);
456 if (io->flags & MAP_AUTOSZ)
457 ioctl |= I365_IOCTL_IOCS16(map);
456 458
457 indirect_write(socket, I365_IOCTL, ioctl); 459 indirect_write(socket, I365_IOCTL, ioctl);
458 460
@@ -497,7 +499,7 @@ static int pd6729_set_mem_map(struct pcmcia_socket *sock,
497 499
498 /* write the stop address */ 500 /* write the stop address */
499 501
500 i= (mem->res->end >> 12) & 0x0fff; 502 i = (mem->res->end >> 12) & 0x0fff;
501 switch (to_cycles(mem->speed)) { 503 switch (to_cycles(mem->speed)) {
502 case 0: 504 case 0:
503 break; 505 break;
@@ -563,7 +565,7 @@ static int pd6729_init(struct pcmcia_socket *sock)
563 565
564/* the pccard structure and its functions */ 566/* the pccard structure and its functions */
565static struct pccard_operations pd6729_operations = { 567static struct pccard_operations pd6729_operations = {
566 .init = pd6729_init, 568 .init = pd6729_init,
567 .get_status = pd6729_get_status, 569 .get_status = pd6729_get_status,
568 .set_socket = pd6729_set_socket, 570 .set_socket = pd6729_set_socket,
569 .set_io_map = pd6729_set_io_map, 571 .set_io_map = pd6729_set_io_map,
@@ -578,8 +580,13 @@ static irqreturn_t pd6729_test(int irq, void *dev)
578 580
579static int pd6729_check_irq(int irq) 581static int pd6729_check_irq(int irq)
580{ 582{
581 if (request_irq(irq, pd6729_test, IRQF_PROBE_SHARED, "x", pd6729_test) 583 int ret;
582 != 0) return -1; 584
585 ret = request_irq(irq, pd6729_test, IRQF_PROBE_SHARED, "x",
586 pd6729_test);
587 if (ret)
588 return -1;
589
583 free_irq(irq, pd6729_test); 590 free_irq(irq, pd6729_test);
584 return 0; 591 return 0;
585} 592}
@@ -591,7 +598,7 @@ static u_int __devinit pd6729_isa_scan(void)
591 598
592 if (irq_mode == 1) { 599 if (irq_mode == 1) {
593 printk(KERN_INFO "pd6729: PCI card interrupts, " 600 printk(KERN_INFO "pd6729: PCI card interrupts, "
594 "PCI status changes\n"); 601 "PCI status changes\n");
595 return 0; 602 return 0;
596 } 603 }
597 604
@@ -607,9 +614,10 @@ static u_int __devinit pd6729_isa_scan(void)
607 if (mask & (1<<i)) 614 if (mask & (1<<i))
608 printk("%s%d", ((mask & ((1<<i)-1)) ? "," : ""), i); 615 printk("%s%d", ((mask & ((1<<i)-1)) ? "," : ""), i);
609 616
610 if (mask == 0) printk("none!"); 617 if (mask == 0)
611 618 printk("none!");
612 printk(" polling status changes.\n"); 619 else
620 printk(" polling status changes.\n");
613 621
614 return mask; 622 return mask;
615} 623}
@@ -624,11 +632,16 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev,
624 632
625 socket = kzalloc(sizeof(struct pd6729_socket) * MAX_SOCKETS, 633 socket = kzalloc(sizeof(struct pd6729_socket) * MAX_SOCKETS,
626 GFP_KERNEL); 634 GFP_KERNEL);
627 if (!socket) 635 if (!socket) {
636 dev_warn(&dev->dev, "failed to kzalloc socket.\n");
628 return -ENOMEM; 637 return -ENOMEM;
638 }
629 639
630 if ((ret = pci_enable_device(dev))) 640 ret = pci_enable_device(dev);
641 if (ret) {
642 dev_warn(&dev->dev, "failed to enable pci_device.\n");
631 goto err_out_free_mem; 643 goto err_out_free_mem;
644 }
632 645
633 if (!pci_resource_start(dev, 0)) { 646 if (!pci_resource_start(dev, 0)) {
634 dev_warn(&dev->dev, "refusing to load the driver as the " 647 dev_warn(&dev->dev, "refusing to load the driver as the "
@@ -639,7 +652,7 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev,
639 dev_info(&dev->dev, "Cirrus PD6729 PCI to PCMCIA Bridge at 0x%llx " 652 dev_info(&dev->dev, "Cirrus PD6729 PCI to PCMCIA Bridge at 0x%llx "
640 "on irq %d\n", 653 "on irq %d\n",
641 (unsigned long long)pci_resource_start(dev, 0), dev->irq); 654 (unsigned long long)pci_resource_start(dev, 0), dev->irq);
642 /* 655 /*
643 * Since we have no memory BARs some firmware may not 656 * Since we have no memory BARs some firmware may not
644 * have had PCI_COMMAND_MEMORY enabled, yet the device needs it. 657 * have had PCI_COMMAND_MEMORY enabled, yet the device needs it.
645 */ 658 */
@@ -685,8 +698,9 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev,
685 pci_set_drvdata(dev, socket); 698 pci_set_drvdata(dev, socket);
686 if (irq_mode == 1) { 699 if (irq_mode == 1) {
687 /* Register the interrupt handler */ 700 /* Register the interrupt handler */
688 if ((ret = request_irq(dev->irq, pd6729_interrupt, IRQF_SHARED, 701 ret = request_irq(dev->irq, pd6729_interrupt, IRQF_SHARED,
689 "pd6729", socket))) { 702 "pd6729", socket);
703 if (ret) {
690 dev_err(&dev->dev, "Failed to register irq %d\n", 704 dev_err(&dev->dev, "Failed to register irq %d\n",
691 dev->irq); 705 dev->irq);
692 goto err_out_free_res; 706 goto err_out_free_res;