aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia/pcnet_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/pcnet_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/pcnet_cs.c')
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c45
1 files changed, 9 insertions, 36 deletions
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index b35c951fc6fa..d85b758f3efa 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -105,8 +105,6 @@ module_param_array(hw_addr, int, NULL, 0);
105static void mii_phy_probe(struct net_device *dev); 105static void mii_phy_probe(struct net_device *dev);
106static void pcnet_config(dev_link_t *link); 106static void pcnet_config(dev_link_t *link);
107static void pcnet_release(dev_link_t *link); 107static void pcnet_release(dev_link_t *link);
108static int pcnet_event(event_t event, int priority,
109 event_callback_args_t *args);
110static int pcnet_open(struct net_device *dev); 108static int pcnet_open(struct net_device *dev);
111static int pcnet_close(struct net_device *dev); 109static int pcnet_close(struct net_device *dev);
112static int ei_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 110static int ei_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
@@ -120,7 +118,6 @@ static int setup_shmem_window(dev_link_t *link, int start_pg,
120static int setup_dma_config(dev_link_t *link, int start_pg, 118static int setup_dma_config(dev_link_t *link, int start_pg,
121 int stop_pg); 119 int stop_pg);
122 120
123static dev_link_t *pcnet_attach(void);
124static void pcnet_detach(struct pcmcia_device *p_dev); 121static void pcnet_detach(struct pcmcia_device *p_dev);
125 122
126static dev_info_t dev_info = "pcnet_cs"; 123static dev_info_t dev_info = "pcnet_cs";
@@ -243,19 +240,17 @@ static inline pcnet_dev_t *PRIV(struct net_device *dev)
243 240
244======================================================================*/ 241======================================================================*/
245 242
246static dev_link_t *pcnet_attach(void) 243static int pcnet_probe(struct pcmcia_device *p_dev)
247{ 244{
248 pcnet_dev_t *info; 245 pcnet_dev_t *info;
249 dev_link_t *link; 246 dev_link_t *link;
250 struct net_device *dev; 247 struct net_device *dev;
251 client_reg_t client_reg;
252 int ret;
253 248
254 DEBUG(0, "pcnet_attach()\n"); 249 DEBUG(0, "pcnet_attach()\n");
255 250
256 /* Create new ethernet device */ 251 /* Create new ethernet device */
257 dev = __alloc_ei_netdev(sizeof(pcnet_dev_t)); 252 dev = __alloc_ei_netdev(sizeof(pcnet_dev_t));
258 if (!dev) return NULL; 253 if (!dev) return -ENOMEM;
259 info = PRIV(dev); 254 info = PRIV(dev);
260 link = &info->link; 255 link = &info->link;
261 link->priv = dev; 256 link->priv = dev;
@@ -270,19 +265,13 @@ static dev_link_t *pcnet_attach(void)
270 dev->stop = &pcnet_close; 265 dev->stop = &pcnet_close;
271 dev->set_config = &set_config; 266 dev->set_config = &set_config;
272 267
273 /* Register with Card Services */ 268 link->handle = p_dev;
274 link->next = NULL; 269 p_dev->instance = link;
275 client_reg.dev_info = &dev_info; 270
276 client_reg.Version = 0x0210; 271 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
277 client_reg.event_callback_args.client_data = link; 272 pcnet_config(link);
278 ret = pcmcia_register_client(&link->handle, &client_reg);
279 if (ret != CS_SUCCESS) {
280 cs_error(link->handle, RegisterClient, ret);
281 pcnet_detach(link->handle);
282 return NULL;
283 }
284 273
285 return link; 274 return 0;
286} /* pcnet_attach */ 275} /* pcnet_attach */
287 276
288/*====================================================================== 277/*======================================================================
@@ -800,21 +789,6 @@ static int pcnet_resume(struct pcmcia_device *p_dev)
800 return 0; 789 return 0;
801} 790}
802 791
803static int pcnet_event(event_t event, int priority,
804 event_callback_args_t *args)
805{
806 dev_link_t *link = args->client_data;
807
808 DEBUG(2, "pcnet_event(0x%06x)\n", event);
809
810 switch (event) {
811 case CS_EVENT_CARD_INSERTION:
812 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
813 pcnet_config(link);
814 break;
815 }
816 return 0;
817} /* pcnet_event */
818 792
819/*====================================================================== 793/*======================================================================
820 794
@@ -1835,8 +1809,7 @@ static struct pcmcia_driver pcnet_driver = {
1835 .drv = { 1809 .drv = {
1836 .name = "pcnet_cs", 1810 .name = "pcnet_cs",
1837 }, 1811 },
1838 .attach = pcnet_attach, 1812 .probe = pcnet_probe,
1839 .event = pcnet_event,
1840 .remove = pcnet_detach, 1813 .remove = pcnet_detach,
1841 .owner = THIS_MODULE, 1814 .owner = THIS_MODULE,
1842 .id_table = pcnet_ids, 1815 .id_table = pcnet_ids,