diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2010-02-17 13:57:05 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-03-07 20:04:52 -0500 |
commit | 8e9394ce2412254ec69fd2a4f3e44a66eade2297 (patch) | |
tree | 355f25148b4ce3f5cfebeaf0939d71cb6beaf88b /drivers/pci | |
parent | 62e877b893e6350c900d381f353aa62ed48dcc97 (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/pci')
-rw-r--r-- | drivers/pci/bus.c | 4 | ||||
-rw-r--r-- | drivers/pci/pci.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c index 712250f5874a..26301cb25e7f 100644 --- a/drivers/pci/bus.c +++ b/drivers/pci/bus.c | |||
@@ -288,9 +288,9 @@ void pci_walk_bus(struct pci_bus *top, int (*cb)(struct pci_dev *, void *), | |||
288 | next = dev->bus_list.next; | 288 | next = dev->bus_list.next; |
289 | 289 | ||
290 | /* Run device routines with the device locked */ | 290 | /* Run device routines with the device locked */ |
291 | down(&dev->dev.sem); | 291 | device_lock(&dev->dev); |
292 | retval = cb(dev, userdata); | 292 | retval = cb(dev, userdata); |
293 | up(&dev->dev.sem); | 293 | device_unlock(&dev->dev); |
294 | if (retval) | 294 | if (retval) |
295 | break; | 295 | break; |
296 | } | 296 | } |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 77b493b3d97b..897fa5ccdb78 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -2486,7 +2486,7 @@ static int pci_dev_reset(struct pci_dev *dev, int probe) | |||
2486 | if (!probe) { | 2486 | if (!probe) { |
2487 | pci_block_user_cfg_access(dev); | 2487 | pci_block_user_cfg_access(dev); |
2488 | /* block PM suspend, driver probe, etc. */ | 2488 | /* block PM suspend, driver probe, etc. */ |
2489 | down(&dev->dev.sem); | 2489 | device_lock(&dev->dev); |
2490 | } | 2490 | } |
2491 | 2491 | ||
2492 | rc = pci_dev_specific_reset(dev, probe); | 2492 | rc = pci_dev_specific_reset(dev, probe); |
@@ -2508,7 +2508,7 @@ static int pci_dev_reset(struct pci_dev *dev, int probe) | |||
2508 | rc = pci_parent_bus_reset(dev, probe); | 2508 | rc = pci_parent_bus_reset(dev, probe); |
2509 | done: | 2509 | done: |
2510 | if (!probe) { | 2510 | if (!probe) { |
2511 | up(&dev->dev.sem); | 2511 | device_unlock(&dev->dev); |
2512 | pci_unblock_user_cfg_access(dev); | 2512 | pci_unblock_user_cfg_access(dev); |
2513 | } | 2513 | } |
2514 | 2514 | ||