From: Matthias Kaehlcke <[email protected]> use mutex instead of binary semaphore in drivers/base/attribute_container.c Signed-off-by: Matthias Kaehlcke <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> --- drivers/base/attribute_container.c | 26 +++++++++++++------------- 1 files changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/base/attribute_container.c b/drivers/base/attribute_container.c index 2222073..1ec0654 100644 --- a/drivers/base/attribute_container.c +++ b/drivers/base/attribute_container.c @@ -62,7 +62,7 @@ EXPORT_SYMBOL_GPL(attribute_container_classdev_to_container); static struct list_head attribute_container_list; -static DECLARE_MUTEX(attribute_container_mutex); +static DEFINE_MUTEX(attribute_container_mutex); /** * attribute_container_register - register an attribute container @@ -77,9 +77,9 @@ attribute_container_register(struct attribute_container *cont) klist_init(&cont->containers,internal_container_klist_get, internal_container_klist_put); - down(&attribute_container_mutex); + mutex_lock(&attribute_container_mutex); list_add_tail(&cont->node, &attribute_container_list); - up(&attribute_container_mutex); + mutex_unlock(&attribute_container_mutex); return 0; } @@ -94,7 +94,7 @@ int attribute_container_unregister(struct attribute_container *cont) { int retval = -EBUSY; - down(&attribute_container_mutex); + mutex_lock(&attribute_container_mutex); spin_lock(&cont->containers.k_lock); if (!list_empty(&cont->containers.k_list)) goto out; @@ -102,7 +102,7 @@ attribute_container_unregister(struct attribute_container *cont) list_del(&cont->node); out: spin_unlock(&cont->containers.k_lock); - up(&attribute_container_mutex); + mutex_unlock(&attribute_container_mutex); return retval; } @@ -145,7 +145,7 @@ attribute_container_add_device(struct device *dev, { struct attribute_container *cont; - down(&attribute_container_mutex); + mutex_lock(&attribute_container_mutex); list_for_each_entry(cont, &attribute_container_list, node) { struct internal_container *ic; @@ -173,7 +173,7 @@ attribute_container_add_device(struct device *dev, attribute_container_add_class_device(&ic->classdev); klist_add_tail(&ic->node, &cont->containers); } - up(&attribute_container_mutex); + mutex_unlock(&attribute_container_mutex); } /* FIXME: can't break out of this unless klist_iter_exit is also @@ -211,7 +211,7 @@ attribute_container_remove_device(struct device *dev, { struct attribute_container *cont; - down(&attribute_container_mutex); + mutex_lock(&attribute_container_mutex); list_for_each_entry(cont, &attribute_container_list, node) { struct internal_container *ic; struct klist_iter iter; @@ -234,7 +234,7 @@ attribute_container_remove_device(struct device *dev, } } } - up(&attribute_container_mutex); + mutex_unlock(&attribute_container_mutex); } /** @@ -255,7 +255,7 @@ attribute_container_device_trigger(struct device *dev, { struct attribute_container *cont; - down(&attribute_container_mutex); + mutex_lock(&attribute_container_mutex); list_for_each_entry(cont, &attribute_container_list, node) { struct internal_container *ic; struct klist_iter iter; @@ -273,7 +273,7 @@ attribute_container_device_trigger(struct device *dev, fn(cont, dev, &ic->classdev); } } - up(&attribute_container_mutex); + mutex_unlock(&attribute_container_mutex); } /** @@ -295,12 +295,12 @@ attribute_container_trigger(struct device *dev, { struct attribute_container *cont; - down(&attribute_container_mutex); + mutex_lock(&attribute_container_mutex); list_for_each_entry(cont, &attribute_container_list, node) { if (cont->match(cont, dev)) fn(cont, dev); } - up(&attribute_container_mutex); + mutex_unlock(&attribute_container_mutex); } /** -- 1.5.1.2 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
- Follow-Ups:
- [PATCH 46/46] dev_dbg: check dev_dbg() arguments
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 46/46] dev_dbg: check dev_dbg() arguments
- References:
- [GIT PATCH] Driver core patches for 2.6.21
- From: Greg KH <[email protected]>
- [PATCH 01/46] driver core: fix device_add error path
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 02/46] driver core: fix namespace issue with devices assigned to classes
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 03/46] dev_printk and new-style class devices
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 05/46] driver core: Use attribute groups in struct device_type
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 06/46] Driver core: add name to device_type
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 07/46] kobject: kobject_shadow_add cleanup
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 08/46] driver core: per-subsystem multithreaded probing
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 09/46] powerpc: make it compile for multithread change
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 10/46] driver core: don't fail attaching the device if it cannot be bound
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 11/46] Driver core: remove unneeded completion from driver release path
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 12/46] kref: fix CPU ordering with respect to krefs
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 13/46] Driver core: notify userspace of network device renames
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 14/46] Driver core: suppress uevents via filter
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 15/46] Driver core: switch firmware_class to uevent_suppress.
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 16/46] uevent: use add_uevent_var() instead of open coding it
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 17/46] Driver core: add suspend() and resume() to struct device_type
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 18/46] Kobject: kobject_uevent.c: Collapse unnecessary loop nesting (top_kobj)
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 19/46] kobject: kobject_add() reference leak
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 20/46] Driver core: remove use of rwsem
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 21/46] SCSI: use the proper semaphore to protect the class lists
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 22/46] USB: remove use of the bus rwsem, as it doesn't really protect anything.
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 23/46] PNP: stop using the subsystem rwsem
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 24/46] Input: serio - do not touch bus's rwsem
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 25/46] Input: gameport - do not touch bus's rwsem
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 26/46] IDE: remove rwsem use from ide-proc core
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 27/46] IEEE1394: remove rwsem use from ieee1394 core
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 28/46] PHY: remove rwsem use from phy core
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 29/46] qeth: Remove usage of subsys.rwsem
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 30/46] kobject core: remove rwsem from struct subsystem
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 31/46] Driver core: make uevent-environment available in uevent-file
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 32/46] Driver core: warn when userspace writes to the uevent file in a non-supported way
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 33/46] kobject: Comment and warning fixes to kobject.c
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 34/46] the overdue removal of the mount/umount uevents
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 35/46] debugfs: Add debugfs_create_u64()
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 36/46] driver core: bus_add_driver should return an error if no bus
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 37/46] Driver core: use mutex instead of semaphore in DMA pool handler
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 38/46] sysfs: bin.c printk fix
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 39/46] s390: cio: Delay uevents for subchannels
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 40/46] device_schedule_callback() needs a module reference
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 41/46] security: prevent permission checking of file removal via sysfs_remove_group()
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 42/46] define platform wakeup hook, use in pci_enable_wake()
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 43/46] s2ram: add arch irq disable/enable hooks
- From: Greg Kroah-Hartman <[email protected]>
- [PATCH 44/46] mod_sysfs_setup() doesn't return errno when kobject_add_dir() failure occurs
- From: Greg Kroah-Hartman <[email protected]>
- [GIT PATCH] Driver core patches for 2.6.21
- Prev by Date: [PATCH 46/46] dev_dbg: check dev_dbg() arguments
- Next by Date: [PATCH 23/46] PNP: stop using the subsystem rwsem
- Previous by thread: [PATCH 44/46] mod_sysfs_setup() doesn't return errno when kobject_add_dir() failure occurs
- Next by thread: [PATCH 46/46] dev_dbg: check dev_dbg() arguments
- Index(es):