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