diff mbox

[PATCHv2,1/5] m88ds3103: do not return error from get_frontend() when not ready

Message ID 1432236172-13964-2-git-send-email-crope@iki.fi (mailing list archive)
State New, archived
Headers show

Commit Message

Antti Palosaari May 21, 2015, 7:22 p.m. UTC
Do not return error from get_frontend() when status is queried, but
device is not ready. dvbv5-zap has habit to call that IOCTL before
device is tuned and it also refuses to use DVBv5 statistic after
that...

Signed-off-by: Antti Palosaari <crope@iki.fi>
---
 drivers/media/dvb-frontends/m88ds3103.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mauro Carvalho Chehab May 30, 2015, 3:02 p.m. UTC | #1
Em Thu, 21 May 2015 22:22:48 +0300
Antti Palosaari <crope@iki.fi> escreveu:

> Do not return error from get_frontend() when status is queried, but
> device is not ready. dvbv5-zap has habit to call that IOCTL before
> device is tuned and it also refuses to use DVBv5 statistic after
> that...

This is actually an error at libdvbv5, that was solved by this patch:

commit bf028618f0a2f86f8515560865b8f8142eddb1d9
Author: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Date:   Tue Apr 14 11:47:57 2015 -0300

    libdvbv5: Retry FE_GET_PROPERTY ioctl if it returns EAGAIN
    
    Retry the FE_GET_PROPERTY ioctl used to determine if we have a DVBv5 device
    if it returns EAGAIN indicating the driver is currently locked by the kernel.
    
    Also skip over subsequent information gathering calls to FE_GET_PROPERTY
    that return EAGAIN.
    
    Signed-off-by: David Howells <dhowells@redhat.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

Basically, -EAGAIN should be discarded.

That's said, see below.


> 
> Signed-off-by: Antti Palosaari <crope@iki.fi>
> ---
>  drivers/media/dvb-frontends/m88ds3103.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/dvb-frontends/m88ds3103.c b/drivers/media/dvb-frontends/m88ds3103.c
> index d3d928e..03dceb5 100644
> --- a/drivers/media/dvb-frontends/m88ds3103.c
> +++ b/drivers/media/dvb-frontends/m88ds3103.c
> @@ -742,7 +742,7 @@ static int m88ds3103_get_frontend(struct dvb_frontend *fe)
>  	dev_dbg(&priv->i2c->dev, "%s:\n", __func__);
>  
>  	if (!priv->warm || !(priv->fe_status & FE_HAS_LOCK)) {
> -		ret = -EAGAIN;
> +		ret = 0;

Returning EAGAIN here doesn't seem right, as this ioctl didn't fail
due to mutex locked while calling an ioctl with non-block mode (that's
basically the usage of EAGAIN).

The proper behavior is to succeed the ioctl, keeping the cache untouched,
with all the DVBv5 available status with scale filled with
FE_SCALE_NOT_AVAILABLE.

That's said, I'm not seeing the part of the code on m88ds3103 that would
be filling the DVBv5 stats. It seems that this patch comment is bogus.

>  		goto err;
>  	}
>  
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Mauro Carvalho Chehab May 30, 2015, 3:10 p.m. UTC | #2
Em Sat, 30 May 2015 12:02:14 -0300
Mauro Carvalho Chehab <mchehab@osg.samsung.com> escreveu:

> Em Thu, 21 May 2015 22:22:48 +0300
> Antti Palosaari <crope@iki.fi> escreveu:
> 
> > Do not return error from get_frontend() when status is queried, but
> > device is not ready. dvbv5-zap has habit to call that IOCTL before
> > device is tuned and it also refuses to use DVBv5 statistic after
> > that...
> 
> This is actually an error at libdvbv5, that was solved by this patch:
> 
> commit bf028618f0a2f86f8515560865b8f8142eddb1d9
> Author: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
> Date:   Tue Apr 14 11:47:57 2015 -0300
> 
>     libdvbv5: Retry FE_GET_PROPERTY ioctl if it returns EAGAIN
>     
>     Retry the FE_GET_PROPERTY ioctl used to determine if we have a DVBv5 device
>     if it returns EAGAIN indicating the driver is currently locked by the kernel.
>     
>     Also skip over subsequent information gathering calls to FE_GET_PROPERTY
>     that return EAGAIN.
>     
>     Signed-off-by: David Howells <dhowells@redhat.com>
>     Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
> 
> Basically, -EAGAIN should be discarded.
> 
> That's said, see below.
> 
> 
> > 
> > Signed-off-by: Antti Palosaari <crope@iki.fi>
> > ---
> >  drivers/media/dvb-frontends/m88ds3103.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/media/dvb-frontends/m88ds3103.c b/drivers/media/dvb-frontends/m88ds3103.c
> > index d3d928e..03dceb5 100644
> > --- a/drivers/media/dvb-frontends/m88ds3103.c
> > +++ b/drivers/media/dvb-frontends/m88ds3103.c
> > @@ -742,7 +742,7 @@ static int m88ds3103_get_frontend(struct dvb_frontend *fe)
> >  	dev_dbg(&priv->i2c->dev, "%s:\n", __func__);
> >  
> >  	if (!priv->warm || !(priv->fe_status & FE_HAS_LOCK)) {
> > -		ret = -EAGAIN;
> > +		ret = 0;
> 
> Returning EAGAIN here doesn't seem right, as this ioctl didn't fail
> due to mutex locked while calling an ioctl with non-block mode (that's
> basically the usage of EAGAIN).
> 
> The proper behavior is to succeed the ioctl, keeping the cache untouched,
> with all the DVBv5 available status with scale filled with
> FE_SCALE_NOT_AVAILABLE.
> 
> That's said, I'm not seeing the part of the code on m88ds3103 that would
> be filling the DVBv5 stats. It seems that this patch comment is bogus.

I ended by applying the patch together with the complete patch series
just fixing the patch description.

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

Patch

diff --git a/drivers/media/dvb-frontends/m88ds3103.c b/drivers/media/dvb-frontends/m88ds3103.c
index d3d928e..03dceb5 100644
--- a/drivers/media/dvb-frontends/m88ds3103.c
+++ b/drivers/media/dvb-frontends/m88ds3103.c
@@ -742,7 +742,7 @@  static int m88ds3103_get_frontend(struct dvb_frontend *fe)
 	dev_dbg(&priv->i2c->dev, "%s:\n", __func__);
 
 	if (!priv->warm || !(priv->fe_status & FE_HAS_LOCK)) {
-		ret = -EAGAIN;
+		ret = 0;
 		goto err;
 	}