aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia/fmvj18x_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/fmvj18x_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/fmvj18x_cs.c')
-rw-r--r--drivers/net/pcmcia/fmvj18x_cs.c54
1 files changed, 12 insertions, 42 deletions
diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c
index dad6393052ff..28fe2fb4d6c0 100644
--- a/drivers/net/pcmcia/fmvj18x_cs.c
+++ b/drivers/net/pcmcia/fmvj18x_cs.c
@@ -88,9 +88,6 @@ static void fmvj18x_config(dev_link_t *link);
88static int fmvj18x_get_hwinfo(dev_link_t *link, u_char *node_id); 88static int fmvj18x_get_hwinfo(dev_link_t *link, u_char *node_id);
89static int fmvj18x_setup_mfc(dev_link_t *link); 89static int fmvj18x_setup_mfc(dev_link_t *link);
90static void fmvj18x_release(dev_link_t *link); 90static void fmvj18x_release(dev_link_t *link);
91static int fmvj18x_event(event_t event, int priority,
92 event_callback_args_t *args);
93static dev_link_t *fmvj18x_attach(void);
94static void fmvj18x_detach(struct pcmcia_device *p_dev); 91static void fmvj18x_detach(struct pcmcia_device *p_dev);
95 92
96/* 93/*
@@ -108,8 +105,6 @@ static void set_rx_mode(struct net_device *dev);
108static void fjn_tx_timeout(struct net_device *dev); 105static void fjn_tx_timeout(struct net_device *dev);
109static struct ethtool_ops netdev_ethtool_ops; 106static struct ethtool_ops netdev_ethtool_ops;
110 107
111static dev_info_t dev_info = "fmvj18x_cs";
112
113/* 108/*
114 card type 109 card type
115 */ 110 */
@@ -233,20 +228,18 @@ typedef struct local_info_t {
233#define BANK_1U 0x24 /* bank 1 (CONFIG_1) */ 228#define BANK_1U 0x24 /* bank 1 (CONFIG_1) */
234#define BANK_2U 0x28 /* bank 2 (CONFIG_1) */ 229#define BANK_2U 0x28 /* bank 2 (CONFIG_1) */
235 230
236static dev_link_t *fmvj18x_attach(void) 231static int fmvj18x_attach(struct pcmcia_device *p_dev)
237{ 232{
238 local_info_t *lp; 233 local_info_t *lp;
239 dev_link_t *link; 234 dev_link_t *link;
240 struct net_device *dev; 235 struct net_device *dev;
241 client_reg_t client_reg; 236
242 int ret;
243
244 DEBUG(0, "fmvj18x_attach()\n"); 237 DEBUG(0, "fmvj18x_attach()\n");
245 238
246 /* Make up a FMVJ18x specific data structure */ 239 /* Make up a FMVJ18x specific data structure */
247 dev = alloc_etherdev(sizeof(local_info_t)); 240 dev = alloc_etherdev(sizeof(local_info_t));
248 if (!dev) 241 if (!dev)
249 return NULL; 242 return -ENOMEM;
250 lp = netdev_priv(dev); 243 lp = netdev_priv(dev);
251 link = &lp->link; 244 link = &lp->link;
252 link->priv = dev; 245 link->priv = dev;
@@ -261,7 +254,7 @@ static dev_link_t *fmvj18x_attach(void)
261 link->irq.IRQInfo1 = IRQ_LEVEL_ID; 254 link->irq.IRQInfo1 = IRQ_LEVEL_ID;
262 link->irq.Handler = &fjn_interrupt; 255 link->irq.Handler = &fjn_interrupt;
263 link->irq.Instance = dev; 256 link->irq.Instance = dev;
264 257
265 /* General socket configuration */ 258 /* General socket configuration */
266 link->conf.Attributes = CONF_ENABLE_IRQ; 259 link->conf.Attributes = CONF_ENABLE_IRQ;
267 link->conf.Vcc = 50; 260 link->conf.Vcc = 50;
@@ -280,20 +273,14 @@ static dev_link_t *fmvj18x_attach(void)
280 dev->watchdog_timeo = TX_TIMEOUT; 273 dev->watchdog_timeo = TX_TIMEOUT;
281#endif 274#endif
282 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); 275 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
283
284 /* Register with Card Services */
285 link->next = NULL;
286 client_reg.dev_info = &dev_info;
287 client_reg.Version = 0x0210;
288 client_reg.event_callback_args.client_data = link;
289 ret = pcmcia_register_client(&link->handle, &client_reg);
290 if (ret != 0) {
291 cs_error(link->handle, RegisterClient, ret);
292 fmvj18x_detach(link->handle);
293 return NULL;
294 }
295 276
296 return link; 277 link->handle = p_dev;
278 p_dev->instance = link;
279
280 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
281 fmvj18x_config(link);
282
283 return 0;
297} /* fmvj18x_attach */ 284} /* fmvj18x_attach */
298 285
299/*====================================================================*/ 286/*====================================================================*/
@@ -734,22 +721,6 @@ static int fmvj18x_resume(struct pcmcia_device *p_dev)
734 721
735/*====================================================================*/ 722/*====================================================================*/
736 723
737static int fmvj18x_event(event_t event, int priority,
738 event_callback_args_t *args)
739{
740 dev_link_t *link = args->client_data;
741
742 DEBUG(1, "fmvj18x_event(0x%06x)\n", event);
743
744 switch (event) {
745 case CS_EVENT_CARD_INSERTION:
746 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
747 fmvj18x_config(link);
748 break;
749 }
750 return 0;
751} /* fmvj18x_event */
752
753static struct pcmcia_device_id fmvj18x_ids[] = { 724static struct pcmcia_device_id fmvj18x_ids[] = {
754 PCMCIA_DEVICE_MANF_CARD(0x0004, 0x0004), 725 PCMCIA_DEVICE_MANF_CARD(0x0004, 0x0004),
755 PCMCIA_DEVICE_PROD_ID12("EAGLE Technology", "NE200 ETHERNET LAN MBH10302 04", 0x528c88c4, 0x74f91e59), 726 PCMCIA_DEVICE_PROD_ID12("EAGLE Technology", "NE200 ETHERNET LAN MBH10302 04", 0x528c88c4, 0x74f91e59),
@@ -780,8 +751,7 @@ static struct pcmcia_driver fmvj18x_cs_driver = {
780 .drv = { 751 .drv = {
781 .name = "fmvj18x_cs", 752 .name = "fmvj18x_cs",
782 }, 753 },
783 .attach = fmvj18x_attach, 754 .probe = fmvj18x_attach,
784 .event = fmvj18x_event,
785 .remove = fmvj18x_detach, 755 .remove = fmvj18x_detach,
786 .id_table = fmvj18x_ids, 756 .id_table = fmvj18x_ids,
787 .suspend = fmvj18x_suspend, 757 .suspend = fmvj18x_suspend,