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/char/pcmcia/synclink_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/char/pcmcia/synclink_cs.c')
-rw-r--r-- | drivers/char/pcmcia/synclink_cs.c | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index ef7a81314f0c..07213454c458 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c | |||
@@ -578,7 +578,6 @@ static int mgslpc_probe(struct pcmcia_device *link) | |||
578 | link->conf.Attributes = 0; | 578 | link->conf.Attributes = 0; |
579 | link->conf.IntType = INT_MEMORY_AND_IO; | 579 | link->conf.IntType = INT_MEMORY_AND_IO; |
580 | 580 | ||
581 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
582 | ret = mgslpc_config(link); | 581 | ret = mgslpc_config(link); |
583 | if (ret) | 582 | if (ret) |
584 | return ret; | 583 | return ret; |
@@ -618,9 +617,6 @@ static int mgslpc_config(struct pcmcia_device *link) | |||
618 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); | 617 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); |
619 | link->conf.ConfigBase = parse.config.base; | 618 | link->conf.ConfigBase = parse.config.base; |
620 | link->conf.Present = parse.config.rmask[0]; | 619 | link->conf.Present = parse.config.rmask[0]; |
621 | |||
622 | /* Configure card */ | ||
623 | link->state |= DEV_CONFIG; | ||
624 | 620 | ||
625 | /* get CIS configuration entry */ | 621 | /* get CIS configuration entry */ |
626 | 622 | ||
@@ -681,8 +677,6 @@ static int mgslpc_config(struct pcmcia_device *link) | |||
681 | printk(", io 0x%04x-0x%04x", link->io.BasePort1, | 677 | printk(", io 0x%04x-0x%04x", link->io.BasePort1, |
682 | link->io.BasePort1+link->io.NumPorts1-1); | 678 | link->io.BasePort1+link->io.NumPorts1-1); |
683 | printk("\n"); | 679 | printk("\n"); |
684 | |||
685 | link->state &= ~DEV_CONFIG_PENDING; | ||
686 | return 0; | 680 | return 0; |
687 | 681 | ||
688 | cs_failed: | 682 | cs_failed: |
@@ -697,25 +691,23 @@ cs_failed: | |||
697 | */ | 691 | */ |
698 | static void mgslpc_release(u_long arg) | 692 | static void mgslpc_release(u_long arg) |
699 | { | 693 | { |
700 | struct pcmcia_device *link = (struct pcmcia_device *)arg; | 694 | struct pcmcia_device *link = (struct pcmcia_device *)arg; |
701 | 695 | ||
702 | if (debug_level >= DEBUG_LEVEL_INFO) | 696 | if (debug_level >= DEBUG_LEVEL_INFO) |
703 | printk("mgslpc_release(0x%p)\n", link); | 697 | printk("mgslpc_release(0x%p)\n", link); |
704 | 698 | ||
705 | pcmcia_disable_device(link); | 699 | pcmcia_disable_device(link); |
706 | } | 700 | } |
707 | 701 | ||
708 | static void mgslpc_detach(struct pcmcia_device *link) | 702 | static void mgslpc_detach(struct pcmcia_device *link) |
709 | { | 703 | { |
710 | if (debug_level >= DEBUG_LEVEL_INFO) | 704 | if (debug_level >= DEBUG_LEVEL_INFO) |
711 | printk("mgslpc_detach(0x%p)\n", link); | 705 | printk("mgslpc_detach(0x%p)\n", link); |
712 | 706 | ||
713 | if (link->state & DEV_CONFIG) { | 707 | ((MGSLPC_INFO *)link->priv)->stop = 1; |
714 | ((MGSLPC_INFO *)link->priv)->stop = 1; | 708 | mgslpc_release((u_long)link); |
715 | mgslpc_release((u_long)link); | ||
716 | } | ||
717 | 709 | ||
718 | mgslpc_remove_device((MGSLPC_INFO *)link->priv); | 710 | mgslpc_remove_device((MGSLPC_INFO *)link->priv); |
719 | } | 711 | } |
720 | 712 | ||
721 | static int mgslpc_suspend(struct pcmcia_device *link) | 713 | static int mgslpc_suspend(struct pcmcia_device *link) |
@@ -1254,7 +1246,7 @@ static irqreturn_t mgslpc_isr(int irq, void *dev_id, struct pt_regs * regs) | |||
1254 | if (!info) | 1246 | if (!info) |
1255 | return IRQ_NONE; | 1247 | return IRQ_NONE; |
1256 | 1248 | ||
1257 | if (!(info->p_dev->state & DEV_CONFIG)) | 1249 | if (!(info->p_dev->_locked)) |
1258 | return IRQ_HANDLED; | 1250 | return IRQ_HANDLED; |
1259 | 1251 | ||
1260 | spin_lock(&info->lock); | 1252 | spin_lock(&info->lock); |