diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2008-08-02 09:30:31 -0400 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2008-08-22 19:22:00 -0400 |
commit | 8e2fc39ddea7fe8c6798837da282db88a09af793 (patch) | |
tree | 7cba37b5b86f4ff25562012a14e29424e3872de0 /drivers/scsi | |
parent | 498ac1899b62626bf6879a251d75c22ec564c559 (diff) |
pcmcia: pcmcia_config_loop() default CIS entry handling
Many drivers use the default CIS entry within their pcmcia_config_loop()
callback function. Therefore, factor the default CIS entry handling out.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/pcmcia/aha152x_stub.c | 5 | ||||
-rw-r--r-- | drivers/scsi/pcmcia/fdomain_stub.c | 5 | ||||
-rw-r--r-- | drivers/scsi/pcmcia/nsp_cs.c | 23 | ||||
-rw-r--r-- | drivers/scsi/pcmcia/qlogic_stub.c | 5 | ||||
-rw-r--r-- | drivers/scsi/pcmcia/sym53c500_cs.c | 1 |
5 files changed, 20 insertions, 19 deletions
diff --git a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c index 5e4d8e42ba0b..2ed3077b826a 100644 --- a/drivers/scsi/pcmcia/aha152x_stub.c +++ b/drivers/scsi/pcmcia/aha152x_stub.c | |||
@@ -141,8 +141,9 @@ static void aha152x_detach(struct pcmcia_device *link) | |||
141 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | 141 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) |
142 | 142 | ||
143 | static int aha152x_config_check(struct pcmcia_device *p_dev, | 143 | static int aha152x_config_check(struct pcmcia_device *p_dev, |
144 | cistpl_cftable_entry_t *cfg, | 144 | cistpl_cftable_entry_t *cfg, |
145 | void *priv_data) | 145 | cistpl_cftable_entry_t *dflt, |
146 | void *priv_data) | ||
146 | { | 147 | { |
147 | /* For New Media T&J, look for a SCSI window */ | 148 | /* For New Media T&J, look for a SCSI window */ |
148 | if (cfg->io.win[0].len >= 0x20) | 149 | if (cfg->io.win[0].len >= 0x20) |
diff --git a/drivers/scsi/pcmcia/fdomain_stub.c b/drivers/scsi/pcmcia/fdomain_stub.c index e3d6937c9200..2b6e92d7be07 100644 --- a/drivers/scsi/pcmcia/fdomain_stub.c +++ b/drivers/scsi/pcmcia/fdomain_stub.c | |||
@@ -124,8 +124,9 @@ static void fdomain_detach(struct pcmcia_device *link) | |||
124 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | 124 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) |
125 | 125 | ||
126 | static int fdomain_config_check(struct pcmcia_device *p_dev, | 126 | static int fdomain_config_check(struct pcmcia_device *p_dev, |
127 | cistpl_cftable_entry_t *cfg, | 127 | cistpl_cftable_entry_t *cfg, |
128 | void *priv_data) | 128 | cistpl_cftable_entry_t *dflt, |
129 | void *priv_data) | ||
129 | { | 130 | { |
130 | p_dev->io.BasePort1 = cfg->io.win[0].base; | 131 | p_dev->io.BasePort1 = cfg->io.win[0].base; |
131 | return pcmcia_request_io(p_dev, &p_dev->io); | 132 | return pcmcia_request_io(p_dev, &p_dev->io); |
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c index aee24b745dc9..aa4523462578 100644 --- a/drivers/scsi/pcmcia/nsp_cs.c +++ b/drivers/scsi/pcmcia/nsp_cs.c | |||
@@ -1612,17 +1612,15 @@ struct nsp_cs_configdata { | |||
1612 | nsp_hw_data *data; | 1612 | nsp_hw_data *data; |
1613 | win_req_t req; | 1613 | win_req_t req; |
1614 | config_info_t conf; | 1614 | config_info_t conf; |
1615 | cistpl_cftable_entry_t dflt; | ||
1616 | }; | 1615 | }; |
1617 | 1616 | ||
1618 | static int nsp_cs_config_check(struct pcmcia_device *p_dev, | 1617 | static int nsp_cs_config_check(struct pcmcia_device *p_dev, |
1619 | cistpl_cftable_entry_t *cfg, | 1618 | cistpl_cftable_entry_t *cfg, |
1619 | cistpl_cftable_entry_t *dflt, | ||
1620 | void *priv_data) | 1620 | void *priv_data) |
1621 | { | 1621 | { |
1622 | struct nsp_cs_configdata *cfg_mem = priv_data; | 1622 | struct nsp_cs_configdata *cfg_mem = priv_data; |
1623 | 1623 | ||
1624 | if (cfg->flags & CISTPL_CFTABLE_DEFAULT) | ||
1625 | memcpy(&cfg_mem->dflt, cfg, sizeof(cistpl_cftable_entry_t)); | ||
1626 | if (cfg->index == 0) | 1624 | if (cfg->index == 0) |
1627 | return -ENODEV; | 1625 | return -ENODEV; |
1628 | 1626 | ||
@@ -1637,28 +1635,27 @@ static int nsp_cs_config_check(struct pcmcia_device *p_dev, | |||
1637 | if (cfg->vcc.present & (1<<CISTPL_POWER_VNOM)) { | 1635 | if (cfg->vcc.present & (1<<CISTPL_POWER_VNOM)) { |
1638 | if (cfg_mem->conf.Vcc != cfg->vcc.param[CISTPL_POWER_VNOM]/10000) | 1636 | if (cfg_mem->conf.Vcc != cfg->vcc.param[CISTPL_POWER_VNOM]/10000) |
1639 | return -ENODEV; | 1637 | return -ENODEV; |
1640 | else if (cfg_mem->dflt.vcc.present & (1<<CISTPL_POWER_VNOM)) { | 1638 | else if (dflt->vcc.present & (1<<CISTPL_POWER_VNOM)) { |
1641 | if (cfg_mem->conf.Vcc != cfg_mem->dflt.vcc.param[CISTPL_POWER_VNOM]/10000) | 1639 | if (cfg_mem->conf.Vcc != dflt->vcc.param[CISTPL_POWER_VNOM]/10000) |
1642 | return -ENODEV; | 1640 | return -ENODEV; |
1643 | } | 1641 | } |
1644 | 1642 | ||
1645 | if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) { | 1643 | if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) { |
1646 | p_dev->conf.Vpp = | 1644 | p_dev->conf.Vpp = |
1647 | cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; | 1645 | cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; |
1648 | } else if (cfg_mem->dflt.vpp1.present & (1 << CISTPL_POWER_VNOM)) { | 1646 | } else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) { |
1649 | p_dev->conf.Vpp = | 1647 | p_dev->conf.Vpp = |
1650 | cfg_mem->dflt.vpp1.param[CISTPL_POWER_VNOM] / 10000; | 1648 | dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000; |
1651 | } | 1649 | } |
1652 | 1650 | ||
1653 | /* Do we need to allocate an interrupt? */ | 1651 | /* Do we need to allocate an interrupt? */ |
1654 | if (cfg->irq.IRQInfo1 || cfg_mem->dflt.irq.IRQInfo1) { | 1652 | if (cfg->irq.IRQInfo1 || dflt->irq.IRQInfo1) |
1655 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; | 1653 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; |
1656 | } | ||
1657 | 1654 | ||
1658 | /* IO window settings */ | 1655 | /* IO window settings */ |
1659 | p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; | 1656 | p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; |
1660 | if ((cfg->io.nwin > 0) || (cfg_mem->dflt.io.nwin > 0)) { | 1657 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { |
1661 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &cfg_mem->dflt.io; | 1658 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; |
1662 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 1659 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; |
1663 | if (!(io->flags & CISTPL_IO_8BIT)) | 1660 | if (!(io->flags & CISTPL_IO_8BIT)) |
1664 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | 1661 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; |
@@ -1677,10 +1674,10 @@ static int nsp_cs_config_check(struct pcmcia_device *p_dev, | |||
1677 | goto next_entry; | 1674 | goto next_entry; |
1678 | } | 1675 | } |
1679 | 1676 | ||
1680 | if ((cfg->mem.nwin > 0) || (cfg_mem->dflt.mem.nwin > 0)) { | 1677 | if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) { |
1681 | memreq_t map; | 1678 | memreq_t map; |
1682 | cistpl_mem_t *mem = | 1679 | cistpl_mem_t *mem = |
1683 | (cfg->mem.nwin) ? &cfg->mem : &cfg_mem->dflt.mem; | 1680 | (cfg->mem.nwin) ? &cfg->mem : &dflt->mem; |
1684 | cfg_mem->req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM; | 1681 | cfg_mem->req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM; |
1685 | cfg_mem->req.Attributes |= WIN_ENABLE; | 1682 | cfg_mem->req.Attributes |= WIN_ENABLE; |
1686 | cfg_mem->req.Base = mem->win[0].host_addr; | 1683 | cfg_mem->req.Base = mem->win[0].host_addr; |
diff --git a/drivers/scsi/pcmcia/qlogic_stub.c b/drivers/scsi/pcmcia/qlogic_stub.c index a361275b20a3..da6b3603198b 100644 --- a/drivers/scsi/pcmcia/qlogic_stub.c +++ b/drivers/scsi/pcmcia/qlogic_stub.c | |||
@@ -196,8 +196,9 @@ static void qlogic_detach(struct pcmcia_device *link) | |||
196 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | 196 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) |
197 | 197 | ||
198 | static int qlogic_config_check(struct pcmcia_device *p_dev, | 198 | static int qlogic_config_check(struct pcmcia_device *p_dev, |
199 | cistpl_cftable_entry_t *cfg, | 199 | cistpl_cftable_entry_t *cfg, |
200 | void *priv_data) | 200 | cistpl_cftable_entry_t *dflt, |
201 | void *priv_data) | ||
201 | { | 202 | { |
202 | p_dev->io.BasePort1 = cfg->io.win[0].base; | 203 | p_dev->io.BasePort1 = cfg->io.win[0].base; |
203 | p_dev->io.NumPorts1 = cfg->io.win[0].len; | 204 | p_dev->io.NumPorts1 = cfg->io.win[0].len; |
diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c index 23a5219051a9..eba193134dfa 100644 --- a/drivers/scsi/pcmcia/sym53c500_cs.c +++ b/drivers/scsi/pcmcia/sym53c500_cs.c | |||
@@ -702,6 +702,7 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | |||
702 | 702 | ||
703 | static int SYM53C500_config_check(struct pcmcia_device *p_dev, | 703 | static int SYM53C500_config_check(struct pcmcia_device *p_dev, |
704 | cistpl_cftable_entry_t *cfg, | 704 | cistpl_cftable_entry_t *cfg, |
705 | cistpl_cftable_entry_t *dflt, | ||
705 | void *priv_data) | 706 | void *priv_data) |
706 | { | 707 | { |
707 | p_dev->io.BasePort1 = cfg->io.win[0].base; | 708 | p_dev->io.BasePort1 = cfg->io.win[0].base; |