lkml.org 
[lkml]   [2012]   [Jan]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Problems with get_driver() and driver_attach() (and new_id too)
On Mon, 9 Jan 2012, Dmitry Torokhov wrote:

> > > drivers/ssb/main.c seems like needs some protection but does it
> > > incorrectly as we do not wait for drivers to drop all references before
> > > unloading modules.
> >
> > Possibly it needs to be replaced with try_module_get. I'll send out an
> > email to the maintainers of these drivers to see what they think.
>
> No, I am not that try_module_get() [alone] is quite what is needed, as
> strictly speaking driver lifetime does not need to be the same as module
> lifetime. But maybe I am just splitting hair as all drivers are
> statically initialized and are tied to their modules...

In theory you're right; what matters is when the driver is registered
and unregistered. (And in fact, although the driver structs are indeed
statically initialized, there also is a struct driver_private part
which doesn't get allocated or initialized until the driver is
registered.)

However, I don't know of any drivers that are unregistered before their
module is unloaded. We could add an API to the driver core for this
(i.e., to block a driver from being unregistered), but there doesn't
seem to be any real point.

Alan Stern



\
 
 \ /
  Last update: 2012-01-09 18:05    [W:0.113 / U:0.224 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site