lkml.org 
[lkml]   [2004]   [Jun]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: two patches - request for comments
On Wed, Jun 02, 2004 at 01:57:40AM +0400, Andrew Zabolotny wrote:
> On Tue, 01 Jun 2004 17:23:11 -0400
> Jeff Garzik <jgarzik@pobox.com> 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 matters, please fix it.

> It'll be something like:
>
> lcd_device = register_lcd_device ("foo", ...);
> ...
> unregister_lcd_device (lcd_device);

What about:
lcd_device = alloc_lcd_device("foo", ...);
error = register_lcd_device(lcd_device);
...
unregister_lcd_device(lcd_device);

thanks,

greg k-h
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:03    [from the cache]
©2003-2011 Jasper Spaans