aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia/axnet_cs.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2005-11-14 15:25:51 -0500
committerDominik Brodowski <linux@dominikbrodowski.net>2006-01-05 18:03:24 -0500
commitf8cfa618dccbdc6dab5297f75779566a388a98fd (patch)
treeb91e0952038dafc6e03bf8b1d8948b1fdefec031 /drivers/net/pcmcia/axnet_cs.c
parentb463581154f3f3eecda27cae60df813fefcd84d3 (diff)
[PATCH] pcmcia: unify attach, EVENT_CARD_INSERTION handlers into one probe callback
Unify the EVENT_CARD_INSERTION and "attach" callbacks to one unified probe() callback. As all in-kernel drivers are changed to this new callback, there will be no temporary backwards-compatibility. Inside a probe() function, each driver _must_ set struct pcmcia_device *p_dev->instance and instance->handle correctly. With these patches, the basic driver interface for 16-bit PCMCIA drivers now has the classic four callbacks known also from other buses: int (*probe) (struct pcmcia_device *dev); void (*remove) (struct pcmcia_device *dev); int (*suspend) (struct pcmcia_device *dev); int (*resume) (struct pcmcia_device *dev); Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/net/pcmcia/axnet_cs.c')
-rw-r--r--drivers/net/pcmcia/axnet_cs.c59
1 files changed, 10 insertions, 49 deletions
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c
index 3d36207d3332..01ddfc8cce3f 100644
--- a/drivers/net/pcmcia/axnet_cs.c
+++ b/drivers/net/pcmcia/axnet_cs.c
@@ -87,8 +87,6 @@ static char *version =
87 87
88static void axnet_config(dev_link_t *link); 88static void axnet_config(dev_link_t *link);
89static void axnet_release(dev_link_t *link); 89static void axnet_release(dev_link_t *link);
90static int axnet_event(event_t event, int priority,
91 event_callback_args_t *args);
92static int axnet_open(struct net_device *dev); 90static int axnet_open(struct net_device *dev);
93static int axnet_close(struct net_device *dev); 91static int axnet_close(struct net_device *dev);
94static int axnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 92static int axnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
@@ -107,11 +105,8 @@ static void block_input(struct net_device *dev, int count,
107static void block_output(struct net_device *dev, int count, 105static void block_output(struct net_device *dev, int count,
108 const u_char *buf, const int start_page); 106 const u_char *buf, const int start_page);
109 107
110static dev_link_t *axnet_attach(void);
111static void axnet_detach(struct pcmcia_device *p_dev); 108static void axnet_detach(struct pcmcia_device *p_dev);
112 109
113static dev_info_t dev_info = "axnet_cs";
114
115static void axdev_setup(struct net_device *dev); 110static void axdev_setup(struct net_device *dev);
116static void AX88190_init(struct net_device *dev, int startp); 111static void AX88190_init(struct net_device *dev, int startp);
117static int ax_open(struct net_device *dev); 112static int ax_open(struct net_device *dev);
@@ -146,13 +141,11 @@ static inline axnet_dev_t *PRIV(struct net_device *dev)
146 141
147======================================================================*/ 142======================================================================*/
148 143
149static dev_link_t *axnet_attach(void) 144static int axnet_attach(struct pcmcia_device *p_dev)
150{ 145{
151 axnet_dev_t *info; 146 axnet_dev_t *info;
152 dev_link_t *link; 147 dev_link_t *link;
153 struct net_device *dev; 148 struct net_device *dev;
154 client_reg_t client_reg;
155 int ret;
156 149
157 DEBUG(0, "axnet_attach()\n"); 150 DEBUG(0, "axnet_attach()\n");
158 151
@@ -160,7 +153,7 @@ static dev_link_t *axnet_attach(void)
160 "eth%d", axdev_setup); 153 "eth%d", axdev_setup);
161 154
162 if (!dev) 155 if (!dev)
163 return NULL; 156 return -ENOMEM;
164 157
165 info = PRIV(dev); 158 info = PRIV(dev);
166 link = &info->link; 159 link = &info->link;
@@ -175,19 +168,13 @@ static dev_link_t *axnet_attach(void)
175 dev->do_ioctl = &axnet_ioctl; 168 dev->do_ioctl = &axnet_ioctl;
176 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); 169 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
177 170
178 /* Register with Card Services */ 171 link->handle = p_dev;
179 link->next = NULL; 172 p_dev->instance = link;
180 client_reg.dev_info = &dev_info;
181 client_reg.Version = 0x0210;
182 client_reg.event_callback_args.client_data = link;
183 ret = pcmcia_register_client(&link->handle, &client_reg);
184 if (ret != CS_SUCCESS) {
185 cs_error(link->handle, RegisterClient, ret);
186 axnet_detach(link->handle);
187 return NULL;
188 }
189 173
190 return link; 174 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
175 axnet_config(link);
176
177 return 0;
191} /* axnet_attach */ 178} /* axnet_attach */
192 179
193/*====================================================================== 180/*======================================================================
@@ -513,31 +500,6 @@ static int axnet_resume(struct pcmcia_device *p_dev)
513 500
514/*====================================================================== 501/*======================================================================
515 502
516 The card status event handler. Mostly, this schedules other
517 stuff to run after an event is received. A CARD_REMOVAL event
518 also sets some flags to discourage the net drivers from trying
519 to talk to the card any more.
520
521======================================================================*/
522
523static int axnet_event(event_t event, int priority,
524 event_callback_args_t *args)
525{
526 dev_link_t *link = args->client_data;
527
528 DEBUG(2, "axnet_event(0x%06x)\n", event);
529
530 switch (event) {
531 case CS_EVENT_CARD_INSERTION:
532 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
533 axnet_config(link);
534 break;
535 }
536 return 0;
537} /* axnet_event */
538
539/*======================================================================
540
541 MII interface support 503 MII interface support
542 504
543======================================================================*/ 505======================================================================*/
@@ -608,7 +570,7 @@ static int axnet_open(struct net_device *dev)
608 570
609 link->open++; 571 link->open++;
610 572
611 request_irq(dev->irq, ei_irq_wrapper, SA_SHIRQ, dev_info, dev); 573 request_irq(dev->irq, ei_irq_wrapper, SA_SHIRQ, "axnet_cs", dev);
612 574
613 info->link_status = 0x00; 575 info->link_status = 0x00;
614 init_timer(&info->watchdog); 576 init_timer(&info->watchdog);
@@ -869,8 +831,7 @@ static struct pcmcia_driver axnet_cs_driver = {
869 .drv = { 831 .drv = {
870 .name = "axnet_cs", 832 .name = "axnet_cs",
871 }, 833 },
872 .attach = axnet_attach, 834 .probe = axnet_attach,
873 .event = axnet_event,
874 .remove = axnet_detach, 835 .remove = axnet_detach,
875 .id_table = axnet_ids, 836 .id_table = axnet_ids,
876 .suspend = axnet_suspend, 837 .suspend = axnet_suspend,