diff options
Diffstat (limited to 'drivers/net/pcmcia/3c589_cs.c')
-rw-r--r-- | drivers/net/pcmcia/3c589_cs.c | 66 |
1 files changed, 15 insertions, 51 deletions
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c index 61f9cf2100ff..4a1a35809807 100644 --- a/drivers/net/pcmcia/3c589_cs.c +++ b/drivers/net/pcmcia/3c589_cs.c | |||
@@ -19,6 +19,8 @@ | |||
19 | 19 | ||
20 | ======================================================================*/ | 20 | ======================================================================*/ |
21 | 21 | ||
22 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
23 | |||
22 | #define DRV_NAME "3c589_cs" | 24 | #define DRV_NAME "3c589_cs" |
23 | #define DRV_VERSION "1.162-ac" | 25 | #define DRV_VERSION "1.162-ac" |
24 | 26 | ||
@@ -41,7 +43,6 @@ | |||
41 | #include <linux/bitops.h> | 43 | #include <linux/bitops.h> |
42 | #include <linux/jiffies.h> | 44 | #include <linux/jiffies.h> |
43 | 45 | ||
44 | #include <pcmcia/cs.h> | ||
45 | #include <pcmcia/cistpl.h> | 46 | #include <pcmcia/cistpl.h> |
46 | #include <pcmcia/cisreg.h> | 47 | #include <pcmcia/cisreg.h> |
47 | #include <pcmcia/ciscode.h> | 48 | #include <pcmcia/ciscode.h> |
@@ -176,14 +177,6 @@ static const struct ethtool_ops netdev_ethtool_ops; | |||
176 | 177 | ||
177 | static void tc589_detach(struct pcmcia_device *p_dev); | 178 | static void tc589_detach(struct pcmcia_device *p_dev); |
178 | 179 | ||
179 | /*====================================================================== | ||
180 | |||
181 | tc589_attach() creates an "instance" of the driver, allocating | ||
182 | local data structures for one device. The device is registered | ||
183 | with Card Services. | ||
184 | |||
185 | ======================================================================*/ | ||
186 | |||
187 | static const struct net_device_ops el3_netdev_ops = { | 180 | static const struct net_device_ops el3_netdev_ops = { |
188 | .ndo_open = el3_open, | 181 | .ndo_open = el3_open, |
189 | .ndo_stop = el3_close, | 182 | .ndo_stop = el3_close, |
@@ -216,9 +209,8 @@ static int tc589_probe(struct pcmcia_device *link) | |||
216 | link->resource[0]->end = 16; | 209 | link->resource[0]->end = 16; |
217 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; | 210 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; |
218 | 211 | ||
219 | link->conf.Attributes = CONF_ENABLE_IRQ; | 212 | link->config_flags |= CONF_ENABLE_IRQ; |
220 | link->conf.IntType = INT_MEMORY_AND_IO; | 213 | link->config_index = 1; |
221 | link->conf.ConfigIndex = 1; | ||
222 | 214 | ||
223 | dev->netdev_ops = &el3_netdev_ops; | 215 | dev->netdev_ops = &el3_netdev_ops; |
224 | dev->watchdog_timeo = TX_TIMEOUT; | 216 | dev->watchdog_timeo = TX_TIMEOUT; |
@@ -226,16 +218,7 @@ static int tc589_probe(struct pcmcia_device *link) | |||
226 | SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); | 218 | SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); |
227 | 219 | ||
228 | return tc589_config(link); | 220 | return tc589_config(link); |
229 | } /* tc589_attach */ | 221 | } |
230 | |||
231 | /*====================================================================== | ||
232 | |||
233 | This deletes a driver "instance". The device is de-registered | ||
234 | with Card Services. If it has been released, all local data | ||
235 | structures are freed. Otherwise, the structures will be freed | ||
236 | when the device is released. | ||
237 | |||
238 | ======================================================================*/ | ||
239 | 222 | ||
240 | static void tc589_detach(struct pcmcia_device *link) | 223 | static void tc589_detach(struct pcmcia_device *link) |
241 | { | 224 | { |
@@ -250,21 +233,13 @@ static void tc589_detach(struct pcmcia_device *link) | |||
250 | free_netdev(dev); | 233 | free_netdev(dev); |
251 | } /* tc589_detach */ | 234 | } /* tc589_detach */ |
252 | 235 | ||
253 | /*====================================================================== | ||
254 | |||
255 | tc589_config() is scheduled to run after a CARD_INSERTION event | ||
256 | is received, to configure the PCMCIA socket, and to make the | ||
257 | ethernet device available to the system. | ||
258 | |||
259 | ======================================================================*/ | ||
260 | |||
261 | static int tc589_config(struct pcmcia_device *link) | 236 | static int tc589_config(struct pcmcia_device *link) |
262 | { | 237 | { |
263 | struct net_device *dev = link->priv; | 238 | struct net_device *dev = link->priv; |
264 | __be16 *phys_addr; | 239 | __be16 *phys_addr; |
265 | int ret, i, j, multi = 0, fifo; | 240 | int ret, i, j, multi = 0, fifo; |
266 | unsigned int ioaddr; | 241 | unsigned int ioaddr; |
267 | char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"}; | 242 | static const char * const ram_split[] = {"5:3", "3:1", "1:1", "3:5"}; |
268 | u8 *buf; | 243 | u8 *buf; |
269 | size_t len; | 244 | size_t len; |
270 | 245 | ||
@@ -273,8 +248,7 @@ static int tc589_config(struct pcmcia_device *link) | |||
273 | phys_addr = (__be16 *)dev->dev_addr; | 248 | phys_addr = (__be16 *)dev->dev_addr; |
274 | /* Is this a 3c562? */ | 249 | /* Is this a 3c562? */ |
275 | if (link->manf_id != MANFID_3COM) | 250 | if (link->manf_id != MANFID_3COM) |
276 | printk(KERN_INFO "3c589_cs: hmmm, is this really a " | 251 | dev_info(&link->dev, "hmmm, is this really a 3Com card??\n"); |
277 | "3Com card??\n"); | ||
278 | multi = (link->card_id == PRODID_3COM_3C562); | 252 | multi = (link->card_id == PRODID_3COM_3C562); |
279 | 253 | ||
280 | link->io_lines = 16; | 254 | link->io_lines = 16; |
@@ -294,7 +268,7 @@ static int tc589_config(struct pcmcia_device *link) | |||
294 | if (ret) | 268 | if (ret) |
295 | goto failed; | 269 | goto failed; |
296 | 270 | ||
297 | ret = pcmcia_request_configuration(link, &link->conf); | 271 | ret = pcmcia_enable_device(link); |
298 | if (ret) | 272 | if (ret) |
299 | goto failed; | 273 | goto failed; |
300 | 274 | ||
@@ -315,8 +289,8 @@ static int tc589_config(struct pcmcia_device *link) | |||
315 | for (i = 0; i < 3; i++) | 289 | for (i = 0; i < 3; i++) |
316 | phys_addr[i] = htons(read_eeprom(ioaddr, i)); | 290 | phys_addr[i] = htons(read_eeprom(ioaddr, i)); |
317 | if (phys_addr[0] == htons(0x6060)) { | 291 | if (phys_addr[0] == htons(0x6060)) { |
318 | printk(KERN_ERR "3c589_cs: IO port conflict at 0x%03lx" | 292 | dev_err(&link->dev, "IO port conflict at 0x%03lx-0x%03lx\n", |
319 | "-0x%03lx\n", dev->base_addr, dev->base_addr+15); | 293 | dev->base_addr, dev->base_addr+15); |
320 | goto failed; | 294 | goto failed; |
321 | } | 295 | } |
322 | } | 296 | } |
@@ -330,12 +304,12 @@ static int tc589_config(struct pcmcia_device *link) | |||
330 | if ((if_port >= 0) && (if_port <= 3)) | 304 | if ((if_port >= 0) && (if_port <= 3)) |
331 | dev->if_port = if_port; | 305 | dev->if_port = if_port; |
332 | else | 306 | else |
333 | printk(KERN_ERR "3c589_cs: invalid if_port requested\n"); | 307 | dev_err(&link->dev, "invalid if_port requested\n"); |
334 | 308 | ||
335 | SET_NETDEV_DEV(dev, &link->dev); | 309 | SET_NETDEV_DEV(dev, &link->dev); |
336 | 310 | ||
337 | if (register_netdev(dev) != 0) { | 311 | if (register_netdev(dev) != 0) { |
338 | printk(KERN_ERR "3c589_cs: register_netdev() failed\n"); | 312 | dev_err(&link->dev, "register_netdev() failed\n"); |
339 | goto failed; | 313 | goto failed; |
340 | } | 314 | } |
341 | 315 | ||
@@ -352,14 +326,6 @@ failed: | |||
352 | return -ENODEV; | 326 | return -ENODEV; |
353 | } /* tc589_config */ | 327 | } /* tc589_config */ |
354 | 328 | ||
355 | /*====================================================================== | ||
356 | |||
357 | After a card is removed, tc589_release() will unregister the net | ||
358 | device, and release the PCMCIA configuration. If the device is | ||
359 | still open, this will be postponed until it is closed. | ||
360 | |||
361 | ======================================================================*/ | ||
362 | |||
363 | static void tc589_release(struct pcmcia_device *link) | 329 | static void tc589_release(struct pcmcia_device *link) |
364 | { | 330 | { |
365 | pcmcia_disable_device(link); | 331 | pcmcia_disable_device(link); |
@@ -537,7 +503,7 @@ static int el3_open(struct net_device *dev) | |||
537 | 503 | ||
538 | tc589_reset(dev); | 504 | tc589_reset(dev); |
539 | init_timer(&lp->media); | 505 | init_timer(&lp->media); |
540 | lp->media.function = &media_check; | 506 | lp->media.function = media_check; |
541 | lp->media.data = (unsigned long) dev; | 507 | lp->media.data = (unsigned long) dev; |
542 | lp->media.expires = jiffies + HZ; | 508 | lp->media.expires = jiffies + HZ; |
543 | add_timer(&lp->media); | 509 | add_timer(&lp->media); |
@@ -942,7 +908,7 @@ static int el3_close(struct net_device *dev) | |||
942 | return 0; | 908 | return 0; |
943 | } | 909 | } |
944 | 910 | ||
945 | static struct pcmcia_device_id tc589_ids[] = { | 911 | static const struct pcmcia_device_id tc589_ids[] = { |
946 | PCMCIA_MFC_DEVICE_MANF_CARD(0, 0x0101, 0x0562), | 912 | PCMCIA_MFC_DEVICE_MANF_CARD(0, 0x0101, 0x0562), |
947 | PCMCIA_MFC_DEVICE_PROD_ID1(0, "Motorola MARQUIS", 0xf03e4e77), | 913 | PCMCIA_MFC_DEVICE_PROD_ID1(0, "Motorola MARQUIS", 0xf03e4e77), |
948 | PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0589), | 914 | PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0589), |
@@ -955,9 +921,7 @@ MODULE_DEVICE_TABLE(pcmcia, tc589_ids); | |||
955 | 921 | ||
956 | static struct pcmcia_driver tc589_driver = { | 922 | static struct pcmcia_driver tc589_driver = { |
957 | .owner = THIS_MODULE, | 923 | .owner = THIS_MODULE, |
958 | .drv = { | 924 | .name = "3c589_cs", |
959 | .name = "3c589_cs", | ||
960 | }, | ||
961 | .probe = tc589_probe, | 925 | .probe = tc589_probe, |
962 | .remove = tc589_detach, | 926 | .remove = tc589_detach, |
963 | .id_table = tc589_ids, | 927 | .id_table = tc589_ids, |