public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [question] about open/release and vidioc_g_input/vidioc_s_input functions
@ 2009-03-23 23:14 Alexey Klimov
  2009-03-24  7:06 ` Hans Verkuil
  0 siblings, 1 reply; 8+ messages in thread
From: Alexey Klimov @ 2009-03-23 23:14 UTC (permalink / raw)
  To: linux-media
  Cc: Mauro Carvalho Chehab, Hans Verkuil, Douglas Schilling Landgraf

Hello, all

After last convertion of radio drivers to use v4l2_device we have such
code in many radio drivers:
(it's radio-terratec.c for example)

...
 static int terratec_open(struct file *file)
{
        return 0;
}

static int terratec_release(struct file *file)
{
        return 0;
}
...

and

...
static int vidioc_g_input(struct file *filp, void *priv, unsigned int
*i)
{
        *i = 0;
        return 0;
}

static int vidioc_s_input(struct file *filp, void *priv, unsigned int i)
{
        return i ? -EINVAL : 0;
}
...

Such code used in many radio-drivers as i understand.

Is it good to place this empty and almost empty functions in:
(here i see two variants)

1) In header file that be in linux/drivers/media/radio/ directory.
Later, we can move some generic/or repeating code in this header.

2) In any v4l header. What header may contain this ? 

?

For what ? Well, as i understand we can decrease amount of lines and
provide this simple generic functions. It's like
video_device_release_empty function behaviour. Maybe not only radio
drivers can use such vidioc_g_input and vidioc_s_input.

Is it worth ?

-- 
Best regards, Klimov Alexey


^ permalink raw reply	[flat|nested] 8+ messages in thread
* Re: [question] about open/release and vidioc_g_input/vidioc_s_input functions
@ 2009-03-24 10:24 Hans Verkuil
  0 siblings, 0 replies; 8+ messages in thread
From: Hans Verkuil @ 2009-03-24 10:24 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Alexey Klimov, linux-media, Mauro Carvalho Chehab,
	Douglas Schilling Landgraf


> On Tuesday 24 March 2009 08:06:39 Hans Verkuil wrote:
>> On Tuesday 24 March 2009 00:14:07 Alexey Klimov wrote:
>> > Hello, all
>> >
>> > After last convertion of radio drivers to use v4l2_device we have such
>> > code in many radio drivers:
>> > (it's radio-terratec.c for example)
>> >
>> > ...
>> >  static int terratec_open(struct file *file)
>> > {
>> >         return 0;
>> > }
>> >
>> > static int terratec_release(struct file *file)
>> > {
>> >         return 0;
>> > }
>> > ...
>> >
>> > and
>> >
>> > ...
>> > static int vidioc_g_input(struct file *filp, void *priv, unsigned int
>> > *i)
>> > {
>> >         *i = 0;
>> >         return 0;
>> > }
>> >
>> > static int vidioc_s_input(struct file *filp, void *priv, unsigned int
>> i)
>> > {
>> >         return i ? -EINVAL : 0;
>> > }
>> > ...
>> >
>> > Such code used in many radio-drivers as i understand.
>> >
>> > Is it good to place this empty and almost empty functions in:
>> > (here i see two variants)
>> >
>> > 1) In header file that be in linux/drivers/media/radio/ directory.
>> > Later, we can move some generic/or repeating code in this header.
>> >
>> > 2) In any v4l header. What header may contain this ?
>> >
>> > ?
>> >
>> > For what ? Well, as i understand we can decrease amount of lines and
>> > provide this simple generic functions. It's like
>> > video_device_release_empty function behaviour. Maybe not only radio
>> > drivers can use such vidioc_g_input and vidioc_s_input.
>> >
>> > Is it worth ?
>>
>> I don't think it is worth doing this for g/s_input. I think it is useful
>> to
>> have them here: it makes it very clear that there is just a single input
>> and the overhead in both lines and actual bytes is minimal.
>
> What about making that the default NULL g_input/s_input callbacks handling
> in
> video_ioctl2 ? Devices with a single input wouldn't need to define
> g_input/s_input callbacks at all.

If you leave s/g_input NULL then you have a device without an input at
all. That's perfectly valid for output-only devices.

Regards,

         Hans

-- 
Hans Verkuil - video4linux developer - sponsored by TANDBERG


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-03-27 17:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-23 23:14 [question] about open/release and vidioc_g_input/vidioc_s_input functions Alexey Klimov
2009-03-24  7:06 ` Hans Verkuil
2009-03-24  9:58   ` Laurent Pinchart
2009-03-27 16:44   ` Alexey Klimov
2009-03-27 16:50     ` Hans Verkuil
2009-03-27 17:34       ` Alexey Klimov
2009-03-27 17:45         ` Hans Verkuil
  -- strict thread matches above, loose matches on Subject: below --
2009-03-24 10:24 Hans Verkuil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox