public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* BUG(?): class_device_driver_link()
@ 2004-06-18 20:12 Alan Stern
  2004-06-18 20:23 ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Alan Stern @ 2004-06-18 20:12 UTC (permalink / raw)
  To: Greg KH; +Cc: James Bottomley, Kernel development list

Greg:

I'm not sure if this is a bug or not, but it is inconsistent behavior in 
sysfs.

When a class_device is added, if it has a regular device associated with
it and that device has a driver, a symlink is added from the class_device
to the driver.  However, if the class_device is added _first_ and the
driver later, this symlink is not created.  It's not clear that there's
any good way to create it, especially if the class_device is added by the
bus layer and the device driver itself is unaware of the class_device.

Is this a known problem?  It definitely affects the sd driver, and maybe 
others.

There is a related side-effect that is a bit unpleasant.  The symlink from
the class_device to the driver increments the driver's refcount.  Since
the driver is unaware of the class_device, it doesn't know to remove the
symlink when its release() method runs.  Consequently, if the driver is
modprobed before the device exists and rmmod'ed after the device is added,
the rmmod will hang until the device also goes away.  But if the driver is 
modprobed _after_ the device exists then the rmmod will complete 
immediately.

Perhaps the answer is that the bus layer must take these things into 
account.  Or perhaps a struct device should somehow know about all the 
class_devices that refer to it.

Alan Stern



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-06-20 22:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-18 20:12 BUG(?): class_device_driver_link() Alan Stern
2004-06-18 20:23 ` Greg KH
2004-06-18 21:36   ` Alan Stern
2004-06-19  0:03     ` Greg KH
2004-06-19  3:28       ` James Bottomley
2004-06-20 22:23         ` Alan Stern

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox