[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1464147962-26650-11-git-send-email-david.kershner@unisys.com>
Date: Tue, 24 May 2016 23:45:48 -0400
From: David Kershner <david.kershner@...sys.com>
To: <corbet@....net>, <tglx@...utronix.de>, <mingo@...hat.com>,
<hpa@...or.com>, <david.kershner@...sys.com>,
<gregkh@...uxfoundation.org>, <erik.arfvidson@...sys.com>,
<timothy.sell@...sys.com>, <hofrat@...dl.org>,
<dzickus@...hat.com>, <jes.sorensen@...hat.com>,
<alexander.curtin@...sys.com>, <janani.rvchndrn@...il.com>,
<sudipm.mukherjee@...il.com>, <prarit@...hat.com>,
<david.binder@...sys.com>, <nhorman@...hat.com>,
<dan.j.williams@...el.com>, <linux-kernel@...r.kernel.org>,
<linux-doc@...r.kernel.org>,
<driverdev-devel@...uxdriverproject.org>,
<sparmaintainer@...sys.com>
CC: Bryan Thompson <bryan.thompson@...sys.com>
Subject: [PATCH 10/24] staging: unisys: visorbus: Make visordriver_callback_lock a mutex
From: Bryan Thompson <bryan.thompson@...sys.com>
visordriver_callback_lock is just a binary semaphore that logically
makes more sense as a mutex.
Signed-off-by: Bryan Thompson <bryan.thompson@...sys.com>
Signed-off-by: David Kershner <david.kershner@...sys.com>
---
drivers/staging/unisys/include/visorbus.h | 3 ++-
drivers/staging/unisys/visorbus/visorbus_main.c | 10 +++++-----
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/unisys/include/visorbus.h b/drivers/staging/unisys/include/visorbus.h
index 9bb88bb..9da25c0 100644
--- a/drivers/staging/unisys/include/visorbus.h
+++ b/drivers/staging/unisys/include/visorbus.h
@@ -161,7 +161,8 @@ struct visor_device {
struct timer_list timer;
bool timer_active;
bool being_removed;
- struct semaphore visordriver_callback_lock;
+ /* mutex to serialize visor_driver function callbacks */
+ struct mutex visordriver_callback_lock;
bool pausing;
bool resuming;
u32 chipset_bus_no;
diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c
index 24b27ff..44609ee 100644
--- a/drivers/staging/unisys/visorbus/visorbus_main.c
+++ b/drivers/staging/unisys/visorbus/visorbus_main.c
@@ -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);
--
1.9.1
Powered by blists - more mailing lists