aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/pcmcia/nsp_cs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/pcmcia/nsp_cs.c')
-rw-r--r--drivers/scsi/pcmcia/nsp_cs.c50
1 files changed, 22 insertions, 28 deletions
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c
index 23548fbf4898..ce4d7d868d27 100644
--- a/drivers/scsi/pcmcia/nsp_cs.c
+++ b/drivers/scsi/pcmcia/nsp_cs.c
@@ -1593,11 +1593,10 @@ 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======================================================================*/
1596static int nsp_cs_attach(struct pcmcia_device *p_dev) 1596static int nsp_cs_attach(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 dev_link_t *link = dev_to_instance(p_dev);
1601 1600
1602 nsp_dbg(NSP_DEBUG_INIT, "in"); 1601 nsp_dbg(NSP_DEBUG_INIT, "in");
1603 1602
@@ -1605,7 +1604,7 @@ static int nsp_cs_attach(struct pcmcia_device *p_dev)
1605 info = kmalloc(sizeof(*info), GFP_KERNEL); 1604 info = kmalloc(sizeof(*info), GFP_KERNEL);
1606 if (info == NULL) { return -ENOMEM; } 1605 if (info == NULL) { return -ENOMEM; }
1607 memset(info, 0, sizeof(*info)); 1606 memset(info, 0, sizeof(*info));
1608 info->p_dev = p_dev; 1607 info->p_dev = link;
1609 link->priv = info; 1608 link->priv = info;
1610 data->ScsiInfo = info; 1609 data->ScsiInfo = info;
1611 1610
@@ -1644,10 +1643,8 @@ static int nsp_cs_attach(struct pcmcia_device *p_dev)
1644 structures are freed. Otherwise, the structures will be freed 1643 structures are freed. Otherwise, the structures will be freed
1645 when the device is released. 1644 when the device is released.
1646======================================================================*/ 1645======================================================================*/
1647static void nsp_cs_detach(struct pcmcia_device *p_dev) 1646static void nsp_cs_detach(struct pcmcia_device *link)
1648{ 1647{
1649 dev_link_t *link = dev_to_instance(p_dev);
1650
1651 nsp_dbg(NSP_DEBUG_INIT, "in, link=0x%p", link); 1648 nsp_dbg(NSP_DEBUG_INIT, "in, link=0x%p", link);
1652 1649
1653 if (link->state & DEV_CONFIG) { 1650 if (link->state & DEV_CONFIG) {
@@ -1668,9 +1665,8 @@ static void nsp_cs_detach(struct pcmcia_device *p_dev)
1668#define CS_CHECK(fn, ret) \ 1665#define CS_CHECK(fn, ret) \
1669do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) 1666do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
1670/*====================================================================*/ 1667/*====================================================================*/
1671static void nsp_cs_config(dev_link_t *link) 1668static void nsp_cs_config(struct pcmcia_device *link)
1672{ 1669{
1673 client_handle_t handle = link->handle;
1674 scsi_info_t *info = link->priv; 1670 scsi_info_t *info = link->priv;
1675 tuple_t tuple; 1671 tuple_t tuple;
1676 cisparse_t parse; 1672 cisparse_t parse;
@@ -1694,9 +1690,9 @@ static void nsp_cs_config(dev_link_t *link)
1694 tuple.TupleData = tuple_data; 1690 tuple.TupleData = tuple_data;
1695 tuple.TupleDataMax = sizeof(tuple_data); 1691 tuple.TupleDataMax = sizeof(tuple_data);
1696 tuple.TupleOffset = 0; 1692 tuple.TupleOffset = 0;
1697 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 1693 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
1698 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); 1694 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
1699 CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); 1695 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
1700 link->conf.ConfigBase = parse.config.base; 1696 link->conf.ConfigBase = parse.config.base;
1701 link->conf.Present = parse.config.rmask[0]; 1697 link->conf.Present = parse.config.rmask[0];
1702 1698
@@ -1704,15 +1700,15 @@ static void nsp_cs_config(dev_link_t *link)
1704 link->state |= DEV_CONFIG; 1700 link->state |= DEV_CONFIG;
1705 1701
1706 /* Look up the current Vcc */ 1702 /* Look up the current Vcc */
1707 CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(handle, &conf)); 1703 CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &conf));
1708 1704
1709 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; 1705 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
1710 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 1706 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
1711 while (1) { 1707 while (1) {
1712 cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); 1708 cistpl_cftable_entry_t *cfg = &(parse.cftable_entry);
1713 1709
1714 if (pcmcia_get_tuple_data(handle, &tuple) != 0 || 1710 if (pcmcia_get_tuple_data(link, &tuple) != 0 ||
1715 pcmcia_parse_tuple(handle, &tuple, &parse) != 0) 1711 pcmcia_parse_tuple(link, &tuple, &parse) != 0)
1716 goto next_entry; 1712 goto next_entry;
1717 1713
1718 if (cfg->flags & CISTPL_CFTABLE_DEFAULT) { dflt = *cfg; } 1714 if (cfg->flags & CISTPL_CFTABLE_DEFAULT) { dflt = *cfg; }
@@ -1768,7 +1764,7 @@ static void nsp_cs_config(dev_link_t *link)
1768 link->io.NumPorts2 = io->win[1].len; 1764 link->io.NumPorts2 = io->win[1].len;
1769 } 1765 }
1770 /* This reserves IO space but doesn't actually enable it */ 1766 /* This reserves IO space but doesn't actually enable it */
1771 if (pcmcia_request_io(link->handle, &link->io) != 0) 1767 if (pcmcia_request_io(link, &link->io) != 0)
1772 goto next_entry; 1768 goto next_entry;
1773 } 1769 }
1774 1770
@@ -1783,7 +1779,7 @@ static void nsp_cs_config(dev_link_t *link)
1783 req.Size = 0x1000; 1779 req.Size = 0x1000;
1784 } 1780 }
1785 req.AccessSpeed = 0; 1781 req.AccessSpeed = 0;
1786 if (pcmcia_request_window(&link->handle, &req, &link->win) != 0) 1782 if (pcmcia_request_window(&link, &req, &link->win) != 0)
1787 goto next_entry; 1783 goto next_entry;
1788 map.Page = 0; map.CardOffset = mem->win[0].card_addr; 1784 map.Page = 0; map.CardOffset = mem->win[0].card_addr;
1789 if (pcmcia_map_mem_page(link->win, &map) != 0) 1785 if (pcmcia_map_mem_page(link->win, &map) != 0)
@@ -1797,14 +1793,14 @@ static void nsp_cs_config(dev_link_t *link)
1797 1793
1798 next_entry: 1794 next_entry:
1799 nsp_dbg(NSP_DEBUG_INIT, "next"); 1795 nsp_dbg(NSP_DEBUG_INIT, "next");
1800 pcmcia_disable_device(handle); 1796 pcmcia_disable_device(link);
1801 CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(handle, &tuple)); 1797 CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(link, &tuple));
1802 } 1798 }
1803 1799
1804 if (link->conf.Attributes & CONF_ENABLE_IRQ) { 1800 if (link->conf.Attributes & CONF_ENABLE_IRQ) {
1805 CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq)); 1801 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
1806 } 1802 }
1807 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(handle, &link->conf)); 1803 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
1808 1804
1809 if (free_ports) { 1805 if (free_ports) {
1810 if (link->io.BasePort1) { 1806 if (link->io.BasePort1) {
@@ -1925,7 +1921,7 @@ static void nsp_cs_config(dev_link_t *link)
1925 1921
1926 cs_failed: 1922 cs_failed:
1927 nsp_dbg(NSP_DEBUG_INIT, "config fail"); 1923 nsp_dbg(NSP_DEBUG_INIT, "config fail");
1928 cs_error(link->handle, last_fn, last_ret); 1924 cs_error(link, last_fn, last_ret);
1929 nsp_cs_release(link); 1925 nsp_cs_release(link);
1930 1926
1931 return; 1927 return;
@@ -1938,7 +1934,7 @@ static void nsp_cs_config(dev_link_t *link)
1938 device, and release the PCMCIA configuration. If the device is 1934 device, and release the PCMCIA configuration. If the device is
1939 still open, this will be postponed until it is closed. 1935 still open, this will be postponed until it is closed.
1940======================================================================*/ 1936======================================================================*/
1941static void nsp_cs_release(dev_link_t *link) 1937static void nsp_cs_release(struct pcmcia_device *link)
1942{ 1938{
1943 scsi_info_t *info = link->priv; 1939 scsi_info_t *info = link->priv;
1944 nsp_hw_data *data = NULL; 1940 nsp_hw_data *data = NULL;
@@ -1966,7 +1962,7 @@ static void nsp_cs_release(dev_link_t *link)
1966 iounmap((void *)(data->MmioAddress)); 1962 iounmap((void *)(data->MmioAddress));
1967 } 1963 }
1968 } 1964 }
1969 pcmcia_disable_device(link->handle); 1965 pcmcia_disable_device(link);
1970 1966
1971#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,2)) 1967#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,2))
1972 if (info->host != NULL) { 1968 if (info->host != NULL) {
@@ -1975,9 +1971,8 @@ static void nsp_cs_release(dev_link_t *link)
1975#endif 1971#endif
1976} /* nsp_cs_release */ 1972} /* nsp_cs_release */
1977 1973
1978static int nsp_cs_suspend(struct pcmcia_device *dev) 1974static int nsp_cs_suspend(struct pcmcia_device *link)
1979{ 1975{
1980 dev_link_t *link = dev_to_instance(dev);
1981 scsi_info_t *info = link->priv; 1976 scsi_info_t *info = link->priv;
1982 nsp_hw_data *data; 1977 nsp_hw_data *data;
1983 1978
@@ -1996,9 +1991,8 @@ static int nsp_cs_suspend(struct pcmcia_device *dev)
1996 return 0; 1991 return 0;
1997} 1992}
1998 1993
1999static int nsp_cs_resume(struct pcmcia_device *dev) 1994static int nsp_cs_resume(struct pcmcia_device *link)
2000{ 1995{
2001 dev_link_t *link = dev_to_instance(dev);
2002 scsi_info_t *info = link->priv; 1996 scsi_info_t *info = link->priv;
2003 nsp_hw_data *data; 1997 nsp_hw_data *data;
2004 1998