diff options
author | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2014-12-03 16:40:27 -0500 |
---|---|---|
committer | David Vrabel <david.vrabel@citrix.com> | 2014-12-04 07:41:59 -0500 |
commit | ac8010221d3fa8697151dfe9a1bb2c504adc68c1 (patch) | |
tree | 6f29ae15005f635809f6b7be8f964cfce29001ec | |
parent | e8801a7418dda995a70f30874aef77e6d064828e (diff) |
driver core: Provide an wrapper around the mutex to do lockdep warnings
Instead of open-coding it in drivers that want to double check
that their functions are indeed holding the device lock.
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Suggested-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
-rw-r--r-- | drivers/xen/xen-pciback/pci_stub.c | 2 | ||||
-rw-r--r-- | include/linux/device.h | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/drivers/xen/xen-pciback/pci_stub.c b/drivers/xen/xen-pciback/pci_stub.c index 9cbe1a31c1e5..8b77089eddac 100644 --- a/drivers/xen/xen-pciback/pci_stub.c +++ b/drivers/xen/xen-pciback/pci_stub.c | |||
@@ -278,7 +278,7 @@ void pcistub_put_pci_dev(struct pci_dev *dev) | |||
278 | /* Cleanup our device | 278 | /* Cleanup our device |
279 | * (so it's ready for the next domain) | 279 | * (so it's ready for the next domain) |
280 | */ | 280 | */ |
281 | lockdep_assert_held(&dev->dev.mutex); | 281 | device_lock_assert(&dev->dev); |
282 | __pci_reset_function_locked(dev); | 282 | __pci_reset_function_locked(dev); |
283 | pci_restore_state(dev); | 283 | pci_restore_state(dev); |
284 | 284 | ||
diff --git a/include/linux/device.h b/include/linux/device.h index ce1f21608b16..41d6a7555c6b 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -911,6 +911,11 @@ static inline void device_unlock(struct device *dev) | |||
911 | mutex_unlock(&dev->mutex); | 911 | mutex_unlock(&dev->mutex); |
912 | } | 912 | } |
913 | 913 | ||
914 | static inline void device_lock_assert(struct device *dev) | ||
915 | { | ||
916 | lockdep_assert_held(&dev->mutex); | ||
917 | } | ||
918 | |||
914 | void driver_init(void); | 919 | void driver_init(void); |
915 | 920 | ||
916 | /* | 921 | /* |