[PATCH] media/usb: cx231xx-pcb-cfg.h: Remove unused enum _true_false.

2013-02-21 Thread Thiago Farina
Signed-off-by: Thiago Farina tfar...@chromium.org
---
 drivers/media/usb/cx231xx/cx231xx-pcb-cfg.h | 5 -
 1 file changed, 5 deletions(-)

diff --git a/drivers/media/usb/cx231xx/cx231xx-pcb-cfg.h 
b/drivers/media/usb/cx231xx/cx231xx-pcb-cfg.h
index f5e46e8..b3c6190 100644
--- a/drivers/media/usb/cx231xx/cx231xx-pcb-cfg.h
+++ b/drivers/media/usb/cx231xx/cx231xx-pcb-cfg.h
@@ -68,11 +68,6 @@ enum USB_SPEED{
HIGH_SPEED = 0x1/* 1: high speed */
 };
 
-enum _true_false{
-   FALSE = 0,
-   TRUE = 1
-};
-
 #define TS_MASK 0x6
 enum TS_PORT{
NO_TS_PORT = 0x0,   /* 2'b00: Neither port used. PCB not a Hybrid,
-- 
1.8.1.151.g32238ae

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/1] wl128x: Remove unused NO_OF_ENTRIES_IN_ARRAY macro.

2011-04-03 Thread Thiago Farina
Signed-off-by: Thiago Farina tfrans...@gmail.com
---
 drivers/media/radio/wl128x/fmdrv.h |2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/media/radio/wl128x/fmdrv.h 
b/drivers/media/radio/wl128x/fmdrv.h
index 5db6fd1..1a45a5d 100644
--- a/drivers/media/radio/wl128x/fmdrv.h
+++ b/drivers/media/radio/wl128x/fmdrv.h
@@ -55,8 +55,6 @@
 #define FM_DRV_TX_TIMEOUT  (5*HZ)  /* 5 seconds */
 #define FM_DRV_RX_SEEK_TIMEOUT (20*HZ) /* 20 seconds */
 
-#define NO_OF_ENTRIES_IN_ARRAY(array) (sizeof(array) / sizeof(array[0]))
-
 #define fmerr(format, ...) \
printk(KERN_ERR fmdrv:  format, ## __VA_ARGS__)
 #define fmwarn(format, ...) \
-- 
1.7.3.2.343.g7d43d

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] drivers/media/video/v4l2-compat-ioctl32.c: Check the return value of copy_to_user

2010-12-21 Thread Thiago Farina
On Tue, Dec 21, 2010 at 4:25 PM, Arnd Bergmann a...@arndb.de wrote:
 On Tuesday 21 December 2010 02:18:06 Thiago Farina wrote:
 diff --git a/drivers/media/video/v4l2-compat-ioctl32.c 
 b/drivers/media/video/v4l2-compat-ioctl32.c
 index e30e8df..55825ec 100644
 --- a/drivers/media/video/v4l2-compat-ioctl32.c
 +++ b/drivers/media/video/v4l2-compat-ioctl32.c
 @@ -206,7 +206,9 @@ static struct video_code __user *get_microcode32(struct 
 video_code32 *kp)
          * user address is invalid, the native ioctl will do
          * the error handling for us
          */
 -       (void) copy_to_user(up-loadwhat, kp-loadwhat, 
 sizeof(up-loadwhat));
 +       if (copy_to_user(up-loadwhat, kp-loadwhat, sizeof(up-loadwhat)))
 +               return NULL;
 +
         (void) put_user(kp-datasize, up-datasize);
         (void) put_user(compat_ptr(kp-data), up-data);
         return up;

 Did you read the comment above the code you changed?

Yes, I read, but I went ahead.

 You can probably change this function to look at the return code of
 copy_to_user, but then you need to treat the put_user return code
 the same, and change the comment.


Right, I will do the same with put_user, but I'm afraid of changing the comment.
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] drivers/media/video/v4l2-compat-ioctl32.c: Check the return value of copy_to_user

2010-12-21 Thread Thiago Farina
This fix the following warning:
drivers/media/video/v4l2-compat-ioctl32.c: In function ‘get_microcode32’:
drivers/media/video/v4l2-compat-ioctl32.c:209: warning: ignoring return value 
of ‘copy_to_user’, declared with attribute warn_unused_result

Signed-off-by: Thiago Farina tfrans...@gmail.com
---
 Changes from v1:
 - Check the return code of put_user too.
 - Remove the obsolete comment.

 drivers/media/video/v4l2-compat-ioctl32.c |   14 ++
 1 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/media/video/v4l2-compat-ioctl32.c 
b/drivers/media/video/v4l2-compat-ioctl32.c
index e30e8df..6f2a022 100644
--- a/drivers/media/video/v4l2-compat-ioctl32.c
+++ b/drivers/media/video/v4l2-compat-ioctl32.c
@@ -201,14 +201,12 @@ static struct video_code __user *get_microcode32(struct 
video_code32 *kp)
 
up = compat_alloc_user_space(sizeof(*up));
 
-   /*
-* NOTE! We don't actually care if these fail. If the
-* user address is invalid, the native ioctl will do
-* the error handling for us
-*/
-   (void) copy_to_user(up-loadwhat, kp-loadwhat, sizeof(up-loadwhat));
-   (void) put_user(kp-datasize, up-datasize);
-   (void) put_user(compat_ptr(kp-data), up-data);
+   if (copy_to_user(up-loadwhat, kp-loadwhat, sizeof(up-loadwhat)))
+   return NULL;
+   if (put_user(kp-datasize, up-datasize))
+   return NULL;
+   if (put_user(compat_ptr(kp-data), up-data))
+   return NULL;
return up;
 }
 
