diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-03-31 10:26:06 -0500 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-03-31 10:26:06 -0500 |
commit | 15b99ac1729503db9e6dc642a50b9b6cb3bf51f9 (patch) | |
tree | cfb8897487beba502aac2b28bc35066a87e34299 /drivers/scsi/pcmcia/nsp_cs.c | |
parent | fba395eee7d3f342ca739c20f5b3ee635d0420a0 (diff) |
[PATCH] pcmcia: add return value to _config() functions
Most of the driver initialization isn't done in the .probe function, but in
the internal _config() functions. Make them return a value, so that .probe
can properly report whether the probing of the device succeeded or not.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/scsi/pcmcia/nsp_cs.c')
-rw-r--r-- | drivers/scsi/pcmcia/nsp_cs.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c index ce4d7d868d27..deec1c3a2619 100644 --- a/drivers/scsi/pcmcia/nsp_cs.c +++ b/drivers/scsi/pcmcia/nsp_cs.c | |||
@@ -1593,10 +1593,11 @@ static int nsp_eh_host_reset(Scsi_Cmnd *SCpnt) | |||
1593 | configure the card at this point -- we wait until we receive a | 1593 | configure the card at this point -- we wait until we receive a |
1594 | card insertion event. | 1594 | card insertion event. |
1595 | ======================================================================*/ | 1595 | ======================================================================*/ |
1596 | static int nsp_cs_attach(struct pcmcia_device *link) | 1596 | static int nsp_cs_probe(struct pcmcia_device *link) |
1597 | { | 1597 | { |
1598 | scsi_info_t *info; | 1598 | scsi_info_t *info; |
1599 | nsp_hw_data *data = &nsp_data_base; | 1599 | nsp_hw_data *data = &nsp_data_base; |
1600 | int ret; | ||
1600 | 1601 | ||
1601 | nsp_dbg(NSP_DEBUG_INIT, "in"); | 1602 | nsp_dbg(NSP_DEBUG_INIT, "in"); |
1602 | 1603 | ||
@@ -1630,10 +1631,10 @@ static int nsp_cs_attach(struct pcmcia_device *link) | |||
1630 | link->conf.Present = PRESENT_OPTION; | 1631 | link->conf.Present = PRESENT_OPTION; |
1631 | 1632 | ||
1632 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 1633 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
1633 | nsp_cs_config(link); | 1634 | ret = nsp_cs_config(link); |
1634 | 1635 | ||
1635 | nsp_dbg(NSP_DEBUG_INIT, "link=0x%p", link); | 1636 | nsp_dbg(NSP_DEBUG_INIT, "link=0x%p", link); |
1636 | return 0; | 1637 | return ret; |
1637 | } /* nsp_cs_attach */ | 1638 | } /* nsp_cs_attach */ |
1638 | 1639 | ||
1639 | 1640 | ||
@@ -1665,8 +1666,9 @@ static void nsp_cs_detach(struct pcmcia_device *link) | |||
1665 | #define CS_CHECK(fn, ret) \ | 1666 | #define CS_CHECK(fn, ret) \ |
1666 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | 1667 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) |
1667 | /*====================================================================*/ | 1668 | /*====================================================================*/ |
1668 | static void nsp_cs_config(struct pcmcia_device *link) | 1669 | static int nsp_cs_config(struct pcmcia_device *link) |
1669 | { | 1670 | { |
1671 | int ret; | ||
1670 | scsi_info_t *info = link->priv; | 1672 | scsi_info_t *info = link->priv; |
1671 | tuple_t tuple; | 1673 | tuple_t tuple; |
1672 | cisparse_t parse; | 1674 | cisparse_t parse; |
@@ -1842,7 +1844,10 @@ static void nsp_cs_config(struct pcmcia_device *link) | |||
1842 | 1844 | ||
1843 | 1845 | ||
1844 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,74)) | 1846 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,74)) |
1845 | scsi_add_host (host, NULL); | 1847 | ret = scsi_add_host (host, NULL); |
1848 | if (ret) | ||
1849 | goto cs_failed; | ||
1850 | |||
1846 | scsi_scan_host(host); | 1851 | scsi_scan_host(host); |
1847 | 1852 | ||
1848 | snprintf(info->node.dev_name, sizeof(info->node.dev_name), "scsi%d", host->host_no); | 1853 | snprintf(info->node.dev_name, sizeof(info->node.dev_name), "scsi%d", host->host_no); |
@@ -1917,14 +1922,14 @@ static void nsp_cs_config(struct pcmcia_device *link) | |||
1917 | printk("\n"); | 1922 | printk("\n"); |
1918 | 1923 | ||
1919 | link->state &= ~DEV_CONFIG_PENDING; | 1924 | link->state &= ~DEV_CONFIG_PENDING; |
1920 | return; | 1925 | return 0; |
1921 | 1926 | ||
1922 | cs_failed: | 1927 | cs_failed: |
1923 | nsp_dbg(NSP_DEBUG_INIT, "config fail"); | 1928 | nsp_dbg(NSP_DEBUG_INIT, "config fail"); |
1924 | cs_error(link, last_fn, last_ret); | 1929 | cs_error(link, last_fn, last_ret); |
1925 | nsp_cs_release(link); | 1930 | nsp_cs_release(link); |
1926 | 1931 | ||
1927 | return; | 1932 | return -ENODEV; |
1928 | } /* nsp_cs_config */ | 1933 | } /* nsp_cs_config */ |
1929 | #undef CS_CHECK | 1934 | #undef CS_CHECK |
1930 | 1935 | ||
@@ -2033,7 +2038,7 @@ static struct pcmcia_driver nsp_driver = { | |||
2033 | .drv = { | 2038 | .drv = { |
2034 | .name = "nsp_cs", | 2039 | .name = "nsp_cs", |
2035 | }, | 2040 | }, |
2036 | .probe = nsp_cs_attach, | 2041 | .probe = nsp_cs_probe, |
2037 | .remove = nsp_cs_detach, | 2042 | .remove = nsp_cs_detach, |
2038 | .id_table = nsp_cs_ids, | 2043 | .id_table = nsp_cs_ids, |
2039 | .suspend = nsp_cs_suspend, | 2044 | .suspend = nsp_cs_suspend, |