All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Frank Schäfer" <fschaefer.oss@googlemail.com>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: mchehab@redhat.com, linux-media@vger.kernel.org, hans.verkuil@cisco.com
Subject: Re: [PATCH] em28xx: return -ENOTTY for tuner + frequency ioctls if the device has no tuner
Date: Tue, 15 Jan 2013 18:06:57 +0100	[thread overview]
Message-ID: <50F58CB1.8010305@googlemail.com> (raw)
In-Reply-To: <201301141020.24697.hverkuil@xs4all.nl>

Am 14.01.2013 10:20, schrieb Hans Verkuil:
> On Sun January 13 2013 13:50:50 Frank Schäfer wrote:
>> Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
>> ---
>>  drivers/media/usb/em28xx/em28xx-video.c |    8 ++++++++
>>  1 Datei geändert, 8 Zeilen hinzugefügt(+)
>>
>> diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c
>> index 2eabf2a..4a7f73c 100644
>> --- a/drivers/media/usb/em28xx/em28xx-video.c
>> +++ b/drivers/media/usb/em28xx/em28xx-video.c
>> @@ -1204,6 +1204,8 @@ static int vidioc_g_tuner(struct file *file, void *priv,
>>  	struct em28xx         *dev = fh->dev;
>>  	int                   rc;
>>  
>> +	if (dev->tuner_type == TUNER_ABSENT)
>> +		return -ENOTTY;
>>  	rc = check_dev(dev);
>>  	if (rc < 0)
>>  		return rc;
>> @@ -1224,6 +1226,8 @@ static int vidioc_s_tuner(struct file *file, void *priv,
>>  	struct em28xx         *dev = fh->dev;
>>  	int                   rc;
>>  
>> +	if (dev->tuner_type == TUNER_ABSENT)
>> +		return -ENOTTY;
>>  	rc = check_dev(dev);
>>  	if (rc < 0)
>>  		return rc;
>> @@ -1241,6 +1245,8 @@ static int vidioc_g_frequency(struct file *file, void *priv,
>>  	struct em28xx_fh      *fh  = priv;
>>  	struct em28xx         *dev = fh->dev;
>>  
>> +	if (dev->tuner_type == TUNER_ABSENT)
>> +		return -ENOTTY;
>>  	if (0 != f->tuner)
>>  		return -EINVAL;
>>  
>> @@ -1255,6 +1261,8 @@ static int vidioc_s_frequency(struct file *file, void *priv,
>>  	struct em28xx         *dev = fh->dev;
>>  	int                   rc;
>>  
>> +	if (dev->tuner_type == TUNER_ABSENT)
>> +		return -ENOTTY;
>>  	rc = check_dev(dev);
>>  	if (rc < 0)
>>  		return rc;
>>
> Rather than doing this in each ioctl, I recommend using v4l2_disable_ioctl
> instead. See for example drivers/media/pci/ivtv/ivtv-streams.c.

Hmm, thanks.
I just did the same we currently do for the VIDIOC_G/S/QUERY_STD and
VIDIOC_G/S_AUDIO ioctls, but yeah, disabling seems to be better.
Btw, what about VIDIOC_G/S_PARAM ? Do they make sense for cameras ?

Regards,
Frank



  reply	other threads:[~2013-01-15 17:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-13 12:50 [PATCH] em28xx: return -ENOTTY for tuner + frequency ioctls if the device has no tuner Frank Schäfer
2013-01-14  9:20 ` Hans Verkuil
2013-01-15 17:06   ` Frank Schäfer [this message]
2013-01-16  8:31     ` Hans Verkuil
2013-01-18 17:14       ` Frank Schäfer
2013-01-18 19:01         ` Hans Verkuil
2013-01-19 19:14           ` Frank Schäfer

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=50F58CB1.8010305@googlemail.com \
    --to=fschaefer.oss@googlemail.com \
    --cc=hans.verkuil@cisco.com \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@redhat.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.