public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH]video:gspca.c Fix  warning: case value '7' not in enumerated type 'enum v4l2_memory'
@ 2010-07-08  4:46 Justin P. Mattock
  2010-07-08  6:40 ` Jean-Francois Moine
  0 siblings, 1 reply; 3+ messages in thread
From: Justin P. Mattock @ 2010-07-08  4:46 UTC (permalink / raw)
  To: linux-media; +Cc: moinejf, mchehab, linux-kernel, Justin P. Mattock

This fixes a warning I'm seeing when building:
  CC [M]  drivers/media/video/gspca/gspca.o
drivers/media/video/gspca/gspca.c: In function 'vidioc_reqbufs':
drivers/media/video/gspca/gspca.c:1508:2: warning: case value '7' not in enumerated type 'enum v4l2_memory'

Signed-off-by: Justin P. Mattock <justinmattock@gmail.com>

---
 drivers/media/video/gspca/gspca.c |    1 -
 include/linux/videodev2.h         |    1 +
 2 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c
index 678675b..a9b4d97 100644
--- a/drivers/media/video/gspca/gspca.c
+++ b/drivers/media/video/gspca/gspca.c
@@ -84,7 +84,6 @@ static void PDEBUG_MODE(char *txt, __u32 pixfmt, int w, int h)
 
 /* specific memory types - !! should be different from V4L2_MEMORY_xxx */
 #define GSPCA_MEMORY_NO 0	/* V4L2_MEMORY_xxx starts from 1 */
-#define GSPCA_MEMORY_READ 7
 
 #define BUF_ALL_FLAGS (V4L2_BUF_FLAG_QUEUED | V4L2_BUF_FLAG_DONE)
 
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 047f7e6..b73aa18 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -170,6 +170,7 @@ enum v4l2_memory {
 	V4L2_MEMORY_MMAP             = 1,
 	V4L2_MEMORY_USERPTR          = 2,
 	V4L2_MEMORY_OVERLAY          = 3,
+	GSPCA_MEMORY_READ 	     = 7,
 };
 
 /* see also http://vektor.theorem.ca/graphics/ycbcr/ */
-- 
1.7.1.rc1.21.gf3bd6


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

* Re: [PATCH]video:gspca.c Fix  warning: case value '7' not in enumerated type 'enum v4l2_memory'
  2010-07-08  4:46 [PATCH]video:gspca.c Fix warning: case value '7' not in enumerated type 'enum v4l2_memory' Justin P. Mattock
@ 2010-07-08  6:40 ` Jean-Francois Moine
  2010-07-08  7:21   ` Justin P. Mattock
  0 siblings, 1 reply; 3+ messages in thread
From: Jean-Francois Moine @ 2010-07-08  6:40 UTC (permalink / raw)
  To: Justin P. Mattock; +Cc: linux-media, mchehab, linux-kernel

On Wed,  7 Jul 2010 21:46:18 -0700
"Justin P. Mattock" <justinmattock@gmail.com> wrote:

> This fixes a warning I'm seeing when building:
>   CC [M]  drivers/media/video/gspca/gspca.o
> drivers/media/video/gspca/gspca.c: In function 'vidioc_reqbufs':
> drivers/media/video/gspca/gspca.c:1508:2: warning: case value '7' not
> in enumerated type 'enum v4l2_memory'

Hi Justin,

I don't agree with your patch: the value GSPCA_MEMORY_READ must not be
seen by user applications.

The warning may be simply fixed by (change the line numbers):

--- gspca.c~	2010-07-08 08:15:14.000000000 +0200
+++ gspca.c	2010-07-08 08:28:52.000000000 +0200
@@ -1467,7 +1467,8 @@ static int vidioc_reqbufs(struct file *f
 	struct gspca_dev *gspca_dev = priv;
 	int i, ret = 0, streaming;
 
-	switch (rb->memory) {
+	i = rb->memory;			/* (avoid compilation warning) */
+	switch (i) {
 	case GSPCA_MEMORY_READ:			/* (internal call) */
 	case V4L2_MEMORY_MMAP:
 	case V4L2_MEMORY_USERPTR:

Cheers.

-- 
Ken ar c'hentañ	|	      ** Breizh ha Linux atav! **
Jef		|		http://moinejf.free.fr/

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

* Re: [PATCH]video:gspca.c Fix  warning: case value '7' not in enumerated type 'enum v4l2_memory'
  2010-07-08  6:40 ` Jean-Francois Moine
@ 2010-07-08  7:21   ` Justin P. Mattock
  0 siblings, 0 replies; 3+ messages in thread
From: Justin P. Mattock @ 2010-07-08  7:21 UTC (permalink / raw)
  To: Jean-Francois Moine; +Cc: linux-media, mchehab, linux-kernel

On 07/07/2010 11:40 PM, Jean-Francois Moine wrote:
> On Wed,  7 Jul 2010 21:46:18 -0700
> "Justin P. Mattock"<justinmattock@gmail.com>  wrote:
>
>> This fixes a warning I'm seeing when building:
>>    CC [M]  drivers/media/video/gspca/gspca.o
>> drivers/media/video/gspca/gspca.c: In function 'vidioc_reqbufs':
>> drivers/media/video/gspca/gspca.c:1508:2: warning: case value '7' not
>> in enumerated type 'enum v4l2_memory'
>
> Hi Justin,
>
> I don't agree with your patch: the value GSPCA_MEMORY_READ must not be
> seen by user applications.
>
> The warning may be simply fixed by (change the line numbers):
>
> --- gspca.c~	2010-07-08 08:15:14.000000000 +0200
> +++ gspca.c	2010-07-08 08:28:52.000000000 +0200
> @@ -1467,7 +1467,8 @@ static int vidioc_reqbufs(struct file *f
>   	struct gspca_dev *gspca_dev = priv;
>   	int i, ret = 0, streaming;
>
> -	switch (rb->memory) {
> +	i = rb->memory;			/* (avoid compilation warning) */
> +	switch (i) {
>   	case GSPCA_MEMORY_READ:			/* (internal call) */
>   	case V4L2_MEMORY_MMAP:
>   	case V4L2_MEMORY_USERPTR:
>
> Cheers.
>


o.k. buddy.. make sense with the userspace etc..
Anyways looks good, builds without a warning..

Tested-By: Justin P. Mattock <justinmattock@gmail.com>

cheers as well,

Justin P. Mattock

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

end of thread, other threads:[~2010-07-08  7:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-08  4:46 [PATCH]video:gspca.c Fix warning: case value '7' not in enumerated type 'enum v4l2_memory' Justin P. Mattock
2010-07-08  6:40 ` Jean-Francois Moine
2010-07-08  7:21   ` Justin P. Mattock

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