* Confusion in usr/include/linux/videodev.h
@ 2009-01-21 1:40 Jaswinder Singh Rajput
2009-01-21 1:50 ` Mauro Carvalho Chehab
0 siblings, 1 reply; 7+ messages in thread
From: Jaswinder Singh Rajput @ 2009-01-21 1:40 UTC (permalink / raw)
To: mchehab, linux-media, video4linux-list, Sam Ravnborg, Ingo Molnar,
LKML
usr/include/linux/videodev.h is giving 2 warnings in 'make headers_check':
usr/include/linux/videodev.h:19: leaks CONFIG_VIDEO to userspace where it is not valid
usr/include/linux/videodev.h:314: leaks CONFIG_VIDEO to userspace where it is not valid
Whole file is covered with #if defined(CONFIG_VIDEO_V4L1_COMPAT) || !defined (__KERNEL__)
It means this file is only valid for kernel mode if CONFIG_VIDEO_V4L1_COMPAT is defined but in user mode it is always valid.
Can we choose some better alternative Or can we use this file as:
#ifdef CONFIG_VIDEO_V4L1_COMPAT
#include <linux/videodev.h>
#endif
Thanks
--
JSR
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Confusion in usr/include/linux/videodev.h
2009-01-21 1:40 Confusion in usr/include/linux/videodev.h Jaswinder Singh Rajput
@ 2009-01-21 1:50 ` Mauro Carvalho Chehab
2009-01-21 4:44 ` Jaswinder Singh Rajput
0 siblings, 1 reply; 7+ messages in thread
From: Mauro Carvalho Chehab @ 2009-01-21 1:50 UTC (permalink / raw)
To: Jaswinder Singh Rajput
Cc: linux-media, video4linux-list, Sam Ravnborg, Ingo Molnar, LKML
On Wed, 21 Jan 2009 07:10:38 +0530
Jaswinder Singh Rajput <jaswinder@kernel.org> wrote:
> usr/include/linux/videodev.h is giving 2 warnings in 'make headers_check':
> usr/include/linux/videodev.h:19: leaks CONFIG_VIDEO to userspace where it is not valid
> usr/include/linux/videodev.h:314: leaks CONFIG_VIDEO to userspace where it is not valid
>
> Whole file is covered with #if defined(CONFIG_VIDEO_V4L1_COMPAT) || !defined (__KERNEL__)
>
> It means this file is only valid for kernel mode if CONFIG_VIDEO_V4L1_COMPAT is defined but in user mode it is always valid.
>
> Can we choose some better alternative Or can we use this file as:
>
> #ifdef CONFIG_VIDEO_V4L1_COMPAT
> #include <linux/videodev.h>
> #endif
This is somewhat like what we have on audio devices (where there are OSS and ALSA API's).
V4L1 is the old deprecated userspace API for video devices. It is still
required by some userspace applications. So, on userspace, it should be
included. Also, this allows that one userspace app to be compatible with both
V4L2 API (the current one) and the legacy V4L1 one.
It should be noticed that are still a few drivers using the legacy API yet to
be converted.
Cheers,
Mauro
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Confusion in usr/include/linux/videodev.h
2009-01-21 1:50 ` Mauro Carvalho Chehab
@ 2009-01-21 4:44 ` Jaswinder Singh Rajput
2009-01-21 8:54 ` Trent Piepho
0 siblings, 1 reply; 7+ messages in thread
From: Jaswinder Singh Rajput @ 2009-01-21 4:44 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: Jaswinder Singh Rajput, linux-media, video4linux-list,
Sam Ravnborg, Ingo Molnar, LKML
On Wed, Jan 21, 2009 at 7:20 AM, Mauro Carvalho Chehab
<mchehab@infradead.org> wrote:
> On Wed, 21 Jan 2009 07:10:38 +0530
> Jaswinder Singh Rajput <jaswinder@kernel.org> wrote:
>
>> usr/include/linux/videodev.h is giving 2 warnings in 'make headers_check':
>> usr/include/linux/videodev.h:19: leaks CONFIG_VIDEO to userspace where it is not valid
>> usr/include/linux/videodev.h:314: leaks CONFIG_VIDEO to userspace where it is not valid
>>
>> Whole file is covered with #if defined(CONFIG_VIDEO_V4L1_COMPAT) || !defined (__KERNEL__)
>>
>> It means this file is only valid for kernel mode if CONFIG_VIDEO_V4L1_COMPAT is defined but in user mode it is always valid.
>>
>> Can we choose some better alternative Or can we use this file as:
>>
>> #ifdef CONFIG_VIDEO_V4L1_COMPAT
>> #include <linux/videodev.h>
>> #endif
>
> This is somewhat like what we have on audio devices (where there are OSS and ALSA API's).
>
> V4L1 is the old deprecated userspace API for video devices. It is still
> required by some userspace applications. So, on userspace, it should be
> included. Also, this allows that one userspace app to be compatible with both
> V4L2 API (the current one) and the legacy V4L1 one.
>
> It should be noticed that are still a few drivers using the legacy API yet to
> be converted.
>
If you have no objections then I will make a patchset which do followings:
1. Remove #if defined(CONFIG_VIDEO_V4L1_COMPAT) || !defined
(__KERNEL__) from include/linux/videodev.h
2. cover all #include <linux/videodev.h> with #ifdef
CONFIG_VIDEO_V4L1_COMPAT in kernel
By this way, we can satisfy both kernel space and userspace issue and
also get rid of above warnings.
If you have better suggestion then let me know.
Thanks,
--
JSR
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Confusion in usr/include/linux/videodev.h
2009-01-21 4:44 ` Jaswinder Singh Rajput
@ 2009-01-21 8:54 ` Trent Piepho
2009-01-21 8:59 ` Jaswinder Singh Rajput
0 siblings, 1 reply; 7+ messages in thread
From: Trent Piepho @ 2009-01-21 8:54 UTC (permalink / raw)
To: Jaswinder Singh Rajput
Cc: Mauro Carvalho Chehab, Jaswinder Singh Rajput, linux-media,
video4linux-list, Sam Ravnborg, Ingo Molnar, LKML
On Wed, 21 Jan 2009, Jaswinder Singh Rajput wrote:
> On Wed, Jan 21, 2009 at 7:20 AM, Mauro Carvalho Chehab
> <mchehab@infradead.org> wrote:
> > On Wed, 21 Jan 2009 07:10:38 +0530
> > Jaswinder Singh Rajput <jaswinder@kernel.org> wrote:
> >
> >> usr/include/linux/videodev.h is giving 2 warnings in 'make headers_check':
> >> usr/include/linux/videodev.h:19: leaks CONFIG_VIDEO to userspace where it is not valid
> >> usr/include/linux/videodev.h:314: leaks CONFIG_VIDEO to userspace where it is not valid
> >>
> >> Whole file is covered with #if defined(CONFIG_VIDEO_V4L1_COMPAT) || !defined (__KERNEL__)
> >>
> >> It means this file is only valid for kernel mode if CONFIG_VIDEO_V4L1_COMPAT is defined but in user mode it is always valid.
> >
> > V4L1 is the old deprecated userspace API for video devices. It is still
> > required by some userspace applications. So, on userspace, it should be
> > included. Also, this allows that one userspace app to be compatible with both
> > V4L2 API (the current one) and the legacy V4L1 one.
> >
> > It should be noticed that are still a few drivers using the legacy API yet to
> > be converted.
> >
>
> If you have no objections then I will make a patchset which do followings:
> 1. Remove #if defined(CONFIG_VIDEO_V4L1_COMPAT) || !defined
> (__KERNEL__) from include/linux/videodev.h
> 2. cover all #include <linux/videodev.h> with #ifdef
> CONFIG_VIDEO_V4L1_COMPAT in kernel
>
> By this way, we can satisfy both kernel space and userspace issue and
> also get rid of above warnings.
>
> If you have better suggestion then let me know.
That sounds like it will add a mess of #if's. How about this?
diff -r 29c5787efcda linux/include/linux/videodev.h
--- a/linux/include/linux/videodev.h Thu Jan 15 09:07:03 2009 -0800
+++ b/linux/include/linux/videodev.h Wed Jan 21 00:51:45 2009 -0800
@@ -15,7 +15,8 @@
#include <linux/ioctl.h>
#include <linux/videodev2.h>
-#if defined(CONFIG_VIDEO_V4L1_COMPAT) || !defined (__KERNEL__)
+#if (defined(__KERNEL__) && defined(CONFIG_VIDEO_V4L1_COMPAT)) \
+ || !defined (__KERNEL__)
#define VID_TYPE_CAPTURE 1 /* Can capture */
#define VID_TYPE_TUNER 2 /* Can tune */
Now CONFIG_VIDEO_V4L1_COMPAT will only be used in the kernel.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Confusion in usr/include/linux/videodev.h
2009-01-21 8:54 ` Trent Piepho
@ 2009-01-21 8:59 ` Jaswinder Singh Rajput
2009-01-21 9:09 ` Arnd Bergmann
0 siblings, 1 reply; 7+ messages in thread
From: Jaswinder Singh Rajput @ 2009-01-21 8:59 UTC (permalink / raw)
To: Trent Piepho
Cc: Mauro Carvalho Chehab, Jaswinder Singh Rajput, linux-media,
video4linux-list, Sam Ravnborg, Ingo Molnar, LKML
On Wed, Jan 21, 2009 at 2:24 PM, Trent Piepho <xyzzy@speakeasy.org> wrote:
> On Wed, 21 Jan 2009, Jaswinder Singh Rajput wrote:
>> On Wed, Jan 21, 2009 at 7:20 AM, Mauro Carvalho Chehab
>> <mchehab@infradead.org> wrote:
>> > On Wed, 21 Jan 2009 07:10:38 +0530
>> > Jaswinder Singh Rajput <jaswinder@kernel.org> wrote:
>> >
>> >> usr/include/linux/videodev.h is giving 2 warnings in 'make headers_check':
>> >> usr/include/linux/videodev.h:19: leaks CONFIG_VIDEO to userspace where it is not valid
>> >> usr/include/linux/videodev.h:314: leaks CONFIG_VIDEO to userspace where it is not valid
>> >>
>> >> Whole file is covered with #if defined(CONFIG_VIDEO_V4L1_COMPAT) || !defined (__KERNEL__)
>> >>
>> >> It means this file is only valid for kernel mode if CONFIG_VIDEO_V4L1_COMPAT is defined but in user mode it is always valid.
>> >
>> > V4L1 is the old deprecated userspace API for video devices. It is still
>> > required by some userspace applications. So, on userspace, it should be
>> > included. Also, this allows that one userspace app to be compatible with both
>> > V4L2 API (the current one) and the legacy V4L1 one.
>> >
>> > It should be noticed that are still a few drivers using the legacy API yet to
>> > be converted.
>> >
>>
>> If you have no objections then I will make a patchset which do followings:
>> 1. Remove #if defined(CONFIG_VIDEO_V4L1_COMPAT) || !defined
>> (__KERNEL__) from include/linux/videodev.h
>> 2. cover all #include <linux/videodev.h> with #ifdef
>> CONFIG_VIDEO_V4L1_COMPAT in kernel
>>
>> By this way, we can satisfy both kernel space and userspace issue and
>> also get rid of above warnings.
>>
>> If you have better suggestion then let me know.
>
> That sounds like it will add a mess of #if's. How about this?
>
> diff -r 29c5787efcda linux/include/linux/videodev.h
> --- a/linux/include/linux/videodev.h Thu Jan 15 09:07:03 2009 -0800
> +++ b/linux/include/linux/videodev.h Wed Jan 21 00:51:45 2009 -0800
> @@ -15,7 +15,8 @@
> #include <linux/ioctl.h>
> #include <linux/videodev2.h>
>
> -#if defined(CONFIG_VIDEO_V4L1_COMPAT) || !defined (__KERNEL__)
> +#if (defined(__KERNEL__) && defined(CONFIG_VIDEO_V4L1_COMPAT)) \
> + || !defined (__KERNEL__)
>
> #define VID_TYPE_CAPTURE 1 /* Can capture */
> #define VID_TYPE_TUNER 2 /* Can tune */
>
> Now CONFIG_VIDEO_V4L1_COMPAT will only be used in the kernel.
>
No, this will still give warnings.
Please run 'make headers_check'
--
JSR
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Confusion in usr/include/linux/videodev.h
2009-01-21 8:59 ` Jaswinder Singh Rajput
@ 2009-01-21 9:09 ` Arnd Bergmann
2009-01-21 9:51 ` Trent Piepho
0 siblings, 1 reply; 7+ messages in thread
From: Arnd Bergmann @ 2009-01-21 9:09 UTC (permalink / raw)
To: Jaswinder Singh Rajput
Cc: Trent Piepho, Mauro Carvalho Chehab, Jaswinder Singh Rajput,
linux-media, video4linux-list, Sam Ravnborg, Ingo Molnar, LKML
On Wednesday 21 January 2009, Jaswinder Singh Rajput wrote:
> > diff -r 29c5787efcda linux/include/linux/videodev.h
> > --- a/linux/include/linux/videodev.h Thu Jan 15 09:07:03 2009 -0800
> > +++ b/linux/include/linux/videodev.h Wed Jan 21 00:51:45 2009 -0800
> > @@ -15,7 +15,8 @@
> > #include <linux/ioctl.h>
> > #include <linux/videodev2.h>
> >
> > -#if defined(CONFIG_VIDEO_V4L1_COMPAT) || !defined (__KERNEL__)
> > +#if (defined(__KERNEL__) && defined(CONFIG_VIDEO_V4L1_COMPAT)) \
> > + || !defined (__KERNEL__)
> >
> > #define VID_TYPE_CAPTURE 1 /* Can capture */
> > #define VID_TYPE_TUNER 2 /* Can tune */
> >
> > Now CONFIG_VIDEO_V4L1_COMPAT will only be used in the kernel.
> >
>
> No, this will still give warnings.
You could #define another conditional, like this:
#ifndef __KERNEL__
# define __V4L1_COMPAT_API /* Always provide definitions to user space */
#else /* __KERNEL__ */
# ifdef CONFIG_VIDEO_V4L1_COMPAT
# define __V4L1_COMPAT_API
# endif /* CONFIG_VIDEO_V4L1_COMPAT /*
#endif /* __KERNEL__ */
Arnd <><
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Confusion in usr/include/linux/videodev.h
2009-01-21 9:09 ` Arnd Bergmann
@ 2009-01-21 9:51 ` Trent Piepho
0 siblings, 0 replies; 7+ messages in thread
From: Trent Piepho @ 2009-01-21 9:51 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Jaswinder Singh Rajput, Mauro Carvalho Chehab,
Jaswinder Singh Rajput, linux-media, video4linux-list,
Sam Ravnborg, Ingo Molnar, LKML
On Wed, 21 Jan 2009, Arnd Bergmann wrote:
> On Wednesday 21 January 2009, Jaswinder Singh Rajput wrote:
> > > diff -r 29c5787efcda linux/include/linux/videodev.h
> > > --- a/linux/include/linux/videodev.h Thu Jan 15 09:07:03 2009 -0800
> > > +++ b/linux/include/linux/videodev.h Wed Jan 21 00:51:45 2009 -0800
> > > @@ -15,7 +15,8 @@
> > > #include <linux/ioctl.h>
> > > #include <linux/videodev2.h>
> > >
> > > -#if defined(CONFIG_VIDEO_V4L1_COMPAT) || !defined (__KERNEL__)
> > > +#if (defined(__KERNEL__) && defined(CONFIG_VIDEO_V4L1_COMPAT)) \
> > > + || !defined (__KERNEL__)
> > >
> > > #define VID_TYPE_CAPTURE 1 /* Can capture */
> > > #define VID_TYPE_TUNER 2 /* Can tune */
> > >
> > > Now CONFIG_VIDEO_V4L1_COMPAT will only be used in the kernel.
> > >
> >
> > No, this will still give warnings.
>
> You could #define another conditional, like this:
>
> #ifndef __KERNEL__
> # define __V4L1_COMPAT_API /* Always provide definitions to user space */
> #else /* __KERNEL__ */
> # ifdef CONFIG_VIDEO_V4L1_COMPAT
> # define __V4L1_COMPAT_API
> # endif /* CONFIG_VIDEO_V4L1_COMPAT /*
> #endif /* __KERNEL__ */
I see what the real problem is now, the unifdef program isn't smart enough
to realize that it knows the result of !defined(__KERNEL__) || defined(FOO)
and so it keeps those ifdefs in when it should be able to remove them.
This works too:
#ifndef __KERNEL__
# define __V4L1_COMPAT_API /* Always provide definitions to user space */
#elif defined(CONFIG_VIDEO_V4L1_COMPAT) /* __KERNEL__ */
# define __V4L1_COMPAT_API
#endif /* CONFIG_VIDEO_V4L1_COMPAT */
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-01-21 9:51 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-21 1:40 Confusion in usr/include/linux/videodev.h Jaswinder Singh Rajput
2009-01-21 1:50 ` Mauro Carvalho Chehab
2009-01-21 4:44 ` Jaswinder Singh Rajput
2009-01-21 8:54 ` Trent Piepho
2009-01-21 8:59 ` Jaswinder Singh Rajput
2009-01-21 9:09 ` Arnd Bergmann
2009-01-21 9:51 ` Trent Piepho
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox