diff options
author | Jean-Francois Moine <moinejf@free.fr> | 2008-07-04 10:16:16 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-07-20 06:16:53 -0400 |
commit | a5ae2062252e697d38e53dbbeb91460252208914 (patch) | |
tree | 38706e9f36e2d93cd3dee8eea639bb74a17b3efa /drivers/media/video/gspca/stk014.c | |
parent | 54ab92ca05550550bcec2462de2605f35d079b66 (diff) |
V4L/DVB (8195): gspca: Input buffer overwritten in spca561 + cleanup code.
spca561: Input buffer may be changed on reg write.
(all sd): Cleanup code, 'const' added.
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/gspca/stk014.c')
-rw-r--r-- | drivers/media/video/gspca/stk014.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/drivers/media/video/gspca/stk014.c b/drivers/media/video/gspca/stk014.c index 6832fe0f3403..ad59c5ab5d90 100644 --- a/drivers/media/video/gspca/stk014.c +++ b/drivers/media/video/gspca/stk014.c | |||
@@ -23,8 +23,8 @@ | |||
23 | #include "gspca.h" | 23 | #include "gspca.h" |
24 | #include "jpeg.h" | 24 | #include "jpeg.h" |
25 | 25 | ||
26 | #define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0) | 26 | #define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4) |
27 | static const char version[] = "2.1.0"; | 27 | static const char version[] = "2.1.4"; |
28 | 28 | ||
29 | MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>"); | 29 | MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>"); |
30 | MODULE_DESCRIPTION("Syntek DV4000 (STK014) USB Camera Driver"); | 30 | MODULE_DESCRIPTION("Syntek DV4000 (STK014) USB Camera Driver"); |
@@ -54,7 +54,6 @@ static int sd_setfreq(struct gspca_dev *gspca_dev, __s32 val); | |||
54 | static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val); | 54 | static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val); |
55 | 55 | ||
56 | static struct ctrl sd_ctrls[] = { | 56 | static struct ctrl sd_ctrls[] = { |
57 | #define SD_BRIGHTNESS 0 | ||
58 | { | 57 | { |
59 | { | 58 | { |
60 | .id = V4L2_CID_BRIGHTNESS, | 59 | .id = V4L2_CID_BRIGHTNESS, |
@@ -63,12 +62,12 @@ static struct ctrl sd_ctrls[] = { | |||
63 | .minimum = 0, | 62 | .minimum = 0, |
64 | .maximum = 255, | 63 | .maximum = 255, |
65 | .step = 1, | 64 | .step = 1, |
66 | .default_value = 127, | 65 | #define BRIGHTNESS_DEF 127 |
66 | .default_value = BRIGHTNESS_DEF, | ||
67 | }, | 67 | }, |
68 | .set = sd_setbrightness, | 68 | .set = sd_setbrightness, |
69 | .get = sd_getbrightness, | 69 | .get = sd_getbrightness, |
70 | }, | 70 | }, |
71 | #define SD_CONTRAST 1 | ||
72 | { | 71 | { |
73 | { | 72 | { |
74 | .id = V4L2_CID_CONTRAST, | 73 | .id = V4L2_CID_CONTRAST, |
@@ -77,26 +76,26 @@ static struct ctrl sd_ctrls[] = { | |||
77 | .minimum = 0, | 76 | .minimum = 0, |
78 | .maximum = 255, | 77 | .maximum = 255, |
79 | .step = 1, | 78 | .step = 1, |
80 | .default_value = 127, | 79 | #define CONTRAST_DEF 127 |
80 | .default_value = CONTRAST_DEF, | ||
81 | }, | 81 | }, |
82 | .set = sd_setcontrast, | 82 | .set = sd_setcontrast, |
83 | .get = sd_getcontrast, | 83 | .get = sd_getcontrast, |
84 | }, | 84 | }, |
85 | #define SD_COLOR 2 | ||
86 | { | 85 | { |
87 | { | 86 | { |
88 | .id = V4L2_CID_SATURATION, | 87 | .id = V4L2_CID_SATURATION, |
89 | .type = V4L2_CTRL_TYPE_INTEGER, | 88 | .type = V4L2_CTRL_TYPE_INTEGER, |
90 | .name = "Saturation", | 89 | .name = "Color", |
91 | .minimum = 0, | 90 | .minimum = 0, |
92 | .maximum = 255, | 91 | .maximum = 255, |
93 | .step = 1, | 92 | .step = 1, |
94 | .default_value = 127, | 93 | #define COLOR_DEF 127 |
94 | .default_value = COLOR_DEF, | ||
95 | }, | 95 | }, |
96 | .set = sd_setcolors, | 96 | .set = sd_setcolors, |
97 | .get = sd_getcolors, | 97 | .get = sd_getcolors, |
98 | }, | 98 | }, |
99 | #define SD_FREQ 3 | ||
100 | { | 99 | { |
101 | { | 100 | { |
102 | .id = V4L2_CID_POWER_LINE_FREQUENCY, | 101 | .id = V4L2_CID_POWER_LINE_FREQUENCY, |
@@ -105,7 +104,8 @@ static struct ctrl sd_ctrls[] = { | |||
105 | .minimum = 1, | 104 | .minimum = 1, |
106 | .maximum = 2, /* 0: 0, 1: 50Hz, 2:60Hz */ | 105 | .maximum = 2, /* 0: 0, 1: 50Hz, 2:60Hz */ |
107 | .step = 1, | 106 | .step = 1, |
108 | .default_value = 1, | 107 | #define FREQ_DEF 1 |
108 | .default_value = FREQ_DEF, | ||
109 | }, | 109 | }, |
110 | .set = sd_setfreq, | 110 | .set = sd_setfreq, |
111 | .get = sd_getfreq, | 111 | .get = sd_getfreq, |
@@ -296,10 +296,10 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
296 | cam->epaddr = 0x02; | 296 | cam->epaddr = 0x02; |
297 | gspca_dev->cam.cam_mode = vga_mode; | 297 | gspca_dev->cam.cam_mode = vga_mode; |
298 | gspca_dev->cam.nmodes = sizeof vga_mode / sizeof vga_mode[0]; | 298 | gspca_dev->cam.nmodes = sizeof vga_mode / sizeof vga_mode[0]; |
299 | sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value; | 299 | sd->brightness = BRIGHTNESS_DEF; |
300 | sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value; | 300 | sd->contrast = CONTRAST_DEF; |
301 | sd->colors = sd_ctrls[SD_COLOR].qctrl.default_value; | 301 | sd->colors = COLOR_DEF; |
302 | sd->lightfreq = sd_ctrls[SD_FREQ].qctrl.default_value; | 302 | sd->lightfreq = FREQ_DEF; |
303 | return 0; | 303 | return 0; |
304 | } | 304 | } |
305 | 305 | ||
@@ -408,7 +408,7 @@ static void sd_close(struct gspca_dev *gspca_dev) | |||
408 | 408 | ||
409 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, | 409 | static void sd_pkt_scan(struct gspca_dev *gspca_dev, |
410 | struct gspca_frame *frame, /* target */ | 410 | struct gspca_frame *frame, /* target */ |
411 | unsigned char *data, /* isoc packet */ | 411 | __u8 *data, /* isoc packet */ |
412 | int len) /* iso packet length */ | 412 | int len) /* iso packet length */ |
413 | { | 413 | { |
414 | static unsigned char ffd9[] = {0xff, 0xd9}; | 414 | static unsigned char ffd9[] = {0xff, 0xd9}; |
@@ -518,10 +518,10 @@ static int sd_querymenu(struct gspca_dev *gspca_dev, | |||
518 | case V4L2_CID_POWER_LINE_FREQUENCY: | 518 | case V4L2_CID_POWER_LINE_FREQUENCY: |
519 | switch (menu->index) { | 519 | switch (menu->index) { |
520 | case 1: /* V4L2_CID_POWER_LINE_FREQUENCY_50HZ */ | 520 | case 1: /* V4L2_CID_POWER_LINE_FREQUENCY_50HZ */ |
521 | strcpy(menu->name, "50 Hz"); | 521 | strcpy((char *) menu->name, "50 Hz"); |
522 | return 0; | 522 | return 0; |
523 | case 2: /* V4L2_CID_POWER_LINE_FREQUENCY_60HZ */ | 523 | case 2: /* V4L2_CID_POWER_LINE_FREQUENCY_60HZ */ |
524 | strcpy(menu->name, "60 Hz"); | 524 | strcpy((char *) menu->name, "60 Hz"); |
525 | return 0; | 525 | return 0; |
526 | } | 526 | } |
527 | break; | 527 | break; |