]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: unisys: visorbus: Make visordriver_callback_lock a mutex
authorBryan Thompson <bryan.thompson@unisys.com>
Sat, 11 Jun 2016 01:48:10 +0000 (21:48 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 15 Aug 2016 18:44:25 +0000 (20:44 +0200)
visordriver_callback_lock is just a binary semaphore that logically
makes more sense as a mutex.

Signed-off-by: Bryan Thompson <bryan.thompson@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <Timothy.Sell@unisys.com>
Acked-By: Neil Horman <nhorman@tuxdriver.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/unisys/include/visorbus.h
drivers/staging/unisys/visorbus/visorbus_main.c

index 9bb88bbb2078412cd563ac8349c0faaafa76669f..3ba01cff4c32e0f245132147b6c8871420702eae 100644 (file)
@@ -161,7 +161,7 @@ struct visor_device {
        struct timer_list timer;
        bool timer_active;
        bool being_removed;
-       struct semaphore visordriver_callback_lock;
+       struct mutex visordriver_callback_lock;
        bool pausing;
        bool resuming;
        u32 chipset_bus_no;
index e98e720fb8685b4ce8ccf4fc58a6b5c0a8341935..2e0eb030c810ceb9ec22f89d5b4184548667c334 100644 (file)
@@ -574,7 +574,7 @@ visordriver_probe_device(struct device *xdev)
        if (!drv->probe)
                return -ENODEV;
 
-       down(&dev->visordriver_callback_lock);
+       mutex_lock(&dev->visordriver_callback_lock);
        dev->being_removed = false;
 
        res = drv->probe(dev);
@@ -584,7 +584,7 @@ visordriver_probe_device(struct device *xdev)
                fix_vbus_dev_info(dev);
        }
 
-       up(&dev->visordriver_callback_lock);
+       mutex_unlock(&dev->visordriver_callback_lock);
        return res;
 }
 
@@ -600,11 +600,11 @@ visordriver_remove_device(struct device *xdev)
 
        dev = to_visor_device(xdev);
        drv = to_visor_driver(xdev->driver);
-       down(&dev->visordriver_callback_lock);
+       mutex_lock(&dev->visordriver_callback_lock);
        dev->being_removed = true;
        if (drv->remove)
                drv->remove(dev);
-       up(&dev->visordriver_callback_lock);
+       mutex_unlock(&dev->visordriver_callback_lock);
        dev_stop_periodic_work(dev);
 
        put_device(&dev->device);
@@ -764,7 +764,7 @@ create_visor_device(struct visor_device *dev)
        POSTCODE_LINUX_4(DEVICE_CREATE_ENTRY_PC, chipset_dev_no, chipset_bus_no,
                         POSTCODE_SEVERITY_INFO);
 
-       sema_init(&dev->visordriver_callback_lock, 1);  /* unlocked */
+       mutex_init(&dev->visordriver_callback_lock);
        dev->device.bus = &visorbus_type;
        dev->device.groups = visorbus_channel_groups;
        device_initialize(&dev->device);