Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1661020
| From | Binoy Jayan <binoy.jayan@linaro.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 3/3] media: ngene: Replace semaphore i2c_switch_mutex with mutex |
| Date | 2017-06-08 12:10 +0200 |
| Message-ID | <tQ2y5-2WM-7@gated-at.bofh.it> (permalink) |
| References | <tQ2y5-2WM-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
The semaphore 'i2c_switch_mutex' is used as 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/media/pci/ngene/ngene-core.c | 2 +-
drivers/media/pci/ngene/ngene-i2c.c | 6 +++---
drivers/media/pci/ngene/ngene.h | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/media/pci/ngene/ngene-core.c b/drivers/media/pci/ngene/ngene-core.c
index 59f2e5f..ca0c0f8 100644
--- a/drivers/media/pci/ngene/ngene-core.c
+++ b/drivers/media/pci/ngene/ngene-core.c
@@ -1349,7 +1349,7 @@ static int ngene_start(struct ngene *dev)
mutex_init(&dev->cmd_mutex);
mutex_init(&dev->stream_mutex);
sema_init(&dev->pll_mutex, 1);
- sema_init(&dev->i2c_switch_mutex, 1);
+ mutex_init(&dev->i2c_switch_mutex);
spin_lock_init(&dev->cmd_lock);
for (i = 0; i < MAX_STREAM; i++)
spin_lock_init(&dev->channel[i].state_lock);
diff --git a/drivers/media/pci/ngene/ngene-i2c.c b/drivers/media/pci/ngene/ngene-i2c.c
index cf39fcf..fbf3635 100644
--- a/drivers/media/pci/ngene/ngene-i2c.c
+++ b/drivers/media/pci/ngene/ngene-i2c.c
@@ -118,7 +118,7 @@ static int ngene_i2c_master_xfer(struct i2c_adapter *adapter,
(struct ngene_channel *)i2c_get_adapdata(adapter);
struct ngene *dev = chan->dev;
- down(&dev->i2c_switch_mutex);
+ mutex_lock(&dev->i2c_switch_mutex);
ngene_i2c_set_bus(dev, chan->number);
if (num == 2 && msg[1].flags & I2C_M_RD && !(msg[0].flags & I2C_M_RD))
@@ -136,11 +136,11 @@ static int ngene_i2c_master_xfer(struct i2c_adapter *adapter,
msg[0].buf, msg[0].len, 0))
goto done;
- up(&dev->i2c_switch_mutex);
+ mutex_unlock(&dev->i2c_switch_mutex);
return -EIO;
done:
- up(&dev->i2c_switch_mutex);
+ mutex_unlock(&dev->i2c_switch_mutex);
return num;
}
diff --git a/drivers/media/pci/ngene/ngene.h b/drivers/media/pci/ngene/ngene.h
index 0dd15d6..7c7cd21 100644
--- a/drivers/media/pci/ngene/ngene.h
+++ b/drivers/media/pci/ngene/ngene.h
@@ -765,7 +765,7 @@ struct ngene {
struct mutex cmd_mutex;
struct mutex stream_mutex;
struct semaphore pll_mutex;
- struct semaphore i2c_switch_mutex;
+ struct mutex i2c_switch_mutex;
int i2c_current_channel;
int i2c_current_bus;
spinlock_t cmd_lock;
--
Binoy Jayan
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/3] ngene: Replace semaphores with mutexes Binoy Jayan <binoy.jayan@linaro.org> - 2017-06-08 12:10 +0200
[PATCH 3/3] media: ngene: Replace semaphore i2c_switch_mutex with mutex Binoy Jayan <binoy.jayan@linaro.org> - 2017-06-08 12:10 +0200
Re: [PATCH 3/3] media: ngene: Replace semaphore i2c_switch_mutex with mutex Arnd Bergmann <arnd@arndb.de> - 2017-06-08 17:20 +0200
[PATCH 1/3] media: ngene: Replace semaphore cmd_mutex with mutex Binoy Jayan <binoy.jayan@linaro.org> - 2017-06-08 12:10 +0200
Re: [PATCH 1/3] media: ngene: Replace semaphore cmd_mutex with mutex Arnd Bergmann <arnd@arndb.de> - 2017-06-08 17:20 +0200
Re: [PATCH 1/3] media: ngene: Replace semaphore cmd_mutex with mutex Binoy Jayan <binoy.jayan@linaro.org> - 2017-06-09 06:40 +0200
Re: [PATCH 1/3] media: ngene: Replace semaphore cmd_mutex with mutex Arnd Bergmann <arnd@arndb.de> - 2017-06-09 12:40 +0200
Re: [PATCH 1/3] media: ngene: Replace semaphore cmd_mutex with mutex Binoy Jayan <binoy.jayan@linaro.org> - 2017-06-13 11:00 +0200
[PATCH 2/3] media: ngene: Replace semaphore stream_mutex with mutex Binoy Jayan <binoy.jayan@linaro.org> - 2017-06-08 12:10 +0200
Re: [PATCH 2/3] media: ngene: Replace semaphore stream_mutex with mutex Arnd Bergmann <arnd@arndb.de> - 2017-06-08 17:20 +0200
csiph-web