aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/3c527.c2
-rw-r--r--drivers/net/Kconfig5
-rw-r--r--drivers/net/appletalk/Kconfig1
-rw-r--r--drivers/net/bfin_mac.c1
-rw-r--r--drivers/net/caif/caif_spi.c6
-rw-r--r--drivers/net/cxgb4/cxgb4_main.c1
-rw-r--r--drivers/net/hamradio/6pack.c2
-rw-r--r--drivers/net/hamradio/mkiss.c2
-rw-r--r--drivers/net/irda/sir_dev.c2
-rw-r--r--drivers/net/pcmcia/3c574_cs.c35
-rw-r--r--drivers/net/pcmcia/3c589_cs.c47
-rw-r--r--drivers/net/pcmcia/axnet_cs.c87
-rw-r--r--drivers/net/pcmcia/com20020_cs.c43
-rw-r--r--drivers/net/pcmcia/fmvj18x_cs.c67
-rw-r--r--drivers/net/pcmcia/ibmtr_cs.c89
-rw-r--r--drivers/net/pcmcia/nmclan_cs.c42
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c146
-rw-r--r--drivers/net/pcmcia/smc91c92_cs.c114
-rw-r--r--drivers/net/pcmcia/xirc2ps_cs.c161
-rw-r--r--drivers/net/ppp_async.c2
-rw-r--r--drivers/net/ppp_generic.c3
-rw-r--r--drivers/net/smc91x.c1
-rw-r--r--drivers/net/usb/hso.c35
-rw-r--r--drivers/net/wan/cosa.c2
-rw-r--r--drivers/net/wimax/i2400m/debugfs.c2
-rw-r--r--drivers/net/wireless/airo.c24
-rw-r--r--drivers/net/wireless/airo_cs.c154
-rw-r--r--drivers/net/wireless/ath/ath5k/debug.c7
-rw-r--r--drivers/net/wireless/ath/ath9k/debug.c30
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_main.c9
-rw-r--r--drivers/net/wireless/atmel_cs.c135
-rw-r--r--drivers/net/wireless/b43/debugfs.c1
-rw-r--r--drivers/net/wireless/b43/pcmcia.c24
-rw-r--r--drivers/net/wireless/b43legacy/debugfs.c1
-rw-r--r--drivers/net/wireless/hostap/hostap_cs.c102
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-rs.c1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-rs.c3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debugfs.c3
-rw-r--r--drivers/net/wireless/iwmc3200wifi/debugfs.c4
-rw-r--r--drivers/net/wireless/iwmc3200wifi/sdio.c1
-rw-r--r--drivers/net/wireless/libertas/debugfs.c2
-rw-r--r--drivers/net/wireless/libertas/if_cs.c57
-rw-r--r--drivers/net/wireless/orinoco/orinoco_cs.c137
-rw-r--r--drivers/net/wireless/orinoco/spectrum_cs.c134
-rw-r--r--drivers/net/wireless/ray_cs.c93
-rw-r--r--drivers/net/wireless/ray_cs.h2
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00debug.c5
-rw-r--r--drivers/net/wireless/wl1251/debugfs.c4
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_debugfs.c6
-rw-r--r--drivers/net/wireless/wl3501_cs.c47
50 files changed, 427 insertions, 1457 deletions
diff --git a/drivers/net/3c527.c b/drivers/net/3c527.c
index 0d6ca1e407d0..013b7c396663 100644
--- a/drivers/net/3c527.c
+++ b/drivers/net/3c527.c
@@ -522,7 +522,7 @@ static int __init mc32_probe1(struct net_device *dev, int slot)
522 lp->tx_len = lp->exec_box->data[9]; /* Transmit list count */ 522 lp->tx_len = lp->exec_box->data[9]; /* Transmit list count */
523 lp->rx_len = lp->exec_box->data[11]; /* Receive list count */ 523 lp->rx_len = lp->exec_box->data[11]; /* Receive list count */
524 524
525 init_MUTEX_LOCKED(&lp->cmd_mutex); 525 sema_init(&lp->cmd_mutex, 0);
526 init_completion(&lp->execution_cmd); 526 init_completion(&lp->execution_cmd);
527 init_completion(&lp->xceiver_cmd); 527 init_completion(&lp->xceiver_cmd);
528 528
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index d24f54b8c19a..7ca1fc8a3a76 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2,6 +2,9 @@
2# Network device configuration 2# Network device configuration
3# 3#
4 4
5config HAVE_NET_MACB
6 bool
7
5menuconfig NETDEVICES 8menuconfig NETDEVICES
6 default y if UML 9 default y if UML
7 depends on NET 10 depends on NET
@@ -221,7 +224,7 @@ if NET_ETHERNET
221 224
222config MACB 225config MACB
223 tristate "Atmel MACB support" 226 tristate "Atmel MACB support"
224 depends on AVR32 || ARCH_AT91SAM9260 || ARCH_AT91SAM9263 || ARCH_AT91SAM9G20 || ARCH_AT91SAM9G45 || ARCH_AT91CAP9 227 depends on HAVE_NET_MACB
225 select PHYLIB 228 select PHYLIB
226 help 229 help
227 The Atmel MACB ethernet interface is found on many AT32 and AT91 230 The Atmel MACB ethernet interface is found on many AT32 and AT91
diff --git a/drivers/net/appletalk/Kconfig b/drivers/net/appletalk/Kconfig
index 0a0e0cd81a23..20f97e7017ce 100644
--- a/drivers/net/appletalk/Kconfig
+++ b/drivers/net/appletalk/Kconfig
@@ -3,6 +3,7 @@
3# 3#
4config ATALK 4config ATALK
5 tristate "Appletalk protocol support" 5 tristate "Appletalk protocol support"
6 depends on BKL # waiting to be removed from net/appletalk/ddp.c
6 select LLC 7 select LLC
7 ---help--- 8 ---help---
8 AppleTalk is the protocol that Apple computers can use to communicate 9 AppleTalk is the protocol that Apple computers can use to communicate
diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c
index 7a0e4156fade..f7233191162b 100644
--- a/drivers/net/bfin_mac.c
+++ b/drivers/net/bfin_mac.c
@@ -38,6 +38,7 @@
38#include <asm/blackfin.h> 38#include <asm/blackfin.h>
39#include <asm/cacheflush.h> 39#include <asm/cacheflush.h>
40#include <asm/portmux.h> 40#include <asm/portmux.h>
41#include <mach/pll.h>
41 42
42#include "bfin_mac.h" 43#include "bfin_mac.h"
43 44
diff --git a/drivers/net/caif/caif_spi.c b/drivers/net/caif/caif_spi.c
index f5058ff2b210..8427533fe313 100644
--- a/drivers/net/caif/caif_spi.c
+++ b/drivers/net/caif/caif_spi.c
@@ -240,13 +240,15 @@ static ssize_t dbgfs_frame(struct file *file, char __user *user_buf,
240static const struct file_operations dbgfs_state_fops = { 240static const struct file_operations dbgfs_state_fops = {
241 .open = dbgfs_open, 241 .open = dbgfs_open,
242 .read = dbgfs_state, 242 .read = dbgfs_state,
243 .owner = THIS_MODULE 243 .owner = THIS_MODULE,
244 .llseek = default_llseek,
244}; 245};
245 246
246static const struct file_operations dbgfs_frame_fops = { 247static const struct file_operations dbgfs_frame_fops = {
247 .open = dbgfs_open, 248 .open = dbgfs_open,
248 .read = dbgfs_frame, 249 .read = dbgfs_frame,
249 .owner = THIS_MODULE 250 .owner = THIS_MODULE,
251 .llseek = default_llseek,
250}; 252};
251 253
252static inline void dev_debugfs_add(struct cfspi *cfspi) 254static inline void dev_debugfs_add(struct cfspi *cfspi)
diff --git a/drivers/net/cxgb4/cxgb4_main.c b/drivers/net/cxgb4/cxgb4_main.c
index 930bd075a43e..87054e0a5746 100644
--- a/drivers/net/cxgb4/cxgb4_main.c
+++ b/drivers/net/cxgb4/cxgb4_main.c
@@ -2068,6 +2068,7 @@ static const struct file_operations mem_debugfs_fops = {
2068 .owner = THIS_MODULE, 2068 .owner = THIS_MODULE,
2069 .open = mem_open, 2069 .open = mem_open,
2070 .read = mem_read, 2070 .read = mem_read,
2071 .llseek = default_llseek,
2071}; 2072};
2072 2073
2073static void __devinit add_debugfs_mem(struct adapter *adap, const char *name, 2074static void __devinit add_debugfs_mem(struct adapter *adap, const char *name,
diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c
index 4b52c767ad05..3e5d0b6b6516 100644
--- a/drivers/net/hamradio/6pack.c
+++ b/drivers/net/hamradio/6pack.c
@@ -608,7 +608,7 @@ static int sixpack_open(struct tty_struct *tty)
608 608
609 spin_lock_init(&sp->lock); 609 spin_lock_init(&sp->lock);
610 atomic_set(&sp->refcnt, 1); 610 atomic_set(&sp->refcnt, 1);
611 init_MUTEX_LOCKED(&sp->dead_sem); 611 sema_init(&sp->dead_sem, 0);
612 612
613 /* !!! length of the buffers. MTU is IP MTU, not PACLEN! */ 613 /* !!! length of the buffers. MTU is IP MTU, not PACLEN! */
614 614
diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c
index 66e88bd59caa..4c628393c8b1 100644
--- a/drivers/net/hamradio/mkiss.c
+++ b/drivers/net/hamradio/mkiss.c
@@ -747,7 +747,7 @@ static int mkiss_open(struct tty_struct *tty)
747 747
748 spin_lock_init(&ax->buflock); 748 spin_lock_init(&ax->buflock);
749 atomic_set(&ax->refcnt, 1); 749 atomic_set(&ax->refcnt, 1);
750 init_MUTEX_LOCKED(&ax->dead_sem); 750 sema_init(&ax->dead_sem, 0);
751 751
752 ax->tty = tty; 752 ax->tty = tty;
753 tty->disc_data = ax; 753 tty->disc_data = ax;
diff --git a/drivers/net/irda/sir_dev.c b/drivers/net/irda/sir_dev.c
index 39d6e6f15d4f..efe05bb34dd8 100644
--- a/drivers/net/irda/sir_dev.c
+++ b/drivers/net/irda/sir_dev.c
@@ -909,7 +909,7 @@ struct sir_dev * sirdev_get_instance(const struct sir_driver *drv, const char *n
909 dev->tx_skb = NULL; 909 dev->tx_skb = NULL;
910 910
911 spin_lock_init(&dev->tx_lock); 911 spin_lock_init(&dev->tx_lock);
912 init_MUTEX(&dev->fsm.sem); 912 sema_init(&dev->fsm.sem, 1);
913 913
914 dev->drv = drv; 914 dev->drv = drv;
915 dev->netdev = ndev; 915 dev->netdev = ndev;
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c
index 042f6777e6b9..2807a0fcadc4 100644
--- a/drivers/net/pcmcia/3c574_cs.c
+++ b/drivers/net/pcmcia/3c574_cs.c
@@ -88,7 +88,6 @@ earlier 3Com products.
88#include <linux/bitops.h> 88#include <linux/bitops.h>
89#include <linux/mii.h> 89#include <linux/mii.h>
90 90
91#include <pcmcia/cs.h>
92#include <pcmcia/cistpl.h> 91#include <pcmcia/cistpl.h>
93#include <pcmcia/cisreg.h> 92#include <pcmcia/cisreg.h>
94#include <pcmcia/ciscode.h> 93#include <pcmcia/ciscode.h>
@@ -280,24 +279,14 @@ static int tc574_probe(struct pcmcia_device *link)
280 spin_lock_init(&lp->window_lock); 279 spin_lock_init(&lp->window_lock);
281 link->resource[0]->end = 32; 280 link->resource[0]->end = 32;
282 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; 281 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16;
283 link->conf.Attributes = CONF_ENABLE_IRQ; 282 link->config_flags |= CONF_ENABLE_IRQ;
284 link->conf.IntType = INT_MEMORY_AND_IO; 283 link->config_index = 1;
285 link->conf.ConfigIndex = 1;
286 284
287 dev->netdev_ops = &el3_netdev_ops; 285 dev->netdev_ops = &el3_netdev_ops;
288 dev->watchdog_timeo = TX_TIMEOUT; 286 dev->watchdog_timeo = TX_TIMEOUT;
289 287
290 return tc574_config(link); 288 return tc574_config(link);
291} /* tc574_attach */ 289}
292
293/*
294
295 This deletes a driver "instance". The device is de-registered
296 with Card Services. If it has been released, all local data
297 structures are freed. Otherwise, the structures will be freed
298 when the device is released.
299
300*/
301 290
302static void tc574_detach(struct pcmcia_device *link) 291static void tc574_detach(struct pcmcia_device *link)
303{ 292{
@@ -312,12 +301,6 @@ static void tc574_detach(struct pcmcia_device *link)
312 free_netdev(dev); 301 free_netdev(dev);
313} /* tc574_detach */ 302} /* tc574_detach */
314 303
315/*
316 tc574_config() is scheduled to run after a CARD_INSERTION event
317 is received, to configure the PCMCIA socket, and to make the
318 ethernet device available to the system.
319*/
320
321static const char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"}; 304static const char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"};
322 305
323static int tc574_config(struct pcmcia_device *link) 306static int tc574_config(struct pcmcia_device *link)
@@ -351,7 +334,7 @@ static int tc574_config(struct pcmcia_device *link)
351 if (ret) 334 if (ret)
352 goto failed; 335 goto failed;
353 336
354 ret = pcmcia_request_configuration(link, &link->conf); 337 ret = pcmcia_enable_device(link);
355 if (ret) 338 if (ret)
356 goto failed; 339 goto failed;
357 340
@@ -462,12 +445,6 @@ failed:
462 445
463} /* tc574_config */ 446} /* tc574_config */
464 447
465/*
466 After a card is removed, tc574_release() will unregister the net
467 device, and release the PCMCIA configuration. If the device is
468 still open, this will be postponed until it is closed.
469*/
470
471static void tc574_release(struct pcmcia_device *link) 448static void tc574_release(struct pcmcia_device *link)
472{ 449{
473 pcmcia_disable_device(link); 450 pcmcia_disable_device(link);
@@ -1182,9 +1159,7 @@ MODULE_DEVICE_TABLE(pcmcia, tc574_ids);
1182 1159
1183static struct pcmcia_driver tc574_driver = { 1160static struct pcmcia_driver tc574_driver = {
1184 .owner = THIS_MODULE, 1161 .owner = THIS_MODULE,
1185 .drv = { 1162 .name = "3c574_cs",
1186 .name = "3c574_cs",
1187 },
1188 .probe = tc574_probe, 1163 .probe = tc574_probe,
1189 .remove = tc574_detach, 1164 .remove = tc574_detach,
1190 .id_table = tc574_ids, 1165 .id_table = tc574_ids,
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c
index 35562a395770..79b9ca0dbdb4 100644
--- a/drivers/net/pcmcia/3c589_cs.c
+++ b/drivers/net/pcmcia/3c589_cs.c
@@ -43,7 +43,6 @@
43#include <linux/bitops.h> 43#include <linux/bitops.h>
44#include <linux/jiffies.h> 44#include <linux/jiffies.h>
45 45
46#include <pcmcia/cs.h>
47#include <pcmcia/cistpl.h> 46#include <pcmcia/cistpl.h>
48#include <pcmcia/cisreg.h> 47#include <pcmcia/cisreg.h>
49#include <pcmcia/ciscode.h> 48#include <pcmcia/ciscode.h>
@@ -178,14 +177,6 @@ static const struct ethtool_ops netdev_ethtool_ops;
178 177
179static void tc589_detach(struct pcmcia_device *p_dev); 178static void tc589_detach(struct pcmcia_device *p_dev);
180 179
181/*======================================================================
182
183 tc589_attach() creates an "instance" of the driver, allocating
184 local data structures for one device. The device is registered
185 with Card Services.
186
187======================================================================*/
188
189static const struct net_device_ops el3_netdev_ops = { 180static const struct net_device_ops el3_netdev_ops = {
190 .ndo_open = el3_open, 181 .ndo_open = el3_open,
191 .ndo_stop = el3_close, 182 .ndo_stop = el3_close,
@@ -218,9 +209,8 @@ static int tc589_probe(struct pcmcia_device *link)
218 link->resource[0]->end = 16; 209 link->resource[0]->end = 16;
219 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; 210 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16;
220 211
221 link->conf.Attributes = CONF_ENABLE_IRQ; 212 link->config_flags |= CONF_ENABLE_IRQ;
222 link->conf.IntType = INT_MEMORY_AND_IO; 213 link->config_index = 1;
223 link->conf.ConfigIndex = 1;
224 214
225 dev->netdev_ops = &el3_netdev_ops; 215 dev->netdev_ops = &el3_netdev_ops;
226 dev->watchdog_timeo = TX_TIMEOUT; 216 dev->watchdog_timeo = TX_TIMEOUT;
@@ -228,16 +218,7 @@ static int tc589_probe(struct pcmcia_device *link)
228 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); 218 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
229 219
230 return tc589_config(link); 220 return tc589_config(link);
231} /* tc589_attach */ 221}
232
233/*======================================================================
234
235 This deletes a driver "instance". The device is de-registered
236 with Card Services. If it has been released, all local data
237 structures are freed. Otherwise, the structures will be freed
238 when the device is released.
239
240======================================================================*/
241 222
242static void tc589_detach(struct pcmcia_device *link) 223static void tc589_detach(struct pcmcia_device *link)
243{ 224{
@@ -252,14 +233,6 @@ static void tc589_detach(struct pcmcia_device *link)
252 free_netdev(dev); 233 free_netdev(dev);
253} /* tc589_detach */ 234} /* tc589_detach */
254 235
255/*======================================================================
256
257 tc589_config() is scheduled to run after a CARD_INSERTION event
258 is received, to configure the PCMCIA socket, and to make the
259 ethernet device available to the system.
260
261======================================================================*/
262
263static int tc589_config(struct pcmcia_device *link) 236static int tc589_config(struct pcmcia_device *link)
264{ 237{
265 struct net_device *dev = link->priv; 238 struct net_device *dev = link->priv;
@@ -295,7 +268,7 @@ static int tc589_config(struct pcmcia_device *link)
295 if (ret) 268 if (ret)
296 goto failed; 269 goto failed;
297 270
298 ret = pcmcia_request_configuration(link, &link->conf); 271 ret = pcmcia_enable_device(link);
299 if (ret) 272 if (ret)
300 goto failed; 273 goto failed;
301 274
@@ -353,14 +326,6 @@ failed:
353 return -ENODEV; 326 return -ENODEV;
354} /* tc589_config */ 327} /* tc589_config */
355 328
356/*======================================================================
357
358 After a card is removed, tc589_release() will unregister the net
359 device, and release the PCMCIA configuration. If the device is
360 still open, this will be postponed until it is closed.
361
362======================================================================*/
363
364static void tc589_release(struct pcmcia_device *link) 329static void tc589_release(struct pcmcia_device *link)
365{ 330{
366 pcmcia_disable_device(link); 331 pcmcia_disable_device(link);
@@ -956,9 +921,7 @@ MODULE_DEVICE_TABLE(pcmcia, tc589_ids);
956 921
957static struct pcmcia_driver tc589_driver = { 922static struct pcmcia_driver tc589_driver = {
958 .owner = THIS_MODULE, 923 .owner = THIS_MODULE,
959 .drv = { 924 .name = "3c589_cs",
960 .name = "3c589_cs",
961 },
962 .probe = tc589_probe, 925 .probe = tc589_probe,
963 .remove = tc589_detach, 926 .remove = tc589_detach,
964 .id_table = tc589_ids, 927 .id_table = tc589_ids,
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c
index 3f61fde70d73..d2e166e29dda 100644
--- a/drivers/net/pcmcia/axnet_cs.c
+++ b/drivers/net/pcmcia/axnet_cs.c
@@ -40,7 +40,6 @@
40#include <linux/mii.h> 40#include <linux/mii.h>
41#include "../8390.h" 41#include "../8390.h"
42 42
43#include <pcmcia/cs.h>
44#include <pcmcia/cistpl.h> 43#include <pcmcia/cistpl.h>
45#include <pcmcia/ciscode.h> 44#include <pcmcia/ciscode.h>
46#include <pcmcia/ds.h> 45#include <pcmcia/ds.h>
@@ -140,14 +139,6 @@ static const struct net_device_ops axnet_netdev_ops = {
140 .ndo_validate_addr = eth_validate_addr, 139 .ndo_validate_addr = eth_validate_addr,
141}; 140};
142 141
143/*======================================================================
144
145 axnet_attach() creates an "instance" of the driver, allocating
146 local data structures for one device. The device is registered
147 with Card Services.
148
149======================================================================*/
150
151static int axnet_probe(struct pcmcia_device *link) 142static int axnet_probe(struct pcmcia_device *link)
152{ 143{
153 axnet_dev_t *info; 144 axnet_dev_t *info;
@@ -166,8 +157,7 @@ static int axnet_probe(struct pcmcia_device *link)
166 info = PRIV(dev); 157 info = PRIV(dev);
167 info->p_dev = link; 158 info->p_dev = link;
168 link->priv = dev; 159 link->priv = dev;
169 link->conf.Attributes = CONF_ENABLE_IRQ; 160 link->config_flags |= CONF_ENABLE_IRQ;
170 link->conf.IntType = INT_MEMORY_AND_IO;
171 161
172 dev->netdev_ops = &axnet_netdev_ops; 162 dev->netdev_ops = &axnet_netdev_ops;
173 163
@@ -176,15 +166,6 @@ static int axnet_probe(struct pcmcia_device *link)
176 return axnet_config(link); 166 return axnet_config(link);
177} /* axnet_attach */ 167} /* axnet_attach */
178 168
179/*======================================================================
180
181 This deletes a driver "instance". The device is de-registered
182 with Card Services. If it has been released, all local data
183 structures are freed. Otherwise, the structures will be freed
184 when the device is released.
185
186======================================================================*/
187
188static void axnet_detach(struct pcmcia_device *link) 169static void axnet_detach(struct pcmcia_device *link)
189{ 170{
190 struct net_device *dev = link->priv; 171 struct net_device *dev = link->priv;
@@ -230,7 +211,7 @@ static int get_prom(struct pcmcia_device *link)
230 }; 211 };
231 212
232 /* Not much of a test, but the alternatives are messy */ 213 /* Not much of a test, but the alternatives are messy */
233 if (link->conf.ConfigBase != 0x03c0) 214 if (link->config_base != 0x03c0)
234 return 0; 215 return 0;
235 216
236 axnet_reset_8390(dev); 217 axnet_reset_8390(dev);
@@ -247,14 +228,6 @@ static int get_prom(struct pcmcia_device *link)
247 return 1; 228 return 1;
248} /* get_prom */ 229} /* get_prom */
249 230
250/*======================================================================
251
252 axnet_config() is scheduled to run after a CARD_INSERTION event
253 is received, to configure the PCMCIA socket, and to make the
254 ethernet device available to the system.
255
256======================================================================*/
257
258static int try_io_port(struct pcmcia_device *link) 231static int try_io_port(struct pcmcia_device *link)
259{ 232{
260 int j, ret; 233 int j, ret;
@@ -285,35 +258,16 @@ static int try_io_port(struct pcmcia_device *link)
285 } 258 }
286} 259}
287 260
288static int axnet_configcheck(struct pcmcia_device *p_dev, 261static int axnet_configcheck(struct pcmcia_device *p_dev, void *priv_data)
289 cistpl_cftable_entry_t *cfg,
290 cistpl_cftable_entry_t *dflt,
291 unsigned int vcc,
292 void *priv_data)
293{ 262{
294 int i; 263 if (p_dev->config_index == 0)
295 cistpl_io_t *io = &cfg->io; 264 return -EINVAL;
296 265
297 if (cfg->index == 0 || cfg->io.nwin == 0) 266 p_dev->config_index = 0x05;
267 if (p_dev->resource[0]->end + p_dev->resource[1]->end < 32)
298 return -ENODEV; 268 return -ENODEV;
299 269
300 p_dev->conf.ConfigIndex = 0x05; 270 return try_io_port(p_dev);
301 /* For multifunction cards, by convention, we configure the
302 network function with window 0, and serial with window 1 */
303 if (io->nwin > 1) {
304 i = (io->win[1].len > io->win[0].len);
305 p_dev->resource[1]->start = io->win[1-i].base;
306 p_dev->resource[1]->end = io->win[1-i].len;
307 } else {
308 i = p_dev->resource[1]->end = 0;
309 }
310 p_dev->resource[0]->start = io->win[i].base;
311 p_dev->resource[0]->end = io->win[i].len;
312 p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
313 if (p_dev->resource[0]->end + p_dev->resource[1]->end >= 32)
314 return try_io_port(p_dev);
315
316 return -ENODEV;
317} 271}
318 272
319static int axnet_config(struct pcmcia_device *link) 273static int axnet_config(struct pcmcia_device *link)
@@ -325,20 +279,19 @@ static int axnet_config(struct pcmcia_device *link)
325 dev_dbg(&link->dev, "axnet_config(0x%p)\n", link); 279 dev_dbg(&link->dev, "axnet_config(0x%p)\n", link);
326 280
327 /* don't trust the CIS on this; Linksys got it wrong */ 281 /* don't trust the CIS on this; Linksys got it wrong */
328 link->conf.Present = 0x63; 282 link->config_regs = 0x63;
283 link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
329 ret = pcmcia_loop_config(link, axnet_configcheck, NULL); 284 ret = pcmcia_loop_config(link, axnet_configcheck, NULL);
330 if (ret != 0) 285 if (ret != 0)
331 goto failed; 286 goto failed;
332 287
333 if (!link->irq) 288 if (!link->irq)
334 goto failed; 289 goto failed;
290
291 if (resource_size(link->resource[1]) == 8)
292 link->config_flags |= CONF_ENABLE_SPKR;
335 293
336 if (resource_size(link->resource[1]) == 8) { 294 ret = pcmcia_enable_device(link);
337 link->conf.Attributes |= CONF_ENABLE_SPKR;
338 link->conf.Status = CCSR_AUDIO_ENA;
339 }
340
341 ret = pcmcia_request_configuration(link, &link->conf);
342 if (ret) 295 if (ret)
343 goto failed; 296 goto failed;
344 297
@@ -412,14 +365,6 @@ failed:
412 return -ENODEV; 365 return -ENODEV;
413} /* axnet_config */ 366} /* axnet_config */
414 367
415/*======================================================================
416
417 After a card is removed, axnet_release() will unregister the net
418 device, and release the PCMCIA configuration. If the device is
419 still open, this will be postponed until it is closed.
420
421======================================================================*/
422
423static void axnet_release(struct pcmcia_device *link) 368static void axnet_release(struct pcmcia_device *link)
424{ 369{
425 pcmcia_disable_device(link); 370 pcmcia_disable_device(link);
@@ -766,9 +711,7 @@ MODULE_DEVICE_TABLE(pcmcia, axnet_ids);
766 711
767static struct pcmcia_driver axnet_cs_driver = { 712static struct pcmcia_driver axnet_cs_driver = {
768 .owner = THIS_MODULE, 713 .owner = THIS_MODULE,
769 .drv = { 714 .name = "axnet_cs",
770 .name = "axnet_cs",
771 },
772 .probe = axnet_probe, 715 .probe = axnet_probe,
773 .remove = axnet_detach, 716 .remove = axnet_detach,
774 .id_table = axnet_ids, 717 .id_table = axnet_ids,
diff --git a/drivers/net/pcmcia/com20020_cs.c b/drivers/net/pcmcia/com20020_cs.c
index f065c35cd4b7..27bfad76fc40 100644
--- a/drivers/net/pcmcia/com20020_cs.c
+++ b/drivers/net/pcmcia/com20020_cs.c
@@ -43,7 +43,6 @@
43#include <linux/arcdevice.h> 43#include <linux/arcdevice.h>
44#include <linux/com20020.h> 44#include <linux/com20020.h>
45 45
46#include <pcmcia/cs.h>
47#include <pcmcia/cistpl.h> 46#include <pcmcia/cistpl.h>
48#include <pcmcia/ds.h> 47#include <pcmcia/ds.h>
49 48
@@ -119,14 +118,6 @@ typedef struct com20020_dev_t {
119 struct net_device *dev; 118 struct net_device *dev;
120} com20020_dev_t; 119} com20020_dev_t;
121 120
122/*======================================================================
123
124 com20020_attach() creates an "instance" of the driver, allocating
125 local data structures for one device. The device is registered
126 with Card Services.
127
128======================================================================*/
129
130static int com20020_probe(struct pcmcia_device *p_dev) 121static int com20020_probe(struct pcmcia_device *p_dev)
131{ 122{
132 com20020_dev_t *info; 123 com20020_dev_t *info;
@@ -156,8 +147,7 @@ static int com20020_probe(struct pcmcia_device *p_dev)
156 147
157 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 148 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
158 p_dev->resource[0]->end = 16; 149 p_dev->resource[0]->end = 16;
159 p_dev->conf.Attributes = CONF_ENABLE_IRQ; 150 p_dev->config_flags |= CONF_ENABLE_IRQ;
160 p_dev->conf.IntType = INT_MEMORY_AND_IO;
161 151
162 info->dev = dev; 152 info->dev = dev;
163 p_dev->priv = info; 153 p_dev->priv = info;
@@ -170,15 +160,6 @@ fail_alloc_info:
170 return -ENOMEM; 160 return -ENOMEM;
171} /* com20020_attach */ 161} /* com20020_attach */
172 162
173/*======================================================================
174
175 This deletes a driver "instance". The device is de-registered
176 with Card Services. If it has been released, all local data
177 structures are freed. Otherwise, the structures will be freed
178 when the device is released.
179
180======================================================================*/
181
182static void com20020_detach(struct pcmcia_device *link) 163static void com20020_detach(struct pcmcia_device *link)
183{ 164{
184 struct com20020_dev_t *info = link->priv; 165 struct com20020_dev_t *info = link->priv;
@@ -217,14 +198,6 @@ static void com20020_detach(struct pcmcia_device *link)
217 198
218} /* com20020_detach */ 199} /* com20020_detach */
219 200
220/*======================================================================
221
222 com20020_config() is scheduled to run after a CARD_INSERTION event
223 is received, to configure the PCMCIA socket, and to make the
224 device available to the system.
225
226======================================================================*/
227
228static int com20020_config(struct pcmcia_device *link) 201static int com20020_config(struct pcmcia_device *link)
229{ 202{
230 struct arcnet_local *lp; 203 struct arcnet_local *lp;
@@ -278,7 +251,7 @@ static int com20020_config(struct pcmcia_device *link)
278 251
279 dev->irq = link->irq; 252 dev->irq = link->irq;
280 253
281 ret = pcmcia_request_configuration(link, &link->conf); 254 ret = pcmcia_enable_device(link);
282 if (ret) 255 if (ret)
283 goto failed; 256 goto failed;
284 257
@@ -312,14 +285,6 @@ failed:
312 return -ENODEV; 285 return -ENODEV;
313} /* com20020_config */ 286} /* com20020_config */
314 287
315/*======================================================================
316
317 After a card is removed, com20020_release() will unregister the net
318 device, and release the PCMCIA configuration. If the device is
319 still open, this will be postponed until it is closed.
320
321======================================================================*/
322
323static void com20020_release(struct pcmcia_device *link) 288static void com20020_release(struct pcmcia_device *link)
324{ 289{
325 dev_dbg(&link->dev, "com20020_release\n"); 290 dev_dbg(&link->dev, "com20020_release\n");
@@ -362,9 +327,7 @@ MODULE_DEVICE_TABLE(pcmcia, com20020_ids);
362 327
363static struct pcmcia_driver com20020_cs_driver = { 328static struct pcmcia_driver com20020_cs_driver = {
364 .owner = THIS_MODULE, 329 .owner = THIS_MODULE,
365 .drv = { 330 .name = "com20020_cs",
366 .name = "com20020_cs",
367 },
368 .probe = com20020_probe, 331 .probe = com20020_probe,
369 .remove = com20020_detach, 332 .remove = com20020_detach,
370 .id_table = com20020_ids, 333 .id_table = com20020_ids,
diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c
index 8f26d548d1bb..9226cda4d054 100644
--- a/drivers/net/pcmcia/fmvj18x_cs.c
+++ b/drivers/net/pcmcia/fmvj18x_cs.c
@@ -51,7 +51,6 @@
51#include <linux/ioport.h> 51#include <linux/ioport.h>
52#include <linux/crc32.h> 52#include <linux/crc32.h>
53 53
54#include <pcmcia/cs.h>
55#include <pcmcia/cistpl.h> 54#include <pcmcia/cistpl.h>
56#include <pcmcia/ciscode.h> 55#include <pcmcia/ciscode.h>
57#include <pcmcia/ds.h> 56#include <pcmcia/ds.h>
@@ -254,8 +253,7 @@ static int fmvj18x_probe(struct pcmcia_device *link)
254 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 253 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
255 254
256 /* General socket configuration */ 255 /* General socket configuration */
257 link->conf.Attributes = CONF_ENABLE_IRQ; 256 link->config_flags |= CONF_ENABLE_IRQ;
258 link->conf.IntType = INT_MEMORY_AND_IO;
259 257
260 dev->netdev_ops = &fjn_netdev_ops; 258 dev->netdev_ops = &fjn_netdev_ops;
261 dev->watchdog_timeo = TX_TIMEOUT; 259 dev->watchdog_timeo = TX_TIMEOUT;
@@ -315,7 +313,7 @@ static int ungermann_try_io_port(struct pcmcia_device *link)
315 ret = pcmcia_request_io(link); 313 ret = pcmcia_request_io(link);
316 if (ret == 0) { 314 if (ret == 0) {
317 /* calculate ConfigIndex value */ 315 /* calculate ConfigIndex value */
318 link->conf.ConfigIndex = 316 link->config_index =
319 ((link->resource[0]->start & 0x0f0) >> 3) | 0x22; 317 ((link->resource[0]->start & 0x0f0) >> 3) | 0x22;
320 return ret; 318 return ret;
321 } 319 }
@@ -323,11 +321,7 @@ static int ungermann_try_io_port(struct pcmcia_device *link)
323 return ret; /* RequestIO failed */ 321 return ret; /* RequestIO failed */
324} 322}
325 323
326static int fmvj18x_ioprobe(struct pcmcia_device *p_dev, 324static int fmvj18x_ioprobe(struct pcmcia_device *p_dev, void *priv_data)
327 cistpl_cftable_entry_t *cfg,
328 cistpl_cftable_entry_t *dflt,
329 unsigned int vcc,
330 void *priv_data)
331{ 325{
332 return 0; /* strange, but that's what the code did already before... */ 326 return 0; /* strange, but that's what the code did already before... */
333} 327}
@@ -364,28 +358,28 @@ static int fmvj18x_config(struct pcmcia_device *link)
364 link->card_id == PRODID_TDK_NP9610 || 358 link->card_id == PRODID_TDK_NP9610 ||
365 link->card_id == PRODID_TDK_MN3200) { 359 link->card_id == PRODID_TDK_MN3200) {
366 /* MultiFunction Card */ 360 /* MultiFunction Card */
367 link->conf.ConfigBase = 0x800; 361 link->config_base = 0x800;
368 link->conf.ConfigIndex = 0x47; 362 link->config_index = 0x47;
369 link->resource[1]->end = 8; 363 link->resource[1]->end = 8;
370 } 364 }
371 break; 365 break;
372 case MANFID_NEC: 366 case MANFID_NEC:
373 cardtype = NEC; /* MultiFunction Card */ 367 cardtype = NEC; /* MultiFunction Card */
374 link->conf.ConfigBase = 0x800; 368 link->config_base = 0x800;
375 link->conf.ConfigIndex = 0x47; 369 link->config_index = 0x47;
376 link->resource[1]->end = 8; 370 link->resource[1]->end = 8;
377 break; 371 break;
378 case MANFID_KME: 372 case MANFID_KME:
379 cardtype = KME; /* MultiFunction Card */ 373 cardtype = KME; /* MultiFunction Card */
380 link->conf.ConfigBase = 0x800; 374 link->config_base = 0x800;
381 link->conf.ConfigIndex = 0x47; 375 link->config_index = 0x47;
382 link->resource[1]->end = 8; 376 link->resource[1]->end = 8;
383 break; 377 break;
384 case MANFID_CONTEC: 378 case MANFID_CONTEC:
385 cardtype = CONTEC; 379 cardtype = CONTEC;
386 break; 380 break;
387 case MANFID_FUJITSU: 381 case MANFID_FUJITSU:
388 if (link->conf.ConfigBase == 0x0fe0) 382 if (link->config_base == 0x0fe0)
389 cardtype = MBH10302; 383 cardtype = MBH10302;
390 else if (link->card_id == PRODID_FUJITSU_MBH10302) 384 else if (link->card_id == PRODID_FUJITSU_MBH10302)
391 /* RATOC REX-5588/9822/4886's PRODID are 0004(=MBH10302), 385 /* RATOC REX-5588/9822/4886's PRODID are 0004(=MBH10302),
@@ -405,10 +399,10 @@ static int fmvj18x_config(struct pcmcia_device *link)
405 case MANFID_FUJITSU: 399 case MANFID_FUJITSU:
406 if (link->card_id == PRODID_FUJITSU_MBH10304) { 400 if (link->card_id == PRODID_FUJITSU_MBH10304) {
407 cardtype = XXX10304; /* MBH10304 with buggy CIS */ 401 cardtype = XXX10304; /* MBH10304 with buggy CIS */
408 link->conf.ConfigIndex = 0x20; 402 link->config_index = 0x20;
409 } else { 403 } else {
410 cardtype = MBH10302; /* NextCom NC5310, etc. */ 404 cardtype = MBH10302; /* NextCom NC5310, etc. */
411 link->conf.ConfigIndex = 1; 405 link->config_index = 1;
412 } 406 }
413 break; 407 break;
414 case MANFID_UNGERMANN: 408 case MANFID_UNGERMANN:
@@ -416,7 +410,7 @@ static int fmvj18x_config(struct pcmcia_device *link)
416 break; 410 break;
417 default: 411 default:
418 cardtype = MBH10302; 412 cardtype = MBH10302;
419 link->conf.ConfigIndex = 1; 413 link->config_index = 1;
420 } 414 }
421 } 415 }
422 416
@@ -434,7 +428,7 @@ static int fmvj18x_config(struct pcmcia_device *link)
434 ret = pcmcia_request_irq(link, fjn_interrupt); 428 ret = pcmcia_request_irq(link, fjn_interrupt);
435 if (ret) 429 if (ret)
436 goto failed; 430 goto failed;
437 ret = pcmcia_request_configuration(link, &link->conf); 431 ret = pcmcia_enable_device(link);
438 if (ret) 432 if (ret)
439 goto failed; 433 goto failed;
440 434
@@ -545,20 +539,18 @@ failed:
545 539
546static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id) 540static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id)
547{ 541{
548 win_req_t req;
549 u_char __iomem *base; 542 u_char __iomem *base;
550 int i, j; 543 int i, j;
551 544
552 /* Allocate a small memory window */ 545 /* Allocate a small memory window */
553 req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; 546 link->resource[2]->flags |= WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE;
554 req.Base = 0; req.Size = 0; 547 link->resource[2]->start = 0; link->resource[2]->end = 0;
555 req.AccessSpeed = 0; 548 i = pcmcia_request_window(link, link->resource[2], 0);
556 i = pcmcia_request_window(link, &req, &link->win);
557 if (i != 0) 549 if (i != 0)
558 return -1; 550 return -1;
559 551
560 base = ioremap(req.Base, req.Size); 552 base = ioremap(link->resource[2]->start, resource_size(link->resource[2]));
561 pcmcia_map_mem_page(link, link->win, 0); 553 pcmcia_map_mem_page(link, link->resource[2], 0);
562 554
563 /* 555 /*
564 * MBH10304 CISTPL_FUNCE_LAN_NODE_ID format 556 * MBH10304 CISTPL_FUNCE_LAN_NODE_ID format
@@ -583,7 +575,7 @@ static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id)
583 } 575 }
584 576
585 iounmap(base); 577 iounmap(base);
586 j = pcmcia_release_window(link, link->win); 578 j = pcmcia_release_window(link, link->resource[2]);
587 return (i != 0x200) ? 0 : -1; 579 return (i != 0x200) ? 0 : -1;
588 580
589} /* fmvj18x_get_hwinfo */ 581} /* fmvj18x_get_hwinfo */
@@ -591,27 +583,26 @@ static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id)
591 583
592static int fmvj18x_setup_mfc(struct pcmcia_device *link) 584static int fmvj18x_setup_mfc(struct pcmcia_device *link)
593{ 585{
594 win_req_t req;
595 int i; 586 int i;
596 struct net_device *dev = link->priv; 587 struct net_device *dev = link->priv;
597 unsigned int ioaddr; 588 unsigned int ioaddr;
598 local_info_t *lp = netdev_priv(dev); 589 local_info_t *lp = netdev_priv(dev);
599 590
600 /* Allocate a small memory window */ 591 /* Allocate a small memory window */
601 req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; 592 link->resource[3]->flags = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE;
602 req.Base = 0; req.Size = 0; 593 link->resource[3]->start = link->resource[3]->end = 0;
603 req.AccessSpeed = 0; 594 i = pcmcia_request_window(link, link->resource[3], 0);
604 i = pcmcia_request_window(link, &req, &link->win);
605 if (i != 0) 595 if (i != 0)
606 return -1; 596 return -1;
607 597
608 lp->base = ioremap(req.Base, req.Size); 598 lp->base = ioremap(link->resource[3]->start,
599 resource_size(link->resource[3]));
609 if (lp->base == NULL) { 600 if (lp->base == NULL) {
610 netdev_notice(dev, "ioremap failed\n"); 601 netdev_notice(dev, "ioremap failed\n");
611 return -1; 602 return -1;
612 } 603 }
613 604
614 i = pcmcia_map_mem_page(link, link->win, 0); 605 i = pcmcia_map_mem_page(link, link->resource[3], 0);
615 if (i != 0) { 606 if (i != 0) {
616 iounmap(lp->base); 607 iounmap(lp->base);
617 lp->base = NULL; 608 lp->base = NULL;
@@ -639,7 +630,6 @@ static void fmvj18x_release(struct pcmcia_device *link)
639 struct net_device *dev = link->priv; 630 struct net_device *dev = link->priv;
640 local_info_t *lp = netdev_priv(dev); 631 local_info_t *lp = netdev_priv(dev);
641 u_char __iomem *tmp; 632 u_char __iomem *tmp;
642 int j;
643 633
644 dev_dbg(&link->dev, "fmvj18x_release\n"); 634 dev_dbg(&link->dev, "fmvj18x_release\n");
645 635
@@ -647,7 +637,6 @@ static void fmvj18x_release(struct pcmcia_device *link)
647 tmp = lp->base; 637 tmp = lp->base;
648 lp->base = NULL; /* set NULL before iounmap */ 638 lp->base = NULL; /* set NULL before iounmap */
649 iounmap(tmp); 639 iounmap(tmp);
650 j = pcmcia_release_window(link, link->win);
651 } 640 }
652 641
653 pcmcia_disable_device(link); 642 pcmcia_disable_device(link);
@@ -709,9 +698,7 @@ MODULE_DEVICE_TABLE(pcmcia, fmvj18x_ids);
709 698
710static struct pcmcia_driver fmvj18x_cs_driver = { 699static struct pcmcia_driver fmvj18x_cs_driver = {
711 .owner = THIS_MODULE, 700 .owner = THIS_MODULE,
712 .drv = { 701 .name = "fmvj18x_cs",
713 .name = "fmvj18x_cs",
714 },
715 .probe = fmvj18x_probe, 702 .probe = fmvj18x_probe,
716 .remove = fmvj18x_detach, 703 .remove = fmvj18x_detach,
717 .id_table = fmvj18x_ids, 704 .id_table = fmvj18x_ids,
diff --git a/drivers/net/pcmcia/ibmtr_cs.c b/drivers/net/pcmcia/ibmtr_cs.c
index dc85282193bf..15d57f5b6f29 100644
--- a/drivers/net/pcmcia/ibmtr_cs.c
+++ b/drivers/net/pcmcia/ibmtr_cs.c
@@ -58,7 +58,6 @@
58#include <linux/trdevice.h> 58#include <linux/trdevice.h>
59#include <linux/ibmtr.h> 59#include <linux/ibmtr.h>
60 60
61#include <pcmcia/cs.h>
62#include <pcmcia/cistpl.h> 61#include <pcmcia/cistpl.h>
63#include <pcmcia/ds.h> 62#include <pcmcia/ds.h>
64 63
@@ -103,9 +102,8 @@ static void ibmtr_detach(struct pcmcia_device *p_dev);
103 102
104typedef struct ibmtr_dev_t { 103typedef struct ibmtr_dev_t {
105 struct pcmcia_device *p_dev; 104 struct pcmcia_device *p_dev;
106 struct net_device *dev; 105 struct net_device *dev;
107 window_handle_t sram_win_handle; 106 struct tok_info *ti;
108 struct tok_info *ti;
109} ibmtr_dev_t; 107} ibmtr_dev_t;
110 108
111static irqreturn_t ibmtr_interrupt(int irq, void *dev_id) { 109static irqreturn_t ibmtr_interrupt(int irq, void *dev_id) {
@@ -114,14 +112,6 @@ static irqreturn_t ibmtr_interrupt(int irq, void *dev_id) {
114 return tok_interrupt(irq, dev); 112 return tok_interrupt(irq, dev);
115}; 113};
116 114
117/*======================================================================
118
119 ibmtr_attach() creates an "instance" of the driver, allocating
120 local data structures for one device. The device is registered
121 with Card Services.
122
123======================================================================*/
124
125static int __devinit ibmtr_attach(struct pcmcia_device *link) 115static int __devinit ibmtr_attach(struct pcmcia_device *link)
126{ 116{
127 ibmtr_dev_t *info; 117 ibmtr_dev_t *info;
@@ -144,24 +134,14 @@ static int __devinit ibmtr_attach(struct pcmcia_device *link)
144 134
145 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 135 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
146 link->resource[0]->end = 4; 136 link->resource[0]->end = 4;
147 link->conf.Attributes = CONF_ENABLE_IRQ; 137 link->config_flags |= CONF_ENABLE_IRQ;
148 link->conf.IntType = INT_MEMORY_AND_IO; 138 link->config_regs = PRESENT_OPTION;
149 link->conf.Present = PRESENT_OPTION;
150 139
151 info->dev = dev; 140 info->dev = dev;
152 141
153 return ibmtr_config(link); 142 return ibmtr_config(link);
154} /* ibmtr_attach */ 143} /* ibmtr_attach */
155 144
156/*======================================================================
157
158 This deletes a driver "instance". The device is de-registered
159 with Card Services. If it has been released, all local data
160 structures are freed. Otherwise, the structures will be freed
161 when the device is released.
162
163======================================================================*/
164
165static void ibmtr_detach(struct pcmcia_device *link) 145static void ibmtr_detach(struct pcmcia_device *link)
166{ 146{
167 struct ibmtr_dev_t *info = link->priv; 147 struct ibmtr_dev_t *info = link->priv;
@@ -186,26 +166,17 @@ static void ibmtr_detach(struct pcmcia_device *link)
186 kfree(info); 166 kfree(info);
187} /* ibmtr_detach */ 167} /* ibmtr_detach */
188 168
189/*======================================================================
190
191 ibmtr_config() is scheduled to run after a CARD_INSERTION event
192 is received, to configure the PCMCIA socket, and to make the
193 token-ring device available to the system.
194
195======================================================================*/
196
197static int __devinit ibmtr_config(struct pcmcia_device *link) 169static int __devinit ibmtr_config(struct pcmcia_device *link)
198{ 170{
199 ibmtr_dev_t *info = link->priv; 171 ibmtr_dev_t *info = link->priv;
200 struct net_device *dev = info->dev; 172 struct net_device *dev = info->dev;
201 struct tok_info *ti = netdev_priv(dev); 173 struct tok_info *ti = netdev_priv(dev);
202 win_req_t req;
203 int i, ret; 174 int i, ret;
204 175
205 dev_dbg(&link->dev, "ibmtr_config\n"); 176 dev_dbg(&link->dev, "ibmtr_config\n");
206 177
207 link->conf.ConfigIndex = 0x61;
208 link->io_lines = 16; 178 link->io_lines = 16;
179 link->config_index = 0x61;
209 180
210 /* Determine if this is PRIMARY or ALTERNATE. */ 181 /* Determine if this is PRIMARY or ALTERNATE. */
211 182
@@ -229,39 +200,39 @@ static int __devinit ibmtr_config(struct pcmcia_device *link)
229 ti->global_int_enable=GLOBAL_INT_ENABLE+((dev->irq==9) ? 2 : dev->irq); 200 ti->global_int_enable=GLOBAL_INT_ENABLE+((dev->irq==9) ? 2 : dev->irq);
230 201
231 /* Allocate the MMIO memory window */ 202 /* Allocate the MMIO memory window */
232 req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE; 203 link->resource[2]->flags |= WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE;
233 req.Attributes |= WIN_USE_WAIT; 204 link->resource[2]->flags |= WIN_USE_WAIT;
234 req.Base = 0; 205 link->resource[2]->start = 0;
235 req.Size = 0x2000; 206 link->resource[2]->end = 0x2000;
236 req.AccessSpeed = 250; 207 ret = pcmcia_request_window(link, link->resource[2], 250);
237 ret = pcmcia_request_window(link, &req, &link->win);
238 if (ret) 208 if (ret)
239 goto failed; 209 goto failed;
240 210
241 ret = pcmcia_map_mem_page(link, link->win, mmiobase); 211 ret = pcmcia_map_mem_page(link, link->resource[2], mmiobase);
242 if (ret) 212 if (ret)
243 goto failed; 213 goto failed;
244 ti->mmio = ioremap(req.Base, req.Size); 214 ti->mmio = ioremap(link->resource[2]->start,
215 resource_size(link->resource[2]));
245 216
246 /* Allocate the SRAM memory window */ 217 /* Allocate the SRAM memory window */
247 req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE; 218 link->resource[3]->flags = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE;
248 req.Attributes |= WIN_USE_WAIT; 219 link->resource[3]->flags |= WIN_USE_WAIT;
249 req.Base = 0; 220 link->resource[3]->start = 0;
250 req.Size = sramsize * 1024; 221 link->resource[3]->end = sramsize * 1024;
251 req.AccessSpeed = 250; 222 ret = pcmcia_request_window(link, link->resource[3], 250);
252 ret = pcmcia_request_window(link, &req, &info->sram_win_handle);
253 if (ret) 223 if (ret)
254 goto failed; 224 goto failed;
255 225
256 ret = pcmcia_map_mem_page(link, info->sram_win_handle, srambase); 226 ret = pcmcia_map_mem_page(link, link->resource[3], srambase);
257 if (ret) 227 if (ret)
258 goto failed; 228 goto failed;
259 229
260 ti->sram_base = srambase >> 12; 230 ti->sram_base = srambase >> 12;
261 ti->sram_virt = ioremap(req.Base, req.Size); 231 ti->sram_virt = ioremap(link->resource[3]->start,
262 ti->sram_phys = req.Base; 232 resource_size(link->resource[3]));
233 ti->sram_phys = link->resource[3]->start;
263 234
264 ret = pcmcia_request_configuration(link, &link->conf); 235 ret = pcmcia_enable_device(link);
265 if (ret) 236 if (ret)
266 goto failed; 237 goto failed;
267 238
@@ -289,14 +260,6 @@ failed:
289 return -ENODEV; 260 return -ENODEV;
290} /* ibmtr_config */ 261} /* ibmtr_config */
291 262
292/*======================================================================
293
294 After a card is removed, ibmtr_release() will unregister the net
295 device, and release the PCMCIA configuration. If the device is
296 still open, this will be postponed until it is closed.
297
298======================================================================*/
299
300static void ibmtr_release(struct pcmcia_device *link) 263static void ibmtr_release(struct pcmcia_device *link)
301{ 264{
302 ibmtr_dev_t *info = link->priv; 265 ibmtr_dev_t *info = link->priv;
@@ -304,7 +267,7 @@ static void ibmtr_release(struct pcmcia_device *link)
304 267
305 dev_dbg(&link->dev, "ibmtr_release\n"); 268 dev_dbg(&link->dev, "ibmtr_release\n");
306 269
307 if (link->win) { 270 if (link->resource[2]->end) {
308 struct tok_info *ti = netdev_priv(dev); 271 struct tok_info *ti = netdev_priv(dev);
309 iounmap(ti->mmio); 272 iounmap(ti->mmio);
310 } 273 }
@@ -386,9 +349,7 @@ MODULE_DEVICE_TABLE(pcmcia, ibmtr_ids);
386 349
387static struct pcmcia_driver ibmtr_cs_driver = { 350static struct pcmcia_driver ibmtr_cs_driver = {
388 .owner = THIS_MODULE, 351 .owner = THIS_MODULE,
389 .drv = { 352 .name = "ibmtr_cs",
390 .name = "ibmtr_cs",
391 },
392 .probe = ibmtr_attach, 353 .probe = ibmtr_attach,
393 .remove = ibmtr_detach, 354 .remove = ibmtr_detach,
394 .id_table = ibmtr_ids, 355 .id_table = ibmtr_ids,
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c
index c1d8ce9e4a6c..0a2b0f9cdf33 100644
--- a/drivers/net/pcmcia/nmclan_cs.c
+++ b/drivers/net/pcmcia/nmclan_cs.c
@@ -148,7 +148,6 @@ Include Files
148#include <linux/ioport.h> 148#include <linux/ioport.h>
149#include <linux/bitops.h> 149#include <linux/bitops.h>
150 150
151#include <pcmcia/cs.h>
152#include <pcmcia/cisreg.h> 151#include <pcmcia/cisreg.h>
153#include <pcmcia/cistpl.h> 152#include <pcmcia/cistpl.h>
154#include <pcmcia/ds.h> 153#include <pcmcia/ds.h>
@@ -437,13 +436,6 @@ static const struct net_device_ops mace_netdev_ops = {
437 .ndo_validate_addr = eth_validate_addr, 436 .ndo_validate_addr = eth_validate_addr,
438}; 437};
439 438
440/* ----------------------------------------------------------------------------
441nmclan_attach
442 Creates an "instance" of the driver, allocating local data
443 structures for one device. The device is registered with Card
444 Services.
445---------------------------------------------------------------------------- */
446
447static int nmclan_probe(struct pcmcia_device *link) 439static int nmclan_probe(struct pcmcia_device *link)
448{ 440{
449 mace_private *lp; 441 mace_private *lp;
@@ -462,10 +454,9 @@ static int nmclan_probe(struct pcmcia_device *link)
462 spin_lock_init(&lp->bank_lock); 454 spin_lock_init(&lp->bank_lock);
463 link->resource[0]->end = 32; 455 link->resource[0]->end = 32;
464 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 456 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
465 link->conf.Attributes = CONF_ENABLE_IRQ; 457 link->config_flags |= CONF_ENABLE_IRQ;
466 link->conf.IntType = INT_MEMORY_AND_IO; 458 link->config_index = 1;
467 link->conf.ConfigIndex = 1; 459 link->config_regs = PRESENT_OPTION;
468 link->conf.Present = PRESENT_OPTION;
469 460
470 lp->tx_free_frames=AM2150_MAX_TX_FRAMES; 461 lp->tx_free_frames=AM2150_MAX_TX_FRAMES;
471 462
@@ -476,14 +467,6 @@ static int nmclan_probe(struct pcmcia_device *link)
476 return nmclan_config(link); 467 return nmclan_config(link);
477} /* nmclan_attach */ 468} /* nmclan_attach */
478 469
479/* ----------------------------------------------------------------------------
480nmclan_detach
481 This deletes a driver "instance". The device is de-registered
482 with Card Services. If it has been released, all local data
483 structures are freed. Otherwise, the structures will be freed
484 when the device is released.
485---------------------------------------------------------------------------- */
486
487static void nmclan_detach(struct pcmcia_device *link) 470static void nmclan_detach(struct pcmcia_device *link)
488{ 471{
489 struct net_device *dev = link->priv; 472 struct net_device *dev = link->priv;
@@ -627,13 +610,6 @@ static int mace_init(mace_private *lp, unsigned int ioaddr, char *enet_addr)
627 return 0; 610 return 0;
628} /* mace_init */ 611} /* mace_init */
629 612
630/* ----------------------------------------------------------------------------
631nmclan_config
632 This routine is scheduled to run after a CARD_INSERTION event
633 is received, to configure the PCMCIA socket, and to make the
634 ethernet device available to the system.
635---------------------------------------------------------------------------- */
636
637static int nmclan_config(struct pcmcia_device *link) 613static int nmclan_config(struct pcmcia_device *link)
638{ 614{
639 struct net_device *dev = link->priv; 615 struct net_device *dev = link->priv;
@@ -652,7 +628,7 @@ static int nmclan_config(struct pcmcia_device *link)
652 ret = pcmcia_request_exclusive_irq(link, mace_interrupt); 628 ret = pcmcia_request_exclusive_irq(link, mace_interrupt);
653 if (ret) 629 if (ret)
654 goto failed; 630 goto failed;
655 ret = pcmcia_request_configuration(link, &link->conf); 631 ret = pcmcia_enable_device(link);
656 if (ret) 632 if (ret)
657 goto failed; 633 goto failed;
658 634
@@ -712,12 +688,6 @@ failed:
712 return -ENODEV; 688 return -ENODEV;
713} /* nmclan_config */ 689} /* nmclan_config */
714 690
715/* ----------------------------------------------------------------------------
716nmclan_release
717 After a card is removed, nmclan_release() will unregister the
718 net device, and release the PCMCIA configuration. If the device
719 is still open, this will be postponed until it is closed.
720---------------------------------------------------------------------------- */
721static void nmclan_release(struct pcmcia_device *link) 691static void nmclan_release(struct pcmcia_device *link)
722{ 692{
723 dev_dbg(&link->dev, "nmclan_release\n"); 693 dev_dbg(&link->dev, "nmclan_release\n");
@@ -1533,9 +1503,7 @@ MODULE_DEVICE_TABLE(pcmcia, nmclan_ids);
1533 1503
1534static struct pcmcia_driver nmclan_cs_driver = { 1504static struct pcmcia_driver nmclan_cs_driver = {
1535 .owner = THIS_MODULE, 1505 .owner = THIS_MODULE,
1536 .drv = { 1506 .name = "nmclan_cs",
1537 .name = "nmclan_cs",
1538 },
1539 .probe = nmclan_probe, 1507 .probe = nmclan_probe,
1540 .remove = nmclan_detach, 1508 .remove = nmclan_detach,
1541 .id_table = nmclan_ids, 1509 .id_table = nmclan_ids,
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index c94311aed1ab..03096c80103d 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -43,7 +43,6 @@
43#include <linux/mii.h> 43#include <linux/mii.h>
44#include "../8390.h" 44#include "../8390.h"
45 45
46#include <pcmcia/cs.h>
47#include <pcmcia/cistpl.h> 46#include <pcmcia/cistpl.h>
48#include <pcmcia/ciscode.h> 47#include <pcmcia/ciscode.h>
49#include <pcmcia/ds.h> 48#include <pcmcia/ds.h>
@@ -238,14 +237,6 @@ static const struct net_device_ops pcnet_netdev_ops = {
238#endif 237#endif
239}; 238};
240 239
241/*======================================================================
242
243 pcnet_attach() creates an "instance" of the driver, allocating
244 local data structures for one device. The device is registered
245 with Card Services.
246
247======================================================================*/
248
249static int pcnet_probe(struct pcmcia_device *link) 240static int pcnet_probe(struct pcmcia_device *link)
250{ 241{
251 pcnet_dev_t *info; 242 pcnet_dev_t *info;
@@ -260,23 +251,13 @@ static int pcnet_probe(struct pcmcia_device *link)
260 info->p_dev = link; 251 info->p_dev = link;
261 link->priv = dev; 252 link->priv = dev;
262 253
263 link->conf.Attributes = CONF_ENABLE_IRQ; 254 link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
264 link->conf.IntType = INT_MEMORY_AND_IO;
265 255
266 dev->netdev_ops = &pcnet_netdev_ops; 256 dev->netdev_ops = &pcnet_netdev_ops;
267 257
268 return pcnet_config(link); 258 return pcnet_config(link);
269} /* pcnet_attach */ 259} /* pcnet_attach */
270 260
271/*======================================================================
272
273 This deletes a driver "instance". The device is de-registered
274 with Card Services. If it has been released, all local data
275 structures are freed. Otherwise, the structures will be freed
276 when the device is released.
277
278======================================================================*/
279
280static void pcnet_detach(struct pcmcia_device *link) 261static void pcnet_detach(struct pcmcia_device *link)
281{ 262{
282 struct net_device *dev = link->priv; 263 struct net_device *dev = link->priv;
@@ -300,22 +281,22 @@ static void pcnet_detach(struct pcmcia_device *link)
300static hw_info_t *get_hwinfo(struct pcmcia_device *link) 281static hw_info_t *get_hwinfo(struct pcmcia_device *link)
301{ 282{
302 struct net_device *dev = link->priv; 283 struct net_device *dev = link->priv;
303 win_req_t req;
304 u_char __iomem *base, *virt; 284 u_char __iomem *base, *virt;
305 int i, j; 285 int i, j;
306 286
307 /* Allocate a small memory window */ 287 /* Allocate a small memory window */
308 req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; 288 link->resource[2]->flags |= WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE;
309 req.Base = 0; req.Size = 0; 289 link->resource[2]->start = 0; link->resource[2]->end = 0;
310 req.AccessSpeed = 0; 290 i = pcmcia_request_window(link, link->resource[2], 0);
311 i = pcmcia_request_window(link, &req, &link->win);
312 if (i != 0) 291 if (i != 0)
313 return NULL; 292 return NULL;
314 293
315 virt = ioremap(req.Base, req.Size); 294 virt = ioremap(link->resource[2]->start,
295 resource_size(link->resource[2]));
316 for (i = 0; i < NR_INFO; i++) { 296 for (i = 0; i < NR_INFO; i++) {
317 pcmcia_map_mem_page(link, link->win, hw_info[i].offset & ~(req.Size-1)); 297 pcmcia_map_mem_page(link, link->resource[2],
318 base = &virt[hw_info[i].offset & (req.Size-1)]; 298 hw_info[i].offset & ~(resource_size(link->resource[2])-1));
299 base = &virt[hw_info[i].offset & (resource_size(link->resource[2])-1)];
319 if ((readb(base+0) == hw_info[i].a0) && 300 if ((readb(base+0) == hw_info[i].a0) &&
320 (readb(base+2) == hw_info[i].a1) && 301 (readb(base+2) == hw_info[i].a1) &&
321 (readb(base+4) == hw_info[i].a2)) { 302 (readb(base+4) == hw_info[i].a2)) {
@@ -326,7 +307,7 @@ static hw_info_t *get_hwinfo(struct pcmcia_device *link)
326 } 307 }
327 308
328 iounmap(virt); 309 iounmap(virt);
329 j = pcmcia_release_window(link, link->win); 310 j = pcmcia_release_window(link, link->resource[2]);
330 return (i < NR_INFO) ? hw_info+i : NULL; 311 return (i < NR_INFO) ? hw_info+i : NULL;
331} /* get_hwinfo */ 312} /* get_hwinfo */
332 313
@@ -421,7 +402,7 @@ static hw_info_t *get_ax88190(struct pcmcia_device *link)
421 int i, j; 402 int i, j;
422 403
423 /* Not much of a test, but the alternatives are messy */ 404 /* Not much of a test, but the alternatives are messy */
424 if (link->conf.ConfigBase != 0x03c0) 405 if (link->config_base != 0x03c0)
425 return NULL; 406 return NULL;
426 407
427 outb_p(0x01, ioaddr + EN0_DCFG); /* Set word-wide access. */ 408 outb_p(0x01, ioaddr + EN0_DCFG); /* Set word-wide access. */
@@ -461,14 +442,6 @@ static hw_info_t *get_hwired(struct pcmcia_device *link)
461 return &default_info; 442 return &default_info;
462} /* get_hwired */ 443} /* get_hwired */
463 444
464/*======================================================================
465
466 pcnet_config() is scheduled to run after a CARD_INSERTION event
467 is received, to configure the PCMCIA socket, and to make the
468 ethernet device available to the system.
469
470======================================================================*/
471
472static int try_io_port(struct pcmcia_device *link) 445static int try_io_port(struct pcmcia_device *link)
473{ 446{
474 int j, ret; 447 int j, ret;
@@ -500,43 +473,22 @@ static int try_io_port(struct pcmcia_device *link)
500 } 473 }
501} 474}
502 475
503static int pcnet_confcheck(struct pcmcia_device *p_dev, 476static int pcnet_confcheck(struct pcmcia_device *p_dev, void *priv_data)
504 cistpl_cftable_entry_t *cfg,
505 cistpl_cftable_entry_t *dflt,
506 unsigned int vcc,
507 void *priv_data)
508{ 477{
509 int *priv = priv_data; 478 int *priv = priv_data;
510 int try = (*priv & 0x1); 479 int try = (*priv & 0x1);
511 int i;
512 cistpl_io_t *io = &cfg->io;
513 480
514 if (cfg->index == 0 || cfg->io.nwin == 0) 481 *priv &= (p_dev->resource[2]->end >= 0x4000) ? 0x10 : ~0x10;
515 return -EINVAL;
516 482
517 /* For multifunction cards, by convention, we configure the 483 if (p_dev->config_index == 0)
518 network function with window 0, and serial with window 1 */ 484 return -EINVAL;
519 if (io->nwin > 1) {
520 i = (io->win[1].len > io->win[0].len);
521 p_dev->resource[1]->start = io->win[1-i].base;
522 p_dev->resource[1]->end = io->win[1-i].len;
523 } else {
524 i = p_dev->resource[1]->end = 0;
525 }
526 485
527 *priv &= ((cfg->mem.nwin == 1) && 486 if (p_dev->resource[0]->end + p_dev->resource[1]->end < 32)
528 (cfg->mem.win[0].len >= 0x4000)) ? 0x10 : ~0x10; 487 return -EINVAL;
529 488
530 p_dev->resource[0]->start = io->win[i].base; 489 if (try)
531 p_dev->resource[0]->end = io->win[i].len;
532 if (!try)
533 p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
534 else
535 p_dev->io_lines = 16; 490 p_dev->io_lines = 16;
536 if (p_dev->resource[0]->end + p_dev->resource[1]->end >= 32) 491 return try_io_port(p_dev);
537 return try_io_port(p_dev);
538
539 return -EINVAL;
540} 492}
541 493
542static hw_info_t *pcnet_try_config(struct pcmcia_device *link, 494static hw_info_t *pcnet_try_config(struct pcmcia_device *link,
@@ -558,15 +510,14 @@ static hw_info_t *pcnet_try_config(struct pcmcia_device *link,
558 if (!link->irq) 510 if (!link->irq)
559 return NULL; 511 return NULL;
560 512
561 if (resource_size(link->resource[1]) == 8) { 513 if (resource_size(link->resource[1]) == 8)
562 link->conf.Attributes |= CONF_ENABLE_SPKR; 514 link->config_flags |= CONF_ENABLE_SPKR;
563 link->conf.Status = CCSR_AUDIO_ENA; 515
564 }
565 if ((link->manf_id == MANFID_IBM) && 516 if ((link->manf_id == MANFID_IBM) &&
566 (link->card_id == PRODID_IBM_HOME_AND_AWAY)) 517 (link->card_id == PRODID_IBM_HOME_AND_AWAY))
567 link->conf.ConfigIndex |= 0x10; 518 link->config_index |= 0x10;
568 519
569 ret = pcmcia_request_configuration(link, &link->conf); 520 ret = pcmcia_enable_device(link);
570 if (ret) 521 if (ret)
571 return NULL; 522 return NULL;
572 523
@@ -581,7 +532,7 @@ static hw_info_t *pcnet_try_config(struct pcmcia_device *link,
581 } else 532 } else
582 dev->if_port = 0; 533 dev->if_port = 0;
583 534
584 if ((link->conf.ConfigBase == 0x03c0) && 535 if ((link->config_base == 0x03c0) &&
585 (link->manf_id == 0x149) && (link->card_id == 0xc1ab)) { 536 (link->manf_id == 0x149) && (link->card_id == 0xc1ab)) {
586 dev_info(&link->dev, 537 dev_info(&link->dev,
587 "this is an AX88190 card - use axnet_cs instead.\n"); 538 "this is an AX88190 card - use axnet_cs instead.\n");
@@ -685,14 +636,6 @@ failed:
685 return -ENODEV; 636 return -ENODEV;
686} /* pcnet_config */ 637} /* pcnet_config */
687 638
688/*======================================================================
689
690 After a card is removed, pcnet_release() will unregister the net
691 device, and release the PCMCIA configuration. If the device is
692 still open, this will be postponed until it is closed.
693
694======================================================================*/
695
696static void pcnet_release(struct pcmcia_device *link) 639static void pcnet_release(struct pcmcia_device *link)
697{ 640{
698 pcnet_dev_t *info = PRIV(link->priv); 641 pcnet_dev_t *info = PRIV(link->priv);
@@ -705,15 +648,6 @@ static void pcnet_release(struct pcmcia_device *link)
705 pcmcia_disable_device(link); 648 pcmcia_disable_device(link);
706} 649}
707 650
708/*======================================================================
709
710 The card status event handler. Mostly, this schedules other
711 stuff to run after an event is received. A CARD_REMOVAL event
712 also sets some flags to discourage the net drivers from trying
713 to talk to the card any more.
714
715======================================================================*/
716
717static int pcnet_suspend(struct pcmcia_device *link) 651static int pcnet_suspend(struct pcmcia_device *link)
718{ 652{
719 struct net_device *dev = link->priv; 653 struct net_device *dev = link->priv;
@@ -1466,7 +1400,6 @@ static int setup_shmem_window(struct pcmcia_device *link, int start_pg,
1466{ 1400{
1467 struct net_device *dev = link->priv; 1401 struct net_device *dev = link->priv;
1468 pcnet_dev_t *info = PRIV(dev); 1402 pcnet_dev_t *info = PRIV(dev);
1469 win_req_t req;
1470 int i, window_size, offset, ret; 1403 int i, window_size, offset, ret;
1471 1404
1472 window_size = (stop_pg - start_pg) << 8; 1405 window_size = (stop_pg - start_pg) << 8;
@@ -1477,22 +1410,22 @@ static int setup_shmem_window(struct pcmcia_device *link, int start_pg,
1477 window_size = roundup_pow_of_two(window_size); 1410 window_size = roundup_pow_of_two(window_size);
1478 1411
1479 /* Allocate a memory window */ 1412 /* Allocate a memory window */
1480 req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE; 1413 link->resource[3]->flags |= WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE;
1481 req.Attributes |= WIN_USE_WAIT; 1414 link->resource[3]->flags |= WIN_USE_WAIT;
1482 req.Base = 0; req.Size = window_size; 1415 link->resource[3]->start = 0; link->resource[3]->end = window_size;
1483 req.AccessSpeed = mem_speed; 1416 ret = pcmcia_request_window(link, link->resource[3], mem_speed);
1484 ret = pcmcia_request_window(link, &req, &link->win);
1485 if (ret) 1417 if (ret)
1486 goto failed; 1418 goto failed;
1487 1419
1488 offset = (start_pg << 8) + cm_offset; 1420 offset = (start_pg << 8) + cm_offset;
1489 offset -= offset % window_size; 1421 offset -= offset % window_size;
1490 ret = pcmcia_map_mem_page(link, link->win, offset); 1422 ret = pcmcia_map_mem_page(link, link->resource[3], offset);
1491 if (ret) 1423 if (ret)
1492 goto failed; 1424 goto failed;
1493 1425
1494 /* Try scribbling on the buffer */ 1426 /* Try scribbling on the buffer */
1495 info->base = ioremap(req.Base, window_size); 1427 info->base = ioremap(link->resource[3]->start,
1428 resource_size(link->resource[3]));
1496 for (i = 0; i < (TX_PAGES<<8); i += 2) 1429 for (i = 0; i < (TX_PAGES<<8); i += 2)
1497 __raw_writew((i>>1), info->base+offset+i); 1430 __raw_writew((i>>1), info->base+offset+i);
1498 udelay(100); 1431 udelay(100);
@@ -1501,19 +1434,20 @@ static int setup_shmem_window(struct pcmcia_device *link, int start_pg,
1501 pcnet_reset_8390(dev); 1434 pcnet_reset_8390(dev);
1502 if (i != (TX_PAGES<<8)) { 1435 if (i != (TX_PAGES<<8)) {
1503 iounmap(info->base); 1436 iounmap(info->base);
1504 pcmcia_release_window(link, link->win); 1437 pcmcia_release_window(link, link->resource[3]);
1505 info->base = NULL; link->win = 0; 1438 info->base = NULL;
1506 goto failed; 1439 goto failed;
1507 } 1440 }
1508 1441
1509 ei_status.mem = info->base + offset; 1442 ei_status.mem = info->base + offset;
1510 ei_status.priv = req.Size; 1443 ei_status.priv = resource_size(link->resource[3]);
1511 dev->mem_start = (u_long)ei_status.mem; 1444 dev->mem_start = (u_long)ei_status.mem;
1512 dev->mem_end = dev->mem_start + req.Size; 1445 dev->mem_end = dev->mem_start + resource_size(link->resource[3]);
1513 1446
1514 ei_status.tx_start_page = start_pg; 1447 ei_status.tx_start_page = start_pg;
1515 ei_status.rx_start_page = start_pg + TX_PAGES; 1448 ei_status.rx_start_page = start_pg + TX_PAGES;
1516 ei_status.stop_page = start_pg + ((req.Size - offset) >> 8); 1449 ei_status.stop_page = start_pg + (
1450 (resource_size(link->resource[3]) - offset) >> 8);
1517 1451
1518 /* set up block i/o functions */ 1452 /* set up block i/o functions */
1519 ei_status.get_8390_hdr = shmem_get_8390_hdr; 1453 ei_status.get_8390_hdr = shmem_get_8390_hdr;
@@ -1752,9 +1686,7 @@ MODULE_FIRMWARE("cis/PE-200.cis");
1752MODULE_FIRMWARE("cis/tamarack.cis"); 1686MODULE_FIRMWARE("cis/tamarack.cis");
1753 1687
1754static struct pcmcia_driver pcnet_driver = { 1688static struct pcmcia_driver pcnet_driver = {
1755 .drv = { 1689 .name = "pcnet_cs",
1756 .name = "pcnet_cs",
1757 },
1758 .probe = pcnet_probe, 1690 .probe = pcnet_probe,
1759 .remove = pcnet_detach, 1691 .remove = pcnet_detach,
1760 .owner = THIS_MODULE, 1692 .owner = THIS_MODULE,
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c
index 7204a4b5529b..8a9ff5318923 100644
--- a/drivers/net/pcmcia/smc91c92_cs.c
+++ b/drivers/net/pcmcia/smc91c92_cs.c
@@ -46,7 +46,6 @@
46#include <linux/jiffies.h> 46#include <linux/jiffies.h>
47#include <linux/firmware.h> 47#include <linux/firmware.h>
48 48
49#include <pcmcia/cs.h>
50#include <pcmcia/cistpl.h> 49#include <pcmcia/cistpl.h>
51#include <pcmcia/cisreg.h> 50#include <pcmcia/cisreg.h>
52#include <pcmcia/ciscode.h> 51#include <pcmcia/ciscode.h>
@@ -302,14 +301,6 @@ static const struct net_device_ops smc_netdev_ops = {
302 .ndo_validate_addr = eth_validate_addr, 301 .ndo_validate_addr = eth_validate_addr,
303}; 302};
304 303
305/*======================================================================
306
307 smc91c92_attach() creates an "instance" of the driver, allocating
308 local data structures for one device. The device is registered
309 with Card Services.
310
311======================================================================*/
312
313static int smc91c92_probe(struct pcmcia_device *link) 304static int smc91c92_probe(struct pcmcia_device *link)
314{ 305{
315 struct smc_private *smc; 306 struct smc_private *smc;
@@ -326,10 +317,6 @@ static int smc91c92_probe(struct pcmcia_device *link)
326 link->priv = dev; 317 link->priv = dev;
327 318
328 spin_lock_init(&smc->lock); 319 spin_lock_init(&smc->lock);
329 link->resource[0]->end = 16;
330 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
331 link->conf.Attributes = CONF_ENABLE_IRQ;
332 link->conf.IntType = INT_MEMORY_AND_IO;
333 320
334 /* The SMC91c92-specific entries in the device structure. */ 321 /* The SMC91c92-specific entries in the device structure. */
335 dev->netdev_ops = &smc_netdev_ops; 322 dev->netdev_ops = &smc_netdev_ops;
@@ -345,15 +332,6 @@ static int smc91c92_probe(struct pcmcia_device *link)
345 return smc91c92_config(link); 332 return smc91c92_config(link);
346} /* smc91c92_attach */ 333} /* smc91c92_attach */
347 334
348/*======================================================================
349
350 This deletes a driver "instance". The device is de-registered
351 with Card Services. If it has been released, all local data
352 structures are freed. Otherwise, the structures will be freed
353 when the device is released.
354
355======================================================================*/
356
357static void smc91c92_detach(struct pcmcia_device *link) 335static void smc91c92_detach(struct pcmcia_device *link)
358{ 336{
359 struct net_device *dev = link->priv; 337 struct net_device *dev = link->priv;
@@ -414,26 +392,28 @@ static int mhz_3288_power(struct pcmcia_device *link)
414 mdelay(200); 392 mdelay(200);
415 393
416 /* Now read and write the COR... */ 394 /* Now read and write the COR... */
417 tmp = readb(smc->base + link->conf.ConfigBase + CISREG_COR); 395 tmp = readb(smc->base + link->config_base + CISREG_COR);
418 udelay(5); 396 udelay(5);
419 writeb(tmp, smc->base + link->conf.ConfigBase + CISREG_COR); 397 writeb(tmp, smc->base + link->config_base + CISREG_COR);
420 398
421 return 0; 399 return 0;
422} 400}
423 401
424static int mhz_mfc_config_check(struct pcmcia_device *p_dev, 402static int mhz_mfc_config_check(struct pcmcia_device *p_dev, void *priv_data)
425 cistpl_cftable_entry_t *cf,
426 cistpl_cftable_entry_t *dflt,
427 unsigned int vcc,
428 void *priv_data)
429{ 403{
430 int k; 404 int k;
431 p_dev->resource[1]->start = cf->io.win[0].base; 405 p_dev->io_lines = 16;
406 p_dev->resource[1]->start = p_dev->resource[0]->start;
407 p_dev->resource[1]->end = 8;
408 p_dev->resource[1]->flags &= ~IO_DATA_PATH_WIDTH;
409 p_dev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
410 p_dev->resource[0]->end = 16;
411 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
412 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
432 for (k = 0; k < 0x400; k += 0x10) { 413 for (k = 0; k < 0x400; k += 0x10) {
433 if (k & 0x80) 414 if (k & 0x80)
434 continue; 415 continue;
435 p_dev->resource[0]->start = k ^ 0x300; 416 p_dev->resource[0]->start = k ^ 0x300;
436 p_dev->io_lines = 16;
437 if (!pcmcia_request_io(p_dev)) 417 if (!pcmcia_request_io(p_dev))
438 return 0; 418 return 0;
439 } 419 }
@@ -444,14 +424,11 @@ static int mhz_mfc_config(struct pcmcia_device *link)
444{ 424{
445 struct net_device *dev = link->priv; 425 struct net_device *dev = link->priv;
446 struct smc_private *smc = netdev_priv(dev); 426 struct smc_private *smc = netdev_priv(dev);
447 win_req_t req;
448 unsigned int offset; 427 unsigned int offset;
449 int i; 428 int i;
450 429
451 link->conf.Attributes |= CONF_ENABLE_SPKR; 430 link->config_flags |= CONF_ENABLE_SPKR | CONF_ENABLE_IRQ |
452 link->conf.Status = CCSR_AUDIO_ENA; 431 CONF_AUTO_SET_IO;
453 link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
454 link->resource[1]->end = 8;
455 432
456 /* The Megahertz combo cards have modem-like CIS entries, so 433 /* The Megahertz combo cards have modem-like CIS entries, so
457 we have to explicitly try a bunch of port combinations. */ 434 we have to explicitly try a bunch of port combinations. */
@@ -461,16 +438,16 @@ static int mhz_mfc_config(struct pcmcia_device *link)
461 dev->base_addr = link->resource[0]->start; 438 dev->base_addr = link->resource[0]->start;
462 439
463 /* Allocate a memory window, for accessing the ISR */ 440 /* Allocate a memory window, for accessing the ISR */
464 req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; 441 link->resource[2]->flags = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE;
465 req.Base = req.Size = 0; 442 link->resource[2]->start = link->resource[2]->end = 0;
466 req.AccessSpeed = 0; 443 i = pcmcia_request_window(link, link->resource[2], 0);
467 i = pcmcia_request_window(link, &req, &link->win);
468 if (i != 0) 444 if (i != 0)
469 return -ENODEV; 445 return -ENODEV;
470 446
471 smc->base = ioremap(req.Base, req.Size); 447 smc->base = ioremap(link->resource[2]->start,
472 offset = (smc->manfid == MANFID_MOTOROLA) ? link->conf.ConfigBase : 0; 448 resource_size(link->resource[2]));
473 i = pcmcia_map_mem_page(link, link->win, offset); 449 offset = (smc->manfid == MANFID_MOTOROLA) ? link->config_base : 0;
450 i = pcmcia_map_mem_page(link, link->resource[2], offset);
474 if ((i == 0) && 451 if ((i == 0) &&
475 (smc->manfid == MANFID_MEGAHERTZ) && 452 (smc->manfid == MANFID_MEGAHERTZ) &&
476 (smc->cardid == PRODID_MEGAHERTZ_EM3288)) 453 (smc->cardid == PRODID_MEGAHERTZ_EM3288))
@@ -593,14 +570,12 @@ static int mot_setup(struct pcmcia_device *link)
593 570
594/*====================================================================*/ 571/*====================================================================*/
595 572
596static int smc_configcheck(struct pcmcia_device *p_dev, 573static int smc_configcheck(struct pcmcia_device *p_dev, void *priv_data)
597 cistpl_cftable_entry_t *cf,
598 cistpl_cftable_entry_t *dflt,
599 unsigned int vcc,
600 void *priv_data)
601{ 574{
602 p_dev->resource[0]->start = cf->io.win[0].base; 575 p_dev->resource[0]->end = 16;
603 p_dev->io_lines = cf->io.flags & CISTPL_IO_LINES_MASK; 576 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
577 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
578
604 return pcmcia_request_io(p_dev); 579 return pcmcia_request_io(p_dev);
605} 580}
606 581
@@ -609,7 +584,8 @@ static int smc_config(struct pcmcia_device *link)
609 struct net_device *dev = link->priv; 584 struct net_device *dev = link->priv;
610 int i; 585 int i;
611 586
612 link->resource[0]->end = 16; 587 link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
588
613 i = pcmcia_loop_config(link, smc_configcheck, NULL); 589 i = pcmcia_loop_config(link, smc_configcheck, NULL);
614 if (!i) 590 if (!i)
615 dev->base_addr = link->resource[0]->start; 591 dev->base_addr = link->resource[0]->start;
@@ -642,15 +618,14 @@ static int osi_config(struct pcmcia_device *link)
642 static const unsigned int com[4] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8 }; 618 static const unsigned int com[4] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8 };
643 int i, j; 619 int i, j;
644 620
645 link->conf.Attributes |= CONF_ENABLE_SPKR; 621 link->config_flags |= CONF_ENABLE_SPKR | CONF_ENABLE_IRQ;
646 link->conf.Status = CCSR_AUDIO_ENA;
647 link->resource[0]->end = 64; 622 link->resource[0]->end = 64;
648 link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; 623 link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
649 link->resource[1]->end = 8; 624 link->resource[1]->end = 8;
650 625
651 /* Enable Hard Decode, LAN, Modem */ 626 /* Enable Hard Decode, LAN, Modem */
652 link->conf.ConfigIndex = 0x23;
653 link->io_lines = 16; 627 link->io_lines = 16;
628 link->config_index = 0x23;
654 629
655 for (i = j = 0; j < 4; j++) { 630 for (i = j = 0; j < 4; j++) {
656 link->resource[1]->start = com[j]; 631 link->resource[1]->start = com[j];
@@ -660,7 +635,7 @@ static int osi_config(struct pcmcia_device *link)
660 } 635 }
661 if (i != 0) { 636 if (i != 0) {
662 /* Fallback: turn off hard decode */ 637 /* Fallback: turn off hard decode */
663 link->conf.ConfigIndex = 0x03; 638 link->config_index = 0x03;
664 link->resource[1]->end = 0; 639 link->resource[1]->end = 0;
665 i = pcmcia_request_io(link); 640 i = pcmcia_request_io(link);
666 } 641 }
@@ -819,27 +794,16 @@ static int check_sig(struct pcmcia_device *link)
819 } 794 }
820 795
821 if (width) { 796 if (width) {
822 modconf_t mod = {
823 .Attributes = CONF_IO_CHANGE_WIDTH,
824 };
825 pr_info("using 8-bit IO window\n"); 797 pr_info("using 8-bit IO window\n");
826 798
827 smc91c92_suspend(link); 799 smc91c92_suspend(link);
828 pcmcia_modify_configuration(link, &mod); 800 pcmcia_fixup_iowidth(link);
829 smc91c92_resume(link); 801 smc91c92_resume(link);
830 return check_sig(link); 802 return check_sig(link);
831 } 803 }
832 return -ENODEV; 804 return -ENODEV;
833} 805}
834 806
835/*======================================================================
836
837 smc91c92_config() is scheduled to run after a CARD_INSERTION event
838 is received, to configure the PCMCIA socket, and to make the
839 ethernet device available to the system.
840
841======================================================================*/
842
843static int smc91c92_config(struct pcmcia_device *link) 807static int smc91c92_config(struct pcmcia_device *link)
844{ 808{
845 struct net_device *dev = link->priv; 809 struct net_device *dev = link->priv;
@@ -871,7 +835,7 @@ static int smc91c92_config(struct pcmcia_device *link)
871 i = pcmcia_request_irq(link, smc_interrupt); 835 i = pcmcia_request_irq(link, smc_interrupt);
872 if (i) 836 if (i)
873 goto config_failed; 837 goto config_failed;
874 i = pcmcia_request_configuration(link, &link->conf); 838 i = pcmcia_enable_device(link);
875 if (i) 839 if (i)
876 goto config_failed; 840 goto config_failed;
877 841
@@ -988,18 +952,10 @@ config_failed:
988 return -ENODEV; 952 return -ENODEV;
989} /* smc91c92_config */ 953} /* smc91c92_config */
990 954
991/*======================================================================
992
993 After a card is removed, smc91c92_release() will unregister the net
994 device, and release the PCMCIA configuration. If the device is
995 still open, this will be postponed until it is closed.
996
997======================================================================*/
998
999static void smc91c92_release(struct pcmcia_device *link) 955static void smc91c92_release(struct pcmcia_device *link)
1000{ 956{
1001 dev_dbg(&link->dev, "smc91c92_release\n"); 957 dev_dbg(&link->dev, "smc91c92_release\n");
1002 if (link->win) { 958 if (link->resource[2]->end) {
1003 struct net_device *dev = link->priv; 959 struct net_device *dev = link->priv;
1004 struct smc_private *smc = netdev_priv(dev); 960 struct smc_private *smc = netdev_priv(dev);
1005 iounmap(smc->base); 961 iounmap(smc->base);
@@ -2092,9 +2048,7 @@ MODULE_DEVICE_TABLE(pcmcia, smc91c92_ids);
2092 2048
2093static struct pcmcia_driver smc91c92_cs_driver = { 2049static struct pcmcia_driver smc91c92_cs_driver = {
2094 .owner = THIS_MODULE, 2050 .owner = THIS_MODULE,
2095 .drv = { 2051 .name = "smc91c92_cs",
2096 .name = "smc91c92_cs",
2097 },
2098 .probe = smc91c92_probe, 2052 .probe = smc91c92_probe,
2099 .remove = smc91c92_detach, 2053 .remove = smc91c92_detach,
2100 .id_table = smc91c92_ids, 2054 .id_table = smc91c92_ids,
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c
index d858b5e4c4a7..a46b7fd6c0f5 100644
--- a/drivers/net/pcmcia/xirc2ps_cs.c
+++ b/drivers/net/pcmcia/xirc2ps_cs.c
@@ -84,7 +84,6 @@
84#include <linux/bitops.h> 84#include <linux/bitops.h>
85#include <linux/mii.h> 85#include <linux/mii.h>
86 86
87#include <pcmcia/cs.h>
88#include <pcmcia/cistpl.h> 87#include <pcmcia/cistpl.h>
89#include <pcmcia/cisreg.h> 88#include <pcmcia/cisreg.h>
90#include <pcmcia/ciscode.h> 89#include <pcmcia/ciscode.h>
@@ -262,33 +261,11 @@ static unsigned mii_rd(unsigned int ioaddr, u_char phyaddr, u_char phyreg);
262static void mii_wr(unsigned int ioaddr, u_char phyaddr, u_char phyreg, 261static void mii_wr(unsigned int ioaddr, u_char phyaddr, u_char phyreg,
263 unsigned data, int len); 262 unsigned data, int len);
264 263
265/*
266 * The event() function is this driver's Card Services event handler.
267 * It will be called by Card Services when an appropriate card status
268 * event is received. The config() and release() entry points are
269 * used to configure or release a socket, in response to card insertion
270 * and ejection events. They are invoked from the event handler.
271 */
272
273static int has_ce2_string(struct pcmcia_device * link); 264static int has_ce2_string(struct pcmcia_device * link);
274static int xirc2ps_config(struct pcmcia_device * link); 265static int xirc2ps_config(struct pcmcia_device * link);
275static void xirc2ps_release(struct pcmcia_device * link); 266static void xirc2ps_release(struct pcmcia_device * link);
276
277/****************
278 * The attach() and detach() entry points are used to create and destroy
279 * "instances" of the driver, where each instance represents everything
280 * needed to manage one actual PCMCIA card.
281 */
282
283static void xirc2ps_detach(struct pcmcia_device *p_dev); 267static void xirc2ps_detach(struct pcmcia_device *p_dev);
284 268
285/****************
286 * You'll also need to prototype all the functions that will actually
287 * be used to talk to your device. See 'pcmem_cs' for a good example
288 * of a fully self-sufficient driver; the other drivers rely more or
289 * less on other parts of the kernel.
290 */
291
292static irqreturn_t xirc2ps_interrupt(int irq, void *dev_id); 269static irqreturn_t xirc2ps_interrupt(int irq, void *dev_id);
293 270
294typedef struct local_info_t { 271typedef struct local_info_t {
@@ -496,16 +473,6 @@ static const struct net_device_ops netdev_ops = {
496 .ndo_validate_addr = eth_validate_addr, 473 .ndo_validate_addr = eth_validate_addr,
497}; 474};
498 475
499/****************
500 * xirc2ps_attach() creates an "instance" of the driver, allocating
501 * local data structures for one device. The device is registered
502 * with Card Services.
503 *
504 * The dev_link structure is initialized, but we don't actually
505 * configure the card at this point -- we wait until we receive a
506 * card insertion event.
507 */
508
509static int 476static int
510xirc2ps_probe(struct pcmcia_device *link) 477xirc2ps_probe(struct pcmcia_device *link)
511{ 478{
@@ -524,9 +491,7 @@ xirc2ps_probe(struct pcmcia_device *link)
524 link->priv = dev; 491 link->priv = dev;
525 492
526 /* General socket configuration */ 493 /* General socket configuration */
527 link->conf.Attributes = CONF_ENABLE_IRQ; 494 link->config_index = 1;
528 link->conf.IntType = INT_MEMORY_AND_IO;
529 link->conf.ConfigIndex = 1;
530 495
531 /* Fill in card specific entries */ 496 /* Fill in card specific entries */
532 dev->netdev_ops = &netdev_ops; 497 dev->netdev_ops = &netdev_ops;
@@ -537,13 +502,6 @@ xirc2ps_probe(struct pcmcia_device *link)
537 return xirc2ps_config(link); 502 return xirc2ps_config(link);
538} /* xirc2ps_attach */ 503} /* xirc2ps_attach */
539 504
540/****************
541 * This deletes a driver "instance". The device is de-registered
542 * with Card Services. If it has been released, all local data
543 * structures are freed. Otherwise, the structures will be freed
544 * when the device is released.
545 */
546
547static void 505static void
548xirc2ps_detach(struct pcmcia_device *link) 506xirc2ps_detach(struct pcmcia_device *link)
549{ 507{
@@ -661,44 +619,53 @@ has_ce2_string(struct pcmcia_device * p_dev)
661} 619}
662 620
663static int 621static int
664xirc2ps_config_modem(struct pcmcia_device *p_dev, 622xirc2ps_config_modem(struct pcmcia_device *p_dev, void *priv_data)
665 cistpl_cftable_entry_t *cf,
666 cistpl_cftable_entry_t *dflt,
667 unsigned int vcc,
668 void *priv_data)
669{ 623{
670 unsigned int ioaddr; 624 unsigned int ioaddr;
671 625
672 if (cf->io.nwin > 0 && (cf->io.win[0].base & 0xf) == 8) { 626 if ((p_dev->resource[0]->start & 0xf) == 8)
673 for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) { 627 return -ENODEV;
674 p_dev->resource[1]->start = cf->io.win[0].base; 628
675 p_dev->resource[0]->start = ioaddr; 629 p_dev->resource[0]->end = 16;
676 if (!pcmcia_request_io(p_dev)) 630 p_dev->resource[1]->end = 8;
677 return 0; 631 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
678 } 632 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_16;
633 p_dev->resource[1]->flags &= ~IO_DATA_PATH_WIDTH;
634 p_dev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
635 p_dev->io_lines = 10;
636
637 p_dev->resource[1]->start = p_dev->resource[0]->start;
638 for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) {
639 p_dev->resource[0]->start = ioaddr;
640 if (!pcmcia_request_io(p_dev))
641 return 0;
679 } 642 }
680 return -ENODEV; 643 return -ENODEV;
681} 644}
682 645
683static int 646static int
684xirc2ps_config_check(struct pcmcia_device *p_dev, 647xirc2ps_config_check(struct pcmcia_device *p_dev, void *priv_data)
685 cistpl_cftable_entry_t *cf,
686 cistpl_cftable_entry_t *dflt,
687 unsigned int vcc,
688 void *priv_data)
689{ 648{
690 int *pass = priv_data; 649 int *pass = priv_data;
650 resource_size_t tmp = p_dev->resource[1]->start;
691 651
692 if (cf->io.nwin > 0 && (cf->io.win[0].base & 0xf) == 8) { 652 tmp += (*pass ? (p_dev->config_index & 0x20 ? -24 : 8)
693 p_dev->resource[1]->start = cf->io.win[0].base; 653 : (p_dev->config_index & 0x20 ? 8 : -24));
694 p_dev->resource[0]->start = p_dev->resource[1]->start 654
695 + (*pass ? (cf->index & 0x20 ? -24:8) 655 if ((p_dev->resource[0]->start & 0xf) == 8)
696 : (cf->index & 0x20 ? 8:-24)); 656 return -ENODEV;
697 if (!pcmcia_request_io(p_dev)) 657
698 return 0; 658 p_dev->resource[0]->end = 18;
699 } 659 p_dev->resource[1]->end = 8;
700 return -ENODEV; 660 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
661 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_16;
662 p_dev->resource[1]->flags &= ~IO_DATA_PATH_WIDTH;
663 p_dev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
664 p_dev->io_lines = 10;
701 665
666 p_dev->resource[1]->start = p_dev->resource[0]->start;
667 p_dev->resource[0]->start = tmp;
668 return pcmcia_request_io(p_dev);
702} 669}
703 670
704 671
@@ -721,11 +688,6 @@ static int pcmcia_get_mac_ce(struct pcmcia_device *p_dev,
721}; 688};
722 689
723 690
724/****************
725 * xirc2ps_config() is scheduled to run after a CARD_INSERTION event
726 * is received, to configure the PCMCIA socket, and to make the
727 * ethernet device available to the system.
728 */
729static int 691static int
730xirc2ps_config(struct pcmcia_device * link) 692xirc2ps_config(struct pcmcia_device * link)
731{ 693{
@@ -801,32 +763,24 @@ xirc2ps_config(struct pcmcia_device * link)
801 goto failure; 763 goto failure;
802 } 764 }
803 765
804 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16;
805 link->io_lines = 10;
806 if (local->modem) { 766 if (local->modem) {
807 int pass; 767 int pass;
768 link->config_flags |= CONF_AUTO_SET_IO;
808 769
809 if (do_sound) {
810 link->conf.Attributes |= CONF_ENABLE_SPKR;
811 link->conf.Status |= CCSR_AUDIO_ENA;
812 }
813 link->resource[1]->end = 8;
814 link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
815 if (local->dingo) { 770 if (local->dingo) {
816 /* Take the Modem IO port from the CIS and scan for a free 771 /* Take the Modem IO port from the CIS and scan for a free
817 * Ethernet port */ 772 * Ethernet port */
818 link->resource[0]->end = 16; /* no Mako stuff anymore */
819 if (!pcmcia_loop_config(link, xirc2ps_config_modem, NULL)) 773 if (!pcmcia_loop_config(link, xirc2ps_config_modem, NULL))
820 goto port_found; 774 goto port_found;
821 } else { 775 } else {
822 link->resource[0]->end = 18;
823 /* We do 2 passes here: The first one uses the regular mapping and 776 /* We do 2 passes here: The first one uses the regular mapping and
824 * the second tries again, thereby considering that the 32 ports are 777 * the second tries again, thereby considering that the 32 ports are
825 * mirrored every 32 bytes. Actually we use a mirrored port for 778 * mirrored every 32 bytes. Actually we use a mirrored port for
826 * the Mako if (on the first pass) the COR bit 5 is set. 779 * the Mako if (on the first pass) the COR bit 5 is set.
827 */ 780 */
828 for (pass=0; pass < 2; pass++) 781 for (pass=0; pass < 2; pass++)
829 if (!pcmcia_loop_config(link, xirc2ps_config_check, &pass)) 782 if (!pcmcia_loop_config(link, xirc2ps_config_check,
783 &pass))
830 goto port_found; 784 goto port_found;
831 /* if special option: 785 /* if special option:
832 * try to configure as Ethernet only. 786 * try to configure as Ethernet only.
@@ -834,7 +788,9 @@ xirc2ps_config(struct pcmcia_device * link)
834 } 788 }
835 pr_notice("no ports available\n"); 789 pr_notice("no ports available\n");
836 } else { 790 } else {
791 link->io_lines = 10;
837 link->resource[0]->end = 16; 792 link->resource[0]->end = 16;
793 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16;
838 for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) { 794 for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) {
839 link->resource[0]->start = ioaddr; 795 link->resource[0]->start = ioaddr;
840 if (!(err = pcmcia_request_io(link))) 796 if (!(err = pcmcia_request_io(link)))
@@ -855,16 +811,14 @@ xirc2ps_config(struct pcmcia_device * link)
855 if ((err=pcmcia_request_irq(link, xirc2ps_interrupt))) 811 if ((err=pcmcia_request_irq(link, xirc2ps_interrupt)))
856 goto config_error; 812 goto config_error;
857 813
858 /**************** 814 link->config_flags |= CONF_ENABLE_IRQ;
859 * This actually configures the PCMCIA socket -- setting up 815 if (do_sound)
860 * the I/O windows and the interrupt mapping. 816 link->config_flags |= CONF_ENABLE_SPKR;
861 */ 817
862 if ((err=pcmcia_request_configuration(link, &link->conf))) 818 if ((err = pcmcia_enable_device(link)))
863 goto config_error; 819 goto config_error;
864 820
865 if (local->dingo) { 821 if (local->dingo) {
866 win_req_t req;
867
868 /* Reset the modem's BAR to the correct value 822 /* Reset the modem's BAR to the correct value
869 * This is necessary because in the RequestConfiguration call, 823 * This is necessary because in the RequestConfiguration call,
870 * the base address of the ethernet port (BasePort1) is written 824 * the base address of the ethernet port (BasePort1) is written
@@ -884,14 +838,14 @@ xirc2ps_config(struct pcmcia_device * link)
884 * is at 0x0800. So we allocate a window into the attribute 838 * is at 0x0800. So we allocate a window into the attribute
885 * memory and write direct to the CIS registers 839 * memory and write direct to the CIS registers
886 */ 840 */
887 req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; 841 link->resource[2]->flags = WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_AM |
888 req.Base = req.Size = 0; 842 WIN_ENABLE;
889 req.AccessSpeed = 0; 843 link->resource[2]->start = link->resource[2]->end = 0;
890 if ((err = pcmcia_request_window(link, &req, &link->win))) 844 if ((err = pcmcia_request_window(link, link->resource[2], 0)))
891 goto config_error; 845 goto config_error;
892 846
893 local->dingo_ccr = ioremap(req.Base,0x1000) + 0x0800; 847 local->dingo_ccr = ioremap(link->resource[2]->start, 0x1000) + 0x0800;
894 if ((err = pcmcia_map_mem_page(link, link->win, 0))) 848 if ((err = pcmcia_map_mem_page(link, link->resource[2], 0)))
895 goto config_error; 849 goto config_error;
896 850
897 /* Setup the CCRs; there are no infos in the CIS about the Ethernet 851 /* Setup the CCRs; there are no infos in the CIS about the Ethernet
@@ -972,17 +926,12 @@ xirc2ps_config(struct pcmcia_device * link)
972 return -ENODEV; 926 return -ENODEV;
973} /* xirc2ps_config */ 927} /* xirc2ps_config */
974 928
975/****************
976 * After a card is removed, xirc2ps_release() will unregister the net
977 * device, and release the PCMCIA configuration. If the device is
978 * still open, this will be postponed until it is closed.
979 */
980static void 929static void
981xirc2ps_release(struct pcmcia_device *link) 930xirc2ps_release(struct pcmcia_device *link)
982{ 931{
983 dev_dbg(&link->dev, "release\n"); 932 dev_dbg(&link->dev, "release\n");
984 933
985 if (link->win) { 934 if (link->resource[2]->end) {
986 struct net_device *dev = link->priv; 935 struct net_device *dev = link->priv;
987 local_info_t *local = netdev_priv(dev); 936 local_info_t *local = netdev_priv(dev);
988 if (local->dingo) 937 if (local->dingo)
@@ -1818,9 +1767,7 @@ MODULE_DEVICE_TABLE(pcmcia, xirc2ps_ids);
1818 1767
1819static struct pcmcia_driver xirc2ps_cs_driver = { 1768static struct pcmcia_driver xirc2ps_cs_driver = {
1820 .owner = THIS_MODULE, 1769 .owner = THIS_MODULE,
1821 .drv = { 1770 .name = "xirc2ps_cs",
1822 .name = "xirc2ps_cs",
1823 },
1824 .probe = xirc2ps_probe, 1771 .probe = xirc2ps_probe,
1825 .remove = xirc2ps_detach, 1772 .remove = xirc2ps_detach,
1826 .id_table = xirc2ps_ids, 1773 .id_table = xirc2ps_ids,
diff --git a/drivers/net/ppp_async.c b/drivers/net/ppp_async.c
index af50a530daee..78d70a6481bf 100644
--- a/drivers/net/ppp_async.c
+++ b/drivers/net/ppp_async.c
@@ -184,7 +184,7 @@ ppp_asynctty_open(struct tty_struct *tty)
184 tasklet_init(&ap->tsk, ppp_async_process, (unsigned long) ap); 184 tasklet_init(&ap->tsk, ppp_async_process, (unsigned long) ap);
185 185
186 atomic_set(&ap->refcnt, 1); 186 atomic_set(&ap->refcnt, 1);
187 init_MUTEX_LOCKED(&ap->dead_sem); 187 sema_init(&ap->dead_sem, 0);
188 188
189 ap->chan.private = ap; 189 ap->chan.private = ap;
190 ap->chan.ops = &async_ops; 190 ap->chan.ops = &async_ops;
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c
index 866e221643ab..09cf56d0416a 100644
--- a/drivers/net/ppp_generic.c
+++ b/drivers/net/ppp_generic.c
@@ -856,7 +856,8 @@ static const struct file_operations ppp_device_fops = {
856 .poll = ppp_poll, 856 .poll = ppp_poll,
857 .unlocked_ioctl = ppp_ioctl, 857 .unlocked_ioctl = ppp_ioctl,
858 .open = ppp_open, 858 .open = ppp_open,
859 .release = ppp_release 859 .release = ppp_release,
860 .llseek = noop_llseek,
860}; 861};
861 862
862static __net_init int ppp_init_net(struct net *net) 863static __net_init int ppp_init_net(struct net *net)
diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c
index 10cf0cbc2185..726df611ee17 100644
--- a/drivers/net/smc91x.c
+++ b/drivers/net/smc91x.c
@@ -72,6 +72,7 @@ static const char version[] =
72#include <linux/sched.h> 72#include <linux/sched.h>
73#include <linux/delay.h> 73#include <linux/delay.h>
74#include <linux/interrupt.h> 74#include <linux/interrupt.h>
75#include <linux/irq.h>
75#include <linux/errno.h> 76#include <linux/errno.h>
76#include <linux/ioport.h> 77#include <linux/ioport.h>
77#include <linux/crc32.h> 78#include <linux/crc32.h>
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index 8110595fbbcc..b154a94de03e 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -1636,11 +1636,11 @@ hso_wait_modem_status(struct hso_serial *serial, unsigned long arg)
1636 * NB: both 1->0 and 0->1 transitions are counted except for 1636 * NB: both 1->0 and 0->1 transitions are counted except for
1637 * RI where only 0->1 is counted. 1637 * RI where only 0->1 is counted.
1638 */ 1638 */
1639static int hso_get_count(struct hso_serial *serial, 1639static int hso_get_count(struct tty_struct *tty,
1640 struct serial_icounter_struct __user *icnt) 1640 struct serial_icounter_struct *icount)
1641{ 1641{
1642 struct serial_icounter_struct icount;
1643 struct uart_icount cnow; 1642 struct uart_icount cnow;
1643 struct hso_serial *serial = get_serial_by_tty(tty);
1644 struct hso_tiocmget *tiocmget = serial->tiocmget; 1644 struct hso_tiocmget *tiocmget = serial->tiocmget;
1645 1645
1646 memset(&icount, 0, sizeof(struct serial_icounter_struct)); 1646 memset(&icount, 0, sizeof(struct serial_icounter_struct));
@@ -1651,19 +1651,19 @@ static int hso_get_count(struct hso_serial *serial,
1651 memcpy(&cnow, &tiocmget->icount, sizeof(struct uart_icount)); 1651 memcpy(&cnow, &tiocmget->icount, sizeof(struct uart_icount));
1652 spin_unlock_irq(&serial->serial_lock); 1652 spin_unlock_irq(&serial->serial_lock);
1653 1653
1654 icount.cts = cnow.cts; 1654 icount->cts = cnow.cts;
1655 icount.dsr = cnow.dsr; 1655 icount->dsr = cnow.dsr;
1656 icount.rng = cnow.rng; 1656 icount->rng = cnow.rng;
1657 icount.dcd = cnow.dcd; 1657 icount->dcd = cnow.dcd;
1658 icount.rx = cnow.rx; 1658 icount->rx = cnow.rx;
1659 icount.tx = cnow.tx; 1659 icount->tx = cnow.tx;
1660 icount.frame = cnow.frame; 1660 icount->frame = cnow.frame;
1661 icount.overrun = cnow.overrun; 1661 icount->overrun = cnow.overrun;
1662 icount.parity = cnow.parity; 1662 icount->parity = cnow.parity;
1663 icount.brk = cnow.brk; 1663 icount->brk = cnow.brk;
1664 icount.buf_overrun = cnow.buf_overrun; 1664 icount->buf_overrun = cnow.buf_overrun;
1665 1665
1666 return copy_to_user(icnt, &icount, sizeof(icount)) ? -EFAULT : 0; 1666 return 0;
1667} 1667}
1668 1668
1669 1669
@@ -1755,10 +1755,6 @@ static int hso_serial_ioctl(struct tty_struct *tty, struct file *file,
1755 case TIOCMIWAIT: 1755 case TIOCMIWAIT:
1756 ret = hso_wait_modem_status(serial, arg); 1756 ret = hso_wait_modem_status(serial, arg);
1757 break; 1757 break;
1758
1759 case TIOCGICOUNT:
1760 ret = hso_get_count(serial, uarg);
1761 break;
1762 default: 1758 default:
1763 ret = -ENOIOCTLCMD; 1759 ret = -ENOIOCTLCMD;
1764 break; 1760 break;
@@ -3291,6 +3287,7 @@ static const struct tty_operations hso_serial_ops = {
3291 .chars_in_buffer = hso_serial_chars_in_buffer, 3287 .chars_in_buffer = hso_serial_chars_in_buffer,
3292 .tiocmget = hso_serial_tiocmget, 3288 .tiocmget = hso_serial_tiocmget,
3293 .tiocmset = hso_serial_tiocmset, 3289 .tiocmset = hso_serial_tiocmset,
3290 .get_icount = hso_get_count,
3294 .unthrottle = hso_unthrottle 3291 .unthrottle = hso_unthrottle
3295}; 3292};
3296 3293
diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c
index 04c6cd4333f1..10bafd59f9c3 100644
--- a/drivers/net/wan/cosa.c
+++ b/drivers/net/wan/cosa.c
@@ -575,7 +575,7 @@ static int cosa_probe(int base, int irq, int dma)
575 575
576 /* Initialize the chardev data structures */ 576 /* Initialize the chardev data structures */
577 mutex_init(&chan->rlock); 577 mutex_init(&chan->rlock);
578 init_MUTEX(&chan->wsem); 578 sema_init(&chan->wsem, 1);
579 579
580 /* Register the network interface */ 580 /* Register the network interface */
581 if (!(chan->netdev = alloc_hdlcdev(chan))) { 581 if (!(chan->netdev = alloc_hdlcdev(chan))) {
diff --git a/drivers/net/wimax/i2400m/debugfs.c b/drivers/net/wimax/i2400m/debugfs.c
index b1aec3e1892f..9c70b5fa3f51 100644
--- a/drivers/net/wimax/i2400m/debugfs.c
+++ b/drivers/net/wimax/i2400m/debugfs.c
@@ -119,6 +119,7 @@ const struct file_operations i2400m_rx_stats_fops = {
119 .open = i2400m_stats_open, 119 .open = i2400m_stats_open,
120 .read = i2400m_rx_stats_read, 120 .read = i2400m_rx_stats_read,
121 .write = i2400m_rx_stats_write, 121 .write = i2400m_rx_stats_write,
122 .llseek = default_llseek,
122}; 123};
123 124
124 125
@@ -171,6 +172,7 @@ const struct file_operations i2400m_tx_stats_fops = {
171 .open = i2400m_stats_open, 172 .open = i2400m_stats_open,
172 .read = i2400m_tx_stats_read, 173 .read = i2400m_tx_stats_read,
173 .write = i2400m_tx_stats_write, 174 .write = i2400m_tx_stats_write,
175 .llseek = default_llseek,
174}; 176};
175 177
176 178
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index 5a56502c4eb0..a36e7870b03e 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -4418,21 +4418,24 @@ static const struct file_operations proc_statsdelta_ops = {
4418 .owner = THIS_MODULE, 4418 .owner = THIS_MODULE,
4419 .read = proc_read, 4419 .read = proc_read,
4420 .open = proc_statsdelta_open, 4420 .open = proc_statsdelta_open,
4421 .release = proc_close 4421 .release = proc_close,
4422 .llseek = default_llseek,
4422}; 4423};
4423 4424
4424static const struct file_operations proc_stats_ops = { 4425static const struct file_operations proc_stats_ops = {
4425 .owner = THIS_MODULE, 4426 .owner = THIS_MODULE,
4426 .read = proc_read, 4427 .read = proc_read,
4427 .open = proc_stats_open, 4428 .open = proc_stats_open,
4428 .release = proc_close 4429 .release = proc_close,
4430 .llseek = default_llseek,
4429}; 4431};
4430 4432
4431static const struct file_operations proc_status_ops = { 4433static const struct file_operations proc_status_ops = {
4432 .owner = THIS_MODULE, 4434 .owner = THIS_MODULE,
4433 .read = proc_read, 4435 .read = proc_read,
4434 .open = proc_status_open, 4436 .open = proc_status_open,
4435 .release = proc_close 4437 .release = proc_close,
4438 .llseek = default_llseek,
4436}; 4439};
4437 4440
4438static const struct file_operations proc_SSID_ops = { 4441static const struct file_operations proc_SSID_ops = {
@@ -4440,7 +4443,8 @@ static const struct file_operations proc_SSID_ops = {
4440 .read = proc_read, 4443 .read = proc_read,
4441 .write = proc_write, 4444 .write = proc_write,
4442 .open = proc_SSID_open, 4445 .open = proc_SSID_open,
4443 .release = proc_close 4446 .release = proc_close,
4447 .llseek = default_llseek,
4444}; 4448};
4445 4449
4446static const struct file_operations proc_BSSList_ops = { 4450static const struct file_operations proc_BSSList_ops = {
@@ -4448,7 +4452,8 @@ static const struct file_operations proc_BSSList_ops = {
4448 .read = proc_read, 4452 .read = proc_read,
4449 .write = proc_write, 4453 .write = proc_write,
4450 .open = proc_BSSList_open, 4454 .open = proc_BSSList_open,
4451 .release = proc_close 4455 .release = proc_close,
4456 .llseek = default_llseek,
4452}; 4457};
4453 4458
4454static const struct file_operations proc_APList_ops = { 4459static const struct file_operations proc_APList_ops = {
@@ -4456,7 +4461,8 @@ static const struct file_operations proc_APList_ops = {
4456 .read = proc_read, 4461 .read = proc_read,
4457 .write = proc_write, 4462 .write = proc_write,
4458 .open = proc_APList_open, 4463 .open = proc_APList_open,
4459 .release = proc_close 4464 .release = proc_close,
4465 .llseek = default_llseek,
4460}; 4466};
4461 4467
4462static const struct file_operations proc_config_ops = { 4468static const struct file_operations proc_config_ops = {
@@ -4464,7 +4470,8 @@ static const struct file_operations proc_config_ops = {
4464 .read = proc_read, 4470 .read = proc_read,
4465 .write = proc_write, 4471 .write = proc_write,
4466 .open = proc_config_open, 4472 .open = proc_config_open,
4467 .release = proc_close 4473 .release = proc_close,
4474 .llseek = default_llseek,
4468}; 4475};
4469 4476
4470static const struct file_operations proc_wepkey_ops = { 4477static const struct file_operations proc_wepkey_ops = {
@@ -4472,7 +4479,8 @@ static const struct file_operations proc_wepkey_ops = {
4472 .read = proc_read, 4479 .read = proc_read,
4473 .write = proc_write, 4480 .write = proc_write,
4474 .open = proc_wepkey_open, 4481 .open = proc_wepkey_open,
4475 .release = proc_close 4482 .release = proc_close,
4483 .llseek = default_llseek,
4476}; 4484};
4477 4485
4478static struct proc_dir_entry *airo_entry; 4486static struct proc_dir_entry *airo_entry;
diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c
index 9a121a5b787c..df2484d45474 100644
--- a/drivers/net/wireless/airo_cs.c
+++ b/drivers/net/wireless/airo_cs.c
@@ -32,7 +32,6 @@
32#include <linux/timer.h> 32#include <linux/timer.h>
33#include <linux/netdevice.h> 33#include <linux/netdevice.h>
34 34
35#include <pcmcia/cs.h>
36#include <pcmcia/cistpl.h> 35#include <pcmcia/cistpl.h>
37#include <pcmcia/cisreg.h> 36#include <pcmcia/cisreg.h>
38#include <pcmcia/ds.h> 37#include <pcmcia/ds.h>
@@ -54,58 +53,21 @@ MODULE_SUPPORTED_DEVICE("Aironet 4500, 4800 and Cisco 340 PCMCIA cards");
54 53
55/*====================================================================*/ 54/*====================================================================*/
56 55
57/*
58 The event() function is this driver's Card Services event handler.
59 It will be called by Card Services when an appropriate card status
60 event is received. The config() and release() entry points are
61 used to configure or release a socket, in response to card
62 insertion and ejection events. They are invoked from the airo_cs
63 event handler.
64*/
65
66static int airo_config(struct pcmcia_device *link); 56static int airo_config(struct pcmcia_device *link);
67static void airo_release(struct pcmcia_device *link); 57static void airo_release(struct pcmcia_device *link);
68 58
69/*
70 The attach() and detach() entry points are used to create and destroy
71 "instances" of the driver, where each instance represents everything
72 needed to manage one actual PCMCIA card.
73*/
74
75static void airo_detach(struct pcmcia_device *p_dev); 59static void airo_detach(struct pcmcia_device *p_dev);
76 60
77typedef struct local_info_t { 61typedef struct local_info_t {
78 struct net_device *eth_dev; 62 struct net_device *eth_dev;
79} local_info_t; 63} local_info_t;
80 64
81/*======================================================================
82
83 airo_attach() creates an "instance" of the driver, allocating
84 local data structures for one device. The device is registered
85 with Card Services.
86
87 The dev_link structure is initialized, but we don't actually
88 configure the card at this point -- we wait until we receive a
89 card insertion event.
90
91 ======================================================================*/
92
93static int airo_probe(struct pcmcia_device *p_dev) 65static int airo_probe(struct pcmcia_device *p_dev)
94{ 66{
95 local_info_t *local; 67 local_info_t *local;
96 68
97 dev_dbg(&p_dev->dev, "airo_attach()\n"); 69 dev_dbg(&p_dev->dev, "airo_attach()\n");
98 70
99 /*
100 General socket configuration defaults can go here. In this
101 client, we assume very little, and rely on the CIS for almost
102 everything. In most clients, many details (i.e., number, sizes,
103 and attributes of IO windows) are fixed by the nature of the
104 device, and can be hard-wired here.
105 */
106 p_dev->conf.Attributes = 0;
107 p_dev->conf.IntType = INT_MEMORY_AND_IO;
108
109 /* Allocate space for private device-specific data */ 71 /* Allocate space for private device-specific data */
110 local = kzalloc(sizeof(local_info_t), GFP_KERNEL); 72 local = kzalloc(sizeof(local_info_t), GFP_KERNEL);
111 if (!local) { 73 if (!local) {
@@ -117,15 +79,6 @@ static int airo_probe(struct pcmcia_device *p_dev)
117 return airo_config(p_dev); 79 return airo_config(p_dev);
118} /* airo_attach */ 80} /* airo_attach */
119 81
120/*======================================================================
121
122 This deletes a driver "instance". The device is de-registered
123 with Card Services. If it has been released, all local data
124 structures are freed. Otherwise, the structures will be freed
125 when the device is released.
126
127 ======================================================================*/
128
129static void airo_detach(struct pcmcia_device *link) 82static void airo_detach(struct pcmcia_device *link)
130{ 83{
131 dev_dbg(&link->dev, "airo_detach\n"); 84 dev_dbg(&link->dev, "airo_detach\n");
@@ -140,60 +93,12 @@ static void airo_detach(struct pcmcia_device *link)
140 kfree(link->priv); 93 kfree(link->priv);
141} /* airo_detach */ 94} /* airo_detach */
142 95
143/*====================================================================== 96static int airo_cs_config_check(struct pcmcia_device *p_dev, void *priv_data)
144
145 airo_config() is scheduled to run after a CARD_INSERTION event
146 is received, to configure the PCMCIA socket, and to make the
147 device available to the system.
148
149 ======================================================================*/
150
151static int airo_cs_config_check(struct pcmcia_device *p_dev,
152 cistpl_cftable_entry_t *cfg,
153 cistpl_cftable_entry_t *dflt,
154 unsigned int vcc,
155 void *priv_data)
156{ 97{
157 if (cfg->index == 0) 98 if (p_dev->config_index == 0)
158 return -ENODEV; 99 return -EINVAL;
159
160 /* Does this card need audio output? */
161 if (cfg->flags & CISTPL_CFTABLE_AUDIO) {
162 p_dev->conf.Attributes |= CONF_ENABLE_SPKR;
163 p_dev->conf.Status = CCSR_AUDIO_ENA;
164 }
165
166 /* Use power settings for Vcc and Vpp if present */
167 /* Note that the CIS values need to be rescaled */
168 if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM))
169 p_dev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000;
170 else if (dflt->vpp1.present & (1<<CISTPL_POWER_VNOM))
171 p_dev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000;
172
173 p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
174
175 /* IO window settings */
176 p_dev->resource[0]->end = p_dev->resource[1]->end = 0;
177 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
178 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
179 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
180 p_dev->resource[0]->flags |=
181 pcmcia_io_cfg_data_width(io->flags);
182 p_dev->resource[0]->start = io->win[0].base;
183 p_dev->resource[0]->end = io->win[0].len;
184 if (io->nwin > 1) {
185 p_dev->resource[1]->flags = p_dev->resource[0]->flags;
186 p_dev->resource[1]->start = io->win[1].base;
187 p_dev->resource[1]->end = io->win[1].len;
188 }
189 }
190 100
191 /* This reserves IO space but doesn't actually enable it */ 101 return pcmcia_request_io(p_dev);
192 if (pcmcia_request_io(p_dev) != 0)
193 return -ENODEV;
194
195 /* If we got this far, we're cool! */
196 return 0;
197} 102}
198 103
199 104
@@ -206,20 +111,9 @@ static int airo_config(struct pcmcia_device *link)
206 111
207 dev_dbg(&link->dev, "airo_config\n"); 112 dev_dbg(&link->dev, "airo_config\n");
208 113
209 /* 114 link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP |
210 * In this loop, we scan the CIS for configuration table 115 CONF_AUTO_AUDIO | CONF_AUTO_SET_IO;
211 * entries, each of which describes a valid card 116
212 * configuration, including voltage, IO window, memory window,
213 * and interrupt settings.
214 *
215 * We make no assumptions about the card to be configured: we
216 * use just the information available in the CIS. In an ideal
217 * world, this would work for any PCMCIA card, but it requires
218 * a complete and accurate CIS. In practice, a driver usually
219 * "knows" most of these things without consulting the CIS,
220 * and most client drivers will only use the CIS to fill in
221 * implementation-defined details.
222 */
223 ret = pcmcia_loop_config(link, airo_cs_config_check, NULL); 117 ret = pcmcia_loop_config(link, airo_cs_config_check, NULL);
224 if (ret) 118 if (ret)
225 goto failed; 119 goto failed;
@@ -227,12 +121,7 @@ static int airo_config(struct pcmcia_device *link)
227 if (!link->irq) 121 if (!link->irq)
228 goto failed; 122 goto failed;
229 123
230 /* 124 ret = pcmcia_enable_device(link);
231 This actually configures the PCMCIA socket -- setting up
232 the I/O windows and the interrupt mapping, and putting the
233 card and host interface into "Memory and IO" mode.
234 */
235 ret = pcmcia_request_configuration(link, &link->conf);
236 if (ret) 125 if (ret)
237 goto failed; 126 goto failed;
238 ((local_info_t *)link->priv)->eth_dev = 127 ((local_info_t *)link->priv)->eth_dev =
@@ -241,17 +130,6 @@ static int airo_config(struct pcmcia_device *link)
241 if (!((local_info_t *)link->priv)->eth_dev) 130 if (!((local_info_t *)link->priv)->eth_dev)
242 goto failed; 131 goto failed;
243 132
244 /* Finally, report what we've done */
245 dev_info(&link->dev, "index 0x%02x: ",
246 link->conf.ConfigIndex);
247 if (link->conf.Vpp)
248 printk(", Vpp %d.%d", link->conf.Vpp/10, link->conf.Vpp%10);
249 printk(", irq %d", link->irq);
250 if (link->resource[0])
251 printk(" & %pR", link->resource[0]);
252 if (link->resource[1])
253 printk(" & %pR", link->resource[1]);
254 printk("\n");
255 return 0; 133 return 0;
256 134
257 failed: 135 failed:
@@ -259,14 +137,6 @@ static int airo_config(struct pcmcia_device *link)
259 return -ENODEV; 137 return -ENODEV;
260} /* airo_config */ 138} /* airo_config */
261 139
262/*======================================================================
263
264 After a card is removed, airo_release() will unregister the
265 device, and release the PCMCIA configuration. If the device is
266 still open, this will be postponed until it is closed.
267
268 ======================================================================*/
269
270static void airo_release(struct pcmcia_device *link) 140static void airo_release(struct pcmcia_device *link)
271{ 141{
272 dev_dbg(&link->dev, "airo_release\n"); 142 dev_dbg(&link->dev, "airo_release\n");
@@ -305,9 +175,7 @@ MODULE_DEVICE_TABLE(pcmcia, airo_ids);
305 175
306static struct pcmcia_driver airo_driver = { 176static struct pcmcia_driver airo_driver = {
307 .owner = THIS_MODULE, 177 .owner = THIS_MODULE,
308 .drv = { 178 .name = "airo_cs",
309 .name = "airo_cs",
310 },
311 .probe = airo_probe, 179 .probe = airo_probe,
312 .remove = airo_detach, 180 .remove = airo_detach,
313 .id_table = airo_ids, 181 .id_table = airo_ids,
@@ -315,12 +183,12 @@ static struct pcmcia_driver airo_driver = {
315 .resume = airo_resume, 183 .resume = airo_resume,
316}; 184};
317 185
318static int airo_cs_init(void) 186static int __init airo_cs_init(void)
319{ 187{
320 return pcmcia_register_driver(&airo_driver); 188 return pcmcia_register_driver(&airo_driver);
321} 189}
322 190
323static void airo_cs_cleanup(void) 191static void __exit airo_cs_cleanup(void)
324{ 192{
325 pcmcia_unregister_driver(&airo_driver); 193 pcmcia_unregister_driver(&airo_driver);
326} 194}
diff --git a/drivers/net/wireless/ath/ath5k/debug.c b/drivers/net/wireless/ath/ath5k/debug.c
index 42ea5b1bdb12..acda56ee521b 100644
--- a/drivers/net/wireless/ath/ath5k/debug.c
+++ b/drivers/net/wireless/ath/ath5k/debug.c
@@ -270,6 +270,7 @@ static const struct file_operations fops_beacon = {
270 .write = write_file_beacon, 270 .write = write_file_beacon,
271 .open = ath5k_debugfs_open, 271 .open = ath5k_debugfs_open,
272 .owner = THIS_MODULE, 272 .owner = THIS_MODULE,
273 .llseek = default_llseek,
273}; 274};
274 275
275 276
@@ -289,6 +290,7 @@ static const struct file_operations fops_reset = {
289 .write = write_file_reset, 290 .write = write_file_reset,
290 .open = ath5k_debugfs_open, 291 .open = ath5k_debugfs_open,
291 .owner = THIS_MODULE, 292 .owner = THIS_MODULE,
293 .llseek = noop_llseek,
292}; 294};
293 295
294 296
@@ -369,6 +371,7 @@ static const struct file_operations fops_debug = {
369 .write = write_file_debug, 371 .write = write_file_debug,
370 .open = ath5k_debugfs_open, 372 .open = ath5k_debugfs_open,
371 .owner = THIS_MODULE, 373 .owner = THIS_MODULE,
374 .llseek = default_llseek,
372}; 375};
373 376
374 377
@@ -480,6 +483,7 @@ static const struct file_operations fops_antenna = {
480 .write = write_file_antenna, 483 .write = write_file_antenna,
481 .open = ath5k_debugfs_open, 484 .open = ath5k_debugfs_open,
482 .owner = THIS_MODULE, 485 .owner = THIS_MODULE,
486 .llseek = default_llseek,
483}; 487};
484 488
485/* debugfs: misc */ 489/* debugfs: misc */
@@ -649,6 +653,7 @@ static const struct file_operations fops_frameerrors = {
649 .write = write_file_frameerrors, 653 .write = write_file_frameerrors,
650 .open = ath5k_debugfs_open, 654 .open = ath5k_debugfs_open,
651 .owner = THIS_MODULE, 655 .owner = THIS_MODULE,
656 .llseek = default_llseek,
652}; 657};
653 658
654 659
@@ -807,6 +812,7 @@ static const struct file_operations fops_ani = {
807 .write = write_file_ani, 812 .write = write_file_ani,
808 .open = ath5k_debugfs_open, 813 .open = ath5k_debugfs_open,
809 .owner = THIS_MODULE, 814 .owner = THIS_MODULE,
815 .llseek = default_llseek,
810}; 816};
811 817
812 818
@@ -877,6 +883,7 @@ static const struct file_operations fops_queue = {
877 .write = write_file_queue, 883 .write = write_file_queue,
878 .open = ath5k_debugfs_open, 884 .open = ath5k_debugfs_open,
879 .owner = THIS_MODULE, 885 .owner = THIS_MODULE,
886 .llseek = default_llseek,
880}; 887};
881 888
882 889
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c
index 7f764e3d1c0a..43e71a944cb1 100644
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -71,7 +71,8 @@ static const struct file_operations fops_debug = {
71 .read = read_file_debug, 71 .read = read_file_debug,
72 .write = write_file_debug, 72 .write = write_file_debug,
73 .open = ath9k_debugfs_open, 73 .open = ath9k_debugfs_open,
74 .owner = THIS_MODULE 74 .owner = THIS_MODULE,
75 .llseek = default_llseek,
75}; 76};
76 77
77#endif 78#endif
@@ -116,7 +117,8 @@ static const struct file_operations fops_tx_chainmask = {
116 .read = read_file_tx_chainmask, 117 .read = read_file_tx_chainmask,
117 .write = write_file_tx_chainmask, 118 .write = write_file_tx_chainmask,
118 .open = ath9k_debugfs_open, 119 .open = ath9k_debugfs_open,
119 .owner = THIS_MODULE 120 .owner = THIS_MODULE,
121 .llseek = default_llseek,
120}; 122};
121 123
122 124
@@ -158,7 +160,8 @@ static const struct file_operations fops_rx_chainmask = {
158 .read = read_file_rx_chainmask, 160 .read = read_file_rx_chainmask,
159 .write = write_file_rx_chainmask, 161 .write = write_file_rx_chainmask,
160 .open = ath9k_debugfs_open, 162 .open = ath9k_debugfs_open,
161 .owner = THIS_MODULE 163 .owner = THIS_MODULE,
164 .llseek = default_llseek,
162}; 165};
163 166
164 167
@@ -259,7 +262,8 @@ static ssize_t read_file_dma(struct file *file, char __user *user_buf,
259static const struct file_operations fops_dma = { 262static const struct file_operations fops_dma = {
260 .read = read_file_dma, 263 .read = read_file_dma,
261 .open = ath9k_debugfs_open, 264 .open = ath9k_debugfs_open,
262 .owner = THIS_MODULE 265 .owner = THIS_MODULE,
266 .llseek = default_llseek,
263}; 267};
264 268
265 269
@@ -375,7 +379,8 @@ static ssize_t read_file_interrupt(struct file *file, char __user *user_buf,
375static const struct file_operations fops_interrupt = { 379static const struct file_operations fops_interrupt = {
376 .read = read_file_interrupt, 380 .read = read_file_interrupt,
377 .open = ath9k_debugfs_open, 381 .open = ath9k_debugfs_open,
378 .owner = THIS_MODULE 382 .owner = THIS_MODULE,
383 .llseek = default_llseek,
379}; 384};
380 385
381static const char * ath_wiphy_state_str(enum ath_wiphy_state state) 386static const char * ath_wiphy_state_str(enum ath_wiphy_state state)
@@ -572,7 +577,8 @@ static const struct file_operations fops_wiphy = {
572 .read = read_file_wiphy, 577 .read = read_file_wiphy,
573 .write = write_file_wiphy, 578 .write = write_file_wiphy,
574 .open = ath9k_debugfs_open, 579 .open = ath9k_debugfs_open,
575 .owner = THIS_MODULE 580 .owner = THIS_MODULE,
581 .llseek = default_llseek,
576}; 582};
577 583
578#define PR(str, elem) \ 584#define PR(str, elem) \
@@ -656,7 +662,8 @@ void ath_debug_stat_tx(struct ath_softc *sc, struct ath_txq *txq,
656static const struct file_operations fops_xmit = { 662static const struct file_operations fops_xmit = {
657 .read = read_file_xmit, 663 .read = read_file_xmit,
658 .open = ath9k_debugfs_open, 664 .open = ath9k_debugfs_open,
659 .owner = THIS_MODULE 665 .owner = THIS_MODULE,
666 .llseek = default_llseek,
660}; 667};
661 668
662static ssize_t read_file_recv(struct file *file, char __user *user_buf, 669static ssize_t read_file_recv(struct file *file, char __user *user_buf,
@@ -778,7 +785,8 @@ void ath_debug_stat_rx(struct ath_softc *sc, struct ath_rx_status *rs)
778static const struct file_operations fops_recv = { 785static const struct file_operations fops_recv = {
779 .read = read_file_recv, 786 .read = read_file_recv,
780 .open = ath9k_debugfs_open, 787 .open = ath9k_debugfs_open,
781 .owner = THIS_MODULE 788 .owner = THIS_MODULE,
789 .llseek = default_llseek,
782}; 790};
783 791
784static ssize_t read_file_regidx(struct file *file, char __user *user_buf, 792static ssize_t read_file_regidx(struct file *file, char __user *user_buf,
@@ -816,7 +824,8 @@ static const struct file_operations fops_regidx = {
816 .read = read_file_regidx, 824 .read = read_file_regidx,
817 .write = write_file_regidx, 825 .write = write_file_regidx,
818 .open = ath9k_debugfs_open, 826 .open = ath9k_debugfs_open,
819 .owner = THIS_MODULE 827 .owner = THIS_MODULE,
828 .llseek = default_llseek,
820}; 829};
821 830
822static ssize_t read_file_regval(struct file *file, char __user *user_buf, 831static ssize_t read_file_regval(struct file *file, char __user *user_buf,
@@ -858,7 +867,8 @@ static const struct file_operations fops_regval = {
858 .read = read_file_regval, 867 .read = read_file_regval,
859 .write = write_file_regval, 868 .write = write_file_regval,
860 .open = ath9k_debugfs_open, 869 .open = ath9k_debugfs_open,
861 .owner = THIS_MODULE 870 .owner = THIS_MODULE,
871 .llseek = default_llseek,
862}; 872};
863 873
864int ath9k_init_debug(struct ath_hw *ah) 874int ath9k_init_debug(struct ath_hw *ah)
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index 55c80866dfc6..9a3be8da755d 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -535,7 +535,8 @@ static ssize_t read_file_tgt_stats(struct file *file, char __user *user_buf,
535static const struct file_operations fops_tgt_stats = { 535static const struct file_operations fops_tgt_stats = {
536 .read = read_file_tgt_stats, 536 .read = read_file_tgt_stats,
537 .open = ath9k_debugfs_open, 537 .open = ath9k_debugfs_open,
538 .owner = THIS_MODULE 538 .owner = THIS_MODULE,
539 .llseek = default_llseek,
539}; 540};
540 541
541static ssize_t read_file_xmit(struct file *file, char __user *user_buf, 542static ssize_t read_file_xmit(struct file *file, char __user *user_buf,
@@ -583,7 +584,8 @@ static ssize_t read_file_xmit(struct file *file, char __user *user_buf,
583static const struct file_operations fops_xmit = { 584static const struct file_operations fops_xmit = {
584 .read = read_file_xmit, 585 .read = read_file_xmit,
585 .open = ath9k_debugfs_open, 586 .open = ath9k_debugfs_open,
586 .owner = THIS_MODULE 587 .owner = THIS_MODULE,
588 .llseek = default_llseek,
587}; 589};
588 590
589static ssize_t read_file_recv(struct file *file, char __user *user_buf, 591static ssize_t read_file_recv(struct file *file, char __user *user_buf,
@@ -612,7 +614,8 @@ static ssize_t read_file_recv(struct file *file, char __user *user_buf,
612static const struct file_operations fops_recv = { 614static const struct file_operations fops_recv = {
613 .read = read_file_recv, 615 .read = read_file_recv,
614 .open = ath9k_debugfs_open, 616 .open = ath9k_debugfs_open,
615 .owner = THIS_MODULE 617 .owner = THIS_MODULE,
618 .llseek = default_llseek,
616}; 619};
617 620
618int ath9k_htc_init_debug(struct ath_hw *ah) 621int ath9k_htc_init_debug(struct ath_hw *ah)
diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c
index 3b632161c106..c96e19da2949 100644
--- a/drivers/net/wireless/atmel_cs.c
+++ b/drivers/net/wireless/atmel_cs.c
@@ -42,7 +42,6 @@
42#include <linux/moduleparam.h> 42#include <linux/moduleparam.h>
43#include <linux/device.h> 43#include <linux/device.h>
44 44
45#include <pcmcia/cs.h>
46#include <pcmcia/cistpl.h> 45#include <pcmcia/cistpl.h>
47#include <pcmcia/cisreg.h> 46#include <pcmcia/cisreg.h>
48#include <pcmcia/ds.h> 47#include <pcmcia/ds.h>
@@ -64,58 +63,21 @@ MODULE_SUPPORTED_DEVICE("Atmel at76c50x PCMCIA cards");
64 63
65/*====================================================================*/ 64/*====================================================================*/
66 65
67/*
68 The event() function is this driver's Card Services event handler.
69 It will be called by Card Services when an appropriate card status
70 event is received. The config() and release() entry points are
71 used to configure or release a socket, in response to card
72 insertion and ejection events. They are invoked from the atmel_cs
73 event handler.
74*/
75
76static int atmel_config(struct pcmcia_device *link); 66static int atmel_config(struct pcmcia_device *link);
77static void atmel_release(struct pcmcia_device *link); 67static void atmel_release(struct pcmcia_device *link);
78 68
79/*
80 The attach() and detach() entry points are used to create and destroy
81 "instances" of the driver, where each instance represents everything
82 needed to manage one actual PCMCIA card.
83*/
84
85static void atmel_detach(struct pcmcia_device *p_dev); 69static void atmel_detach(struct pcmcia_device *p_dev);
86 70
87typedef struct local_info_t { 71typedef struct local_info_t {
88 struct net_device *eth_dev; 72 struct net_device *eth_dev;
89} local_info_t; 73} local_info_t;
90 74
91/*======================================================================
92
93 atmel_attach() creates an "instance" of the driver, allocating
94 local data structures for one device. The device is registered
95 with Card Services.
96
97 The dev_link structure is initialized, but we don't actually
98 configure the card at this point -- we wait until we receive a
99 card insertion event.
100
101 ======================================================================*/
102
103static int atmel_probe(struct pcmcia_device *p_dev) 75static int atmel_probe(struct pcmcia_device *p_dev)
104{ 76{
105 local_info_t *local; 77 local_info_t *local;
106 78
107 dev_dbg(&p_dev->dev, "atmel_attach()\n"); 79 dev_dbg(&p_dev->dev, "atmel_attach()\n");
108 80
109 /*
110 General socket configuration defaults can go here. In this
111 client, we assume very little, and rely on the CIS for almost
112 everything. In most clients, many details (i.e., number, sizes,
113 and attributes of IO windows) are fixed by the nature of the
114 device, and can be hard-wired here.
115 */
116 p_dev->conf.Attributes = 0;
117 p_dev->conf.IntType = INT_MEMORY_AND_IO;
118
119 /* Allocate space for private device-specific data */ 81 /* Allocate space for private device-specific data */
120 local = kzalloc(sizeof(local_info_t), GFP_KERNEL); 82 local = kzalloc(sizeof(local_info_t), GFP_KERNEL);
121 if (!local) { 83 if (!local) {
@@ -127,15 +89,6 @@ static int atmel_probe(struct pcmcia_device *p_dev)
127 return atmel_config(p_dev); 89 return atmel_config(p_dev);
128} /* atmel_attach */ 90} /* atmel_attach */
129 91
130/*======================================================================
131
132 This deletes a driver "instance". The device is de-registered
133 with Card Services. If it has been released, all local data
134 structures are freed. Otherwise, the structures will be freed
135 when the device is released.
136
137 ======================================================================*/
138
139static void atmel_detach(struct pcmcia_device *link) 92static void atmel_detach(struct pcmcia_device *link)
140{ 93{
141 dev_dbg(&link->dev, "atmel_detach\n"); 94 dev_dbg(&link->dev, "atmel_detach\n");
@@ -145,14 +98,6 @@ static void atmel_detach(struct pcmcia_device *link)
145 kfree(link->priv); 98 kfree(link->priv);
146} 99}
147 100
148/*======================================================================
149
150 atmel_config() is scheduled to run after a CARD_INSERTION event
151 is received, to configure the PCMCIA socket, and to make the
152 device available to the system.
153
154 ======================================================================*/
155
156/* Call-back function to interrogate PCMCIA-specific information 101/* Call-back function to interrogate PCMCIA-specific information
157 about the current existance of the card */ 102 about the current existance of the card */
158static int card_present(void *arg) 103static int card_present(void *arg)
@@ -165,47 +110,11 @@ static int card_present(void *arg)
165 return 0; 110 return 0;
166} 111}
167 112
168static int atmel_config_check(struct pcmcia_device *p_dev, 113static int atmel_config_check(struct pcmcia_device *p_dev, void *priv_data)
169 cistpl_cftable_entry_t *cfg,
170 cistpl_cftable_entry_t *dflt,
171 unsigned int vcc,
172 void *priv_data)
173{ 114{
174 if (cfg->index == 0) 115 if (p_dev->config_index == 0)
175 return -ENODEV; 116 return -EINVAL;
176
177 /* Does this card need audio output? */
178 if (cfg->flags & CISTPL_CFTABLE_AUDIO) {
179 p_dev->conf.Attributes |= CONF_ENABLE_SPKR;
180 p_dev->conf.Status = CCSR_AUDIO_ENA;
181 }
182 117
183 /* Use power settings for Vcc and Vpp if present */
184 /* Note that the CIS values need to be rescaled */
185 if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM))
186 p_dev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000;
187 else if (dflt->vpp1.present & (1<<CISTPL_POWER_VNOM))
188 p_dev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000;
189
190 p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
191
192 /* IO window settings */
193 p_dev->resource[0]->end = p_dev->resource[1]->end = 0;
194 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
195 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
196 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
197 p_dev->resource[0]->flags |=
198 pcmcia_io_cfg_data_width(io->flags);
199 p_dev->resource[0]->start = io->win[0].base;
200 p_dev->resource[0]->end = io->win[0].len;
201 if (io->nwin > 1) {
202 p_dev->resource[1]->flags = p_dev->resource[0]->flags;
203 p_dev->resource[1]->start = io->win[1].base;
204 p_dev->resource[1]->end = io->win[1].len;
205 }
206 }
207
208 /* This reserves IO space but doesn't actually enable it */
209 return pcmcia_request_io(p_dev); 118 return pcmcia_request_io(p_dev);
210} 119}
211 120
@@ -220,18 +129,9 @@ static int atmel_config(struct pcmcia_device *link)
220 129
221 dev_dbg(&link->dev, "atmel_config\n"); 130 dev_dbg(&link->dev, "atmel_config\n");
222 131
223 /* 132 link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP |
224 In this loop, we scan the CIS for configuration table entries, 133 CONF_AUTO_AUDIO | CONF_AUTO_SET_IO;
225 each of which describes a valid card configuration, including 134
226 voltage, IO window, memory window, and interrupt settings.
227
228 We make no assumptions about the card to be configured: we use
229 just the information available in the CIS. In an ideal world,
230 this would work for any PCMCIA card, but it requires a complete
231 and accurate CIS. In practice, a driver usually "knows" most of
232 these things without consulting the CIS, and most client drivers
233 will only use the CIS to fill in implementation-defined details.
234 */
235 if (pcmcia_loop_config(link, atmel_config_check, NULL)) 135 if (pcmcia_loop_config(link, atmel_config_check, NULL))
236 goto failed; 136 goto failed;
237 137
@@ -240,12 +140,7 @@ static int atmel_config(struct pcmcia_device *link)
240 goto failed; 140 goto failed;
241 } 141 }
242 142
243 /* 143 ret = pcmcia_enable_device(link);
244 This actually configures the PCMCIA socket -- setting up
245 the I/O windows and the interrupt mapping, and putting the
246 card and host interface into "Memory and IO" mode.
247 */
248 ret = pcmcia_request_configuration(link, &link->conf);
249 if (ret) 144 if (ret)
250 goto failed; 145 goto failed;
251 146
@@ -267,14 +162,6 @@ static int atmel_config(struct pcmcia_device *link)
267 return -ENODEV; 162 return -ENODEV;
268} 163}
269 164
270/*======================================================================
271
272 After a card is removed, atmel_release() will unregister the
273 device, and release the PCMCIA configuration. If the device is
274 still open, this will be postponed until it is closed.
275
276 ======================================================================*/
277
278static void atmel_release(struct pcmcia_device *link) 165static void atmel_release(struct pcmcia_device *link)
279{ 166{
280 struct net_device *dev = ((local_info_t*)link->priv)->eth_dev; 167 struct net_device *dev = ((local_info_t*)link->priv)->eth_dev;
@@ -353,9 +240,7 @@ MODULE_DEVICE_TABLE(pcmcia, atmel_ids);
353 240
354static struct pcmcia_driver atmel_driver = { 241static struct pcmcia_driver atmel_driver = {
355 .owner = THIS_MODULE, 242 .owner = THIS_MODULE,
356 .drv = { 243 .name = "atmel_cs",
357 .name = "atmel_cs",
358 },
359 .probe = atmel_probe, 244 .probe = atmel_probe,
360 .remove = atmel_detach, 245 .remove = atmel_detach,
361 .id_table = atmel_ids, 246 .id_table = atmel_ids,
@@ -363,12 +248,12 @@ static struct pcmcia_driver atmel_driver = {
363 .resume = atmel_resume, 248 .resume = atmel_resume,
364}; 249};
365 250
366static int atmel_cs_init(void) 251static int __init atmel_cs_init(void)
367{ 252{
368 return pcmcia_register_driver(&atmel_driver); 253 return pcmcia_register_driver(&atmel_driver);
369} 254}
370 255
371static void atmel_cs_cleanup(void) 256static void __exit atmel_cs_cleanup(void)
372{ 257{
373 pcmcia_unregister_driver(&atmel_driver); 258 pcmcia_unregister_driver(&atmel_driver);
374} 259}
diff --git a/drivers/net/wireless/b43/debugfs.c b/drivers/net/wireless/b43/debugfs.c
index 80b19a44a407..59f59fa40334 100644
--- a/drivers/net/wireless/b43/debugfs.c
+++ b/drivers/net/wireless/b43/debugfs.c
@@ -627,6 +627,7 @@ out_unlock:
627 .open = b43_debugfs_open, \ 627 .open = b43_debugfs_open, \
628 .read = b43_debugfs_read, \ 628 .read = b43_debugfs_read, \
629 .write = b43_debugfs_write, \ 629 .write = b43_debugfs_write, \
630 .llseek = generic_file_llseek, \
630 }, \ 631 }, \
631 .file_struct_offset = offsetof(struct b43_dfsentry, \ 632 .file_struct_offset = offsetof(struct b43_dfsentry, \
632 file_##name), \ 633 file_##name), \
diff --git a/drivers/net/wireless/b43/pcmcia.c b/drivers/net/wireless/b43/pcmcia.c
index dfbc41d431ff..7dcba5fafdc7 100644
--- a/drivers/net/wireless/b43/pcmcia.c
+++ b/drivers/net/wireless/b43/pcmcia.c
@@ -26,7 +26,6 @@
26#include <linux/ssb/ssb.h> 26#include <linux/ssb/ssb.h>
27#include <linux/slab.h> 27#include <linux/slab.h>
28 28
29#include <pcmcia/cs.h>
30#include <pcmcia/cistpl.h> 29#include <pcmcia/cistpl.h>
31#include <pcmcia/ciscode.h> 30#include <pcmcia/ciscode.h>
32#include <pcmcia/ds.h> 31#include <pcmcia/ds.h>
@@ -63,7 +62,6 @@ static int b43_pcmcia_resume(struct pcmcia_device *dev)
63static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) 62static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev)
64{ 63{
65 struct ssb_bus *ssb; 64 struct ssb_bus *ssb;
66 win_req_t win;
67 int err = -ENOMEM; 65 int err = -ENOMEM;
68 int res = 0; 66 int res = 0;
69 67
@@ -73,30 +71,28 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev)
73 71
74 err = -ENODEV; 72 err = -ENODEV;
75 73
76 dev->conf.Attributes = CONF_ENABLE_IRQ; 74 dev->config_flags |= CONF_ENABLE_IRQ;
77 dev->conf.IntType = INT_MEMORY_AND_IO;
78 75
79 win.Attributes = WIN_ENABLE | WIN_DATA_WIDTH_16 | 76 dev->resource[2]->flags |= WIN_ENABLE | WIN_DATA_WIDTH_16 |
80 WIN_USE_WAIT; 77 WIN_USE_WAIT;
81 win.Base = 0; 78 dev->resource[2]->start = 0;
82 win.Size = SSB_CORE_SIZE; 79 dev->resource[2]->end = SSB_CORE_SIZE;
83 win.AccessSpeed = 250; 80 res = pcmcia_request_window(dev, dev->resource[2], 250);
84 res = pcmcia_request_window(dev, &win, &dev->win);
85 if (res != 0) 81 if (res != 0)
86 goto err_kfree_ssb; 82 goto err_kfree_ssb;
87 83
88 res = pcmcia_map_mem_page(dev, dev->win, 0); 84 res = pcmcia_map_mem_page(dev, dev->resource[2], 0);
89 if (res != 0) 85 if (res != 0)
90 goto err_disable; 86 goto err_disable;
91 87
92 if (!dev->irq) 88 if (!dev->irq)
93 goto err_disable; 89 goto err_disable;
94 90
95 res = pcmcia_request_configuration(dev, &dev->conf); 91 res = pcmcia_enable_device(dev);
96 if (res != 0) 92 if (res != 0)
97 goto err_disable; 93 goto err_disable;
98 94
99 err = ssb_bus_pcmciabus_register(ssb, dev, win.Base); 95 err = ssb_bus_pcmciabus_register(ssb, dev, dev->resource[2]->start);
100 if (err) 96 if (err)
101 goto err_disable; 97 goto err_disable;
102 dev->priv = ssb; 98 dev->priv = ssb;
@@ -125,9 +121,7 @@ static void __devexit b43_pcmcia_remove(struct pcmcia_device *dev)
125 121
126static struct pcmcia_driver b43_pcmcia_driver = { 122static struct pcmcia_driver b43_pcmcia_driver = {
127 .owner = THIS_MODULE, 123 .owner = THIS_MODULE,
128 .drv = { 124 .name = "b43-pcmcia",
129 .name = "b43-pcmcia",
130 },
131 .id_table = b43_pcmcia_tbl, 125 .id_table = b43_pcmcia_tbl,
132 .probe = b43_pcmcia_probe, 126 .probe = b43_pcmcia_probe,
133 .remove = __devexit_p(b43_pcmcia_remove), 127 .remove = __devexit_p(b43_pcmcia_remove),
diff --git a/drivers/net/wireless/b43legacy/debugfs.c b/drivers/net/wireless/b43legacy/debugfs.c
index 1f85ac569fec..f232618f2cd1 100644
--- a/drivers/net/wireless/b43legacy/debugfs.c
+++ b/drivers/net/wireless/b43legacy/debugfs.c
@@ -334,6 +334,7 @@ out_unlock:
334 .open = b43legacy_debugfs_open, \ 334 .open = b43legacy_debugfs_open, \
335 .read = b43legacy_debugfs_read, \ 335 .read = b43legacy_debugfs_read, \
336 .write = b43legacy_debugfs_write, \ 336 .write = b43legacy_debugfs_write, \
337 .llseek = generic_file_llseek, \
337 }, \ 338 }, \
338 .file_struct_offset = offsetof(struct b43legacy_dfsentry, \ 339 .file_struct_offset = offsetof(struct b43legacy_dfsentry, \
339 file_##name), \ 340 file_##name), \
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c
index ba54d1b04d22..bd8a4134edeb 100644
--- a/drivers/net/wireless/hostap/hostap_cs.c
+++ b/drivers/net/wireless/hostap/hostap_cs.c
@@ -12,7 +12,6 @@
12#include <linux/wireless.h> 12#include <linux/wireless.h>
13#include <net/iw_handler.h> 13#include <net/iw_handler.h>
14 14
15#include <pcmcia/cs.h>
16#include <pcmcia/cistpl.h> 15#include <pcmcia/cistpl.h>
17#include <pcmcia/cisreg.h> 16#include <pcmcia/cisreg.h>
18#include <pcmcia/ds.h> 17#include <pcmcia/ds.h>
@@ -437,7 +436,6 @@ static int hostap_cs_probe(struct pcmcia_device *p_dev)
437 int ret; 436 int ret;
438 437
439 PDEBUG(DEBUG_HW, "%s: setting Vcc=33 (constant)\n", dev_info); 438 PDEBUG(DEBUG_HW, "%s: setting Vcc=33 (constant)\n", dev_info);
440 p_dev->conf.IntType = INT_MEMORY_AND_IO;
441 439
442 ret = prism2_config(p_dev); 440 ret = prism2_config(p_dev);
443 if (ret) { 441 if (ret) {
@@ -468,74 +466,11 @@ static void prism2_detach(struct pcmcia_device *link)
468} 466}
469 467
470 468
471/* run after a CARD_INSERTION event is received to configure the PCMCIA 469static int prism2_config_check(struct pcmcia_device *p_dev, void *priv_data)
472 * socket and make the device available to the system */
473
474static int prism2_config_check(struct pcmcia_device *p_dev,
475 cistpl_cftable_entry_t *cfg,
476 cistpl_cftable_entry_t *dflt,
477 unsigned int vcc,
478 void *priv_data)
479{ 470{
480 if (cfg->index == 0) 471 if (p_dev->config_index == 0)
481 return -ENODEV; 472 return -EINVAL;
482
483 PDEBUG(DEBUG_EXTRA, "Checking CFTABLE_ENTRY 0x%02X "
484 "(default 0x%02X)\n", cfg->index, dflt->index);
485
486 /* Does this card need audio output? */
487 if (cfg->flags & CISTPL_CFTABLE_AUDIO) {
488 p_dev->conf.Attributes |= CONF_ENABLE_SPKR;
489 p_dev->conf.Status = CCSR_AUDIO_ENA;
490 }
491
492 /* Use power settings for Vcc and Vpp if present */
493 /* Note that the CIS values need to be rescaled */
494 if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) {
495 if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] /
496 10000 && !ignore_cis_vcc) {
497 PDEBUG(DEBUG_EXTRA, " Vcc mismatch - skipping"
498 " this entry\n");
499 return -ENODEV;
500 }
501 } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
502 if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] /
503 10000 && !ignore_cis_vcc) {
504 PDEBUG(DEBUG_EXTRA, " Vcc (default) mismatch "
505 "- skipping this entry\n");
506 return -ENODEV;
507 }
508 }
509 473
510 if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
511 p_dev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
512 else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM))
513 p_dev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
514
515 /* Do we need to allocate an interrupt? */
516 p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
517
518 /* IO window settings */
519 PDEBUG(DEBUG_EXTRA, "IO window settings: cfg->io.nwin=%d "
520 "dflt->io.nwin=%d\n",
521 cfg->io.nwin, dflt->io.nwin);
522 p_dev->resource[0]->end = p_dev->resource[1]->end = 0;
523 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
524 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
525 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
526 p_dev->resource[0]->flags |=
527 pcmcia_io_cfg_data_width(io->flags);
528 p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
529 p_dev->resource[0]->start = io->win[0].base;
530 p_dev->resource[0]->end = io->win[0].len;
531 if (io->nwin > 1) {
532 p_dev->resource[1]->flags = p_dev->resource[0]->flags;
533 p_dev->resource[1]->start = io->win[1].base;
534 p_dev->resource[1]->end = io->win[1].len;
535 }
536 }
537
538 /* This reserves IO space but doesn't actually enable it */
539 return pcmcia_request_io(p_dev); 474 return pcmcia_request_io(p_dev);
540} 475}
541 476
@@ -557,6 +492,10 @@ static int prism2_config(struct pcmcia_device *link)
557 } 492 }
558 493
559 /* Look for an appropriate configuration table entry in the CIS */ 494 /* Look for an appropriate configuration table entry in the CIS */
495 link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_AUDIO |
496 CONF_AUTO_CHECK_VCC | CONF_AUTO_SET_IO | CONF_ENABLE_IRQ;
497 if (ignore_cis_vcc)
498 link->config_flags &= ~CONF_AUTO_CHECK_VCC;
560 ret = pcmcia_loop_config(link, prism2_config_check, NULL); 499 ret = pcmcia_loop_config(link, prism2_config_check, NULL);
561 if (ret) { 500 if (ret) {
562 if (!ignore_cis_vcc) 501 if (!ignore_cis_vcc)
@@ -588,12 +527,7 @@ static int prism2_config(struct pcmcia_device *link)
588 if (ret) 527 if (ret)
589 goto failed_unlock; 528 goto failed_unlock;
590 529
591 /* 530 ret = pcmcia_enable_device(link);
592 * This actually configures the PCMCIA socket -- setting up
593 * the I/O windows and the interrupt mapping, and putting the
594 * card and host interface into "Memory and IO" mode.
595 */
596 ret = pcmcia_request_configuration(link, &link->conf);
597 if (ret) 531 if (ret)
598 goto failed_unlock; 532 goto failed_unlock;
599 533
@@ -602,20 +536,6 @@ static int prism2_config(struct pcmcia_device *link)
602 536
603 spin_unlock_irqrestore(&local->irq_init_lock, flags); 537 spin_unlock_irqrestore(&local->irq_init_lock, flags);
604 538
605 /* Finally, report what we've done */
606 printk(KERN_INFO "%s: index 0x%02x: ",
607 dev_info, link->conf.ConfigIndex);
608 if (link->conf.Vpp)
609 printk(", Vpp %d.%d", link->conf.Vpp / 10,
610 link->conf.Vpp % 10);
611 if (link->conf.Attributes & CONF_ENABLE_IRQ)
612 printk(", irq %d", link->irq);
613 if (link->resource[0])
614 printk(" & %pR", link->resource[0]);
615 if (link->resource[1])
616 printk(" & %pR", link->resource[1]);
617 printk("\n");
618
619 local->shutdown = 0; 539 local->shutdown = 0;
620 540
621 sandisk_enable_wireless(dev); 541 sandisk_enable_wireless(dev);
@@ -627,7 +547,7 @@ static int prism2_config(struct pcmcia_device *link)
627 return ret; 547 return ret;
628 548
629 failed_unlock: 549 failed_unlock:
630 spin_unlock_irqrestore(&local->irq_init_lock, flags); 550 spin_unlock_irqrestore(&local->irq_init_lock, flags);
631 failed: 551 failed:
632 kfree(hw_priv); 552 kfree(hw_priv);
633 prism2_release((u_long)link); 553 prism2_release((u_long)link);
@@ -779,9 +699,7 @@ MODULE_DEVICE_TABLE(pcmcia, hostap_cs_ids);
779 699
780 700
781static struct pcmcia_driver hostap_driver = { 701static struct pcmcia_driver hostap_driver = {
782 .drv = { 702 .name = "hostap_cs",
783 .name = "hostap_cs",
784 },
785 .probe = hostap_cs_probe, 703 .probe = hostap_cs_probe,
786 .remove = prism2_detach, 704 .remove = prism2_detach,
787 .owner = THIS_MODULE, 705 .owner = THIS_MODULE,
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
index d707f5bb1a8b..1f3e7e34fbc7 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
@@ -873,6 +873,7 @@ static ssize_t iwl3945_sta_dbgfs_stats_table_read(struct file *file,
873static const struct file_operations rs_sta_dbgfs_stats_table_ops = { 873static const struct file_operations rs_sta_dbgfs_stats_table_ops = {
874 .read = iwl3945_sta_dbgfs_stats_table_read, 874 .read = iwl3945_sta_dbgfs_stats_table_read,
875 .open = iwl3945_open_file_generic, 875 .open = iwl3945_open_file_generic,
876 .llseek = default_llseek,
876}; 877};
877 878
878static void iwl3945_add_debugfs(void *priv, void *priv_sta, 879static void iwl3945_add_debugfs(void *priv, void *priv_sta,
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
index 5abe2e9ff0d2..065553629de5 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
@@ -3197,6 +3197,7 @@ static const struct file_operations rs_sta_dbgfs_scale_table_ops = {
3197 .write = rs_sta_dbgfs_scale_table_write, 3197 .write = rs_sta_dbgfs_scale_table_write,
3198 .read = rs_sta_dbgfs_scale_table_read, 3198 .read = rs_sta_dbgfs_scale_table_read,
3199 .open = open_file_generic, 3199 .open = open_file_generic,
3200 .llseek = default_llseek,
3200}; 3201};
3201static ssize_t rs_sta_dbgfs_stats_table_read(struct file *file, 3202static ssize_t rs_sta_dbgfs_stats_table_read(struct file *file,
3202 char __user *user_buf, size_t count, loff_t *ppos) 3203 char __user *user_buf, size_t count, loff_t *ppos)
@@ -3239,6 +3240,7 @@ static ssize_t rs_sta_dbgfs_stats_table_read(struct file *file,
3239static const struct file_operations rs_sta_dbgfs_stats_table_ops = { 3240static const struct file_operations rs_sta_dbgfs_stats_table_ops = {
3240 .read = rs_sta_dbgfs_stats_table_read, 3241 .read = rs_sta_dbgfs_stats_table_read,
3241 .open = open_file_generic, 3242 .open = open_file_generic,
3243 .llseek = default_llseek,
3242}; 3244};
3243 3245
3244static ssize_t rs_sta_dbgfs_rate_scale_data_read(struct file *file, 3246static ssize_t rs_sta_dbgfs_rate_scale_data_read(struct file *file,
@@ -3270,6 +3272,7 @@ static ssize_t rs_sta_dbgfs_rate_scale_data_read(struct file *file,
3270static const struct file_operations rs_sta_dbgfs_rate_scale_data_ops = { 3272static const struct file_operations rs_sta_dbgfs_rate_scale_data_ops = {
3271 .read = rs_sta_dbgfs_rate_scale_data_read, 3273 .read = rs_sta_dbgfs_rate_scale_data_read,
3272 .open = open_file_generic, 3274 .open = open_file_generic,
3275 .llseek = default_llseek,
3273}; 3276};
3274 3277
3275static void rs_add_debugfs(void *priv, void *priv_sta, 3278static void rs_add_debugfs(void *priv, void *priv_sta,
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
index 96d9085639e3..8fdd4efdb1d3 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
@@ -86,6 +86,7 @@ static int iwl_dbgfs_open_file_generic(struct inode *inode, struct file *file)
86static const struct file_operations iwl_dbgfs_##name##_ops = { \ 86static const struct file_operations iwl_dbgfs_##name##_ops = { \
87 .read = iwl_dbgfs_##name##_read, \ 87 .read = iwl_dbgfs_##name##_read, \
88 .open = iwl_dbgfs_open_file_generic, \ 88 .open = iwl_dbgfs_open_file_generic, \
89 .llseek = generic_file_llseek, \
89}; 90};
90 91
91#define DEBUGFS_WRITE_FILE_OPS(name) \ 92#define DEBUGFS_WRITE_FILE_OPS(name) \
@@ -93,6 +94,7 @@ static const struct file_operations iwl_dbgfs_##name##_ops = { \
93static const struct file_operations iwl_dbgfs_##name##_ops = { \ 94static const struct file_operations iwl_dbgfs_##name##_ops = { \
94 .write = iwl_dbgfs_##name##_write, \ 95 .write = iwl_dbgfs_##name##_write, \
95 .open = iwl_dbgfs_open_file_generic, \ 96 .open = iwl_dbgfs_open_file_generic, \
97 .llseek = generic_file_llseek, \
96}; 98};
97 99
98 100
@@ -103,6 +105,7 @@ static const struct file_operations iwl_dbgfs_##name##_ops = { \
103 .write = iwl_dbgfs_##name##_write, \ 105 .write = iwl_dbgfs_##name##_write, \
104 .read = iwl_dbgfs_##name##_read, \ 106 .read = iwl_dbgfs_##name##_read, \
105 .open = iwl_dbgfs_open_file_generic, \ 107 .open = iwl_dbgfs_open_file_generic, \
108 .llseek = generic_file_llseek, \
106}; 109};
107 110
108static ssize_t iwl_dbgfs_tx_statistics_read(struct file *file, 111static ssize_t iwl_dbgfs_tx_statistics_read(struct file *file,
diff --git a/drivers/net/wireless/iwmc3200wifi/debugfs.c b/drivers/net/wireless/iwmc3200wifi/debugfs.c
index 53b0b7711f02..0a0cc9667cd6 100644
--- a/drivers/net/wireless/iwmc3200wifi/debugfs.c
+++ b/drivers/net/wireless/iwmc3200wifi/debugfs.c
@@ -402,24 +402,28 @@ static const struct file_operations iwm_debugfs_txq_fops = {
402 .owner = THIS_MODULE, 402 .owner = THIS_MODULE,
403 .open = iwm_generic_open, 403 .open = iwm_generic_open,
404 .read = iwm_debugfs_txq_read, 404 .read = iwm_debugfs_txq_read,
405 .llseek = default_llseek,
405}; 406};
406 407
407static const struct file_operations iwm_debugfs_tx_credit_fops = { 408static const struct file_operations iwm_debugfs_tx_credit_fops = {
408 .owner = THIS_MODULE, 409 .owner = THIS_MODULE,
409 .open = iwm_generic_open, 410 .open = iwm_generic_open,
410 .read = iwm_debugfs_tx_credit_read, 411 .read = iwm_debugfs_tx_credit_read,
412 .llseek = default_llseek,
411}; 413};
412 414
413static const struct file_operations iwm_debugfs_rx_ticket_fops = { 415static const struct file_operations iwm_debugfs_rx_ticket_fops = {
414 .owner = THIS_MODULE, 416 .owner = THIS_MODULE,
415 .open = iwm_generic_open, 417 .open = iwm_generic_open,
416 .read = iwm_debugfs_rx_ticket_read, 418 .read = iwm_debugfs_rx_ticket_read,
419 .llseek = default_llseek,
417}; 420};
418 421
419static const struct file_operations iwm_debugfs_fw_err_fops = { 422static const struct file_operations iwm_debugfs_fw_err_fops = {
420 .owner = THIS_MODULE, 423 .owner = THIS_MODULE,
421 .open = iwm_generic_open, 424 .open = iwm_generic_open,
422 .read = iwm_debugfs_fw_err_read, 425 .read = iwm_debugfs_fw_err_read,
426 .llseek = default_llseek,
423}; 427};
424 428
425void iwm_debugfs_init(struct iwm_priv *iwm) 429void iwm_debugfs_init(struct iwm_priv *iwm)
diff --git a/drivers/net/wireless/iwmc3200wifi/sdio.c b/drivers/net/wireless/iwmc3200wifi/sdio.c
index edcb52330cf5..56383e7be835 100644
--- a/drivers/net/wireless/iwmc3200wifi/sdio.c
+++ b/drivers/net/wireless/iwmc3200wifi/sdio.c
@@ -364,6 +364,7 @@ static const struct file_operations iwm_debugfs_sdio_fops = {
364 .owner = THIS_MODULE, 364 .owner = THIS_MODULE,
365 .open = iwm_debugfs_sdio_open, 365 .open = iwm_debugfs_sdio_open,
366 .read = iwm_debugfs_sdio_read, 366 .read = iwm_debugfs_sdio_read,
367 .llseek = default_llseek,
367}; 368};
368 369
369static void if_sdio_debugfs_init(struct iwm_priv *iwm, struct dentry *parent_dir) 370static void if_sdio_debugfs_init(struct iwm_priv *iwm, struct dentry *parent_dir)
diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c
index 651a79c8de8a..fbf3b0332bb7 100644
--- a/drivers/net/wireless/libertas/debugfs.c
+++ b/drivers/net/wireless/libertas/debugfs.c
@@ -696,6 +696,7 @@ out_unlock:
696 .open = open_file_generic, \ 696 .open = open_file_generic, \
697 .read = (fread), \ 697 .read = (fread), \
698 .write = (fwrite), \ 698 .write = (fwrite), \
699 .llseek = generic_file_llseek, \
699} 700}
700 701
701struct lbs_debugfs_files { 702struct lbs_debugfs_files {
@@ -961,6 +962,7 @@ static const struct file_operations lbs_debug_fops = {
961 .open = open_file_generic, 962 .open = open_file_generic,
962 .write = lbs_debugfs_write, 963 .write = lbs_debugfs_write,
963 .read = lbs_debugfs_read, 964 .read = lbs_debugfs_read,
965 .llseek = default_llseek,
964}; 966};
965 967
966/** 968/**
diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c
index e213a5dc049d..fc8121190d38 100644
--- a/drivers/net/wireless/libertas/if_cs.c
+++ b/drivers/net/wireless/libertas/if_cs.c
@@ -28,7 +28,6 @@
28#include <linux/firmware.h> 28#include <linux/firmware.h>
29#include <linux/netdevice.h> 29#include <linux/netdevice.h>
30 30
31#include <pcmcia/cs.h>
32#include <pcmcia/cistpl.h> 31#include <pcmcia/cistpl.h>
33#include <pcmcia/ds.h> 32#include <pcmcia/ds.h>
34 33
@@ -759,15 +758,6 @@ static int if_cs_host_to_card(struct lbs_private *priv,
759} 758}
760 759
761 760
762/********************************************************************/
763/* Card Services */
764/********************************************************************/
765
766/*
767 * After a card is removed, if_cs_release() will unregister the
768 * device, and release the PCMCIA configuration. If the device is
769 * still open, this will be postponed until it is closed.
770 */
771static void if_cs_release(struct pcmcia_device *p_dev) 761static void if_cs_release(struct pcmcia_device *p_dev)
772{ 762{
773 struct if_cs_card *card = p_dev->priv; 763 struct if_cs_card *card = p_dev->priv;
@@ -783,31 +773,12 @@ static void if_cs_release(struct pcmcia_device *p_dev)
783} 773}
784 774
785 775
786/* 776static int if_cs_ioprobe(struct pcmcia_device *p_dev, void *priv_data)
787 * This creates an "instance" of the driver, allocating local data
788 * structures for one device. The device is registered with Card
789 * Services.
790 *
791 * The dev_link structure is initialized, but we don't actually
792 * configure the card at this point -- we wait until we receive a card
793 * insertion event.
794 */
795
796static int if_cs_ioprobe(struct pcmcia_device *p_dev,
797 cistpl_cftable_entry_t *cfg,
798 cistpl_cftable_entry_t *dflt,
799 unsigned int vcc,
800 void *priv_data)
801{ 777{
778 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
802 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 779 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
803 p_dev->resource[0]->start = cfg->io.win[0].base;
804 p_dev->resource[0]->end = cfg->io.win[0].len;
805 780
806 /* Do we need to allocate an interrupt? */ 781 if (p_dev->resource[1]->end) {
807 p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
808
809 /* IO window settings */
810 if (cfg->io.nwin != 1) {
811 lbs_pr_err("wrong CIS (check number of IO windows)\n"); 782 lbs_pr_err("wrong CIS (check number of IO windows)\n");
812 return -ENODEV; 783 return -ENODEV;
813 } 784 }
@@ -835,8 +806,7 @@ static int if_cs_probe(struct pcmcia_device *p_dev)
835 card->p_dev = p_dev; 806 card->p_dev = p_dev;
836 p_dev->priv = card; 807 p_dev->priv = card;
837 808
838 p_dev->conf.Attributes = 0; 809 p_dev->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
839 p_dev->conf.IntType = INT_MEMORY_AND_IO;
840 810
841 if (pcmcia_loop_config(p_dev, if_cs_ioprobe, NULL)) { 811 if (pcmcia_loop_config(p_dev, if_cs_ioprobe, NULL)) {
842 lbs_pr_err("error in pcmcia_loop_config\n"); 812 lbs_pr_err("error in pcmcia_loop_config\n");
@@ -860,14 +830,9 @@ static int if_cs_probe(struct pcmcia_device *p_dev)
860 goto out1; 830 goto out1;
861 } 831 }
862 832
863 /* 833 ret = pcmcia_enable_device(p_dev);
864 * This actually configures the PCMCIA socket -- setting up
865 * the I/O windows and the interrupt mapping, and putting the
866 * card and host interface into "Memory and IO" mode.
867 */
868 ret = pcmcia_request_configuration(p_dev, &p_dev->conf);
869 if (ret) { 834 if (ret) {
870 lbs_pr_err("error in pcmcia_request_configuration\n"); 835 lbs_pr_err("error in pcmcia_enable_device\n");
871 goto out2; 836 goto out2;
872 } 837 }
873 838
@@ -979,12 +944,6 @@ out:
979} 944}
980 945
981 946
982/*
983 * This deletes a driver "instance". The device is de-registered with
984 * Card Services. If it has been released, all local data structures
985 * are freed. Otherwise, the structures will be freed when the device
986 * is released.
987 */
988static void if_cs_detach(struct pcmcia_device *p_dev) 947static void if_cs_detach(struct pcmcia_device *p_dev)
989{ 948{
990 struct if_cs_card *card = p_dev->priv; 949 struct if_cs_card *card = p_dev->priv;
@@ -1018,9 +977,7 @@ MODULE_DEVICE_TABLE(pcmcia, if_cs_ids);
1018 977
1019static struct pcmcia_driver lbs_driver = { 978static struct pcmcia_driver lbs_driver = {
1020 .owner = THIS_MODULE, 979 .owner = THIS_MODULE,
1021 .drv = { 980 .name = DRV_NAME,
1022 .name = DRV_NAME,
1023 },
1024 .probe = if_cs_probe, 981 .probe = if_cs_probe,
1025 .remove = if_cs_detach, 982 .remove = if_cs_detach,
1026 .id_table = if_cs_ids, 983 .id_table = if_cs_ids,
diff --git a/drivers/net/wireless/orinoco/orinoco_cs.c b/drivers/net/wireless/orinoco/orinoco_cs.c
index ef46a2d88539..71b3d68b9403 100644
--- a/drivers/net/wireless/orinoco/orinoco_cs.c
+++ b/drivers/net/wireless/orinoco/orinoco_cs.c
@@ -17,7 +17,6 @@
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/delay.h> 19#include <linux/delay.h>
20#include <pcmcia/cs.h>
21#include <pcmcia/cistpl.h> 20#include <pcmcia/cistpl.h>
22#include <pcmcia/cisreg.h> 21#include <pcmcia/cisreg.h>
23#include <pcmcia/ds.h> 22#include <pcmcia/ds.h>
@@ -93,14 +92,6 @@ orinoco_cs_hard_reset(struct orinoco_private *priv)
93/* PCMCIA stuff */ 92/* PCMCIA stuff */
94/********************************************************************/ 93/********************************************************************/
95 94
96/*
97 * This creates an "instance" of the driver, allocating local data
98 * structures for one device. The device is registered with Card
99 * Services.
100 *
101 * The dev_link structure is initialized, but we don't actually
102 * configure the card at this point -- we wait until we receive a card
103 * insertion event. */
104static int 95static int
105orinoco_cs_probe(struct pcmcia_device *link) 96orinoco_cs_probe(struct pcmcia_device *link)
106{ 97{
@@ -117,23 +108,9 @@ orinoco_cs_probe(struct pcmcia_device *link)
117 card->p_dev = link; 108 card->p_dev = link;
118 link->priv = priv; 109 link->priv = priv;
119 110
120 /* General socket configuration defaults can go here. In this
121 * client, we assume very little, and rely on the CIS for
122 * almost everything. In most clients, many details (i.e.,
123 * number, sizes, and attributes of IO windows) are fixed by
124 * the nature of the device, and can be hard-wired here. */
125 link->conf.Attributes = 0;
126 link->conf.IntType = INT_MEMORY_AND_IO;
127
128 return orinoco_cs_config(link); 111 return orinoco_cs_config(link);
129} /* orinoco_cs_attach */ 112} /* orinoco_cs_attach */
130 113
131/*
132 * This deletes a driver "instance". The device is de-registered with
133 * Card Services. If it has been released, all local data structures
134 * are freed. Otherwise, the structures will be freed when the device
135 * is released.
136 */
137static void orinoco_cs_detach(struct pcmcia_device *link) 114static void orinoco_cs_detach(struct pcmcia_device *link)
138{ 115{
139 struct orinoco_private *priv = link->priv; 116 struct orinoco_private *priv = link->priv;
@@ -145,76 +122,12 @@ static void orinoco_cs_detach(struct pcmcia_device *link)
145 free_orinocodev(priv); 122 free_orinocodev(priv);
146} /* orinoco_cs_detach */ 123} /* orinoco_cs_detach */
147 124
148/* 125static int orinoco_cs_config_check(struct pcmcia_device *p_dev, void *priv_data)
149 * orinoco_cs_config() is scheduled to run after a CARD_INSERTION
150 * event is received, to configure the PCMCIA socket, and to make the
151 * device available to the system.
152 */
153
154static int orinoco_cs_config_check(struct pcmcia_device *p_dev,
155 cistpl_cftable_entry_t *cfg,
156 cistpl_cftable_entry_t *dflt,
157 unsigned int vcc,
158 void *priv_data)
159{ 126{
160 if (cfg->index == 0) 127 if (p_dev->config_index == 0)
161 goto next_entry; 128 return -EINVAL;
162
163 /* Use power settings for Vcc and Vpp if present */
164 /* Note that the CIS values need to be rescaled */
165 if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) {
166 if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) {
167 DEBUG(2, "%s: Vcc mismatch (vcc = %d, CIS = %d)\n",
168 __func__, vcc,
169 cfg->vcc.param[CISTPL_POWER_VNOM] / 10000);
170 if (!ignore_cis_vcc)
171 goto next_entry;
172 }
173 } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
174 if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) {
175 DEBUG(2, "%s: Vcc mismatch (vcc = %d, CIS = %d)\n",
176 __func__, vcc,
177 dflt->vcc.param[CISTPL_POWER_VNOM] / 10000);
178 if (!ignore_cis_vcc)
179 goto next_entry;
180 }
181 }
182 129
183 if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) 130 return pcmcia_request_io(p_dev);
184 p_dev->conf.Vpp =
185 cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
186 else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM))
187 p_dev->conf.Vpp =
188 dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
189
190 /* Do we need to allocate an interrupt? */
191 p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
192
193 /* IO window settings */
194 p_dev->resource[0]->end = p_dev->resource[1]->end = 0;
195 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
196 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
197 p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
198 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
199 p_dev->resource[0]->flags |=
200 pcmcia_io_cfg_data_width(io->flags);
201 p_dev->resource[0]->start = io->win[0].base;
202 p_dev->resource[0]->end = io->win[0].len;
203 if (io->nwin > 1) {
204 p_dev->resource[1]->flags = p_dev->resource[0]->flags;
205 p_dev->resource[1]->start = io->win[1].base;
206 p_dev->resource[1]->end = io->win[1].len;
207 }
208
209 /* This reserves IO space but doesn't actually enable it */
210 if (pcmcia_request_io(p_dev) != 0)
211 goto next_entry;
212 }
213 return 0;
214
215next_entry:
216 pcmcia_disable_device(p_dev);
217 return -ENODEV;
218}; 131};
219 132
220static int 133static int
@@ -225,20 +138,10 @@ orinoco_cs_config(struct pcmcia_device *link)
225 int ret; 138 int ret;
226 void __iomem *mem; 139 void __iomem *mem;
227 140
228 /* 141 link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC |
229 * In this loop, we scan the CIS for configuration table 142 CONF_AUTO_SET_IO | CONF_ENABLE_IRQ;
230 * entries, each of which describes a valid card 143 if (ignore_cis_vcc)
231 * configuration, including voltage, IO window, memory window, 144 link->config_flags &= ~CONF_AUTO_CHECK_VCC;
232 * and interrupt settings.
233 *
234 * We make no assumptions about the card to be configured: we
235 * use just the information available in the CIS. In an ideal
236 * world, this would work for any PCMCIA card, but it requires
237 * a complete and accurate CIS. In practice, a driver usually
238 * "knows" most of these things without consulting the CIS,
239 * and most client drivers will only use the CIS to fill in
240 * implementation-defined details.
241 */
242 ret = pcmcia_loop_config(link, orinoco_cs_config_check, NULL); 145 ret = pcmcia_loop_config(link, orinoco_cs_config_check, NULL);
243 if (ret) { 146 if (ret) {
244 if (!ignore_cis_vcc) 147 if (!ignore_cis_vcc)
@@ -262,12 +165,7 @@ orinoco_cs_config(struct pcmcia_device *link)
262 165
263 hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING); 166 hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING);
264 167
265 /* 168 ret = pcmcia_enable_device(link);
266 * This actually configures the PCMCIA socket -- setting up
267 * the I/O windows and the interrupt mapping, and putting the
268 * card and host interface into "Memory and IO" mode.
269 */
270 ret = pcmcia_request_configuration(link, &link->conf);
271 if (ret) 169 if (ret)
272 goto failed; 170 goto failed;
273 171
@@ -291,11 +189,6 @@ orinoco_cs_config(struct pcmcia_device *link)
291 return -ENODEV; 189 return -ENODEV;
292} /* orinoco_cs_config */ 190} /* orinoco_cs_config */
293 191
294/*
295 * After a card is removed, orinoco_cs_release() will unregister the
296 * device, and release the PCMCIA configuration. If the device is
297 * still open, this will be postponed until it is closed.
298 */
299static void 192static void
300orinoco_cs_release(struct pcmcia_device *link) 193orinoco_cs_release(struct pcmcia_device *link)
301{ 194{
@@ -344,12 +237,6 @@ static int orinoco_cs_resume(struct pcmcia_device *link)
344/* Module initialization */ 237/* Module initialization */
345/********************************************************************/ 238/********************************************************************/
346 239
347/* Can't be declared "const" or the whole __initdata section will
348 * become const */
349static char version[] __initdata = DRIVER_NAME " " DRIVER_VERSION
350 " (David Gibson <hermes@gibson.dropbear.id.au>, "
351 "Pavel Roskin <proski@gnu.org>, et al)";
352
353static struct pcmcia_device_id orinoco_cs_ids[] = { 240static struct pcmcia_device_id orinoco_cs_ids[] = {
354 PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0777), /* 3Com AirConnect PCI 777A */ 241 PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0777), /* 3Com AirConnect PCI 777A */
355 PCMCIA_DEVICE_MANF_CARD(0x0156, 0x0002), /* Lucent Orinoco and old Intersil */ 242 PCMCIA_DEVICE_MANF_CARD(0x0156, 0x0002), /* Lucent Orinoco and old Intersil */
@@ -441,9 +328,7 @@ MODULE_DEVICE_TABLE(pcmcia, orinoco_cs_ids);
441 328
442static struct pcmcia_driver orinoco_driver = { 329static struct pcmcia_driver orinoco_driver = {
443 .owner = THIS_MODULE, 330 .owner = THIS_MODULE,
444 .drv = { 331 .name = DRIVER_NAME,
445 .name = DRIVER_NAME,
446 },
447 .probe = orinoco_cs_probe, 332 .probe = orinoco_cs_probe,
448 .remove = orinoco_cs_detach, 333 .remove = orinoco_cs_detach,
449 .id_table = orinoco_cs_ids, 334 .id_table = orinoco_cs_ids,
@@ -454,8 +339,6 @@ static struct pcmcia_driver orinoco_driver = {
454static int __init 339static int __init
455init_orinoco_cs(void) 340init_orinoco_cs(void)
456{ 341{
457 printk(KERN_DEBUG "%s\n", version);
458
459 return pcmcia_register_driver(&orinoco_driver); 342 return pcmcia_register_driver(&orinoco_driver);
460} 343}
461 344
diff --git a/drivers/net/wireless/orinoco/spectrum_cs.c b/drivers/net/wireless/orinoco/spectrum_cs.c
index 873877e17e1b..fb859a5ad2eb 100644
--- a/drivers/net/wireless/orinoco/spectrum_cs.c
+++ b/drivers/net/wireless/orinoco/spectrum_cs.c
@@ -25,7 +25,6 @@
25#include <linux/kernel.h> 25#include <linux/kernel.h>
26#include <linux/init.h> 26#include <linux/init.h>
27#include <linux/delay.h> 27#include <linux/delay.h>
28#include <pcmcia/cs.h>
29#include <pcmcia/cistpl.h> 28#include <pcmcia/cistpl.h>
30#include <pcmcia/cisreg.h> 29#include <pcmcia/cisreg.h>
31#include <pcmcia/ds.h> 30#include <pcmcia/ds.h>
@@ -154,14 +153,6 @@ spectrum_cs_stop_firmware(struct orinoco_private *priv, int idle)
154/* PCMCIA stuff */ 153/* PCMCIA stuff */
155/********************************************************************/ 154/********************************************************************/
156 155
157/*
158 * This creates an "instance" of the driver, allocating local data
159 * structures for one device. The device is registered with Card
160 * Services.
161 *
162 * The dev_link structure is initialized, but we don't actually
163 * configure the card at this point -- we wait until we receive a card
164 * insertion event. */
165static int 156static int
166spectrum_cs_probe(struct pcmcia_device *link) 157spectrum_cs_probe(struct pcmcia_device *link)
167{ 158{
@@ -179,23 +170,9 @@ spectrum_cs_probe(struct pcmcia_device *link)
179 card->p_dev = link; 170 card->p_dev = link;
180 link->priv = priv; 171 link->priv = priv;
181 172
182 /* General socket configuration defaults can go here. In this
183 * client, we assume very little, and rely on the CIS for
184 * almost everything. In most clients, many details (i.e.,
185 * number, sizes, and attributes of IO windows) are fixed by
186 * the nature of the device, and can be hard-wired here. */
187 link->conf.Attributes = 0;
188 link->conf.IntType = INT_MEMORY_AND_IO;
189
190 return spectrum_cs_config(link); 173 return spectrum_cs_config(link);
191} /* spectrum_cs_attach */ 174} /* spectrum_cs_attach */
192 175
193/*
194 * This deletes a driver "instance". The device is de-registered with
195 * Card Services. If it has been released, all local data structures
196 * are freed. Otherwise, the structures will be freed when the device
197 * is released.
198 */
199static void spectrum_cs_detach(struct pcmcia_device *link) 176static void spectrum_cs_detach(struct pcmcia_device *link)
200{ 177{
201 struct orinoco_private *priv = link->priv; 178 struct orinoco_private *priv = link->priv;
@@ -207,76 +184,13 @@ static void spectrum_cs_detach(struct pcmcia_device *link)
207 free_orinocodev(priv); 184 free_orinocodev(priv);
208} /* spectrum_cs_detach */ 185} /* spectrum_cs_detach */
209 186
210/*
211 * spectrum_cs_config() is scheduled to run after a CARD_INSERTION
212 * event is received, to configure the PCMCIA socket, and to make the
213 * device available to the system.
214 */
215
216static int spectrum_cs_config_check(struct pcmcia_device *p_dev, 187static int spectrum_cs_config_check(struct pcmcia_device *p_dev,
217 cistpl_cftable_entry_t *cfg,
218 cistpl_cftable_entry_t *dflt,
219 unsigned int vcc,
220 void *priv_data) 188 void *priv_data)
221{ 189{
222 if (cfg->index == 0) 190 if (p_dev->config_index == 0)
223 goto next_entry; 191 return -EINVAL;
224
225 /* Use power settings for Vcc and Vpp if present */
226 /* Note that the CIS values need to be rescaled */
227 if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) {
228 if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) {
229 DEBUG(2, "%s: Vcc mismatch (vcc = %d, CIS = %d)\n",
230 __func__, vcc,
231 cfg->vcc.param[CISTPL_POWER_VNOM] / 10000);
232 if (!ignore_cis_vcc)
233 goto next_entry;
234 }
235 } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
236 if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) {
237 DEBUG(2, "%s: Vcc mismatch (vcc = %d, CIS = %d)\n",
238 __func__, vcc,
239 dflt->vcc.param[CISTPL_POWER_VNOM] / 10000);
240 if (!ignore_cis_vcc)
241 goto next_entry;
242 }
243 }
244 192
245 if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) 193 return pcmcia_request_io(p_dev);
246 p_dev->conf.Vpp =
247 cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
248 else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM))
249 p_dev->conf.Vpp =
250 dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
251
252 /* Do we need to allocate an interrupt? */
253 p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
254
255 /* IO window settings */
256 p_dev->resource[0]->end = p_dev->resource[1]->end = 0;
257 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
258 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
259 p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
260 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
261 p_dev->resource[0]->flags |=
262 pcmcia_io_cfg_data_width(io->flags);
263 p_dev->resource[0]->start = io->win[0].base;
264 p_dev->resource[0]->end = io->win[0].len;
265 if (io->nwin > 1) {
266 p_dev->resource[1]->flags = p_dev->resource[0]->flags;
267 p_dev->resource[1]->start = io->win[1].base;
268 p_dev->resource[1]->end = io->win[1].len;
269 }
270
271 /* This reserves IO space but doesn't actually enable it */
272 if (pcmcia_request_io(p_dev) != 0)
273 goto next_entry;
274 }
275 return 0;
276
277next_entry:
278 pcmcia_disable_device(p_dev);
279 return -ENODEV;
280}; 194};
281 195
282static int 196static int
@@ -287,20 +201,10 @@ spectrum_cs_config(struct pcmcia_device *link)
287 int ret; 201 int ret;
288 void __iomem *mem; 202 void __iomem *mem;
289 203
290 /* 204 link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC |
291 * In this loop, we scan the CIS for configuration table 205 CONF_AUTO_SET_IO | CONF_ENABLE_IRQ;
292 * entries, each of which describes a valid card 206 if (ignore_cis_vcc)
293 * configuration, including voltage, IO window, memory window, 207 link->config_flags &= ~CONF_AUTO_CHECK_VCC;
294 * and interrupt settings.
295 *
296 * We make no assumptions about the card to be configured: we
297 * use just the information available in the CIS. In an ideal
298 * world, this would work for any PCMCIA card, but it requires
299 * a complete and accurate CIS. In practice, a driver usually
300 * "knows" most of these things without consulting the CIS,
301 * and most client drivers will only use the CIS to fill in
302 * implementation-defined details.
303 */
304 ret = pcmcia_loop_config(link, spectrum_cs_config_check, NULL); 208 ret = pcmcia_loop_config(link, spectrum_cs_config_check, NULL);
305 if (ret) { 209 if (ret) {
306 if (!ignore_cis_vcc) 210 if (!ignore_cis_vcc)
@@ -325,12 +229,7 @@ spectrum_cs_config(struct pcmcia_device *link)
325 hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING); 229 hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING);
326 hw->eeprom_pda = true; 230 hw->eeprom_pda = true;
327 231
328 /* 232 ret = pcmcia_enable_device(link);
329 * This actually configures the PCMCIA socket -- setting up
330 * the I/O windows and the interrupt mapping, and putting the
331 * card and host interface into "Memory and IO" mode.
332 */
333 ret = pcmcia_request_configuration(link, &link->conf);
334 if (ret) 233 if (ret)
335 goto failed; 234 goto failed;
336 235
@@ -358,11 +257,6 @@ spectrum_cs_config(struct pcmcia_device *link)
358 return -ENODEV; 257 return -ENODEV;
359} /* spectrum_cs_config */ 258} /* spectrum_cs_config */
360 259
361/*
362 * After a card is removed, spectrum_cs_release() will unregister the
363 * device, and release the PCMCIA configuration. If the device is
364 * still open, this will be postponed until it is closed.
365 */
366static void 260static void
367spectrum_cs_release(struct pcmcia_device *link) 261spectrum_cs_release(struct pcmcia_device *link)
368{ 262{
@@ -407,12 +301,6 @@ spectrum_cs_resume(struct pcmcia_device *link)
407/* Module initialization */ 301/* Module initialization */
408/********************************************************************/ 302/********************************************************************/
409 303
410/* Can't be declared "const" or the whole __initdata section will
411 * become const */
412static char version[] __initdata = DRIVER_NAME " " DRIVER_VERSION
413 " (Pavel Roskin <proski@gnu.org>,"
414 " David Gibson <hermes@gibson.dropbear.id.au>, et al)";
415
416static struct pcmcia_device_id spectrum_cs_ids[] = { 304static struct pcmcia_device_id spectrum_cs_ids[] = {
417 PCMCIA_DEVICE_MANF_CARD(0x026c, 0x0001), /* Symbol Spectrum24 LA4137 */ 305 PCMCIA_DEVICE_MANF_CARD(0x026c, 0x0001), /* Symbol Spectrum24 LA4137 */
418 PCMCIA_DEVICE_MANF_CARD(0x0104, 0x0001), /* Socket Communications CF */ 306 PCMCIA_DEVICE_MANF_CARD(0x0104, 0x0001), /* Socket Communications CF */
@@ -423,9 +311,7 @@ MODULE_DEVICE_TABLE(pcmcia, spectrum_cs_ids);
423 311
424static struct pcmcia_driver orinoco_driver = { 312static struct pcmcia_driver orinoco_driver = {
425 .owner = THIS_MODULE, 313 .owner = THIS_MODULE,
426 .drv = { 314 .name = DRIVER_NAME,
427 .name = DRIVER_NAME,
428 },
429 .probe = spectrum_cs_probe, 315 .probe = spectrum_cs_probe,
430 .remove = spectrum_cs_detach, 316 .remove = spectrum_cs_detach,
431 .suspend = spectrum_cs_suspend, 317 .suspend = spectrum_cs_suspend,
@@ -436,8 +322,6 @@ static struct pcmcia_driver orinoco_driver = {
436static int __init 322static int __init
437init_spectrum_cs(void) 323init_spectrum_cs(void)
438{ 324{
439 printk(KERN_DEBUG "%s\n", version);
440
441 return pcmcia_register_driver(&orinoco_driver); 325 return pcmcia_register_driver(&orinoco_driver);
442} 326}
443 327
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
index 5ca624a64c42..97007d9e2c1f 100644
--- a/drivers/net/wireless/ray_cs.c
+++ b/drivers/net/wireless/ray_cs.c
@@ -45,7 +45,6 @@
45#include <linux/skbuff.h> 45#include <linux/skbuff.h>
46#include <linux/ieee80211.h> 46#include <linux/ieee80211.h>
47 47
48#include <pcmcia/cs.h>
49#include <pcmcia/cistpl.h> 48#include <pcmcia/cistpl.h>
50#include <pcmcia/cisreg.h> 49#include <pcmcia/cisreg.h>
51#include <pcmcia/ds.h> 50#include <pcmcia/ds.h>
@@ -166,13 +165,6 @@ static int bc;
166 */ 165 */
167static char *phy_addr = NULL; 166static char *phy_addr = NULL;
168 167
169
170/* A struct pcmcia_device structure has fields for most things that are needed
171 to keep track of a socket, but there will usually be some device
172 specific information that also needs to be kept track of. The
173 'priv' pointer in a struct pcmcia_device structure can be used to point to
174 a device-specific private data structure, like this.
175*/
176static unsigned int ray_mem_speed = 500; 168static unsigned int ray_mem_speed = 500;
177 169
178/* WARNING: THIS DRIVER IS NOT CAPABLE OF HANDLING MULTIPLE DEVICES! */ 170/* WARNING: THIS DRIVER IS NOT CAPABLE OF HANDLING MULTIPLE DEVICES! */
@@ -287,14 +279,6 @@ static const struct net_device_ops ray_netdev_ops = {
287 .ndo_validate_addr = eth_validate_addr, 279 .ndo_validate_addr = eth_validate_addr,
288}; 280};
289 281
290/*=============================================================================
291 ray_attach() creates an "instance" of the driver, allocating
292 local data structures for one device. The device is registered
293 with Card Services.
294 The dev_link structure is initialized, but we don't actually
295 configure the card at this point -- we wait until we receive a
296 card insertion event.
297=============================================================================*/
298static int ray_probe(struct pcmcia_device *p_dev) 282static int ray_probe(struct pcmcia_device *p_dev)
299{ 283{
300 ray_dev_t *local; 284 ray_dev_t *local;
@@ -315,9 +299,8 @@ static int ray_probe(struct pcmcia_device *p_dev)
315 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 299 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
316 300
317 /* General socket configuration */ 301 /* General socket configuration */
318 p_dev->conf.Attributes = CONF_ENABLE_IRQ; 302 p_dev->config_flags |= CONF_ENABLE_IRQ;
319 p_dev->conf.IntType = INT_MEMORY_AND_IO; 303 p_dev->config_index = 1;
320 p_dev->conf.ConfigIndex = 1;
321 304
322 p_dev->priv = dev; 305 p_dev->priv = dev;
323 306
@@ -349,12 +332,6 @@ fail_alloc_dev:
349 return -ENOMEM; 332 return -ENOMEM;
350} /* ray_attach */ 333} /* ray_attach */
351 334
352/*=============================================================================
353 This deletes a driver "instance". The device is de-registered
354 with Card Services. If it has been released, all local data
355 structures are freed. Otherwise, the structures will be freed
356 when the device is released.
357=============================================================================*/
358static void ray_detach(struct pcmcia_device *link) 335static void ray_detach(struct pcmcia_device *link)
359{ 336{
360 struct net_device *dev; 337 struct net_device *dev;
@@ -377,17 +354,11 @@ static void ray_detach(struct pcmcia_device *link)
377 dev_dbg(&link->dev, "ray_cs ray_detach ending\n"); 354 dev_dbg(&link->dev, "ray_cs ray_detach ending\n");
378} /* ray_detach */ 355} /* ray_detach */
379 356
380/*=============================================================================
381 ray_config() is run after a CARD_INSERTION event
382 is received, to configure the PCMCIA socket, and to make the
383 ethernet device available to the system.
384=============================================================================*/
385#define MAX_TUPLE_SIZE 128 357#define MAX_TUPLE_SIZE 128
386static int ray_config(struct pcmcia_device *link) 358static int ray_config(struct pcmcia_device *link)
387{ 359{
388 int ret = 0; 360 int ret = 0;
389 int i; 361 int i;
390 win_req_t req;
391 struct net_device *dev = (struct net_device *)link->priv; 362 struct net_device *dev = (struct net_device *)link->priv;
392 ray_dev_t *local = netdev_priv(dev); 363 ray_dev_t *local = netdev_priv(dev);
393 364
@@ -408,54 +379,50 @@ static int ray_config(struct pcmcia_device *link)
408 goto failed; 379 goto failed;
409 dev->irq = link->irq; 380 dev->irq = link->irq;
410 381
411 /* This actually configures the PCMCIA socket -- setting up 382 ret = pcmcia_enable_device(link);
412 the I/O windows and the interrupt mapping.
413 */
414 ret = pcmcia_request_configuration(link, &link->conf);
415 if (ret) 383 if (ret)
416 goto failed; 384 goto failed;
417 385
418/*** Set up 32k window for shared memory (transmit and control) ************/ 386/*** Set up 32k window for shared memory (transmit and control) ************/
419 req.Attributes = 387 link->resource[2]->flags |= WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT;
420 WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT; 388 link->resource[2]->start = 0;
421 req.Base = 0; 389 link->resource[2]->end = 0x8000;
422 req.Size = 0x8000; 390 ret = pcmcia_request_window(link, link->resource[2], ray_mem_speed);
423 req.AccessSpeed = ray_mem_speed;
424 ret = pcmcia_request_window(link, &req, &link->win);
425 if (ret) 391 if (ret)
426 goto failed; 392 goto failed;
427 ret = pcmcia_map_mem_page(link, link->win, 0); 393 ret = pcmcia_map_mem_page(link, link->resource[2], 0);
428 if (ret) 394 if (ret)
429 goto failed; 395 goto failed;
430 local->sram = ioremap(req.Base, req.Size); 396 local->sram = ioremap(link->resource[2]->start,
397 resource_size(link->resource[2]));
431 398
432/*** Set up 16k window for shared memory (receive buffer) ***************/ 399/*** Set up 16k window for shared memory (receive buffer) ***************/
433 req.Attributes = 400 link->resource[3]->flags |=
434 WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT; 401 WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT;
435 req.Base = 0; 402 link->resource[3]->start = 0;
436 req.Size = 0x4000; 403 link->resource[3]->end = 0x4000;
437 req.AccessSpeed = ray_mem_speed; 404 ret = pcmcia_request_window(link, link->resource[3], ray_mem_speed);
438 ret = pcmcia_request_window(link, &req, &local->rmem_handle);
439 if (ret) 405 if (ret)
440 goto failed; 406 goto failed;
441 ret = pcmcia_map_mem_page(link, local->rmem_handle, 0x8000); 407 ret = pcmcia_map_mem_page(link, link->resource[3], 0x8000);
442 if (ret) 408 if (ret)
443 goto failed; 409 goto failed;
444 local->rmem = ioremap(req.Base, req.Size); 410 local->rmem = ioremap(link->resource[3]->start,
411 resource_size(link->resource[3]));
445 412
446/*** Set up window for attribute memory ***********************************/ 413/*** Set up window for attribute memory ***********************************/
447 req.Attributes = 414 link->resource[4]->flags |=
448 WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_AM | WIN_ENABLE | WIN_USE_WAIT; 415 WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_AM | WIN_ENABLE | WIN_USE_WAIT;
449 req.Base = 0; 416 link->resource[4]->start = 0;
450 req.Size = 0x1000; 417 link->resource[4]->end = 0x1000;
451 req.AccessSpeed = ray_mem_speed; 418 ret = pcmcia_request_window(link, link->resource[4], ray_mem_speed);
452 ret = pcmcia_request_window(link, &req, &local->amem_handle);
453 if (ret) 419 if (ret)
454 goto failed; 420 goto failed;
455 ret = pcmcia_map_mem_page(link, local->amem_handle, 0); 421 ret = pcmcia_map_mem_page(link, link->resource[4], 0);
456 if (ret) 422 if (ret)
457 goto failed; 423 goto failed;
458 local->amem = ioremap(req.Base, req.Size); 424 local->amem = ioremap(link->resource[4]->start,
425 resource_size(link->resource[4]));
459 426
460 dev_dbg(&link->dev, "ray_config sram=%p\n", local->sram); 427 dev_dbg(&link->dev, "ray_config sram=%p\n", local->sram);
461 dev_dbg(&link->dev, "ray_config rmem=%p\n", local->rmem); 428 dev_dbg(&link->dev, "ray_config rmem=%p\n", local->rmem);
@@ -771,11 +738,7 @@ static void join_net(u_long data)
771 local->card_status = CARD_DOING_ACQ; 738 local->card_status = CARD_DOING_ACQ;
772} 739}
773 740
774/*============================================================================ 741
775 After a card is removed, ray_release() will unregister the net
776 device, and release the PCMCIA configuration. If the device is
777 still open, this will be postponed until it is closed.
778=============================================================================*/
779static void ray_release(struct pcmcia_device *link) 742static void ray_release(struct pcmcia_device *link)
780{ 743{
781 struct net_device *dev = link->priv; 744 struct net_device *dev = link->priv;
@@ -2786,6 +2749,7 @@ static ssize_t ray_cs_essid_proc_write(struct file *file,
2786static const struct file_operations ray_cs_essid_proc_fops = { 2749static const struct file_operations ray_cs_essid_proc_fops = {
2787 .owner = THIS_MODULE, 2750 .owner = THIS_MODULE,
2788 .write = ray_cs_essid_proc_write, 2751 .write = ray_cs_essid_proc_write,
2752 .llseek = noop_llseek,
2789}; 2753};
2790 2754
2791static ssize_t int_proc_write(struct file *file, const char __user *buffer, 2755static ssize_t int_proc_write(struct file *file, const char __user *buffer,
@@ -2819,6 +2783,7 @@ static ssize_t int_proc_write(struct file *file, const char __user *buffer,
2819static const struct file_operations int_proc_fops = { 2783static const struct file_operations int_proc_fops = {
2820 .owner = THIS_MODULE, 2784 .owner = THIS_MODULE,
2821 .write = int_proc_write, 2785 .write = int_proc_write,
2786 .llseek = noop_llseek,
2822}; 2787};
2823#endif 2788#endif
2824 2789
@@ -2831,9 +2796,7 @@ MODULE_DEVICE_TABLE(pcmcia, ray_ids);
2831 2796
2832static struct pcmcia_driver ray_driver = { 2797static struct pcmcia_driver ray_driver = {
2833 .owner = THIS_MODULE, 2798 .owner = THIS_MODULE,
2834 .drv = { 2799 .name = "ray_cs",
2835 .name = "ray_cs",
2836 },
2837 .probe = ray_probe, 2800 .probe = ray_probe,
2838 .remove = ray_detach, 2801 .remove = ray_detach,
2839 .id_table = ray_ids, 2802 .id_table = ray_ids,
diff --git a/drivers/net/wireless/ray_cs.h b/drivers/net/wireless/ray_cs.h
index 9f01ddb19748..e79848fbcca1 100644
--- a/drivers/net/wireless/ray_cs.h
+++ b/drivers/net/wireless/ray_cs.h
@@ -25,8 +25,6 @@ struct beacon_rx {
25typedef struct ray_dev_t { 25typedef struct ray_dev_t {
26 int card_status; 26 int card_status;
27 int authentication_state; 27 int authentication_state;
28 window_handle_t amem_handle; /* handle to window for attribute memory */
29 window_handle_t rmem_handle; /* handle to window for rx buffer on card */
30 void __iomem *sram; /* pointer to beginning of shared RAM */ 28 void __iomem *sram; /* pointer to beginning of shared RAM */
31 void __iomem *amem; /* pointer to attribute mem window */ 29 void __iomem *amem; /* pointer to attribute mem window */
32 void __iomem *rmem; /* pointer to receive buffer window */ 30 void __iomem *rmem; /* pointer to receive buffer window */
diff --git a/drivers/net/wireless/rt2x00/rt2x00debug.c b/drivers/net/wireless/rt2x00/rt2x00debug.c
index c1710b27ba70..fcdb6b0dc40f 100644
--- a/drivers/net/wireless/rt2x00/rt2x00debug.c
+++ b/drivers/net/wireless/rt2x00/rt2x00debug.c
@@ -315,6 +315,7 @@ static const struct file_operations rt2x00debug_fop_queue_dump = {
315 .poll = rt2x00debug_poll_queue_dump, 315 .poll = rt2x00debug_poll_queue_dump,
316 .open = rt2x00debug_open_queue_dump, 316 .open = rt2x00debug_open_queue_dump,
317 .release = rt2x00debug_release_queue_dump, 317 .release = rt2x00debug_release_queue_dump,
318 .llseek = default_llseek,
318}; 319};
319 320
320static ssize_t rt2x00debug_read_queue_stats(struct file *file, 321static ssize_t rt2x00debug_read_queue_stats(struct file *file,
@@ -371,6 +372,7 @@ static const struct file_operations rt2x00debug_fop_queue_stats = {
371 .read = rt2x00debug_read_queue_stats, 372 .read = rt2x00debug_read_queue_stats,
372 .open = rt2x00debug_file_open, 373 .open = rt2x00debug_file_open,
373 .release = rt2x00debug_file_release, 374 .release = rt2x00debug_file_release,
375 .llseek = default_llseek,
374}; 376};
375 377
376#ifdef CONFIG_RT2X00_LIB_CRYPTO 378#ifdef CONFIG_RT2X00_LIB_CRYPTO
@@ -423,6 +425,7 @@ static const struct file_operations rt2x00debug_fop_crypto_stats = {
423 .read = rt2x00debug_read_crypto_stats, 425 .read = rt2x00debug_read_crypto_stats,
424 .open = rt2x00debug_file_open, 426 .open = rt2x00debug_file_open,
425 .release = rt2x00debug_file_release, 427 .release = rt2x00debug_file_release,
428 .llseek = default_llseek,
426}; 429};
427#endif 430#endif
428 431
@@ -512,6 +515,7 @@ static const struct file_operations rt2x00debug_fop_##__name = {\
512 .write = rt2x00debug_write_##__name, \ 515 .write = rt2x00debug_write_##__name, \
513 .open = rt2x00debug_file_open, \ 516 .open = rt2x00debug_file_open, \
514 .release = rt2x00debug_file_release, \ 517 .release = rt2x00debug_file_release, \
518 .llseek = generic_file_llseek, \
515}; 519};
516 520
517RT2X00DEBUGFS_OPS(csr, "0x%.8x\n", u32); 521RT2X00DEBUGFS_OPS(csr, "0x%.8x\n", u32);
@@ -545,6 +549,7 @@ static const struct file_operations rt2x00debug_fop_dev_flags = {
545 .read = rt2x00debug_read_dev_flags, 549 .read = rt2x00debug_read_dev_flags,
546 .open = rt2x00debug_file_open, 550 .open = rt2x00debug_file_open,
547 .release = rt2x00debug_file_release, 551 .release = rt2x00debug_file_release,
552 .llseek = default_llseek,
548}; 553};
549 554
550static struct dentry *rt2x00debug_create_file_driver(const char *name, 555static struct dentry *rt2x00debug_create_file_driver(const char *name,
diff --git a/drivers/net/wireless/wl1251/debugfs.c b/drivers/net/wireless/wl1251/debugfs.c
index 6e5caaa9f613..6c274007d200 100644
--- a/drivers/net/wireless/wl1251/debugfs.c
+++ b/drivers/net/wireless/wl1251/debugfs.c
@@ -48,6 +48,7 @@ static ssize_t name## _read(struct file *file, char __user *userbuf, \
48static const struct file_operations name## _ops = { \ 48static const struct file_operations name## _ops = { \
49 .read = name## _read, \ 49 .read = name## _read, \
50 .open = wl1251_open_file_generic, \ 50 .open = wl1251_open_file_generic, \
51 .llseek = generic_file_llseek, \
51}; 52};
52 53
53#define DEBUGFS_ADD(name, parent) \ 54#define DEBUGFS_ADD(name, parent) \
@@ -84,6 +85,7 @@ static ssize_t sub## _ ##name## _read(struct file *file, \
84static const struct file_operations sub## _ ##name## _ops = { \ 85static const struct file_operations sub## _ ##name## _ops = { \
85 .read = sub## _ ##name## _read, \ 86 .read = sub## _ ##name## _read, \
86 .open = wl1251_open_file_generic, \ 87 .open = wl1251_open_file_generic, \
88 .llseek = generic_file_llseek, \
87}; 89};
88 90
89#define DEBUGFS_FWSTATS_ADD(sub, name) \ 91#define DEBUGFS_FWSTATS_ADD(sub, name) \
@@ -234,6 +236,7 @@ static ssize_t tx_queue_len_read(struct file *file, char __user *userbuf,
234static const struct file_operations tx_queue_len_ops = { 236static const struct file_operations tx_queue_len_ops = {
235 .read = tx_queue_len_read, 237 .read = tx_queue_len_read,
236 .open = wl1251_open_file_generic, 238 .open = wl1251_open_file_generic,
239 .llseek = generic_file_llseek,
237}; 240};
238 241
239static ssize_t tx_queue_status_read(struct file *file, char __user *userbuf, 242static ssize_t tx_queue_status_read(struct file *file, char __user *userbuf,
@@ -255,6 +258,7 @@ static ssize_t tx_queue_status_read(struct file *file, char __user *userbuf,
255static const struct file_operations tx_queue_status_ops = { 258static const struct file_operations tx_queue_status_ops = {
256 .read = tx_queue_status_read, 259 .read = tx_queue_status_read,
257 .open = wl1251_open_file_generic, 260 .open = wl1251_open_file_generic,
261 .llseek = generic_file_llseek,
258}; 262};
259 263
260static void wl1251_debugfs_delete_files(struct wl1251 *wl) 264static void wl1251_debugfs_delete_files(struct wl1251 *wl)
diff --git a/drivers/net/wireless/wl12xx/wl1271_debugfs.c b/drivers/net/wireless/wl12xx/wl1271_debugfs.c
index c239ef4d0b8d..66c2b90ddfd4 100644
--- a/drivers/net/wireless/wl12xx/wl1271_debugfs.c
+++ b/drivers/net/wireless/wl12xx/wl1271_debugfs.c
@@ -51,6 +51,7 @@ static ssize_t name## _read(struct file *file, char __user *userbuf, \
51static const struct file_operations name## _ops = { \ 51static const struct file_operations name## _ops = { \
52 .read = name## _read, \ 52 .read = name## _read, \
53 .open = wl1271_open_file_generic, \ 53 .open = wl1271_open_file_generic, \
54 .llseek = generic_file_llseek, \
54}; 55};
55 56
56#define DEBUGFS_ADD(name, parent) \ 57#define DEBUGFS_ADD(name, parent) \
@@ -87,6 +88,7 @@ static ssize_t sub## _ ##name## _read(struct file *file, \
87static const struct file_operations sub## _ ##name## _ops = { \ 88static const struct file_operations sub## _ ##name## _ops = { \
88 .read = sub## _ ##name## _read, \ 89 .read = sub## _ ##name## _read, \
89 .open = wl1271_open_file_generic, \ 90 .open = wl1271_open_file_generic, \
91 .llseek = generic_file_llseek, \
90}; 92};
91 93
92#define DEBUGFS_FWSTATS_ADD(sub, name) \ 94#define DEBUGFS_FWSTATS_ADD(sub, name) \
@@ -237,6 +239,7 @@ static ssize_t tx_queue_len_read(struct file *file, char __user *userbuf,
237static const struct file_operations tx_queue_len_ops = { 239static const struct file_operations tx_queue_len_ops = {
238 .read = tx_queue_len_read, 240 .read = tx_queue_len_read,
239 .open = wl1271_open_file_generic, 241 .open = wl1271_open_file_generic,
242 .llseek = default_llseek,
240}; 243};
241 244
242static ssize_t gpio_power_read(struct file *file, char __user *user_buf, 245static ssize_t gpio_power_read(struct file *file, char __user *user_buf,
@@ -291,7 +294,8 @@ out:
291static const struct file_operations gpio_power_ops = { 294static const struct file_operations gpio_power_ops = {
292 .read = gpio_power_read, 295 .read = gpio_power_read,
293 .write = gpio_power_write, 296 .write = gpio_power_write,
294 .open = wl1271_open_file_generic 297 .open = wl1271_open_file_generic,
298 .llseek = default_llseek,
295}; 299};
296 300
297static void wl1271_debugfs_delete_files(struct wl1271 *wl) 301static void wl1271_debugfs_delete_files(struct wl1271 *wl)
diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c
index 420e9e986a18..ee82df62e646 100644
--- a/drivers/net/wireless/wl3501_cs.c
+++ b/drivers/net/wireless/wl3501_cs.c
@@ -47,7 +47,6 @@
47 47
48#include <net/iw_handler.h> 48#include <net/iw_handler.h>
49 49
50#include <pcmcia/cs.h>
51#include <pcmcia/cistpl.h> 50#include <pcmcia/cistpl.h>
52#include <pcmcia/cisreg.h> 51#include <pcmcia/cisreg.h>
53#include <pcmcia/ds.h> 52#include <pcmcia/ds.h>
@@ -77,13 +76,6 @@
77#define WL3501_RESUME 0 76#define WL3501_RESUME 0
78#define WL3501_SUSPEND 1 77#define WL3501_SUSPEND 1
79 78
80/*
81 * The event() function is this driver's Card Services event handler. It will
82 * be called by Card Services when an appropriate card status event is
83 * received. The config() and release() entry points are used to configure or
84 * release a socket, in response to card insertion and ejection events. They
85 * are invoked from the wl24 event handler.
86 */
87static int wl3501_config(struct pcmcia_device *link); 79static int wl3501_config(struct pcmcia_device *link);
88static void wl3501_release(struct pcmcia_device *link); 80static void wl3501_release(struct pcmcia_device *link);
89 81
@@ -1859,15 +1851,6 @@ static const struct net_device_ops wl3501_netdev_ops = {
1859 .ndo_validate_addr = eth_validate_addr, 1851 .ndo_validate_addr = eth_validate_addr,
1860}; 1852};
1861 1853
1862/**
1863 * wl3501_attach - creates an "instance" of the driver
1864 *
1865 * Creates an "instance" of the driver, allocating local data structures for
1866 * one device. The device is registered with Card Services.
1867 *
1868 * The dev_link structure is initialized, but we don't actually configure the
1869 * card at this point -- we wait until we receive a card insertion event.
1870 */
1871static int wl3501_probe(struct pcmcia_device *p_dev) 1854static int wl3501_probe(struct pcmcia_device *p_dev)
1872{ 1855{
1873 struct net_device *dev; 1856 struct net_device *dev;
@@ -1878,9 +1861,8 @@ static int wl3501_probe(struct pcmcia_device *p_dev)
1878 p_dev->resource[0]->flags = IO_DATA_PATH_WIDTH_8; 1861 p_dev->resource[0]->flags = IO_DATA_PATH_WIDTH_8;
1879 1862
1880 /* General socket configuration */ 1863 /* General socket configuration */
1881 p_dev->conf.Attributes = CONF_ENABLE_IRQ; 1864 p_dev->config_flags = CONF_ENABLE_IRQ;
1882 p_dev->conf.IntType = INT_MEMORY_AND_IO; 1865 p_dev->config_index = 1;
1883 p_dev->conf.ConfigIndex = 1;
1884 1866
1885 dev = alloc_etherdev(sizeof(struct wl3501_card)); 1867 dev = alloc_etherdev(sizeof(struct wl3501_card));
1886 if (!dev) 1868 if (!dev)
@@ -1903,14 +1885,6 @@ out_link:
1903 return -ENOMEM; 1885 return -ENOMEM;
1904} 1886}
1905 1887
1906/**
1907 * wl3501_config - configure the PCMCIA socket and make eth device available
1908 * @link - FILL_IN
1909 *
1910 * wl3501_config() is scheduled to run after a CARD_INSERTION event is
1911 * received, to configure the PCMCIA socket, and to make the ethernet device
1912 * available to the system.
1913 */
1914static int wl3501_config(struct pcmcia_device *link) 1888static int wl3501_config(struct pcmcia_device *link)
1915{ 1889{
1916 struct net_device *dev = link->priv; 1890 struct net_device *dev = link->priv;
@@ -1941,10 +1915,7 @@ static int wl3501_config(struct pcmcia_device *link)
1941 if (ret) 1915 if (ret)
1942 goto failed; 1916 goto failed;
1943 1917
1944 /* This actually configures the PCMCIA socket -- setting up the I/O 1918 ret = pcmcia_enable_device(link);
1945 * windows and the interrupt mapping. */
1946
1947 ret = pcmcia_request_configuration(link, &link->conf);
1948 if (ret) 1919 if (ret)
1949 goto failed; 1920 goto failed;
1950 1921
@@ -1999,14 +1970,6 @@ failed:
1999 return -ENODEV; 1970 return -ENODEV;
2000} 1971}
2001 1972
2002/**
2003 * wl3501_release - unregister the net, release PCMCIA configuration
2004 * @arg - link
2005 *
2006 * After a card is removed, wl3501_release() will unregister the net device,
2007 * and release the PCMCIA configuration. If the device is still open, this
2008 * will be postponed until it is closed.
2009 */
2010static void wl3501_release(struct pcmcia_device *link) 1973static void wl3501_release(struct pcmcia_device *link)
2011{ 1974{
2012 pcmcia_disable_device(link); 1975 pcmcia_disable_device(link);
@@ -2045,9 +2008,7 @@ MODULE_DEVICE_TABLE(pcmcia, wl3501_ids);
2045 2008
2046static struct pcmcia_driver wl3501_driver = { 2009static struct pcmcia_driver wl3501_driver = {
2047 .owner = THIS_MODULE, 2010 .owner = THIS_MODULE,
2048 .drv = { 2011 .name = "wl3501_cs",
2049 .name = "wl3501_cs",
2050 },
2051 .probe = wl3501_probe, 2012 .probe = wl3501_probe,
2052 .remove = wl3501_detach, 2013 .remove = wl3501_detach,
2053 .id_table = wl3501_ids, 2014 .id_table = wl3501_ids,