public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [bk/patch] driver model update: device_unregister()
@ 2002-10-09  0:57 Patrick Mochel
  2002-10-09  0:57 ` Patrick Mochel
                   ` (3 more replies)
  0 siblings, 4 replies; 38+ messages in thread
From: Patrick Mochel @ 2002-10-09  0:57 UTC (permalink / raw)
  To: torvalds; +Cc: linux-kernel


Without further ado, here is device_unregister(), and a fixup of the IDE 
and USB code that use it.  Description below.

Please apply. (bkbits is taking a really long time, so it might take a few 
to actually show up).

	-pat

Please pull from 

	bk://ldm.bkbits.net/linux-2.5-core

This will update the following files:

 drivers/base/core.c      |   38 +++++++++++++++++++++++++++++++-------
 drivers/base/fs/device.c |    3 +--
 drivers/ide/ide-disk.c   |    2 +-
 drivers/usb/core/usb.c   |    4 ++--
 include/linux/device.h   |    3 ++-
 5 files changed, 37 insertions(+), 13 deletions(-)

through these ChangeSets:

<mochel@osdl.org> (02/10/08 1.601)
   USB: call device_unregister() instead of put_device() when removing devices.

<mochel@osdl.org> (02/10/08 1.600)
   IDE: call device_unregister() instead of put_device() in ide-disk->cleanup().

<mochel@osdl.org> (02/10/08 1.599)
   driver model: check return of get_device() when creating a driverfs file.

<mochel@osdl.org> (02/10/08 1.598)
   driver model: and present field to struct device and implement device_unregister().
   
   device_unregister() is intended to be the complement of device_register(), and assumes
   most of the functionality of the current put_device(). It should be called by the bus 
   driver when a device is physically removed from the system. 
   
   It should _not_ be called from a driver's remove() method, as that remove() method is called
   via device_detach() in device_unregister(). 
   
   dev->present is used to flag the physical presence of the device. It is set when the device
   is registered, and cleared when unregistered. get_device() checks this flag, and returns
   a NULL pointer if cleared. This prevents anyone from obtaining a reference to a device
   that has been unregistered (removed), but not yet been freed (e.g. if someone else is 
   holding a reference to it).
   
   put_device() BUG()s if dev->present is set. A device should be unregistered before it is 
   freed. This will catch people doing it in the wrong order. 





^ permalink raw reply	[flat|nested] 38+ messages in thread
[parent not found: <Pine.LNX.4.44.0210111725240.14124-100000@chaos.physics.uiowa.edu>]

end of thread, other threads:[~2002-10-15 22:12 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-10-09  0:57 [bk/patch] driver model update: device_unregister() Patrick Mochel
2002-10-09  0:57 ` Patrick Mochel
2002-10-09  0:57 ` Patrick Mochel
2002-10-09  0:57 ` Patrick Mochel
2002-10-09  1:04   ` Alexander Viro
2002-10-09 16:38     ` Patrick Mochel
2002-10-09 17:14       ` Linus Torvalds
2002-10-09 17:24         ` Patrick Mochel
2002-10-09 17:26         ` Patrick Mochel
2002-10-09 17:41           ` Linus Torvalds
2002-10-09 17:46             ` Patrick Mochel
2002-10-09 17:50               ` Linus Torvalds
2002-10-10 21:19                 ` Rob Landley
2002-10-09 18:01             ` Jeff Muizlelaar
2002-10-09 17:33         ` Alexander Viro
2002-10-09 17:45           ` Linus Torvalds
2002-10-09 17:47             ` Alexander Viro
2002-10-09 17:55               ` Linus Torvalds
2002-10-09 18:00                 ` Alexander Viro
2002-10-09 18:47                   ` Linus Torvalds
2002-10-09 19:02                     ` Alexander Viro
2002-10-09 19:16                       ` Linus Torvalds
2002-10-09 19:26                         ` Alexander Viro
2002-10-09 19:47                           ` Linus Torvalds
2002-10-09 20:11                             ` Alexander Viro
2002-10-09 21:45                               ` Roman Zippel
2002-10-09 22:31                                 ` Kai Germaschewski
2002-10-10 18:04                                   ` Roman Zippel
2002-10-10 18:49                                     ` Kai Germaschewski
2002-10-11 13:48                                       ` Roman Zippel
2002-10-09 23:49                               ` Patrick Mochel
2002-10-10  7:11                                 ` Mike Anderson
2002-10-09 20:42                   ` Andries Brouwer
2002-10-15 22:18                     ` Daniel Phillips
2002-10-09 18:02                 ` Patrick Mochel
2002-10-09 18:04                   ` Alexander Viro
2002-10-09  0:57 ` Patrick Mochel
     [not found] <Pine.LNX.4.44.0210111725240.14124-100000@chaos.physics.uiowa.edu>
2002-10-12  0:47 ` Roman Zippel

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