diff options
Diffstat (limited to 'drivers/net/wireless/wl3501_cs.c')
-rw-r--r-- | drivers/net/wireless/wl3501_cs.c | 67 |
1 files changed, 31 insertions, 36 deletions
diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c index 4b054f54e9d5..752d22260080 100644 --- a/drivers/net/wireless/wl3501_cs.c +++ b/drivers/net/wireless/wl3501_cs.c | |||
@@ -103,8 +103,8 @@ module_param(pc_debug, int, 0); | |||
103 | * release a socket, in response to card insertion and ejection events. They | 103 | * release a socket, in response to card insertion and ejection events. They |
104 | * are invoked from the wl24 event handler. | 104 | * are invoked from the wl24 event handler. |
105 | */ | 105 | */ |
106 | static void wl3501_config(dev_link_t *link); | 106 | static void wl3501_config(struct pcmcia_device *link); |
107 | static void wl3501_release(dev_link_t *link); | 107 | static void wl3501_release(struct pcmcia_device *link); |
108 | 108 | ||
109 | /* | 109 | /* |
110 | * The dev_info variable is the "key" that is used to match up this | 110 | * The dev_info variable is the "key" that is used to match up this |
@@ -1270,7 +1270,7 @@ static int wl3501_close(struct net_device *dev) | |||
1270 | struct wl3501_card *this = dev->priv; | 1270 | struct wl3501_card *this = dev->priv; |
1271 | int rc = -ENODEV; | 1271 | int rc = -ENODEV; |
1272 | unsigned long flags; | 1272 | unsigned long flags; |
1273 | dev_link_t *link; | 1273 | struct pcmcia_device *link; |
1274 | link = this->p_dev; | 1274 | link = this->p_dev; |
1275 | 1275 | ||
1276 | spin_lock_irqsave(&this->lock, flags); | 1276 | spin_lock_irqsave(&this->lock, flags); |
@@ -1383,7 +1383,7 @@ static int wl3501_open(struct net_device *dev) | |||
1383 | int rc = -ENODEV; | 1383 | int rc = -ENODEV; |
1384 | struct wl3501_card *this = dev->priv; | 1384 | struct wl3501_card *this = dev->priv; |
1385 | unsigned long flags; | 1385 | unsigned long flags; |
1386 | dev_link_t *link; | 1386 | struct pcmcia_device *link; |
1387 | link = this->p_dev; | 1387 | link = this->p_dev; |
1388 | 1388 | ||
1389 | spin_lock_irqsave(&this->lock, flags); | 1389 | spin_lock_irqsave(&this->lock, flags); |
@@ -1477,9 +1477,8 @@ static struct ethtool_ops ops = { | |||
1477 | * Services. If it has been released, all local data structures are freed. | 1477 | * Services. If it has been released, all local data structures are freed. |
1478 | * Otherwise, the structures will be freed when the device is released. | 1478 | * Otherwise, the structures will be freed when the device is released. |
1479 | */ | 1479 | */ |
1480 | static void wl3501_detach(struct pcmcia_device *p_dev) | 1480 | static void wl3501_detach(struct pcmcia_device *link) |
1481 | { | 1481 | { |
1482 | dev_link_t *link = dev_to_instance(p_dev); | ||
1483 | struct net_device *dev = link->priv; | 1482 | struct net_device *dev = link->priv; |
1484 | 1483 | ||
1485 | /* If the device is currently configured and active, we won't actually | 1484 | /* If the device is currently configured and active, we won't actually |
@@ -1925,23 +1924,22 @@ static int wl3501_attach(struct pcmcia_device *p_dev) | |||
1925 | { | 1924 | { |
1926 | struct net_device *dev; | 1925 | struct net_device *dev; |
1927 | struct wl3501_card *this; | 1926 | struct wl3501_card *this; |
1928 | dev_link_t *link = dev_to_instance(p_dev); | ||
1929 | 1927 | ||
1930 | /* The io structure describes IO port mapping */ | 1928 | /* The io structure describes IO port mapping */ |
1931 | link->io.NumPorts1 = 16; | 1929 | p_dev->io.NumPorts1 = 16; |
1932 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 1930 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; |
1933 | link->io.IOAddrLines = 5; | 1931 | p_dev->io.IOAddrLines = 5; |
1934 | 1932 | ||
1935 | /* Interrupt setup */ | 1933 | /* Interrupt setup */ |
1936 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT; | 1934 | p_dev->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT; |
1937 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | 1935 | p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID; |
1938 | link->irq.Handler = wl3501_interrupt; | 1936 | p_dev->irq.Handler = wl3501_interrupt; |
1939 | 1937 | ||
1940 | /* General socket configuration */ | 1938 | /* General socket configuration */ |
1941 | link->conf.Attributes = CONF_ENABLE_IRQ; | 1939 | p_dev->conf.Attributes = CONF_ENABLE_IRQ; |
1942 | link->conf.IntType = INT_MEMORY_AND_IO; | 1940 | p_dev->conf.IntType = INT_MEMORY_AND_IO; |
1943 | link->conf.ConfigIndex = 1; | 1941 | p_dev->conf.ConfigIndex = 1; |
1944 | link->conf.Present = PRESENT_OPTION; | 1942 | p_dev->conf.Present = PRESENT_OPTION; |
1945 | 1943 | ||
1946 | dev = alloc_etherdev(sizeof(struct wl3501_card)); | 1944 | dev = alloc_etherdev(sizeof(struct wl3501_card)); |
1947 | if (!dev) | 1945 | if (!dev) |
@@ -1959,9 +1957,9 @@ static int wl3501_attach(struct pcmcia_device *p_dev) | |||
1959 | dev->wireless_handlers = (struct iw_handler_def *)&wl3501_handler_def; | 1957 | dev->wireless_handlers = (struct iw_handler_def *)&wl3501_handler_def; |
1960 | SET_ETHTOOL_OPS(dev, &ops); | 1958 | SET_ETHTOOL_OPS(dev, &ops); |
1961 | netif_stop_queue(dev); | 1959 | netif_stop_queue(dev); |
1962 | link->priv = link->irq.Instance = dev; | 1960 | p_dev->priv = p_dev->irq.Instance = dev; |
1963 | 1961 | ||
1964 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 1962 | p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
1965 | wl3501_config(p_dev); | 1963 | wl3501_config(p_dev); |
1966 | 1964 | ||
1967 | return 0; | 1965 | return 0; |
@@ -1980,11 +1978,10 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | |||
1980 | * received, to configure the PCMCIA socket, and to make the ethernet device | 1978 | * received, to configure the PCMCIA socket, and to make the ethernet device |
1981 | * available to the system. | 1979 | * available to the system. |
1982 | */ | 1980 | */ |
1983 | static void wl3501_config(dev_link_t *link) | 1981 | static void wl3501_config(struct pcmcia_device *link) |
1984 | { | 1982 | { |
1985 | tuple_t tuple; | 1983 | tuple_t tuple; |
1986 | cisparse_t parse; | 1984 | cisparse_t parse; |
1987 | client_handle_t handle = link->handle; | ||
1988 | struct net_device *dev = link->priv; | 1985 | struct net_device *dev = link->priv; |
1989 | int i = 0, j, last_fn, last_ret; | 1986 | int i = 0, j, last_fn, last_ret; |
1990 | unsigned char bf[64]; | 1987 | unsigned char bf[64]; |
@@ -1993,12 +1990,12 @@ static void wl3501_config(dev_link_t *link) | |||
1993 | /* This reads the card's CONFIG tuple to find its config registers. */ | 1990 | /* This reads the card's CONFIG tuple to find its config registers. */ |
1994 | tuple.Attributes = 0; | 1991 | tuple.Attributes = 0; |
1995 | tuple.DesiredTuple = CISTPL_CONFIG; | 1992 | tuple.DesiredTuple = CISTPL_CONFIG; |
1996 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); | 1993 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
1997 | tuple.TupleData = bf; | 1994 | tuple.TupleData = bf; |
1998 | tuple.TupleDataMax = sizeof(bf); | 1995 | tuple.TupleDataMax = sizeof(bf); |
1999 | tuple.TupleOffset = 0; | 1996 | tuple.TupleOffset = 0; |
2000 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); | 1997 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); |
2001 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); | 1998 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); |
2002 | link->conf.ConfigBase = parse.config.base; | 1999 | link->conf.ConfigBase = parse.config.base; |
2003 | link->conf.Present = parse.config.rmask[0]; | 2000 | link->conf.Present = parse.config.rmask[0]; |
2004 | 2001 | ||
@@ -2014,28 +2011,28 @@ static void wl3501_config(dev_link_t *link) | |||
2014 | * 0x200-0x2ff, and so on, because this seems safer */ | 2011 | * 0x200-0x2ff, and so on, because this seems safer */ |
2015 | link->io.BasePort1 = j; | 2012 | link->io.BasePort1 = j; |
2016 | link->io.BasePort2 = link->io.BasePort1 + 0x10; | 2013 | link->io.BasePort2 = link->io.BasePort1 + 0x10; |
2017 | i = pcmcia_request_io(link->handle, &link->io); | 2014 | i = pcmcia_request_io(link, &link->io); |
2018 | if (i == CS_SUCCESS) | 2015 | if (i == CS_SUCCESS) |
2019 | break; | 2016 | break; |
2020 | } | 2017 | } |
2021 | if (i != CS_SUCCESS) { | 2018 | if (i != CS_SUCCESS) { |
2022 | cs_error(link->handle, RequestIO, i); | 2019 | cs_error(link, RequestIO, i); |
2023 | goto failed; | 2020 | goto failed; |
2024 | } | 2021 | } |
2025 | 2022 | ||
2026 | /* Now allocate an interrupt line. Note that this does not actually | 2023 | /* Now allocate an interrupt line. Note that this does not actually |
2027 | * assign a handler to the interrupt. */ | 2024 | * assign a handler to the interrupt. */ |
2028 | 2025 | ||
2029 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq)); | 2026 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); |
2030 | 2027 | ||
2031 | /* This actually configures the PCMCIA socket -- setting up the I/O | 2028 | /* This actually configures the PCMCIA socket -- setting up the I/O |
2032 | * windows and the interrupt mapping. */ | 2029 | * windows and the interrupt mapping. */ |
2033 | 2030 | ||
2034 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf)); | 2031 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); |
2035 | 2032 | ||
2036 | dev->irq = link->irq.AssignedIRQ; | 2033 | dev->irq = link->irq.AssignedIRQ; |
2037 | dev->base_addr = link->io.BasePort1; | 2034 | dev->base_addr = link->io.BasePort1; |
2038 | SET_NETDEV_DEV(dev, &handle_to_dev(handle)); | 2035 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); |
2039 | if (register_netdev(dev)) { | 2036 | if (register_netdev(dev)) { |
2040 | printk(KERN_NOTICE "wl3501_cs: register_netdev() failed\n"); | 2037 | printk(KERN_NOTICE "wl3501_cs: register_netdev() failed\n"); |
2041 | goto failed; | 2038 | goto failed; |
@@ -2087,7 +2084,7 @@ static void wl3501_config(dev_link_t *link) | |||
2087 | netif_start_queue(dev); | 2084 | netif_start_queue(dev); |
2088 | goto out; | 2085 | goto out; |
2089 | cs_failed: | 2086 | cs_failed: |
2090 | cs_error(link->handle, last_fn, last_ret); | 2087 | cs_error(link, last_fn, last_ret); |
2091 | failed: | 2088 | failed: |
2092 | wl3501_release(link); | 2089 | wl3501_release(link); |
2093 | out: | 2090 | out: |
@@ -2102,7 +2099,7 @@ out: | |||
2102 | * and release the PCMCIA configuration. If the device is still open, this | 2099 | * and release the PCMCIA configuration. If the device is still open, this |
2103 | * will be postponed until it is closed. | 2100 | * will be postponed until it is closed. |
2104 | */ | 2101 | */ |
2105 | static void wl3501_release(dev_link_t *link) | 2102 | static void wl3501_release(struct pcmcia_device *link) |
2106 | { | 2103 | { |
2107 | struct net_device *dev = link->priv; | 2104 | struct net_device *dev = link->priv; |
2108 | 2105 | ||
@@ -2110,12 +2107,11 @@ static void wl3501_release(dev_link_t *link) | |||
2110 | if (link->dev_node) | 2107 | if (link->dev_node) |
2111 | unregister_netdev(dev); | 2108 | unregister_netdev(dev); |
2112 | 2109 | ||
2113 | pcmcia_disable_device(link->handle); | 2110 | pcmcia_disable_device(link); |
2114 | } | 2111 | } |
2115 | 2112 | ||
2116 | static int wl3501_suspend(struct pcmcia_device *p_dev) | 2113 | static int wl3501_suspend(struct pcmcia_device *link) |
2117 | { | 2114 | { |
2118 | dev_link_t *link = dev_to_instance(p_dev); | ||
2119 | struct net_device *dev = link->priv; | 2115 | struct net_device *dev = link->priv; |
2120 | 2116 | ||
2121 | wl3501_pwr_mgmt(dev->priv, WL3501_SUSPEND); | 2117 | wl3501_pwr_mgmt(dev->priv, WL3501_SUSPEND); |
@@ -2125,9 +2121,8 @@ static int wl3501_suspend(struct pcmcia_device *p_dev) | |||
2125 | return 0; | 2121 | return 0; |
2126 | } | 2122 | } |
2127 | 2123 | ||
2128 | static int wl3501_resume(struct pcmcia_device *p_dev) | 2124 | static int wl3501_resume(struct pcmcia_device *link) |
2129 | { | 2125 | { |
2130 | dev_link_t *link = dev_to_instance(p_dev); | ||
2131 | struct net_device *dev = link->priv; | 2126 | struct net_device *dev = link->priv; |
2132 | 2127 | ||
2133 | wl3501_pwr_mgmt(dev->priv, WL3501_RESUME); | 2128 | wl3501_pwr_mgmt(dev->priv, WL3501_RESUME); |