Commit e95032ff authored by Daniel Ritz's avatar Daniel Ritz Committed by Jeff Garzik

[PATCH] xirc2ps_cs update

hi

this patch does:
- net_device is no longer allocated as part of the driver's private structure,
  instead it's allocated via alloc_netdev
- xirc2ps_detach calls xirc2ps_release if necessary (like the other drivers)

against 2.5.70-bk.

rgds
-daniel
parent 74250c56
...@@ -358,7 +358,6 @@ static dev_link_t *dev_list; ...@@ -358,7 +358,6 @@ static dev_link_t *dev_list;
typedef struct local_info_t { typedef struct local_info_t {
dev_link_t link; dev_link_t link;
struct net_device dev;
dev_node_t node; dev_node_t node;
struct net_device_stats stats; struct net_device_stats stats;
int card_type; int card_type;
...@@ -619,11 +618,12 @@ xirc2ps_attach(void) ...@@ -619,11 +618,12 @@ xirc2ps_attach(void)
flush_stale_links(); flush_stale_links();
/* Allocate the device structure */ /* Allocate the device structure */
local = kmalloc(sizeof(*local), GFP_KERNEL); dev = alloc_etherdev(sizeof(local_info_t));
if (!local) return NULL; if (!dev)
memset(local, 0, sizeof(*local)); return NULL;
link = &local->link; dev = &local->dev; local = dev->priv;
link->priv = dev->priv = local; link = &local->link;
link->priv = dev;
init_timer(&link->release); init_timer(&link->release);
link->release.function = &xirc2ps_release; link->release.function = &xirc2ps_release;
...@@ -645,7 +645,6 @@ xirc2ps_attach(void) ...@@ -645,7 +645,6 @@ xirc2ps_attach(void)
dev->get_stats = &do_get_stats; dev->get_stats = &do_get_stats;
dev->do_ioctl = &do_ioctl; dev->do_ioctl = &do_ioctl;
dev->set_multicast_list = &set_multicast_list; dev->set_multicast_list = &set_multicast_list;
ether_setup(dev);
dev->open = &do_open; dev->open = &do_open;
dev->stop = &do_stop; dev->stop = &do_stop;
#ifdef HAVE_TX_TIMEOUT #ifdef HAVE_TX_TIMEOUT
...@@ -684,7 +683,7 @@ xirc2ps_attach(void) ...@@ -684,7 +683,7 @@ xirc2ps_attach(void)
static void static void
xirc2ps_detach(dev_link_t * link) xirc2ps_detach(dev_link_t * link)
{ {
local_info_t *local = link->priv; struct net_device *dev = link->priv;
dev_link_t **linkp; dev_link_t **linkp;
DEBUG(0, "detach(0x%p)\n", link); DEBUG(0, "detach(0x%p)\n", link);
...@@ -706,10 +705,11 @@ xirc2ps_detach(dev_link_t * link) ...@@ -706,10 +705,11 @@ xirc2ps_detach(dev_link_t * link)
*/ */
del_timer(&link->release); del_timer(&link->release);
if (link->state & DEV_CONFIG) { if (link->state & DEV_CONFIG) {
DEBUG(0, "detach postponed, '%s' still locked\n", xirc2ps_release((unsigned long)link);
link->dev->dev_name); if (link->state & DEV_STALE_CONFIG) {
link->state |= DEV_STALE_LINK; link->state |= DEV_STALE_LINK;
return; return;
}
} }
/* Break the link with Card Services */ /* Break the link with Card Services */
...@@ -719,8 +719,8 @@ xirc2ps_detach(dev_link_t * link) ...@@ -719,8 +719,8 @@ xirc2ps_detach(dev_link_t * link)
/* Unlink device structure, free it */ /* Unlink device structure, free it */
*linkp = link->next; *linkp = link->next;
if (link->dev) if (link->dev)
unregister_netdev(&local->dev); unregister_netdev(dev);
kfree(local); kfree(dev);
} /* xirc2ps_detach */ } /* xirc2ps_detach */
...@@ -745,7 +745,8 @@ xirc2ps_detach(dev_link_t * link) ...@@ -745,7 +745,8 @@ xirc2ps_detach(dev_link_t * link)
static int static int
set_card_type(dev_link_t *link, const void *s) set_card_type(dev_link_t *link, const void *s)
{ {
local_info_t *local = link->priv; struct net_device *dev = link->priv;
local_info_t *local = dev->priv;
#ifdef PCMCIA_DEBUG #ifdef PCMCIA_DEBUG
unsigned cisrev = ((const unsigned char *)s)[2]; unsigned cisrev = ((const unsigned char *)s)[2];
#endif #endif
...@@ -839,8 +840,8 @@ static void ...@@ -839,8 +840,8 @@ static void
xirc2ps_config(dev_link_t * link) xirc2ps_config(dev_link_t * link)
{ {
client_handle_t handle = link->handle; client_handle_t handle = link->handle;
local_info_t *local = link->priv; struct net_device *dev = link->priv;
struct net_device *dev = &local->dev; local_info_t *local = dev->priv;
tuple_t tuple; tuple_t tuple;
cisparse_t parse; cisparse_t parse;
ioaddr_t ioaddr; ioaddr_t ioaddr;
...@@ -1195,11 +1196,10 @@ static void ...@@ -1195,11 +1196,10 @@ static void
xirc2ps_release(u_long arg) xirc2ps_release(u_long arg)
{ {
dev_link_t *link = (dev_link_t *) arg; dev_link_t *link = (dev_link_t *) arg;
local_info_t *local = link->priv;
struct net_device *dev = &local->dev;
DEBUG(0, "release(0x%p)\n", link); DEBUG(0, "release(0x%p)\n", link);
#if 0
/* /*
* If the device is currently in use, we won't release until it * If the device is currently in use, we won't release until it
* is actually closed. * is actually closed.
...@@ -1210,8 +1210,10 @@ xirc2ps_release(u_long arg) ...@@ -1210,8 +1210,10 @@ xirc2ps_release(u_long arg)
link->state |= DEV_STALE_CONFIG; link->state |= DEV_STALE_CONFIG;
return; return;
} }
#endif
if (link->win) { if (link->win) {
struct net_device *dev = link->priv;
local_info_t *local = dev->priv; local_info_t *local = dev->priv;
if (local->dingo) if (local->dingo)
iounmap(local->dingo_ccr - 0x0800); iounmap(local->dingo_ccr - 0x0800);
...@@ -1243,8 +1245,7 @@ xirc2ps_event(event_t event, int priority, ...@@ -1243,8 +1245,7 @@ xirc2ps_event(event_t event, int priority,
event_callback_args_t * args) event_callback_args_t * args)
{ {
dev_link_t *link = args->client_data; dev_link_t *link = args->client_data;
local_info_t *lp = link->priv; struct net_device *dev = link->priv;
struct net_device *dev = &lp->dev;
DEBUG(0, "event(%d)\n", (int)event); DEBUG(0, "event(%d)\n", (int)event);
...@@ -2083,12 +2084,8 @@ exit_xirc2ps_cs(void) ...@@ -2083,12 +2084,8 @@ exit_xirc2ps_cs(void)
{ {
pcmcia_unregister_driver(&xirc2ps_cs_driver); pcmcia_unregister_driver(&xirc2ps_cs_driver);
while (dev_list) { while (dev_list)
if (dev_list->state & DEV_CONFIG) xirc2ps_detach(dev_list);
xirc2ps_release((u_long)dev_list);
if (dev_list) /* xirc2ps_release() might already have detached... */
xirc2ps_detach(dev_list);
}
} }
module_init(init_xirc2ps_cs); module_init(init_xirc2ps_cs);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment