]> git.neil.brown.name Git - history.git/commit
Update device model locking
authorPatrick Mochel <mochel@osdl.org>
Tue, 13 Aug 2002 07:01:43 +0000 (00:01 -0700)
committerPatrick Mochel <mochel@osdl.org>
Tue, 13 Aug 2002 07:01:43 +0000 (00:01 -0700)
commit789e39b03171d02308ba0f2f86711a1721595639
treefe3c3d5f596c6061ac9e4e85394cd99612852660
parent266c24ad83baf7d2c9873d5c289fe0126fb90c68
Update device model locking

Change all iterators of devices to:
- use list_for_each
- check return of get_device_locked
- don't break until we hold the lock if we get an error

When a device's reference count hits 0, remove it from all lists, including
bus and driver lists.

Between the iterator algorithm and the guaranteed removal from the lists,
there should never be a device in a list with a reference count of 0.
So, whenever we're iterating over the lists, we'll always have a valid
device. We don't decrement the refcount until the next iteration of the
loop, so we're also guaranteed to get the correct next item in the list.
drivers/base/bus.c
drivers/base/core.c
drivers/base/driver.c
drivers/base/power.c