lkml.org 
[lkml]   [2000]   [Oct]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [Q] init_etherdev()
Andrey Panin wrote:
>
> Hi all,
>
> after walking through some of NIC drivers and trying to remove check_region()
> calls, i have two small questions:
>
> 1) many NIC drivers contain (in XXX_probe1 functions) check like this:
>
> if (dev == NULL) {
> dev = init_etherdev();
> }
>
> but many drivers don't check (dev == NULL) at all. So first question: is this check
> and init_etherdev() call really required or this is old crap waiting for removal ?

Look at the call paths for the drivers coming from Space.c... Most of
the NIC drivers that do the above are ISA drivers, where they are always
provided a device struct. I believe that we can change the above to

if (dev == NULL)
BUG ();


> 2) if init_etherdev() is required, than call to unregister_netdevice() is
> required too (in case of probe failure), isn't it ?

I think so.. I do know that if init_etherdev() is required, you must
also kfree() in the module_exit() function. Since this case is so rare
(AFAICS), most drivers don't handle this case, and never call kfree at
all.

-If- init_etherdev is required at all (I think it is not), then you
would need a flag... You would need two flags, if you want to handle
the case where dev->priv is allocated manually, versus allocated in
init_etherdev.

if (dev == NULL) {
dev = init_etherdev (0, 0);
if (!dev) return -ENOMEM;
tp->have_dynamic_netdev = 1;
}

--
Jeff Garzik | The difference between laziness and
Building 1024 | prioritization is the end result.
MandrakeSoft |
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:41    [W:0.039 / U:0.936 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site