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/net/pcmcia/ibmtr_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/net/pcmcia/ibmtr_cs.c')
-rw-r--r-- | drivers/net/pcmcia/ibmtr_cs.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/drivers/net/pcmcia/ibmtr_cs.c b/drivers/net/pcmcia/ibmtr_cs.c index e038d9278a59..b8fe70b85641 100644 --- a/drivers/net/pcmcia/ibmtr_cs.c +++ b/drivers/net/pcmcia/ibmtr_cs.c | |||
@@ -173,7 +173,6 @@ static int ibmtr_attach(struct pcmcia_device *link) | |||
173 | 173 | ||
174 | SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); | 174 | SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); |
175 | 175 | ||
176 | link->state |= DEV_PRESENT; | ||
177 | return ibmtr_config(link); | 176 | return ibmtr_config(link); |
178 | } /* ibmtr_attach */ | 177 | } /* ibmtr_attach */ |
179 | 178 | ||
@@ -200,8 +199,8 @@ static void ibmtr_detach(struct pcmcia_device *link) | |||
200 | struct tok_info *ti = netdev_priv(dev); | 199 | struct tok_info *ti = netdev_priv(dev); |
201 | del_timer_sync(&(ti->tr_timer)); | 200 | del_timer_sync(&(ti->tr_timer)); |
202 | } | 201 | } |
203 | if (link->state & DEV_CONFIG) | 202 | |
204 | ibmtr_release(link); | 203 | ibmtr_release(link); |
205 | 204 | ||
206 | free_netdev(dev); | 205 | free_netdev(dev); |
207 | kfree(info); | 206 | kfree(info); |
@@ -241,10 +240,6 @@ static int ibmtr_config(struct pcmcia_device *link) | |||
241 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | 240 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); |
242 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); | 241 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); |
243 | link->conf.ConfigBase = parse.config.base; | 242 | link->conf.ConfigBase = parse.config.base; |
244 | |||
245 | /* Configure card */ | ||
246 | link->state |= DEV_CONFIG; | ||
247 | |||
248 | link->conf.ConfigIndex = 0x61; | 243 | link->conf.ConfigIndex = 0x61; |
249 | 244 | ||
250 | /* Determine if this is PRIMARY or ALTERNATE. */ | 245 | /* Determine if this is PRIMARY or ALTERNATE. */ |
@@ -301,7 +296,6 @@ static int ibmtr_config(struct pcmcia_device *link) | |||
301 | ibmtr_hw_setup(dev, mmiobase); | 296 | ibmtr_hw_setup(dev, mmiobase); |
302 | 297 | ||
303 | link->dev_node = &info->node; | 298 | link->dev_node = &info->node; |
304 | link->state &= ~DEV_CONFIG_PENDING; | ||
305 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 299 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); |
306 | 300 | ||
307 | i = ibmtr_probe_card(dev); | 301 | i = ibmtr_probe_card(dev); |
@@ -358,7 +352,7 @@ static int ibmtr_suspend(struct pcmcia_device *link) | |||
358 | ibmtr_dev_t *info = link->priv; | 352 | ibmtr_dev_t *info = link->priv; |
359 | struct net_device *dev = info->dev; | 353 | struct net_device *dev = info->dev; |
360 | 354 | ||
361 | if ((link->state & DEV_CONFIG) && (link->open)) | 355 | if (link->open) |
362 | netif_device_detach(dev); | 356 | netif_device_detach(dev); |
363 | 357 | ||
364 | return 0; | 358 | return 0; |
@@ -369,7 +363,7 @@ static int ibmtr_resume(struct pcmcia_device *link) | |||
369 | ibmtr_dev_t *info = link->priv; | 363 | ibmtr_dev_t *info = link->priv; |
370 | struct net_device *dev = info->dev; | 364 | struct net_device *dev = info->dev; |
371 | 365 | ||
372 | if ((link->state & DEV_CONFIG) && (link->open)) { | 366 | if (link->open) { |
373 | ibmtr_probe(dev); /* really? */ | 367 | ibmtr_probe(dev); /* really? */ |
374 | netif_device_attach(dev); | 368 | netif_device_attach(dev); |
375 | } | 369 | } |