Re: two patches - request for comments
From: Andrew Zabolotny
Date: Tue Jun 01 2004 - 16:59:49 EST
On Tue, 01 Jun 2004 17:23:11 -0400
Jeff Garzik <jgarzik@xxxxxxxxx> wrote:
> Typical Linux usage to an item being registered is
> ptr = alloc_foo()
> register_foo(ptr)
> unregister_foo(ptr)
> free_foo()
In this case it is:
register_lcd_device("foo", ...);
...
unregister_lcd_device("foo");
The name is guaranteed to be unique by sysfs design during the whole
device lifetime, and calling unregister_xxx() outside the lifetime brackets
is clearly an error.
> It is quite unusual to unregister based on name. Pointers are far more
> likely to be unique, and the programmer is far less likely to screw up
> the unregister operation.
I understand this, I see why it looks unusual. I'll fix this if it matters.
It'll be something like:
lcd_device = register_lcd_device ("foo", ...);
...
unregister_lcd_device (lcd_device);
However, this extra pointer will take some memory; not much of course.
--
Greetings,
Andrew
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/