aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/pcmcia_resource.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2006-03-01 18:09:29 -0500
committerDominik Brodowski <linux@dominikbrodowski.net>2006-03-31 10:26:33 -0500
commite2d4096365e06b9a3799afbadc28b4519c0b3526 (patch)
tree90ec691d71f9c0309048714e359b8ba351b533f7 /drivers/pcmcia/pcmcia_resource.c
parentf6fbe01ac976f3ec618cd5fb71ad9ce2cfa7ab2b (diff)
[PATCH] pcmcia: use bitfield instead of p_state and state
Instead of the two status values struct pcmcia_device->p_state and state, use descriptive bitfields. Most value-checking in drivers was invalid, as the core now only calls the ->remove() (a.k.a. detach) function in case the attachement _and_ configuration was successful. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/pcmcia/pcmcia_resource.c')
-rw-r--r--drivers/pcmcia/pcmcia_resource.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c
index dbf167c979f6..45063b4e5b78 100644
--- a/drivers/pcmcia/pcmcia_resource.c
+++ b/drivers/pcmcia/pcmcia_resource.c
@@ -476,8 +476,8 @@ int pcmcia_release_configuration(struct pcmcia_device *p_dev)
476 config_t *c = p_dev->function_config; 476 config_t *c = p_dev->function_config;
477 int i; 477 int i;
478 478
479 if (p_dev->p_state & CLIENT_CONFIG_LOCKED) { 479 if (p_dev->_locked) {
480 p_dev->p_state &= ~CLIENT_CONFIG_LOCKED; 480 p_dev->_locked = 0;
481 if (--(s->lock_count) == 0) { 481 if (--(s->lock_count) == 0) {
482 s->socket.flags = SS_OUTPUT_ENA; /* Is this correct? */ 482 s->socket.flags = SS_OUTPUT_ENA; /* Is this correct? */
483 s->socket.Vpp = 0; 483 s->socket.Vpp = 0;
@@ -516,10 +516,10 @@ static int pcmcia_release_io(struct pcmcia_device *p_dev, io_req_t *req)
516 struct pcmcia_socket *s = p_dev->socket; 516 struct pcmcia_socket *s = p_dev->socket;
517 config_t *c = p_dev->function_config; 517 config_t *c = p_dev->function_config;
518 518
519 if (!(p_dev->p_state & CLIENT_IO_REQ)) 519 if (!p_dev->_io )
520 return CS_BAD_HANDLE; 520 return CS_BAD_HANDLE;
521 521
522 p_dev->p_state &= ~CLIENT_IO_REQ; 522 p_dev->_io = 0;
523 523
524 if ((c->io.BasePort1 != req->BasePort1) || 524 if ((c->io.BasePort1 != req->BasePort1) ||
525 (c->io.NumPorts1 != req->NumPorts1) || 525 (c->io.NumPorts1 != req->NumPorts1) ||
@@ -542,9 +542,9 @@ static int pcmcia_release_irq(struct pcmcia_device *p_dev, irq_req_t *req)
542 struct pcmcia_socket *s = p_dev->socket; 542 struct pcmcia_socket *s = p_dev->socket;
543 config_t *c= p_dev->function_config; 543 config_t *c= p_dev->function_config;
544 544
545 if (!(p_dev->p_state & CLIENT_IRQ_REQ)) 545 if (!p_dev->_irq)
546 return CS_BAD_HANDLE; 546 return CS_BAD_HANDLE;
547 p_dev->p_state &= ~CLIENT_IRQ_REQ; 547 p_dev->_irq = 0;
548 548
549 if (c->state & CONFIG_LOCKED) 549 if (c->state & CONFIG_LOCKED)
550 return CS_CONFIGURATION_LOCKED; 550 return CS_CONFIGURATION_LOCKED;
@@ -576,7 +576,7 @@ int pcmcia_release_window(window_handle_t win)
576 if ((win == NULL) || (win->magic != WINDOW_MAGIC)) 576 if ((win == NULL) || (win->magic != WINDOW_MAGIC))
577 return CS_BAD_HANDLE; 577 return CS_BAD_HANDLE;
578 s = win->sock; 578 s = win->sock;
579 if (!(win->handle->p_state & CLIENT_WIN_REQ(win->index))) 579 if (!(win->handle->_win & CLIENT_WIN_REQ(win->index)))
580 return CS_BAD_HANDLE; 580 return CS_BAD_HANDLE;
581 581
582 /* Shut down memory window */ 582 /* Shut down memory window */
@@ -590,7 +590,7 @@ int pcmcia_release_window(window_handle_t win)
590 kfree(win->ctl.res); 590 kfree(win->ctl.res);
591 win->ctl.res = NULL; 591 win->ctl.res = NULL;
592 } 592 }
593 win->handle->p_state &= ~CLIENT_WIN_REQ(win->index); 593 win->handle->_win &= ~CLIENT_WIN_REQ(win->index);
594 594
595 win->magic = 0; 595 win->magic = 0;
596 596
@@ -708,7 +708,7 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev,
708 } 708 }
709 709
710 c->state |= CONFIG_LOCKED; 710 c->state |= CONFIG_LOCKED;
711 p_dev->p_state |= CLIENT_CONFIG_LOCKED; 711 p_dev->_locked = 1;
712 return CS_SUCCESS; 712 return CS_SUCCESS;
713} /* pcmcia_request_configuration */ 713} /* pcmcia_request_configuration */
714EXPORT_SYMBOL(pcmcia_request_configuration); 714EXPORT_SYMBOL(pcmcia_request_configuration);
@@ -754,7 +754,7 @@ int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req)
754 754
755 c->io = *req; 755 c->io = *req;
756 c->state |= CONFIG_IO_REQ; 756 c->state |= CONFIG_IO_REQ;
757 p_dev->p_state |= CLIENT_IO_REQ; 757 p_dev->_io = 1;
758 return CS_SUCCESS; 758 return CS_SUCCESS;
759} /* pcmcia_request_io */ 759} /* pcmcia_request_io */
760EXPORT_SYMBOL(pcmcia_request_io); 760EXPORT_SYMBOL(pcmcia_request_io);
@@ -850,7 +850,7 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req)
850 s->irq.Config++; 850 s->irq.Config++;
851 851
852 c->state |= CONFIG_IRQ_REQ; 852 c->state |= CONFIG_IRQ_REQ;
853 p_dev->p_state |= CLIENT_IRQ_REQ; 853 p_dev->_irq = 1;
854 854
855#ifdef CONFIG_PCMCIA_PROBE 855#ifdef CONFIG_PCMCIA_PROBE
856 pcmcia_used_irq[irq]++; 856 pcmcia_used_irq[irq]++;
@@ -910,7 +910,7 @@ int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, window_h
910 if (!win->ctl.res) 910 if (!win->ctl.res)
911 return CS_IN_USE; 911 return CS_IN_USE;
912 } 912 }
913 (*p_dev)->p_state |= CLIENT_WIN_REQ(w); 913 (*p_dev)->_win |= CLIENT_WIN_REQ(w);
914 914
915 /* Configure the socket controller */ 915 /* Configure the socket controller */
916 win->ctl.map = w+1; 916 win->ctl.map = w+1;