Re: Driver bind/unbind and __devinit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/8/05, Greg KH <[email protected]> wrote:
> On Thu, Dec 08, 2005 at 04:14:58PM -0500, Dmitry Torokhov wrote:
> > Hi,
> >
> > Many drivers have their probe routines declared as __devinit which is
> > a no-op unless CONFIG_HOTPLUG is set. However driver's bind/unbind
> > attributes are created unconditionally, as fas as I can see. Would not
> > it cause an oops if someone tries to use these attributes with
> > CONFIG_HOTPLUG=N? Am I missing something?
>
> You are missing the CONFIG_HOTPLUG checks around the functions that add
> and check the device ids from these sysfs files.  If CONFIG_HOTPLUG is
> not enabled, those files do not do anything.
>

I am slow today... I don't see any dependencies on CONFIG_HOTPLUG in
drivers/base... Or you talking about one particular subsystem that
handles this correctly?

> In 2.6.16, CONFIG_HOTPLUG is moving under CONFIG_EMBEDDED, so the odds
> of people disabling it are going to be pretty small now.
>

I dont think this is a valid argument.

> > Also, unbind implementation does not seem safe - we check the driver
> > before taking device's semaphore so we risk unbinding wrong driver (in
> > the unlikely event that we manage to unbind and bind another driver in
> > another thread).
>
> Do you have a suggestion as to how to fix this?
>

I think we could take the semaphore before checking driver and then
use __device_release_driver(). But we'd need to make it global or move
bind/unbind code into drivers/base/dd.c

--
Dmitry
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux