On Mon, 16 Dec 2002 02:17:33 +0200
Kari Hameenaho <[EMAIL PROTECTED]> wrote:
> On Mon, 16 Dec 2002 00:29:24 +0100
> "Oliver Neukum" <[EMAIL PROTECTED]> wrote:
>
> > The only issue that I see is that you made common code for doing so
> > but failed to put proper locking into it, which means reference counting
> > in this case.
>
> Ok, I am not really familiar how reference counting is to be used in kernel,
> so maybe somebody else can fix it.
>
Looking this locking again, could the open() use driver.serialize for locking ?
...
down(&scanner_driver.serialize);
intf = usb_find_interface(&scanner_driver,mk_kdev(USB_MAJOR,scn_minor));
if (intf) {
scn = dev_get_drvdata (&intf->dev);
down(&(scn->sem));
}
up(&scanner_driver.serialize);
if (!intf) {
err("open_scanner(%d): Unable to access minor data", scn_minor);
return -ENODEV;
}
...
So now probe() and disconnect() cannot happen during locked part of open().
But I can see that this is not the nicest looking code either.
I dont know if even encapsulation can help this fundamentally.
This is just one more possibility to handle things safe way.
---
Kari H�meenaho
-------------------------------------------------------
This SF.NET email is sponsored by: Order your Holiday Geek Presents Now!
Green Lasers, Hip Geek T-Shirts, Remote Control Tanks, Caffeinated Soap,
MP3 Players, XBox Games, Flying Saucers, WebCams, Smart Putty.
T H I N K G E E K . C O M http://www.thinkgeek.com/sf/
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel