driver core: Provide an wrapper around the mutex to do lockdep warnings
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Wed, 3 Dec 2014 21:40:27 +0000 (16:40 -0500)
committerDavid Vrabel <david.vrabel@citrix.com>
Thu, 4 Dec 2014 12:41:59 +0000 (12:41 +0000)
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>
drivers/xen/xen-pciback/pci_stub.c
include/linux/device.h

index 9cbe1a31c1e5bc98d5e0ba1d0eb8433b4d6d5410..8b77089eddac140ce65b0e12731b0407f89029d3 100644 (file)
@@ -278,7 +278,7 @@ void pcistub_put_pci_dev(struct pci_dev *dev)
        /* Cleanup our device
         * (so it's ready for the next domain)
         */
-       lockdep_assert_held(&dev->dev.mutex);
+       device_lock_assert(&dev->dev);
        __pci_reset_function_locked(dev);
        pci_restore_state(dev);
 
index ce1f21608b168f9b1f1759f5f4eefd4c4d4beae5..41d6a7555c6bbb21c26b16fffd4fea4adcdfc763 100644 (file)
@@ -911,6 +911,11 @@ static inline void device_unlock(struct device *dev)
        mutex_unlock(&dev->mutex);
 }
 
+static inline void device_lock_assert(struct device *dev)
+{
+       lockdep_assert_held(&dev->mutex);
+}
+
 void driver_init(void);
 
 /*