aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/pcmcia_resource.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pcmcia/pcmcia_resource.c')
-rw-r--r--drivers/pcmcia/pcmcia_resource.c37
1 files changed, 20 insertions, 17 deletions
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c
index a8bf8c1b45ed..d5db95644b64 100644
--- a/drivers/pcmcia/pcmcia_resource.c
+++ b/drivers/pcmcia/pcmcia_resource.c
@@ -33,7 +33,7 @@
33 33
34 34
35/* Access speed for IO windows */ 35/* Access speed for IO windows */
36static int io_speed = 0; 36static int io_speed;
37module_param(io_speed, int, 0444); 37module_param(io_speed, int, 0444);
38 38
39 39
@@ -62,7 +62,8 @@ static int alloc_io_space(struct pcmcia_socket *s, u_int attr,
62 num, align); 62 num, align);
63 align = 0; 63 align = 0;
64 } else 64 } else
65 while (align && (align < num)) align <<= 1; 65 while (align && (align < num))
66 align <<= 1;
66 } 67 }
67 if (*base & ~(align-1)) { 68 if (*base & ~(align-1)) {
68 dev_dbg(&s->dev, "odd IO request: base %#x align %#x\n", 69 dev_dbg(&s->dev, "odd IO request: base %#x align %#x\n",
@@ -338,7 +339,7 @@ static int pcmcia_release_io(struct pcmcia_device *p_dev, io_req_t *req)
338 struct pcmcia_socket *s = p_dev->socket; 339 struct pcmcia_socket *s = p_dev->socket;
339 config_t *c = p_dev->function_config; 340 config_t *c = p_dev->function_config;
340 341
341 if (!p_dev->_io ) 342 if (!p_dev->_io)
342 return -EINVAL; 343 return -EINVAL;
343 344
344 p_dev->_io = 0; 345 p_dev->_io = 0;
@@ -362,7 +363,7 @@ static int pcmcia_release_io(struct pcmcia_device *p_dev, io_req_t *req)
362static int pcmcia_release_irq(struct pcmcia_device *p_dev, irq_req_t *req) 363static int pcmcia_release_irq(struct pcmcia_device *p_dev, irq_req_t *req)
363{ 364{
364 struct pcmcia_socket *s = p_dev->socket; 365 struct pcmcia_socket *s = p_dev->socket;
365 config_t *c= p_dev->function_config; 366 config_t *c = p_dev->function_config;
366 367
367 if (!p_dev->_irq) 368 if (!p_dev->_irq)
368 return -EINVAL; 369 return -EINVAL;
@@ -383,9 +384,8 @@ static int pcmcia_release_irq(struct pcmcia_device *p_dev, irq_req_t *req)
383 s->irq.AssignedIRQ = 0; 384 s->irq.AssignedIRQ = 0;
384 } 385 }
385 386
386 if (req->Handler) { 387 if (req->Handler)
387 free_irq(req->AssignedIRQ, p_dev->priv); 388 free_irq(req->AssignedIRQ, p_dev->priv);
388 }
389 389
390#ifdef CONFIG_PCMCIA_PROBE 390#ifdef CONFIG_PCMCIA_PROBE
391 pcmcia_used_irq[req->AssignedIRQ]--; 391 pcmcia_used_irq[req->AssignedIRQ]--;
@@ -656,7 +656,8 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req)
656 type = IRQF_SHARED; 656 type = IRQF_SHARED;
657 else if (req->Attributes & IRQ_TYPE_DYNAMIC_SHARING) 657 else if (req->Attributes & IRQ_TYPE_DYNAMIC_SHARING)
658 type = IRQF_SHARED; 658 type = IRQF_SHARED;
659 else printk(KERN_WARNING "pcmcia: Driver needs updating to support IRQ sharing.\n"); 659 else
660 printk(KERN_WARNING "pcmcia: Driver needs updating to support IRQ sharing.\n");
660 661
661#ifdef CONFIG_PCMCIA_PROBE 662#ifdef CONFIG_PCMCIA_PROBE
662 663
@@ -788,7 +789,8 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_ha
788 789
789 /* Allocate system memory window */ 790 /* Allocate system memory window */
790 for (w = 0; w < MAX_WIN; w++) 791 for (w = 0; w < MAX_WIN; w++)
791 if (!(s->state & SOCKET_WIN_REQ(w))) break; 792 if (!(s->state & SOCKET_WIN_REQ(w)))
793 break;
792 if (w == MAX_WIN) { 794 if (w == MAX_WIN) {
793 dev_dbg(&s->dev, "all windows are used already\n"); 795 dev_dbg(&s->dev, "all windows are used already\n");
794 return -EINVAL; 796 return -EINVAL;
@@ -826,18 +828,19 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_ha
826 s->state |= SOCKET_WIN_REQ(w); 828 s->state |= SOCKET_WIN_REQ(w);
827 829
828 /* Return window handle */ 830 /* Return window handle */
829 if (s->features & SS_CAP_STATIC_MAP) { 831 if (s->features & SS_CAP_STATIC_MAP)
830 req->Base = win->static_start; 832 req->Base = win->static_start;
831 } else { 833 else
832 req->Base = win->res->start; 834 req->Base = win->res->start;
833 } 835
834 *wh = w + 1; 836 *wh = w + 1;
835 837
836 return 0; 838 return 0;
837} /* pcmcia_request_window */ 839} /* pcmcia_request_window */
838EXPORT_SYMBOL(pcmcia_request_window); 840EXPORT_SYMBOL(pcmcia_request_window);
839 841
840void pcmcia_disable_device(struct pcmcia_device *p_dev) { 842void pcmcia_disable_device(struct pcmcia_device *p_dev)
843{
841 pcmcia_release_configuration(p_dev); 844 pcmcia_release_configuration(p_dev);
842 pcmcia_release_io(p_dev, &p_dev->io); 845 pcmcia_release_io(p_dev, &p_dev->io);
843 pcmcia_release_irq(p_dev, &p_dev->irq); 846 pcmcia_release_irq(p_dev, &p_dev->irq);
@@ -970,7 +973,7 @@ int pcmcia_loop_tuple(struct pcmcia_device *p_dev, cisdata_t code,
970 973
971 return pccard_loop_tuple(p_dev->socket, p_dev->func, code, NULL, 974 return pccard_loop_tuple(p_dev->socket, p_dev->func, code, NULL,
972 &loop, pcmcia_do_loop_tuple); 975 &loop, pcmcia_do_loop_tuple);
973}; 976}
974EXPORT_SYMBOL(pcmcia_loop_tuple); 977EXPORT_SYMBOL(pcmcia_loop_tuple);
975 978
976 979
@@ -1000,7 +1003,7 @@ static int pcmcia_do_get_tuple(struct pcmcia_device *p_dev, tuple_t *tuple,
1000 } else 1003 } else
1001 dev_dbg(&p_dev->dev, "do_get_tuple: out of memory\n"); 1004 dev_dbg(&p_dev->dev, "do_get_tuple: out of memory\n");
1002 return 0; 1005 return 0;
1003}; 1006}
1004 1007
1005/** 1008/**
1006 * pcmcia_get_tuple() - get first tuple from CIS 1009 * pcmcia_get_tuple() - get first tuple from CIS
@@ -1024,7 +1027,7 @@ size_t pcmcia_get_tuple(struct pcmcia_device *p_dev, cisdata_t code,
1024 pcmcia_loop_tuple(p_dev, code, pcmcia_do_get_tuple, &get); 1027 pcmcia_loop_tuple(p_dev, code, pcmcia_do_get_tuple, &get);
1025 1028
1026 return get.len; 1029 return get.len;
1027}; 1030}
1028EXPORT_SYMBOL(pcmcia_get_tuple); 1031EXPORT_SYMBOL(pcmcia_get_tuple);
1029 1032
1030 1033
@@ -1057,7 +1060,7 @@ static int pcmcia_do_get_mac(struct pcmcia_device *p_dev, tuple_t *tuple,
1057 for (i = 0; i < 6; i++) 1060 for (i = 0; i < 6; i++)
1058 dev->dev_addr[i] = tuple->TupleData[i+2]; 1061 dev->dev_addr[i] = tuple->TupleData[i+2];
1059 return 0; 1062 return 0;
1060}; 1063}
1061 1064
1062/** 1065/**
1063 * pcmcia_get_mac_from_cis() - read out MAC address from CISTPL_FUNCE 1066 * pcmcia_get_mac_from_cis() - read out MAC address from CISTPL_FUNCE
@@ -1071,6 +1074,6 @@ static int pcmcia_do_get_mac(struct pcmcia_device *p_dev, tuple_t *tuple,
1071int pcmcia_get_mac_from_cis(struct pcmcia_device *p_dev, struct net_device *dev) 1074int pcmcia_get_mac_from_cis(struct pcmcia_device *p_dev, struct net_device *dev)
1072{ 1075{
1073 return pcmcia_loop_tuple(p_dev, CISTPL_FUNCE, pcmcia_do_get_mac, dev); 1076 return pcmcia_loop_tuple(p_dev, CISTPL_FUNCE, pcmcia_do_get_mac, dev);
1074}; 1077}
1075EXPORT_SYMBOL(pcmcia_get_mac_from_cis); 1078EXPORT_SYMBOL(pcmcia_get_mac_from_cis);
1076 1079