All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@redhat.com>
To: Antti Palosaari <crope@iki.fi>
Cc: linux-media@vger.kernel.org
Subject: Re: [PATCH RFC 3/3] dvb_frontend: do not allow statistic IOCTLs when sleeping
Date: Sun, 12 Aug 2012 12:28:10 -0300	[thread overview]
Message-ID: <5027CB8A.1020204@redhat.com> (raw)
In-Reply-To: <1344551101-16700-4-git-send-email-crope@iki.fi>

Em 09-08-2012 19:25, Antti Palosaari escreveu:
> Demodulator cannot perform statistic IOCTLs when it is not tuned.
> Return -EPERM in such case.

While, in general, doing it makes sense, -EPERM is a very bad return code.
It is used to indicate when accessing some resources would require root access.

> 
> Signed-off-by: Antti Palosaari <crope@iki.fi>
> ---
>  drivers/media/dvb/dvb-core/dvb_frontend.c | 34 +++++++++++++++++++++++--------
>  1 file changed, 25 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c
> index 4fc11eb..40efcde 100644
> --- a/drivers/media/dvb/dvb-core/dvb_frontend.c
> +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c
> @@ -2157,27 +2157,43 @@ static int dvb_frontend_ioctl_legacy(struct file *file,
>  			err = fe->ops.read_status(fe, status);
>  		break;
>  	}
> +
>  	case FE_READ_BER:
> -		if (fe->ops.read_ber)
> -			err = fe->ops.read_ber(fe, (__u32*) parg);
> +		if (fe->ops.read_ber) {
> +			if (fepriv->thread)
> +				err = fe->ops.read_ber(fe, (__u32 *) parg);
> +			else
> +				err = -EPERM;
> +		}
>  		break;
>  
>  	case FE_READ_SIGNAL_STRENGTH:
> -		if (fe->ops.read_signal_strength)
> -			err = fe->ops.read_signal_strength(fe, (__u16*) parg);
> +		if (fe->ops.read_signal_strength) {
> +			if (fepriv->thread)
> +				err = fe->ops.read_signal_strength(fe, (__u16 *) parg);
> +			else
> +				err = -EPERM;
> +		}
>  		break;

Signal strength can still be available even without locking.

>  
>  	case FE_READ_SNR:
> -		if (fe->ops.read_snr)
> -			err = fe->ops.read_snr(fe, (__u16*) parg);
> +		if (fe->ops.read_snr) {
> +			if (fepriv->thread)
> +				err = fe->ops.read_snr(fe, (__u16 *) parg);
> +			else
> +				err = -EPERM;
> +		}
>  		break;
>  
>  	case FE_READ_UNCORRECTED_BLOCKS:
> -		if (fe->ops.read_ucblocks)
> -			err = fe->ops.read_ucblocks(fe, (__u32*) parg);
> +		if (fe->ops.read_ucblocks) {
> +			if (fepriv->thread)
> +				err = fe->ops.read_ucblocks(fe, (__u32 *) parg);
> +			else
> +				err = -EPERM;
> +		}
>  		break;
>  
> -
>  	case FE_DISEQC_RESET_OVERLOAD:
>  		if (fe->ops.diseqc_reset_overload) {
>  			err = fe->ops.diseqc_reset_overload(fe);
> 

Regards,
Mauro

  reply	other threads:[~2012-08-12 15:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-09 22:24 [PATCH RFC 0/3] dvb-frontend statistic IOCTL validation Antti Palosaari
2012-08-09 22:24 ` [PATCH RFC 1/3] dvb_frontend: use Kernel dev_* logging Antti Palosaari
2012-08-12 15:37   ` Mauro Carvalho Chehab
2012-08-09 22:25 ` [PATCH RFC 2/3] dvb_frontend: return -ENOTTY for unimplement IOCTL Antti Palosaari
2012-08-12 15:30   ` Mauro Carvalho Chehab
2012-08-09 22:25 ` [PATCH RFC 3/3] dvb_frontend: do not allow statistic IOCTLs when sleeping Antti Palosaari
2012-08-12 15:28   ` Mauro Carvalho Chehab [this message]
2012-08-12 16:28     ` Antti Palosaari

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=5027CB8A.1020204@redhat.com \
    --to=mchehab@redhat.com \
    --cc=crope@iki.fi \
    --cc=linux-media@vger.kernel.org \
    /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.