diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-01-10 14:41:27 -0500 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-03-31 10:01:43 -0500 |
commit | dbb22f0d65ccc2e9dfeb4c420942f2757a80f8d2 (patch) | |
tree | 242382a959af9e8ac93afbc187fc74db9494d7c9 /drivers | |
parent | 1ae9c7d8198ae973da3b927e28d63f294ffa11e3 (diff) |
[PATCH] pcmcia: access config_t using pointer instead of array
Access the PCMCIA config_t struct (one per device function) using
a pointer in struct pcmcia_device, instead of looking them up in
an array.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/pcmcia/cs_internal.h | 6 | ||||
-rw-r--r-- | drivers/pcmcia/ds.c | 1 | ||||
-rw-r--r-- | drivers/pcmcia/pcmcia_resource.c | 19 |
3 files changed, 10 insertions, 16 deletions
diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h index 2b267def9621..f889a44280f5 100644 --- a/drivers/pcmcia/cs_internal.h +++ b/drivers/pcmcia/cs_internal.h | |||
@@ -94,12 +94,6 @@ static inline void cs_socket_put(struct pcmcia_socket *skt) | |||
94 | } | 94 | } |
95 | } | 95 | } |
96 | 96 | ||
97 | #define CHECK_SOCKET(s) \ | ||
98 | (((s) >= sockets) || (socket_table[s]->ops == NULL)) | ||
99 | |||
100 | #define SOCKET(h) (h->socket) | ||
101 | #define CONFIG(h) (&SOCKET(h)->config[(h)->func]) | ||
102 | |||
103 | /* In cardbus.c */ | 97 | /* In cardbus.c */ |
104 | int cb_alloc(struct pcmcia_socket *s); | 98 | int cb_alloc(struct pcmcia_socket *s); |
105 | void cb_free(struct pcmcia_socket *s); | 99 | void cb_free(struct pcmcia_socket *s); |
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index a4333a82669f..5166f00cfe3a 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c | |||
@@ -399,6 +399,7 @@ static int pcmcia_device_probe(struct device * dev) | |||
399 | goto put_module; | 399 | goto put_module; |
400 | } | 400 | } |
401 | } | 401 | } |
402 | p_dev->function_config = &s->config[p_dev->func]; | ||
402 | 403 | ||
403 | ret = p_drv->probe(p_dev); | 404 | ret = p_drv->probe(p_dev); |
404 | if (ret) | 405 | if (ret) |
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index f58814519ebc..11a94d9a15fb 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c | |||
@@ -372,9 +372,7 @@ int pccard_get_status(struct pcmcia_socket *s, unsigned int function, | |||
372 | 372 | ||
373 | int pcmcia_get_status(client_handle_t handle, cs_status_t *status) | 373 | int pcmcia_get_status(client_handle_t handle, cs_status_t *status) |
374 | { | 374 | { |
375 | struct pcmcia_socket *s; | 375 | return pccard_get_status(handle->socket, handle->func, status); |
376 | s = SOCKET(handle); | ||
377 | return pccard_get_status(s, handle->func, status); | ||
378 | } | 376 | } |
379 | EXPORT_SYMBOL(pcmcia_get_status); | 377 | EXPORT_SYMBOL(pcmcia_get_status); |
380 | 378 | ||
@@ -422,7 +420,8 @@ int pcmcia_modify_configuration(struct pcmcia_device *p_dev, | |||
422 | config_t *c; | 420 | config_t *c; |
423 | 421 | ||
424 | s = p_dev->socket; | 422 | s = p_dev->socket; |
425 | c = CONFIG(p_dev); | 423 | c = p_dev->function_config; |
424 | |||
426 | if (!(s->state & SOCKET_PRESENT)) | 425 | if (!(s->state & SOCKET_PRESENT)) |
427 | return CS_NO_CARD; | 426 | return CS_NO_CARD; |
428 | if (!(c->state & CONFIG_LOCKED)) | 427 | if (!(c->state & CONFIG_LOCKED)) |
@@ -470,7 +469,7 @@ int pcmcia_release_configuration(struct pcmcia_device *p_dev) | |||
470 | p_dev->state &= ~CLIENT_CONFIG_LOCKED; | 469 | p_dev->state &= ~CLIENT_CONFIG_LOCKED; |
471 | 470 | ||
472 | if (!(p_dev->state & CLIENT_STALE)) { | 471 | if (!(p_dev->state & CLIENT_STALE)) { |
473 | config_t *c = CONFIG(p_dev); | 472 | config_t *c = p_dev->function_config; |
474 | if (--(s->lock_count) == 0) { | 473 | if (--(s->lock_count) == 0) { |
475 | s->socket.flags = SS_OUTPUT_ENA; /* Is this correct? */ | 474 | s->socket.flags = SS_OUTPUT_ENA; /* Is this correct? */ |
476 | s->socket.Vpp = 0; | 475 | s->socket.Vpp = 0; |
@@ -512,7 +511,7 @@ int pcmcia_release_io(struct pcmcia_device *p_dev, io_req_t *req) | |||
512 | p_dev->state &= ~CLIENT_IO_REQ; | 511 | p_dev->state &= ~CLIENT_IO_REQ; |
513 | 512 | ||
514 | if (!(p_dev->state & CLIENT_STALE)) { | 513 | if (!(p_dev->state & CLIENT_STALE)) { |
515 | config_t *c = CONFIG(p_dev); | 514 | config_t *c = p_dev->function_config; |
516 | if (c->state & CONFIG_LOCKED) | 515 | if (c->state & CONFIG_LOCKED) |
517 | return CS_CONFIGURATION_LOCKED; | 516 | return CS_CONFIGURATION_LOCKED; |
518 | if ((c->io.BasePort1 != req->BasePort1) || | 517 | if ((c->io.BasePort1 != req->BasePort1) || |
@@ -540,7 +539,7 @@ int pcmcia_release_irq(struct pcmcia_device *p_dev, irq_req_t *req) | |||
540 | p_dev->state &= ~CLIENT_IRQ_REQ; | 539 | p_dev->state &= ~CLIENT_IRQ_REQ; |
541 | 540 | ||
542 | if (!(p_dev->state & CLIENT_STALE)) { | 541 | if (!(p_dev->state & CLIENT_STALE)) { |
543 | config_t *c = CONFIG(p_dev); | 542 | config_t *c= p_dev->function_config; |
544 | if (c->state & CONFIG_LOCKED) | 543 | if (c->state & CONFIG_LOCKED) |
545 | return CS_CONFIGURATION_LOCKED; | 544 | return CS_CONFIGURATION_LOCKED; |
546 | if (c->irq.Attributes != req->Attributes) | 545 | if (c->irq.Attributes != req->Attributes) |
@@ -610,7 +609,7 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev, | |||
610 | 609 | ||
611 | if (req->IntType & INT_CARDBUS) | 610 | if (req->IntType & INT_CARDBUS) |
612 | return CS_UNSUPPORTED_MODE; | 611 | return CS_UNSUPPORTED_MODE; |
613 | c = CONFIG(p_dev); | 612 | c = p_dev->function_config; |
614 | if (c->state & CONFIG_LOCKED) | 613 | if (c->state & CONFIG_LOCKED) |
615 | return CS_CONFIGURATION_LOCKED; | 614 | return CS_CONFIGURATION_LOCKED; |
616 | 615 | ||
@@ -730,7 +729,7 @@ int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req) | |||
730 | 729 | ||
731 | if (!req) | 730 | if (!req) |
732 | return CS_UNSUPPORTED_MODE; | 731 | return CS_UNSUPPORTED_MODE; |
733 | c = CONFIG(p_dev); | 732 | c = p_dev->function_config; |
734 | if (c->state & CONFIG_LOCKED) | 733 | if (c->state & CONFIG_LOCKED) |
735 | return CS_CONFIGURATION_LOCKED; | 734 | return CS_CONFIGURATION_LOCKED; |
736 | if (c->state & CONFIG_IO_REQ) | 735 | if (c->state & CONFIG_IO_REQ) |
@@ -786,7 +785,7 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req) | |||
786 | 785 | ||
787 | if (!(s->state & SOCKET_PRESENT)) | 786 | if (!(s->state & SOCKET_PRESENT)) |
788 | return CS_NO_CARD; | 787 | return CS_NO_CARD; |
789 | c = CONFIG(p_dev); | 788 | c = p_dev->function_config; |
790 | if (c->state & CONFIG_LOCKED) | 789 | if (c->state & CONFIG_LOCKED) |
791 | return CS_CONFIGURATION_LOCKED; | 790 | return CS_CONFIGURATION_LOCKED; |
792 | if (c->state & CONFIG_IRQ_REQ) | 791 | if (c->state & CONFIG_IRQ_REQ) |