* [PATCH 2.5.70] acenic -- update to use alloc_etherdev
@ 2003-06-11 21:42 Stephen Hemminger
2003-06-11 22:21 ` Jes Sorensen
0 siblings, 1 reply; 7+ messages in thread
From: Stephen Hemminger @ 2003-06-11 21:42 UTC (permalink / raw)
To: Jeff Garzik, Jes Sorenson; +Cc: netdev
Updated acenic driver to use alloc_etherdev to hold private data structure.
Uses register_netdev() to get the name right this time ;-)
Tested against 2.5.70 bk latest on Tigon III board.
diff -Nru a/drivers/net/acenic.c b/drivers/net/acenic.c
--- a/drivers/net/acenic.c Wed Jun 11 14:36:47 2003
+++ b/drivers/net/acenic.c Wed Jun 11 14:36:47 2003
@@ -642,8 +642,7 @@
(pdev->device == PCI_DEVICE_ID_SGI_ACENIC)))
continue;
- dev = init_etherdev(NULL, sizeof(struct ace_private));
-
+ dev = alloc_etherdev(sizeof(struct ace_private));
if (dev == NULL) {
printk(KERN_ERR "acenic: Unable to allocate "
"net_device structure!\n");
@@ -653,13 +652,6 @@
SET_MODULE_OWNER(dev);
SET_NETDEV_DEV(dev, &pdev->dev);
- if (!dev->priv)
- dev->priv = kmalloc(sizeof(*ap), GFP_KERNEL);
- if (!dev->priv) {
- printk(KERN_ERR "acenic: Unable to allocate memory\n");
- return -ENOMEM;
- }
-
ap = dev->priv;
ap->pdev = pdev;
@@ -737,6 +729,12 @@
"AceNIC %i will be disabled.\n",
dev->name, boards_found);
break;
+ }
+
+ if (register_netdev(dev)) {
+ printk(KERN_ERR "acenic: device registration failed\n");
+ kfree(dev);
+ continue;
}
switch(pdev->vendor) {
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2.5.70] acenic -- update to use alloc_etherdev
2003-06-11 21:42 [PATCH 2.5.70] acenic -- update to use alloc_etherdev Stephen Hemminger
@ 2003-06-11 22:21 ` Jes Sorensen
2003-06-12 4:04 ` David S. Miller
0 siblings, 1 reply; 7+ messages in thread
From: Jes Sorensen @ 2003-06-11 22:21 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Jeff Garzik, netdev
>>>>> "Stephen" == Stephen Hemminger <shemminger@osdl.org> writes:
Stephen> Updated acenic driver to use alloc_etherdev to hold private
Stephen> data structure. Uses register_netdev() to get the name right
Stephen> this time ;-)
Please provide a compat macro for 2.4.18 and younger as well.
Stephen> Tested against 2.5.70 bk latest on Tigon III board.
Pretty sure it wasn't a Tigon III ;-)
Jes
PS: The name is Sorensen
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2.5.70] acenic -- update to use alloc_etherdev
2003-06-11 22:21 ` Jes Sorensen
@ 2003-06-12 4:04 ` David S. Miller
[not found] ` <3EE81263.4040205@osdl.org>
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: David S. Miller @ 2003-06-12 4:04 UTC (permalink / raw)
To: jes; +Cc: shemminger, jgarzik, netdev
From: Jes Sorensen <jes@wildopensource.com>
Date: 11 Jun 2003 18:21:09 -0400
>>>>> "Stephen" == Stephen Hemminger <shemminger@osdl.org> writes:
Stephen> Updated acenic driver to use alloc_etherdev to hold private
Stephen> data structure. Uses register_netdev() to get the name right
Stephen> this time ;-)
Please provide a compat macro for 2.4.18 and younger as well.
How actively are you maintaining acenic. Jes? :-) This is
a very serious question, I haven't seen a 2.5.x change go back
to 2.4.x since it's inception.
All this compat nonsense is becoming useless. Other drivers
fair just fine 2.4.x/2.5.x without all this ifdef mumbo-jumbo
that litters acenic.c and makes it nearly impossible to read.
In fact all these localized compat macros make acenic.c HARDER
to maintain.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2.5.70] acenic -- update to use alloc_etherdev
[not found] ` <3EE81263.4040205@osdl.org>
@ 2003-06-12 5:43 ` David S. Miller
2003-06-12 17:05 ` Jes Sorensen
1 sibling, 0 replies; 7+ messages in thread
From: David S. Miller @ 2003-06-12 5:43 UTC (permalink / raw)
To: shemminger; +Cc: jes, jgarzik, netdev
From: Stephen Hemminger <shemminger@osdl.org>
Date: Wed, 11 Jun 2003 22:40:51 -0700
The problem is it doesn't know what irqreturn_t is. The enclosed
cribbed from atm/he.c fixes that, but it still redefines local_irq_save etc.
Such compat macros belong in include/linux/interrupt.h and
someone needs to merge that to Marcelo.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2.5.70] acenic -- update to use alloc_etherdev
2003-06-12 4:04 ` David S. Miller
[not found] ` <3EE81263.4040205@osdl.org>
@ 2003-06-12 5:44 ` Stephen Hemminger
2003-06-12 17:01 ` Jes Sorensen
2 siblings, 0 replies; 7+ messages in thread
From: Stephen Hemminger @ 2003-06-12 5:44 UTC (permalink / raw)
To: David S. Miller; +Cc: jes, jgarzik, netdev
David S. Miller wrote:
> From: Jes Sorensen <jes@wildopensource.com>
> Date: 11 Jun 2003 18:21:09 -0400
>
> >>>>> "Stephen" == Stephen Hemminger <shemminger@osdl.org> writes:
>
> Stephen> Updated acenic driver to use alloc_etherdev to hold private
> Stephen> data structure. Uses register_netdev() to get the name right
> Stephen> this time ;-)
>
> Please provide a compat macro for 2.4.18 and younger as well.
>
>How actively are you maintaining acenic. Jes? :-) This is
>a very serious question, I haven't seen a 2.5.x change go back
>to 2.4.x since it's inception.
>
>All this compat nonsense is becoming useless. Other drivers
>fair just fine 2.4.x/2.5.x without all this ifdef mumbo-jumbo
>that litters acenic.c and makes it nearly impossible to read.
>
>In fact all these localized compat macros make acenic.c HARDER
>to maintain.
>
>
The funny thing is this alloc_etherdev patch did not change the
compatiablity one bit.
Just for grins, took the 2.5 driver back into the 2.4.18 and it doesn't
build.
The problem is it doesn't know what irqreturn_t is. The enclosed
cribbed from atm/he.c fixes that, but it still redefines local_irq_save etc.
Maybe it is time to stop the insanity.
diff -Nru a/drivers/net/acenic.c b/drivers/net/acenic.c
--- a/drivers/net/acenic.c Wed Jun 11 22:36:43 2003
+++ b/drivers/net/acenic.c Wed Jun 11 22:36:43 2003
@@ -188,6 +188,13 @@
#define ACE_MOD_DEC_USE_COUNT do{} while(0)
#endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,69)
+typedef void irqreturn_t;
+#define IRQ_NONE
+#define IRQ_HANDLED
+#define IRQ_RETVAL(x)
+#endif
+
#ifndef SET_NETDEV_DEV
#define SET_NETDEV_DEV(net, pdev) do{} while(0)
#endif
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2.5.70] acenic -- update to use alloc_etherdev
2003-06-12 4:04 ` David S. Miller
[not found] ` <3EE81263.4040205@osdl.org>
2003-06-12 5:44 ` Stephen Hemminger
@ 2003-06-12 17:01 ` Jes Sorensen
2 siblings, 0 replies; 7+ messages in thread
From: Jes Sorensen @ 2003-06-12 17:01 UTC (permalink / raw)
To: David S. Miller; +Cc: shemminger, jgarzik, netdev
>>>>> "David" == David S Miller <davem@redhat.com> writes:
David> How actively are you maintaining acenic. Jes? :-) This is a
David> very serious question, I haven't seen a 2.5.x change go back to
David> 2.4.x since it's inception.
Hi David,
I clearly haven't been doing the job on acenic recently as I would
have liked nor on 2.5 for that sake, so I don't see all the changes
that just go into 2.5.
David> All this compat nonsense is becoming useless. Other drivers
David> fair just fine 2.4.x/2.5.x without all this ifdef mumbo-jumbo
David> that litters acenic.c and makes it nearly impossible to read.
Depends on how you look at it. First of all the primary goal of the
macros is not to make it easier to integrate the driver with the
latest state of the art 2.4.x kernel from Marcelo, but rather to make
it possible for people to take the driver and drop it into an earlier
kernel they are running and only upgrade the driver. There have been
quite a lot of acenic users in the past who were not willing to
upgrade their kernels for various reasons and who relied on
this. Putting the compat macros into include/linux/interrupt.h in
Marcelo's tree as you suggested in a later email won't solve this
specific problem.
Nowadays it's probably reasonable to assume that the majority of users
are at 2.4.17+ so I think it's valid to go in and get rid of some of
the compat macros that are there to support kernels older than that.
David> In fact all these localized compat macros make acenic.c HARDER
David> to maintain.
I think we will just have to agree to disagree on this. I find it a
lot easier to read the code when it uses the 2.5 syntax and provides
2.4 compat macros than it is to have a ton of #ifdef's throughout the
code itself.
Cheers,
Jes
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2.5.70] acenic -- update to use alloc_etherdev
[not found] ` <3EE81263.4040205@osdl.org>
2003-06-12 5:43 ` David S. Miller
@ 2003-06-12 17:05 ` Jes Sorensen
1 sibling, 0 replies; 7+ messages in thread
From: Jes Sorensen @ 2003-06-12 17:05 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: David S. Miller, jgarzik, netdev
>>>>> "Stephen" == Stephen Hemminger <shemminger@osdl.org> writes:
Stephen> The funny thing is this alloc_etherdev patch did not change
Stephen> the compatiablity one bit. Just for grins, took the 2.5
Stephen> driver back into the 2.4.18 and it doesn't build. The
Stephen> problem is it doesn't know what irqreturn_t is. The enclosed
Stephen> cribbed from atm/he.c fixes that, but it still redefines
Stephen> local_irq_save etc.
Hi Stephen,
I went back and looked at the comment in 2.4 for when alloc_etherdev
was introduced, but clearly I got the mapping of this to the 2.4.x
release dates wrong. That was my bad.
As for local_irq_save() those patches will still be needed if they are
not present in 2.4.17 (I think this is probably a reasonable cut-off
release), if it's in 2.4.17+ I'll agree we can pull it.
But the irqreturn_t compat stuff still needs to go in since it's
clearly not going to be present in 2.4.18 etc.
Cheers,
Jes
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2003-06-12 17:05 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-06-11 21:42 [PATCH 2.5.70] acenic -- update to use alloc_etherdev Stephen Hemminger
2003-06-11 22:21 ` Jes Sorensen
2003-06-12 4:04 ` David S. Miller
[not found] ` <3EE81263.4040205@osdl.org>
2003-06-12 5:43 ` David S. Miller
2003-06-12 17:05 ` Jes Sorensen
2003-06-12 5:44 ` Stephen Hemminger
2003-06-12 17:01 ` Jes Sorensen
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).