-- 
1.7.3.2.343.g7d43d

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] dvb-core: remove unnecessary casting of kmalloc.

2010-01-16 Thread Thiago Farina
Signed-off-by: Thiago Farina tfrans...@gmail.com
---
 drivers/media/dvb/dvb-core/dvb_frontend.c |6 ++
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c 
b/drivers/media/dvb/dvb-core/dvb_frontend.c
index 0746122..8eb4a3b 100644
--- a/drivers/media/dvb/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -1536,8 +1536,7 @@ static int dvb_frontend_ioctl_properties(struct inode 
*inode, struct file *file,
if ((tvps-num == 0) || (tvps-num  DTV_IOCTL_MAX_MSGS))
return -EINVAL;
 
-   tvp = (struct dtv_property *) kmalloc(tvps-num *
-   sizeof(struct dtv_property), GFP_KERNEL);
+   tvp = kmalloc(tvps-num * sizeof(struct dtv_property), 
GFP_KERNEL);
if (!tvp) {
err = -ENOMEM;
goto out;
@@ -1569,8 +1568,7 @@ static int dvb_frontend_ioctl_properties(struct inode 
*inode, struct file *file,
if ((tvps-num == 0) || (tvps-num  DTV_IOCTL_MAX_MSGS))
return -EINVAL;
 
-   tvp = (struct dtv_property *) kmalloc(tvps-num *
-   sizeof(struct dtv_property), GFP_KERNEL);
+   tvp = kmalloc(tvps-num * sizeof(struct dtv_property), 
GFP_KERNEL);
if (!tvp) {
err = -ENOMEM;
goto out;
-- 
1.6.6.103.g699d2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] cpia2: use __stringify macro.

2009-11-29 Thread Thiago Farina
Signed-off-by: Thiago Farina tfrans...@gmail.com
---
 drivers/media/video/cpia2/cpia2_v4l.c |   27 +++
 1 files changed, 11 insertions(+), 16 deletions(-)

diff --git a/drivers/media/video/cpia2/cpia2_v4l.c 
b/drivers/media/video/cpia2/cpia2_v4l.c
index 0b4a8f3..6c5fcd8 100644
--- a/drivers/media/video/cpia2/cpia2_v4l.c
+++ b/drivers/media/video/cpia2/cpia2_v4l.c
@@ -38,17 +38,12 @@
 #include linux/slab.h
 #include linux/init.h
 #include linux/videodev.h
+#include linux/stringify.h
 #include media/v4l2-ioctl.h
 
 #include cpia2.h
 #include cpia2dev.h
 
-
-//#define _CPIA2_DEBUG_
-
-#define MAKE_STRING_1(x)   #x
-#define MAKE_STRING(x) MAKE_STRING_1(x)
-
 static int video_nr = -1;
 module_param(video_nr, int, 0);
 MODULE_PARM_DESC(video_nr,video device to register (0=/dev/video0, etc));
@@ -60,26 +55,26 @@ MODULE_PARM_DESC(buffer_size, Size for each frame buffer 
in bytes (default 68k)
 static int num_buffers = 3;
 module_param(num_buffers, int, 0);
 MODULE_PARM_DESC(num_buffers, Number of frame buffers (1-
-MAKE_STRING(VIDEO_MAX_FRAME) , default 3));
+__stringify(VIDEO_MAX_FRAME) , default 3));
 
 static int alternate = DEFAULT_ALT;
 module_param(alternate, int, 0);
-MODULE_PARM_DESC(alternate, USB Alternate ( MAKE_STRING(USBIF_ISO_1) -
-MAKE_STRING(USBIF_ISO_6) , default 
-MAKE_STRING(DEFAULT_ALT) ));
+MODULE_PARM_DESC(alternate, USB Alternate ( __stringify(USBIF_ISO_1) -
+__stringify(USBIF_ISO_6) , default 
+__stringify(DEFAULT_ALT) ));
 
 static int flicker_freq = 60;
 module_param(flicker_freq, int, 0);
-MODULE_PARM_DESC(flicker_freq, Flicker frequency ( MAKE_STRING(50) or
-MAKE_STRING(60) , default 
-MAKE_STRING(60) ));
+MODULE_PARM_DESC(flicker_freq, Flicker frequency ( __stringify(50) or
+__stringify(60) , default 
+__stringify(60) ));
 
 static int flicker_mode = NEVER_FLICKER;
 module_param(flicker_mode, int, 0);
 MODULE_PARM_DESC(flicker_mode,
-Flicker supression ( MAKE_STRING(NEVER_FLICKER) or
-MAKE_STRING(ANTI_FLICKER_ON) , default 
-MAKE_STRING(NEVER_FLICKER) ));
+Flicker supression ( __stringify(NEVER_FLICKER) or
+__stringify(ANTI_FLICKER_ON) , default 
+__stringify(NEVER_FLICKER) ));
 
 MODULE_AUTHOR(Steve Miller (STMicroelectronics) steve.mil...@st.com);
 MODULE_DESCRIPTION(V4L-driver for STMicroelectronics CPiA2 based cameras);
-- 
1.6.6.rc0.61.g41d5b

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html