]> git.baikalelectronics.ru Git - kernel.git/commit
driver-core: use klist for class device list and implement iterator
authorTejun Heo <tj@kernel.org>
Mon, 25 Aug 2008 17:50:19 +0000 (19:50 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Thu, 9 Oct 2008 06:56:04 +0000 (08:56 +0200)
commitfe972600b41ce7a036207d7e44bdfc562a933575
tree035472164252c3b54071f044c161b312b6bc8b44
parent56f2f8d3958d205d936df48c73d49452377cd390
driver-core: use klist for class device list and implement iterator

Iterating over entries using callback usually isn't too fun especially
when the entry being iterated over can't be manipulated freely.  This
patch converts class->p->class_devices to klist and implements class
device iterator so that the users can freely build their own control
structure.  The users are also free to call back into class code
without worrying about locking.

class_for_each_device() and class_find_device() are converted to use
the new iterators, so their users don't have to worry about locking
anymore either.

Note: This depends on klist-dont-iterate-over-deleted-entries patch
because class_intf->add/remove_dev() depends on proper synchronization
with device removal.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
drivers/base/base.h
drivers/base/class.c
drivers/base/core.c
include/linux/device.h