Em Mon, 14 Sep 2009 16:29:58 +0400
"aos...@netup.ru" <aos...@netup.ru> escreveu:

> Hello,
> 
> Fixed. Try again please.
> 


> 
> # HG changeset patch
> # User Abylay Ospan <aos...@netup.ru>
> # Date 1252176678 -14400
> # Node ID 2f1119c624ebafde8332fb7a0c8a9315e50e9d51
> # Parent 2b49813f84822a1c0d88875ac590a455d93e9225
> Fix gpio mutex in NetUP Dual DVB-S2 CI card.
> 
> From: Abylay Ospan <aos...@netup.ru>
> 
> The card uses the same cx23885 gpio lines for two adapters.
> In case of there is several cards in system we must implement
> gpio mutex per cx23885 chip.
> 
> Signed-off-by: Abylay Ospan <aos...@netup.ru>
> 
> --- a/linux/drivers/media/video/cx23885/cimax2.c      Thu Sep 03 09:06:34 
> 2009 -0300
> +++ b/linux/drivers/media/video/cx23885/cimax2.c      Sat Sep 05 22:51:18 
> 2009 +0400
> @@ -75,7 +75,6 @@
>       void *priv;
>  };
>  
> -struct mutex gpio_mutex;/* Two CiMax's uses same GPIO lines */
>  
>  int netup_read_i2c(struct i2c_adapter *i2c_adap, u8 addr, u8 reg,
>                                               u8 *buf, int len)
> @@ -183,10 +182,11 @@
>       if (ret != 0)
>               return ret;
>  
> -     mutex_lock(&gpio_mutex);
> +     mutex_lock(&dev->gpio_lock);
>  
>       /* write addr */
>       cx_write(MC417_OEN, NETUP_EN_ALL);
> +     udelay(2000);

udelay is not nice to the processor, since it won't handle any other task while
waiting. In general, it is better to use usleep().

>       cx_write(MC417_RWD, NETUP_CTRL_OFF |
>                               NETUP_ADLO | (0xff & addr));
>       cx_clear(MC417_RWD, NETUP_ADLO);
> @@ -194,9 +194,10 @@
>                               NETUP_ADHI | (0xff & (addr >> 8)));
>       cx_clear(MC417_RWD, NETUP_ADHI);
>  
> -     if (read) /* data in */
> +     if (read) { /* data in */
>               cx_write(MC417_OEN, NETUP_EN_ALL | NETUP_DATA);
> -     else /* data out */
> +             udelay(2000);

Same issue here.

> +     } else /* data out */
>               cx_write(MC417_RWD, NETUP_CTRL_OFF | data);
>  
>       /* choose chip */
> @@ -206,7 +207,7 @@
>       cx_clear(MC417_RWD, (read) ? NETUP_RD : NETUP_WR);
>       mem = netup_ci_get_mem(dev);
>  
> -     mutex_unlock(&gpio_mutex);
> +     mutex_unlock(&dev->gpio_lock);
>  
>       if (!read)
>               if (mem < 0)
> @@ -411,7 +412,6 @@
>       switch (port->nr) {
>       case 1:
>               state->ci_i2c_addr = 0x40;
> -             mutex_init(&gpio_mutex);
>               break;
>       case 2:
>               state->ci_i2c_addr = 0x41;
> --- a/linux/drivers/media/video/cx23885/cx23885-core.c        Thu Sep 03 
> 09:06:34 2009 -0300
> +++ b/linux/drivers/media/video/cx23885/cx23885-core.c        Sat Sep 05 
> 22:51:18 2009 +0400
> @@ -759,6 +759,7 @@
>       int i;
>  
>       mutex_init(&dev->lock);
> +     mutex_init(&dev->gpio_lock);
>  
>       atomic_inc(&dev->refcount);
>  
> --- a/linux/drivers/media/video/cx23885/cx23885.h     Thu Sep 03 09:06:34 
> 2009 -0300
> +++ b/linux/drivers/media/video/cx23885/cx23885.h     Sat Sep 05 22:51:18 
> 2009 +0400
> @@ -326,6 +326,7 @@
>  
>       int                        nr;
>       struct mutex               lock;
> +     struct mutex               gpio_lock;
>  
>       /* board details */
>       unsigned int               board;
> 




Cheers,
Mauro
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to