* [PATCH] ibmtr_cs/ibmtr on 2.6.0-test9 - get working again
@ 2003-10-25 22:14 Mike Phillips
2003-10-25 22:56 ` Andrew Morton
0 siblings, 1 reply; 3+ messages in thread
From: Mike Phillips @ 2003-10-25 22:14 UTC (permalink / raw)
To: linux-kernel; +Cc: torvalds, jgarzik, shemminger, netdev
Patch to get ibmtr_cs / ibmtr working again in 2.6.0-test9. A change
went in a while back I missed that killed it. Also fixed the timer to
elimitate the uninitialized timer error on close.
Please apply so we have a working driver for 2.6. I'll start right on
updates to the new net-2.5 probes interface.
Thanks
Mike Phillips
diff -urN -X dontdiff linux-2.6.0-test9.vanilla/drivers/net/pcmcia/ibmtr_cs.c linux-2.6.0-test9/drivers/net/pcmcia/ibmtr_cs.c
--- linux-2.6.0-test9.vanilla/drivers/net/pcmcia/ibmtr_cs.c 2003-10-25 14:43:42.000000000 -0400
+++ linux-2.6.0-test9/drivers/net/pcmcia/ibmtr_cs.c 2003-10-25 17:23:35.000000000 -0400
@@ -136,7 +136,7 @@
struct net_device *dev;
dev_node_t node;
window_handle_t sram_win_handle;
- struct tok_info ti;
+ struct tok_info *ti;
} ibmtr_dev_t;
static void netdev_get_drvinfo(struct net_device *dev,
@@ -168,14 +168,17 @@
DEBUG(0, "ibmtr_attach()\n");
/* Create new token-ring device */
- dev = alloc_trdev(sizeof(*info));
+ info = kmalloc(sizeof(*info), GFP_KERNEL);
+ if (!info) return NULL;
+ memset(info,0,sizeof(*info));
+ dev = alloc_trdev(sizeof(struct tok_info));
if (!dev)
return NULL;
- info = dev->priv;
link = &info->link;
link->priv = info;
-
+ info->ti = dev->priv;
+
link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
link->io.NumPorts1 = 4;
link->io.IOAddrLines = 16;
@@ -265,6 +268,7 @@
*linkp = link->next;
unregister_netdev(dev);
free_netdev(dev);
+ kfree(info);
} /* ibmtr_detach */
/*======================================================================
diff -urN -X dontdiff linux-2.6.0-test9.vanilla/drivers/net/tokenring/ibmtr.c linux-2.6.0-test9/drivers/net/tokenring/ibmtr.c
--- linux-2.6.0-test9.vanilla/drivers/net/tokenring/ibmtr.c 2003-10-25 14:43:58.000000000 -0400
+++ linux-2.6.0-test9/drivers/net/tokenring/ibmtr.c 2003-10-25 17:26:38.000000000 -0400
@@ -152,7 +152,7 @@
/* this allows displaying full adapter information */
-char *channel_def[] __initdata = { "ISA", "MCA", "ISA P&P" };
+char *channel_def[] __devinitdata = { "ISA", "MCA", "ISA P&P" };
static char pcchannelid[] __devinitdata = {
0x05, 0x00, 0x04, 0x09,
@@ -864,7 +864,8 @@
ti->sram_virt &= ~1; /* to reverse what we do in tok_close */
/* init the spinlock */
ti->lock = (spinlock_t) SPIN_LOCK_UNLOCKED;
-
+ init_timer(&ti->tr_timer);
+
i = tok_init_card(dev);
if (i) return i;
@@ -1033,7 +1034,7 @@
/* Important for PCMCIA hot unplug, otherwise, we'll pull the card, */
/* unloading the module from memory, and then if a timer pops, ouch */
- del_timer(&ti->tr_timer);
+ del_timer_sync(&ti->tr_timer);
outb(0, dev->base_addr + ADAPTRESET);
ti->sram_virt |= 1;
ti->open_status = CLOSED;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ibmtr_cs/ibmtr on 2.6.0-test9 - get working again
2003-10-25 22:14 [PATCH] ibmtr_cs/ibmtr on 2.6.0-test9 - get working again Mike Phillips
@ 2003-10-25 22:56 ` Andrew Morton
2003-10-25 23:17 ` Mike Phillips
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2003-10-25 22:56 UTC (permalink / raw)
To: Mike Phillips; +Cc: linux-kernel, torvalds, jgarzik, shemminger, netdev
Mike Phillips <phillim2@comcast.net> wrote:
>
> - dev = alloc_trdev(sizeof(*info));
> + info = kmalloc(sizeof(*info), GFP_KERNEL);
> + if (!info) return NULL;
> + memset(info,0,sizeof(*info));
> + dev = alloc_trdev(sizeof(struct tok_info));
> if (!dev)
> return NULL;
This return leaks the memory at `info'.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ibmtr_cs/ibmtr on 2.6.0-test9 - get working again
2003-10-25 22:56 ` Andrew Morton
@ 2003-10-25 23:17 ` Mike Phillips
0 siblings, 0 replies; 3+ messages in thread
From: Mike Phillips @ 2003-10-25 23:17 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel, torvalds, jgarzik, shemminger, netdev
Andrew Morton may (or may not) have said:
> > if (!dev)
> > return NULL;
>
> This return leaks the memory at `info'.
Ooops, so it does, bad me. Corrected patch below:
diff -urN -X dontdiff linux-2.6.0-test9.vanilla/drivers/net/pcmcia/ibmtr_cs.c linux-2.6.0-test9/drivers/net/pcmcia/ibmtr_cs.c
--- linux-2.6.0-test9.vanilla/drivers/net/pcmcia/ibmtr_cs.c 2003-10-25 14:43:42.000000000 -0400
+++ linux-2.6.0-test9/drivers/net/pcmcia/ibmtr_cs.c 2003-10-25 19:01:02.000000000 -0400
@@ -136,7 +136,7 @@
struct net_device *dev;
dev_node_t node;
window_handle_t sram_win_handle;
- struct tok_info ti;
+ struct tok_info *ti;
} ibmtr_dev_t;
static void netdev_get_drvinfo(struct net_device *dev,
@@ -168,14 +168,19 @@
DEBUG(0, "ibmtr_attach()\n");
/* Create new token-ring device */
- dev = alloc_trdev(sizeof(*info));
- if (!dev)
- return NULL;
- info = dev->priv;
+ info = kmalloc(sizeof(*info), GFP_KERNEL);
+ if (!info) return NULL;
+ memset(info,0,sizeof(*info));
+ dev = alloc_trdev(sizeof(struct tok_info));
+ if (!dev) {
+ kfree(info);
+ return NULL;
+ }
link = &info->link;
link->priv = info;
-
+ info->ti = dev->priv;
+
link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
link->io.NumPorts1 = 4;
link->io.IOAddrLines = 16;
@@ -265,6 +270,7 @@
*linkp = link->next;
unregister_netdev(dev);
free_netdev(dev);
+ kfree(info);
} /* ibmtr_detach */
/*======================================================================
diff -urN -X dontdiff linux-2.6.0-test9.vanilla/drivers/net/tokenring/ibmtr.c linux-2.6.0-test9/drivers/net/tokenring/ibmtr.c
--- linux-2.6.0-test9.vanilla/drivers/net/tokenring/ibmtr.c 2003-10-25 14:43:58.000000000 -0400
+++ linux-2.6.0-test9/drivers/net/tokenring/ibmtr.c 2003-10-25 17:26:38.000000000 -0400
@@ -152,7 +152,7 @@
/* this allows displaying full adapter information */
-char *channel_def[] __initdata = { "ISA", "MCA", "ISA P&P" };
+char *channel_def[] __devinitdata = { "ISA", "MCA", "ISA P&P" };
static char pcchannelid[] __devinitdata = {
0x05, 0x00, 0x04, 0x09,
@@ -864,7 +864,8 @@
ti->sram_virt &= ~1; /* to reverse what we do in tok_close */
/* init the spinlock */
ti->lock = (spinlock_t) SPIN_LOCK_UNLOCKED;
-
+ init_timer(&ti->tr_timer);
+
i = tok_init_card(dev);
if (i) return i;
@@ -1033,7 +1034,7 @@
/* Important for PCMCIA hot unplug, otherwise, we'll pull the card, */
/* unloading the module from memory, and then if a timer pops, ouch */
- del_timer(&ti->tr_timer);
+ del_timer_sync(&ti->tr_timer);
outb(0, dev->base_addr + ADAPTRESET);
ti->sram_virt |= 1;
ti->open_status = CLOSED;
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-10-25 23:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-10-25 22:14 [PATCH] ibmtr_cs/ibmtr on 2.6.0-test9 - get working again Mike Phillips
2003-10-25 22:56 ` Andrew Morton
2003-10-25 23:17 ` Mike Phillips
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).