mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
[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 <[email protected]>
This commit is contained in:
parent
f6fbe01ac9
commit
e2d4096365
49 changed files with 335 additions and 682 deletions
|
|
@ -244,7 +244,7 @@ static void bluecard_write_wakeup(bluecard_info_t *info)
|
|||
|
||||
clear_bit(XMIT_WAKEUP, &(info->tx_state));
|
||||
|
||||
if (!(info->p_dev->state & DEV_PRESENT))
|
||||
if (!pcmcia_dev_present(info->p_dev))
|
||||
return;
|
||||
|
||||
if (test_bit(XMIT_BUFFER_NUMBER, &(info->tx_state))) {
|
||||
|
|
@ -879,7 +879,6 @@ static int bluecard_probe(struct pcmcia_device *link)
|
|||
link->conf.Attributes = CONF_ENABLE_IRQ;
|
||||
link->conf.IntType = INT_MEMORY_AND_IO;
|
||||
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
return bluecard_config(link);
|
||||
}
|
||||
|
||||
|
|
@ -888,9 +887,7 @@ static void bluecard_detach(struct pcmcia_device *link)
|
|||
{
|
||||
bluecard_info_t *info = link->priv;
|
||||
|
||||
if (link->state & DEV_CONFIG)
|
||||
bluecard_release(link);
|
||||
|
||||
bluecard_release(link);
|
||||
kfree(info);
|
||||
}
|
||||
|
||||
|
|
@ -933,9 +930,6 @@ static int bluecard_config(struct pcmcia_device *link)
|
|||
link->conf.ConfigBase = parse.config.base;
|
||||
link->conf.Present = parse.config.rmask[0];
|
||||
|
||||
/* Configure card */
|
||||
link->state |= DEV_CONFIG;
|
||||
|
||||
link->conf.ConfigIndex = 0x20;
|
||||
link->io.NumPorts1 = 64;
|
||||
link->io.IOAddrLines = 6;
|
||||
|
|
@ -969,7 +963,6 @@ static int bluecard_config(struct pcmcia_device *link)
|
|||
|
||||
strcpy(info->node.dev_name, info->hdev->name);
|
||||
link->dev_node = &info->node;
|
||||
link->state &= ~DEV_CONFIG_PENDING;
|
||||
|
||||
return 0;
|
||||
|
||||
|
|
@ -986,8 +979,7 @@ static void bluecard_release(struct pcmcia_device *link)
|
|||
{
|
||||
bluecard_info_t *info = link->priv;
|
||||
|
||||
if (link->state & DEV_PRESENT)
|
||||
bluecard_close(info);
|
||||
bluecard_close(info);
|
||||
|
||||
del_timer(&(info->timer));
|
||||
|
||||
|
|
|
|||
|
|
@ -195,7 +195,7 @@ static void bt3c_write_wakeup(bt3c_info_t *info)
|
|||
register struct sk_buff *skb;
|
||||
register int len;
|
||||
|
||||
if (!(info->p_dev->state & DEV_PRESENT))
|
||||
if (!pcmcia_dev_present(info->p_dev))
|
||||
break;
|
||||
|
||||
|
||||
|
|
@ -668,7 +668,6 @@ static int bt3c_probe(struct pcmcia_device *link)
|
|||
link->conf.Attributes = CONF_ENABLE_IRQ;
|
||||
link->conf.IntType = INT_MEMORY_AND_IO;
|
||||
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
return bt3c_config(link);
|
||||
}
|
||||
|
||||
|
|
@ -677,9 +676,7 @@ static void bt3c_detach(struct pcmcia_device *link)
|
|||
{
|
||||
bt3c_info_t *info = link->priv;
|
||||
|
||||
if (link->state & DEV_CONFIG)
|
||||
bt3c_release(link);
|
||||
|
||||
bt3c_release(link);
|
||||
kfree(info);
|
||||
}
|
||||
|
||||
|
|
@ -733,9 +730,6 @@ static int bt3c_config(struct pcmcia_device *link)
|
|||
link->conf.ConfigBase = parse.config.base;
|
||||
link->conf.Present = parse.config.rmask[0];
|
||||
|
||||
/* Configure card */
|
||||
link->state |= DEV_CONFIG;
|
||||
|
||||
/* First pass: look for a config entry that looks normal. */
|
||||
tuple.TupleData = (cisdata_t *)buf;
|
||||
tuple.TupleOffset = 0;
|
||||
|
|
@ -805,7 +799,6 @@ found_port:
|
|||
|
||||
strcpy(info->node.dev_name, info->hdev->name);
|
||||
link->dev_node = &info->node;
|
||||
link->state &= ~DEV_CONFIG_PENDING;
|
||||
|
||||
return 0;
|
||||
|
||||
|
|
@ -822,8 +815,7 @@ static void bt3c_release(struct pcmcia_device *link)
|
|||
{
|
||||
bt3c_info_t *info = link->priv;
|
||||
|
||||
if (link->state & DEV_PRESENT)
|
||||
bt3c_close(info);
|
||||
bt3c_close(info);
|
||||
|
||||
pcmcia_disable_device(link);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ static void btuart_write_wakeup(btuart_info_t *info)
|
|||
|
||||
clear_bit(XMIT_WAKEUP, &(info->tx_state));
|
||||
|
||||
if (!(info->p_dev->state & DEV_PRESENT))
|
||||
if (!pcmcia_dev_present(info->p_dev))
|
||||
return;
|
||||
|
||||
if (!(skb = skb_dequeue(&(info->txq))))
|
||||
|
|
@ -599,7 +599,6 @@ static int btuart_probe(struct pcmcia_device *link)
|
|||
link->conf.Attributes = CONF_ENABLE_IRQ;
|
||||
link->conf.IntType = INT_MEMORY_AND_IO;
|
||||
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
return btuart_config(link);
|
||||
}
|
||||
|
||||
|
|
@ -608,9 +607,7 @@ static void btuart_detach(struct pcmcia_device *link)
|
|||
{
|
||||
btuart_info_t *info = link->priv;
|
||||
|
||||
if (link->state & DEV_CONFIG)
|
||||
btuart_release(link);
|
||||
|
||||
btuart_release(link);
|
||||
kfree(info);
|
||||
}
|
||||
|
||||
|
|
@ -664,9 +661,6 @@ static int btuart_config(struct pcmcia_device *link)
|
|||
link->conf.ConfigBase = parse.config.base;
|
||||
link->conf.Present = parse.config.rmask[0];
|
||||
|
||||
/* Configure card */
|
||||
link->state |= DEV_CONFIG;
|
||||
|
||||
/* First pass: look for a config entry that looks normal. */
|
||||
tuple.TupleData = (cisdata_t *) buf;
|
||||
tuple.TupleOffset = 0;
|
||||
|
|
@ -737,7 +731,6 @@ found_port:
|
|||
|
||||
strcpy(info->node.dev_name, info->hdev->name);
|
||||
link->dev_node = &info->node;
|
||||
link->state &= ~DEV_CONFIG_PENDING;
|
||||
|
||||
return 0;
|
||||
|
||||
|
|
@ -754,8 +747,7 @@ static void btuart_release(struct pcmcia_device *link)
|
|||
{
|
||||
btuart_info_t *info = link->priv;
|
||||
|
||||
if (link->state & DEV_PRESENT)
|
||||
btuart_close(info);
|
||||
btuart_close(info);
|
||||
|
||||
pcmcia_disable_device(link);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ static void dtl1_write_wakeup(dtl1_info_t *info)
|
|||
|
||||
clear_bit(XMIT_WAKEUP, &(info->tx_state));
|
||||
|
||||
if (!(info->p_dev->state & DEV_PRESENT))
|
||||
if (!pcmcia_dev_present(info->p_dev))
|
||||
return;
|
||||
|
||||
if (!(skb = skb_dequeue(&(info->txq))))
|
||||
|
|
@ -578,7 +578,6 @@ static int dtl1_probe(struct pcmcia_device *link)
|
|||
link->conf.Attributes = CONF_ENABLE_IRQ;
|
||||
link->conf.IntType = INT_MEMORY_AND_IO;
|
||||
|
||||
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
|
||||
return dtl1_config(link);
|
||||
}
|
||||
|
||||
|
|
@ -587,8 +586,7 @@ static void dtl1_detach(struct pcmcia_device *link)
|
|||
{
|
||||
dtl1_info_t *info = link->priv;
|
||||
|
||||
if (link->state & DEV_CONFIG)
|
||||
dtl1_release(link);
|
||||
dtl1_release(link);
|
||||
|
||||
kfree(info);
|
||||
}
|
||||
|
|
@ -642,9 +640,6 @@ static int dtl1_config(struct pcmcia_device *link)
|
|||
link->conf.ConfigBase = parse.config.base;
|
||||
link->conf.Present = parse.config.rmask[0];
|
||||
|
||||
/* Configure card */
|
||||
link->state |= DEV_CONFIG;
|
||||
|
||||
tuple.TupleData = (cisdata_t *)buf;
|
||||
tuple.TupleOffset = 0;
|
||||
tuple.TupleDataMax = 255;
|
||||
|
|
@ -689,7 +684,6 @@ static int dtl1_config(struct pcmcia_device *link)
|
|||
|
||||
strcpy(info->node.dev_name, info->hdev->name);
|
||||
link->dev_node = &info->node;
|
||||
link->state &= ~DEV_CONFIG_PENDING;
|
||||
|
||||
return 0;
|
||||
|
||||
|
|
@ -706,8 +700,7 @@ static void dtl1_release(struct pcmcia_device *link)
|
|||
{
|
||||
dtl1_info_t *info = link->priv;
|
||||
|
||||
if (link->state & DEV_PRESENT)
|
||||
dtl1_close(info);
|
||||
dtl1_close(info);
|
||||
|
||||
pcmcia_disable_device(link);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue