summaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2006-03-02 00:09:29 +0100
committerDominik Brodowski <linux@dominikbrodowski.net>2006-03-31 17:26:33 +0200
commite2d4096365e06b9a3799afbadc28b4519c0b3526 (patch)
tree90ec691d71f9c0309048714e359b8ba351b533f7 /drivers/scsi
parentf6fbe01ac976f3ec618cd5fb71ad9ce2cfa7ab2b (diff)
downloadblackbird-obmc-linux-e2d4096365e06b9a3799afbadc28b4519c0b3526.tar.gz
blackbird-obmc-linux-e2d4096365e06b9a3799afbadc28b4519c0b3526.zip
[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/scsi')
-rw-r--r--drivers/scsi/pcmcia/aha152x_stub.c8
-rw-r--r--drivers/scsi/pcmcia/fdomain_stub.c11
-rw-r--r--drivers/scsi/pcmcia/nsp_cs.c23
-rw-r--r--drivers/scsi/pcmcia/qlogic_stub.c33
-rw-r--r--drivers/scsi/pcmcia/sym53c500_cs.c35
5 files changed, 30 insertions, 80 deletions
diff --git a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c
index 7caa700cf189..ee449b29fc82 100644
--- a/drivers/scsi/pcmcia/aha152x_stub.c
+++ b/drivers/scsi/pcmcia/aha152x_stub.c
@@ -122,7 +122,6 @@ static int aha152x_probe(struct pcmcia_device *link)
link->conf.IntType = INT_MEMORY_AND_IO;
link->conf.Present = PRESENT_OPTION;
- link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
return aha152x_config_cs(link);
} /* aha152x_attach */
@@ -132,8 +131,7 @@ static void aha152x_detach(struct pcmcia_device *link)
{
DEBUG(0, "aha152x_detach(0x%p)\n", link);
- if (link->state & DEV_CONFIG)
- aha152x_release_cs(link);
+ aha152x_release_cs(link);
/* Unlink device structure, free bits */
kfree(link->priv);
@@ -165,9 +163,6 @@ static int aha152x_config_cs(struct pcmcia_device *link)
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
link->conf.ConfigBase = parse.config.base;
- /* Configure card */
- link->state |= DEV_CONFIG;
-
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
while (1) {
@@ -216,7 +211,6 @@ static int aha152x_config_cs(struct pcmcia_device *link)
link->dev_node = &info->node;
info->host = host;
- link->state &= ~DEV_CONFIG_PENDING;
return 0;
cs_failed:
diff --git a/drivers/scsi/pcmcia/fdomain_stub.c b/drivers/scsi/pcmcia/fdomain_stub.c
index 80afd3e879cc..85f7ffac19a0 100644
--- a/drivers/scsi/pcmcia/fdomain_stub.c
+++ b/drivers/scsi/pcmcia/fdomain_stub.c
@@ -105,7 +105,6 @@ static int fdomain_probe(struct pcmcia_device *link)
link->conf.IntType = INT_MEMORY_AND_IO;
link->conf.Present = PRESENT_OPTION;
- link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
return fdomain_config(link);
} /* fdomain_attach */
@@ -115,8 +114,7 @@ static void fdomain_detach(struct pcmcia_device *link)
{
DEBUG(0, "fdomain_detach(0x%p)\n", link);
- if (link->state & DEV_CONFIG)
- fdomain_release(link);
+ fdomain_release(link);
kfree(link->priv);
} /* fdomain_detach */
@@ -147,9 +145,6 @@ static int fdomain_config(struct pcmcia_device *link)
CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
link->conf.ConfigBase = parse.config.base;
- /* Configure card */
- link->state |= DEV_CONFIG;
-
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
while (1) {
@@ -188,7 +183,6 @@ static int fdomain_config(struct pcmcia_device *link)
link->dev_node = &info->node;
info->host = host;
- link->state &= ~DEV_CONFIG_PENDING;
return 0;
cs_failed:
@@ -214,8 +208,7 @@ static void fdomain_release(struct pcmcia_device *link)
static int fdomain_resume(struct pcmcia_device *link)
{
- if (link->state & DEV_CONFIG)
- fdomain_16x0_bus_reset(NULL);
+ fdomain_16x0_bus_reset(NULL);
return 0;
}
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c
index deec1c3a2619..231f9c311c69 100644
--- a/drivers/scsi/pcmcia/nsp_cs.c
+++ b/drivers/scsi/pcmcia/nsp_cs.c
@@ -1630,7 +1630,6 @@ static int nsp_cs_probe(struct pcmcia_device *link)
link->conf.IntType = INT_MEMORY_AND_IO;
link->conf.Present = PRESENT_OPTION;
- link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
ret = nsp_cs_config(link);
nsp_dbg(NSP_DEBUG_INIT, "link=0x%p", link);
@@ -1648,10 +1647,8 @@ static void nsp_cs_detach(struct pcmcia_device *link)
{
nsp_dbg(NSP_DEBUG_INIT, "in, link=0x%p", link);
- if (link->state & DEV_CONFIG) {
- ((scsi_info_t *)link->priv)->stop = 1;
- nsp_cs_release(link);
- }
+ ((scsi_info_t *)link->priv)->stop = 1;
+ nsp_cs_release(link);
kfree(link->priv);
link->priv = NULL;
@@ -1698,9 +1695,6 @@ static int nsp_cs_config(struct pcmcia_device *link)
link->conf.ConfigBase = parse.config.base;
link->conf.Present = parse.config.rmask[0];
- /* Configure card */
- link->state |= DEV_CONFIG;
-
/* Look up the current Vcc */
CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &conf));
@@ -1921,7 +1915,6 @@ static int nsp_cs_config(struct pcmcia_device *link)
req.Base+req.Size-1);
printk("\n");
- link->state &= ~DEV_CONFIG_PENDING;
return 0;
cs_failed:
@@ -2071,19 +2064,7 @@ static int __init nsp_cs_init(void)
static void __exit nsp_cs_exit(void)
{
nsp_msg(KERN_INFO, "unloading...");
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,68))
pcmcia_unregister_driver(&nsp_driver);
-#else
- unregister_pcmcia_driver(&dev_info);
- /* XXX: this really needs to move into generic code.. */
- while (dev_list != NULL) {
- if (dev_list->state & DEV_CONFIG) {
- nsp_cs_release(dev_list);
- }
- nsp_cs_detach(dev_list);
- }
-#endif
}
diff --git a/drivers/scsi/pcmcia/qlogic_stub.c b/drivers/scsi/pcmcia/qlogic_stub.c
index 61c2eb03a9b5..86c2ac6ae623 100644
--- a/drivers/scsi/pcmcia/qlogic_stub.c
+++ b/drivers/scsi/pcmcia/qlogic_stub.c
@@ -178,7 +178,6 @@ static int qlogic_probe(struct pcmcia_device *link)
link->conf.IntType = INT_MEMORY_AND_IO;
link->conf.Present = PRESENT_OPTION;
- link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
return qlogic_config(link);
} /* qlogic_attach */
@@ -188,9 +187,7 @@ static void qlogic_detach(struct pcmcia_device *link)
{
DEBUG(0, "qlogic_detach(0x%p)\n", link);
- if (link->state & DEV_CONFIG)
- qlogic_release(link);
-
+ qlogic_release(link);
kfree(link->priv);
} /* qlogic_detach */
@@ -224,9 +221,6 @@ static int qlogic_config(struct pcmcia_device * link)
if ((pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) && (pcmcia_get_tuple_data(link, &tuple) == CS_SUCCESS))
info->manf_id = le16_to_cpu(tuple.TupleData[0]);
- /* Configure card */
- link->state |= DEV_CONFIG;
-
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
while (1) {
@@ -272,7 +266,6 @@ static int qlogic_config(struct pcmcia_device * link)
link->dev_node = &info->node;
info->host = host;
- link->state &= ~DEV_CONFIG_PENDING;
return 0;
cs_failed:
@@ -302,20 +295,18 @@ static void qlogic_release(struct pcmcia_device *link)
static int qlogic_resume(struct pcmcia_device *link)
{
- if (link->state & DEV_CONFIG) {
- scsi_info_t *info = link->priv;
-
- pcmcia_request_configuration(link, &link->conf);
- if ((info->manf_id == MANFID_MACNICA) ||
- (info->manf_id == MANFID_PIONEER) ||
- (info->manf_id == 0x0098)) {
- outb(0x80, link->io.BasePort1 + 0xd);
- outb(0x24, link->io.BasePort1 + 0x9);
- outb(0x04, link->io.BasePort1 + 0xd);
- }
- /* Ugggglllyyyy!!! */
- qlogicfas408_bus_reset(NULL);
+ scsi_info_t *info = link->priv;
+
+ pcmcia_request_configuration(link, &link->conf);
+ if ((info->manf_id == MANFID_MACNICA) ||
+ (info->manf_id == MANFID_PIONEER) ||
+ (info->manf_id == 0x0098)) {
+ outb(0x80, link->io.BasePort1 + 0xd);
+ outb(0x24, link->io.BasePort1 + 0x9);
+ outb(0x04, link->io.BasePort1 + 0xd);
}
+ /* Ugggglllyyyy!!! */
+ qlogicfas408_bus_reset(NULL);
return 0;
}
diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c
index b4432206a881..9f59827707f0 100644
--- a/drivers/scsi/pcmcia/sym53c500_cs.c
+++ b/drivers/scsi/pcmcia/sym53c500_cs.c
@@ -736,9 +736,6 @@ SYM53C500_config(struct pcmcia_device *link)
(pcmcia_get_tuple_data(link, &tuple) == CS_SUCCESS))
info->manf_id = le16_to_cpu(tuple.TupleData[0]);
- /* Configure card */
- link->state |= DEV_CONFIG;
-
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
while (1) {
@@ -836,7 +833,6 @@ next_entry:
scsi_scan_host(host);
- link->state &= ~DEV_CONFIG_PENDING;
return 0;
err_free_irq:
@@ -846,7 +842,6 @@ err_free_scsi:
err_release:
release_region(port_base, 0x10);
printk(KERN_INFO "sym53c500_cs: no SCSI devices found\n");
- link->state &= ~DEV_CONFIG_PENDING;
return -ENODEV;
cs_failed:
@@ -859,21 +854,19 @@ static int sym53c500_resume(struct pcmcia_device *link)
{
struct scsi_info_t *info = link->priv;
- if (link->state & DEV_CONFIG) {
- /* See earlier comment about manufacturer IDs. */
- if ((info->manf_id == MANFID_MACNICA) ||
- (info->manf_id == MANFID_PIONEER) ||
- (info->manf_id == 0x0098)) {
- outb(0x80, link->io.BasePort1 + 0xd);
- outb(0x24, link->io.BasePort1 + 0x9);
- outb(0x04, link->io.BasePort1 + 0xd);
- }
- /*
- * If things don't work after a "resume",
- * this is a good place to start looking.
- */
- SYM53C500_int_host_reset(link->io.BasePort1);
+ /* See earlier comment about manufacturer IDs. */
+ if ((info->manf_id == MANFID_MACNICA) ||
+ (info->manf_id == MANFID_PIONEER) ||
+ (info->manf_id == 0x0098)) {
+ outb(0x80, link->io.BasePort1 + 0xd);
+ outb(0x24, link->io.BasePort1 + 0x9);
+ outb(0x04, link->io.BasePort1 + 0xd);
}
+ /*
+ * If things don't work after a "resume",
+ * this is a good place to start looking.
+ */
+ SYM53C500_int_host_reset(link->io.BasePort1);
return 0;
}
@@ -883,8 +876,7 @@ SYM53C500_detach(struct pcmcia_device *link)
{
DEBUG(0, "SYM53C500_detach(0x%p)\n", link);
- if (link->state & DEV_CONFIG)
- SYM53C500_release(link);
+ SYM53C500_release(link);
kfree(link->priv);
link->priv = NULL;
@@ -913,7 +905,6 @@ SYM53C500_probe(struct pcmcia_device *link)
link->conf.IntType = INT_MEMORY_AND_IO;
link->conf.Present = PRESENT_OPTION;
- link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
return SYM53C500_config(link);
} /* SYM53C500_attach */
OpenPOWER on IntegriCloud