[lkml]   [1996]   [May]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
SubjectRe: Dummy driver broken in pre-2.0.5
Daniel Barlow <> writes:
> You'll probably get two hundred reports of this, all from `demon'
> addresses. But here's mine anyway ...
> The change to net/core/dev.c
> * Thomas Bogendoerfer : Return ENODEV for dev_open, if there
> * is no device open function.
> breaks the dummy device; unless it is compiled as a module, it has no
> device open function.

I like it when people discover problems before I do -- it saves me
having to work out the answers (I'm currently downloading pre2.0.5, so
haven't hit it yet).

The change to net/core/dev.c means that dev_open is no longer optional --
it has to be provided.

I don't really understand the change. The _fops operations are ones
that are often called to override the defaults. In the case of the dummy
driver, there is nothing that needs to be done, so no routine is provided.
All it will help is catching one aspect of incorrect drivers (one that
need an open routine, but do not provide one).

If this change is needed, I think I would do the patch differently.
I would remove the "#ifdef MODULE" from around the definitions and use
of dev_open and dev_close, and leave the module stuff to do appropriate
things with MOD_{INC,DEC}_USE_COUNT (make them into a noop).

This is really up to Alan, since he did the modularisation of
the dummy driver (and will know why dev_open being mandatory is a
good/bad/indifferent idea).

[The sharp people amongst you will realise that this patch is against
1.2.13, but it was to hand, and this is more to illustrate what I mean]

--- /usr/src/linux/drivers/net/dummy.c Mon Jan 23 08:38:28 1995
+++ dummy.c Sun May 19 10:23:42 1996
@@ -61,7 +61,6 @@
static struct enet_statistics *dummy_get_stats(struct device *dev);

-#ifdef MODULE
static int dummy_open(struct device *dev)
@@ -74,9 +73,6 @@
return 0;

int dummy_init(struct device *dev)
/* I commented this out as bootup is noisy enough anyway and this driver
@@ -91,10 +87,8 @@
memset(dev->priv, 0, sizeof(struct enet_statistics));
dev->get_stats = dummy_get_stats;
-#ifdef MODULE
dev->open = &dummy_open;
dev->stop = &dummy_close;

/* Fill in the fields of the device structure with ethernet-generic values. */
`O O' | Home:
// ^ \\ | Work:

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