Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1426193 > unrolled thread
| Started by | Binoy Jayan <binoy.jayan@linaro.org> |
|---|---|
| First post | 2016-06-20 07:20 +0200 |
| Last post | 2016-06-20 14:30 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] staging: unisys: visorbus: Replace semaphore with mutex Binoy Jayan <binoy.jayan@linaro.org> - 2016-06-20 07:20 +0200
RE: [PATCH] staging: unisys: visorbus: Replace semaphore with mutex "Sell, Timothy C" <Timothy.Sell@unisys.com> - 2016-06-20 14:30 +0200
| From | Binoy Jayan <binoy.jayan@linaro.org> |
|---|---|
| Date | 2016-06-20 07:20 +0200 |
| Subject | [PATCH] staging: unisys: visorbus: Replace semaphore with mutex |
| Message-ID | <rLZMS-42g-25@gated-at.bofh.it> |
The semaphore 'visordriver_callback_lock' is a simple mutex, so
it should be written as one. Semaphores are going away in the future.
Signed-off-by: Binoy Jayan <binoy.jayan@linaro.org>
---
drivers/staging/unisys/include/visorbus.h | 3 ++-
drivers/staging/unisys/visorbus/visorbus_main.c | 14 +++++++-------
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/drivers/staging/unisys/include/visorbus.h b/drivers/staging/unisys/include/visorbus.h
index 9baf1ec..38edca8 100644
--- a/drivers/staging/unisys/include/visorbus.h
+++ b/drivers/staging/unisys/include/visorbus.h
@@ -34,6 +34,7 @@
#include <linux/poll.h>
#include <linux/kernel.h>
#include <linux/uuid.h>
+#include <linux/mutex.h>
#include "periodic_work.h"
#include "channel.h"
@@ -159,7 +160,7 @@ struct visor_device {
struct list_head list_all;
struct periodic_work *periodic_work;
bool being_removed;
- struct semaphore visordriver_callback_lock;
+ 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 3a147db..93996a5 100644
--- a/drivers/staging/unisys/visorbus/visorbus_main.c
+++ b/drivers/staging/unisys/visorbus/visorbus_main.c
@@ -544,10 +544,10 @@ dev_periodic_work(void *xdev)
struct visor_device *dev = xdev;
struct visor_driver *drv = to_visor_driver(dev->device.driver);
- down(&dev->visordriver_callback_lock);
+ mutex_lock(&dev->visordriver_callback_lock);
if (drv->channel_interrupt)
drv->channel_interrupt(dev);
- up(&dev->visordriver_callback_lock);
+ mutex_unlock(&dev->visordriver_callback_lock);
if (!visor_periodic_work_nextperiod(dev->periodic_work))
put_device(&dev->device);
}
@@ -588,7 +588,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);
@@ -598,7 +598,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;
}
@@ -614,11 +614,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);
@@ -778,7 +778,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);
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
[toc] | [next] | [standalone]
| From | "Sell, Timothy C" <Timothy.Sell@unisys.com> |
|---|---|
| Date | 2016-06-20 14:30 +0200 |
| Message-ID | <rM6v0-8aw-53@gated-at.bofh.it> |
| In reply to | #1426193 |
> -----Original Message----- > From: Binoy Jayan [mailto:binoy.jayan@linaro.org] > Sent: Monday, June 20, 2016 1:07 AM > To: Kershner, David A; Greg Kroah-Hartman > Cc: Arnd Bergmann; *S-Par-Maintainer; devel@driverdev.osuosl.org; linux- > kernel@vger.kernel.org; Binoy Jayan > Subject: [PATCH] staging: unisys: visorbus: Replace semaphore with mutex > > The semaphore 'visordriver_callback_lock' is a simple mutex, so > it should be written as one. Semaphores are going away in the future. > Thanks Binoy, but we already submitted a patch for this issue on June 11, and are currently awaiting its acceptance into staging. See: * [PATCH RESEND 12/28] staging: unisys: visorbus: Make visordriver_callback_lock a mutex (http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/2016-June/090861.html) * [PATCH RESEND 00/28] staging: unisys: fix visorbus & visorinput issues raised by tglx (http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/2016-June/090854.html) Tim Sell
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web