From: Antti Palosaari <crope@iki.fi>
To: Malcolm Priestley <tvboxspy@gmail.com>
Cc: linux-media@vger.kernel.org
Subject: Re: [PATCH 2/2 FOR 3.4] af9015: fix i2c failures for dual-tuner devices - part 2
Date: Wed, 14 Mar 2012 23:36:13 +0200 [thread overview]
Message-ID: <4F610F4D.6080402@iki.fi> (raw)
In-Reply-To: <1331759693.5713.12.camel@tvbox>
On 14.03.2012 23:14, Malcolm Priestley wrote:
> On Wed, 2012-03-14 at 16:27 +0200, Antti Palosaari wrote:
>> Some changes for previous patch I liked to do.
>> Just move tuner init and sleep to own functions from the demod
>> init and sleep functions. Functionality remains still almost the same.
>>
>> Signed-off-by: Antti Palosaari<crope@iki.fi>
>> ---
>> drivers/media/dvb/dvb-usb/af9015.c | 74 ++++++++++++++++++++++-------------
>> drivers/media/dvb/dvb-usb/af9015.h | 4 +-
>> 2 files changed, 48 insertions(+), 30 deletions(-)
>>
>> diff --git a/drivers/media/dvb/dvb-usb/af9015.c b/drivers/media/dvb/dvb-usb/af9015.c
>> index 9307b4ca..7e70ea5 100644
>> --- a/drivers/media/dvb/dvb-usb/af9015.c
>> +++ b/drivers/media/dvb/dvb-usb/af9015.c
>> @@ -1141,18 +1141,7 @@ static int af9015_af9013_init(struct dvb_frontend *fe)
>> return -EAGAIN;
>>
>> ret = priv->init[adap->id](fe);
>> - if (ret)
>> - goto err_unlock;
>> -
>> - if (priv->tuner_ops_init[adap->id]) {
>> - if (fe->ops.i2c_gate_ctrl)
>> - fe->ops.i2c_gate_ctrl(fe, 1);
>> - ret = priv->tuner_ops_init[adap->id](fe);
>> - if (fe->ops.i2c_gate_ctrl)
>> - fe->ops.i2c_gate_ctrl(fe, 0);
>> - }
>>
>> -err_unlock:
>> mutex_unlock(&adap->dev->usb_mutex);
>>
>> return ret;
>> @@ -1168,24 +1157,48 @@ static int af9015_af9013_sleep(struct dvb_frontend *fe)
>> if (mutex_lock_interruptible(&adap->dev->usb_mutex))
>> return -EAGAIN;
>>
>> - if (priv->tuner_ops_sleep[adap->id]) {
>> - if (fe->ops.i2c_gate_ctrl)
>> - fe->ops.i2c_gate_ctrl(fe, 1);
>> - ret = priv->tuner_ops_sleep[adap->id](fe);
>> - if (fe->ops.i2c_gate_ctrl)
>> - fe->ops.i2c_gate_ctrl(fe, 0);
>> - if (ret)
>> - goto err_unlock;
>> - }
>> -
>> ret = priv->sleep[adap->id](fe);
>>
>> -err_unlock:
>> mutex_unlock(&adap->dev->usb_mutex);
>>
>> return ret;
>> }
>>
>> +/* override tuner callbacks for resource locking */
>> +static int af9015_tuner_init(struct dvb_frontend *fe)
>> +{
>> + int ret;
>> + struct dvb_usb_adapter *adap = fe->dvb->priv;
>> + struct af9015_state *priv = adap->dev->priv;
>> +
>> + if (mutex_lock_interruptible(&adap->dev->usb_mutex))
>> + return -EAGAIN;
> Hi Antti
>
> I think using mutex_lock_interruptible errors into dvb-usb causes false
> errors and errors caused by missed registers.
>
> I prefer to use mutex_lock only return genuine device errors.
IIRC documentation says mutex_lock_interruptible() must be used instead
of mutex_lock() when possible. I don't see any reason why I it should be
changed.
regards
Antti
--
http://palosaari.fi/
prev parent reply other threads:[~2012-03-14 21:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-14 14:27 [PATCH 1/2 FOR 3.4] af9015: fix i2c failures for dual-tuner devices Antti Palosaari
2012-03-14 14:27 ` [PATCH 2/2 FOR 3.4] af9015: fix i2c failures for dual-tuner devices - part 2 Antti Palosaari
2012-03-14 21:14 ` Malcolm Priestley
2012-03-14 21:36 ` Antti Palosaari [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F610F4D.6080402@iki.fi \
--to=crope@iki.fi \
--cc=linux-media@vger.kernel.org \
--cc=tvboxspy@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.