aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/uwb
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2010-02-17 13:57:05 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2010-03-07 20:04:52 -0500
commit8e9394ce2412254ec69fd2a4f3e44a66eade2297 (patch)
tree355f25148b4ce3f5cfebeaf0939d71cb6beaf88b /drivers/uwb
parent62e877b893e6350c900d381f353aa62ed48dcc97 (diff)
Driver core: create lock/unlock functions for struct device
In the future, we are going to be changing the lock type for struct device (once we get the lockdep infrastructure properly worked out) To make that changeover easier, and to possibly burry the lock in a different part of struct device, let's create some functions to lock and unlock a device so that no out-of-core code needs to be changed in the future. This patch creates the device_lock/unlock/trylock() functions, and converts all in-tree users to them. Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Jean Delvare <khali@linux-fr.org> Cc: Dave Young <hidave.darkstar@gmail.com> Cc: Ming Lei <tom.leiming@gmail.com> Cc: Jiri Kosina <jkosina@suse.cz> Cc: Phil Carmody <ext-phil.2.carmody@nokia.com> Cc: Arjan van de Ven <arjan@linux.intel.com> Cc: Cornelia Huck <cornelia.huck@de.ibm.com> Cc: Rafael J. Wysocki <rjw@sisk.pl> Cc: Pavel Machek <pavel@ucw.cz> Cc: Len Brown <len.brown@intel.com> Cc: Magnus Damm <damm@igel.co.jp> Cc: Alan Stern <stern@rowland.harvard.edu> Cc: Randy Dunlap <randy.dunlap@oracle.com> Cc: Stefan Richter <stefanr@s5r6.in-berlin.de> Cc: David Brownell <dbrownell@users.sourceforge.net> Cc: Vegard Nossum <vegard.nossum@gmail.com> Cc: Jesse Barnes <jbarnes@virtuousgeek.org> Cc: Alex Chiang <achiang@hp.com> Cc: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Andrew Patterson <andrew.patterson@hp.com> Cc: Yu Zhao <yu.zhao@intel.com> Cc: Dominik Brodowski <linux@dominikbrodowski.net> Cc: Samuel Ortiz <sameo@linux.intel.com> Cc: Wolfram Sang <w.sang@pengutronix.de> Cc: CHENG Renquan <rqcheng@smu.edu.sg> Cc: Oliver Neukum <oliver@neukum.org> Cc: Frans Pop <elendil@planet.nl> Cc: David Vrabel <david.vrabel@csr.com> Cc: Kay Sievers <kay.sievers@vrfy.org> Cc: Sarah Sharp <sarah.a.sharp@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/uwb')
-rw-r--r--drivers/uwb/umc-bus.c4
-rw-r--r--drivers/uwb/uwb-internal.h4
2 files changed, 4 insertions, 4 deletions
diff --git a/drivers/uwb/umc-bus.c b/drivers/uwb/umc-bus.c
index cdd6c8efc9f8..5fad4e791b3e 100644
--- a/drivers/uwb/umc-bus.c
+++ b/drivers/uwb/umc-bus.c
@@ -62,12 +62,12 @@ int umc_controller_reset(struct umc_dev *umc)
62 struct device *parent = umc->dev.parent; 62 struct device *parent = umc->dev.parent;
63 int ret = 0; 63 int ret = 0;
64 64
65 if(down_trylock(&parent->sem)) 65 if (device_trylock(parent))
66 return -EAGAIN; 66 return -EAGAIN;
67 ret = device_for_each_child(parent, parent, umc_bus_pre_reset_helper); 67 ret = device_for_each_child(parent, parent, umc_bus_pre_reset_helper);
68 if (ret >= 0) 68 if (ret >= 0)
69 ret = device_for_each_child(parent, parent, umc_bus_post_reset_helper); 69 ret = device_for_each_child(parent, parent, umc_bus_post_reset_helper);
70 up(&parent->sem); 70 device_unlock(parent);
71 71
72 return ret; 72 return ret;
73} 73}
diff --git a/drivers/uwb/uwb-internal.h b/drivers/uwb/uwb-internal.h
index d5bcfc1c227a..157485c862c0 100644
--- a/drivers/uwb/uwb-internal.h
+++ b/drivers/uwb/uwb-internal.h
@@ -366,12 +366,12 @@ struct dentry *uwb_dbg_create_pal_dir(struct uwb_pal *pal);
366 366
367static inline void uwb_dev_lock(struct uwb_dev *uwb_dev) 367static inline void uwb_dev_lock(struct uwb_dev *uwb_dev)
368{ 368{
369 down(&uwb_dev->dev.sem); 369 device_lock(&uwb_dev->dev);
370} 370}
371 371
372static inline void uwb_dev_unlock(struct uwb_dev *uwb_dev) 372static inline void uwb_dev_unlock(struct uwb_dev *uwb_dev)
373{ 373{
374 up(&uwb_dev->dev.sem); 374 device_unlock(&uwb_dev->dev);
375} 375}
376 376
377#endif /* #ifndef __UWB_INTERNAL_H__ */ 377#endif /* #ifndef __UWB_INTERNAL_H__ */