diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-03-01 18:09:29 -0500 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-03-31 10:26:33 -0500 |
commit | e2d4096365e06b9a3799afbadc28b4519c0b3526 (patch) | |
tree | 90ec691d71f9c0309048714e359b8ba351b533f7 /drivers/serial/serial_cs.c | |
parent | f6fbe01ac976f3ec618cd5fb71ad9ce2cfa7ab2b (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/serial/serial_cs.c')
-rw-r--r-- | drivers/serial/serial_cs.c | 35 |
1 files changed, 9 insertions, 26 deletions
diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c index e7875090dc4c..eec05a0a86f6 100644 --- a/drivers/serial/serial_cs.c +++ b/drivers/serial/serial_cs.c | |||
@@ -128,38 +128,27 @@ static void serial_remove(struct pcmcia_device *link) | |||
128 | struct serial_info *info = link->priv; | 128 | struct serial_info *info = link->priv; |
129 | int i; | 129 | int i; |
130 | 130 | ||
131 | link->state &= ~DEV_PRESENT; | ||
132 | |||
133 | DEBUG(0, "serial_release(0x%p)\n", link); | 131 | DEBUG(0, "serial_release(0x%p)\n", link); |
134 | 132 | ||
135 | /* | 133 | /* |
136 | * Recheck to see if the device is still configured. | 134 | * Recheck to see if the device is still configured. |
137 | */ | 135 | */ |
138 | if (info->p_dev->state & DEV_CONFIG) { | 136 | for (i = 0; i < info->ndev; i++) |
139 | for (i = 0; i < info->ndev; i++) | 137 | serial8250_unregister_port(info->line[i]); |
140 | serial8250_unregister_port(info->line[i]); | ||
141 | |||
142 | info->p_dev->dev_node = NULL; | ||
143 | 138 | ||
144 | if (!info->slave) | 139 | info->p_dev->dev_node = NULL; |
145 | pcmcia_disable_device(link); | ||
146 | 140 | ||
147 | info->p_dev->state &= ~DEV_CONFIG; | 141 | if (!info->slave) |
148 | } | 142 | pcmcia_disable_device(link); |
149 | } | 143 | } |
150 | 144 | ||
151 | static int serial_suspend(struct pcmcia_device *link) | 145 | static int serial_suspend(struct pcmcia_device *link) |
152 | { | 146 | { |
153 | if (link->state & DEV_CONFIG) { | 147 | struct serial_info *info = link->priv; |
154 | struct serial_info *info = link->priv; | 148 | int i; |
155 | int i; | ||
156 | |||
157 | for (i = 0; i < info->ndev; i++) | ||
158 | serial8250_suspend_port(info->line[i]); | ||
159 | 149 | ||
160 | if (info->slave) | 150 | for (i = 0; i < info->ndev; i++) |
161 | link->state &= DEV_SUSPEND_NORELEASE; | 151 | serial8250_suspend_port(info->line[i]); |
162 | } | ||
163 | 152 | ||
164 | return 0; | 153 | return 0; |
165 | } | 154 | } |
@@ -210,7 +199,6 @@ static int serial_probe(struct pcmcia_device *link) | |||
210 | } | 199 | } |
211 | link->conf.IntType = INT_MEMORY_AND_IO; | 200 | link->conf.IntType = INT_MEMORY_AND_IO; |
212 | 201 | ||
213 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
214 | return serial_config(link); | 202 | return serial_config(link); |
215 | } | 203 | } |
216 | 204 | ||
@@ -586,9 +574,6 @@ static int serial_config(struct pcmcia_device * link) | |||
586 | link->conf.ConfigBase = parse->config.base; | 574 | link->conf.ConfigBase = parse->config.base; |
587 | link->conf.Present = parse->config.rmask[0]; | 575 | link->conf.Present = parse->config.rmask[0]; |
588 | 576 | ||
589 | /* Configure card */ | ||
590 | link->state |= DEV_CONFIG; | ||
591 | |||
592 | /* Is this a compliant multifunction card? */ | 577 | /* Is this a compliant multifunction card? */ |
593 | tuple->DesiredTuple = CISTPL_LONGLINK_MFC; | 578 | tuple->DesiredTuple = CISTPL_LONGLINK_MFC; |
594 | tuple->Attributes = TUPLE_RETURN_COMMON | TUPLE_RETURN_LINK; | 579 | tuple->Attributes = TUPLE_RETURN_COMMON | TUPLE_RETURN_LINK; |
@@ -648,7 +633,6 @@ static int serial_config(struct pcmcia_device * link) | |||
648 | } | 633 | } |
649 | 634 | ||
650 | link->dev_node = &info->node[0]; | 635 | link->dev_node = &info->node[0]; |
651 | link->state &= ~DEV_CONFIG_PENDING; | ||
652 | kfree(cfg_mem); | 636 | kfree(cfg_mem); |
653 | return 0; | 637 | return 0; |
654 | 638 | ||
@@ -656,7 +640,6 @@ static int serial_config(struct pcmcia_device * link) | |||
656 | cs_error(link, last_fn, last_ret); | 640 | cs_error(link, last_fn, last_ret); |
657 | failed: | 641 | failed: |
658 | serial_remove(link); | 642 | serial_remove(link); |
659 | link->state &= ~DEV_CONFIG_PENDING; | ||
660 | kfree(cfg_mem); | 643 | kfree(cfg_mem); |
661 | return -ENODEV; | 644 | return -ENODEV; |
662 | } | 645 | } |