media: ngene: Replace semaphore i2c_switch_mutex with mutex
authorBinoy Jayan <binoy.jayan@linaro.org>
Tue, 13 Jun 2017 08:58:50 +0000 (05:58 -0300)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Sat, 24 Jun 2017 19:42:34 +0000 (16:42 -0300)
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>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/pci/ngene/ngene-core.c
drivers/media/pci/ngene/ngene-i2c.c
drivers/media/pci/ngene/ngene.h

index ea649012b8c744a0c0ba533401cf3e11a4623f14..8c92cb7f7e72f7af8ca6411ec60db81c8b95bbaa 100644 (file)
@@ -1345,7 +1345,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);
index cf39fcf54adfb812ca691caa68e09ddcbb434947..fbf36353c7014b9f3424a850585b82d147177e3a 100644 (file)
@@ -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;
 }
 
index 0dd15d61b8ee93412d8f785c39c3872703ad2368..7c7cd217333d8af262e802081fb775ea4db2f7b4 100644 (file)
@@ -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;