Commit a5ae2062 authored by Jean-Francois Moine's avatar Jean-Francois Moine Committed by Mauro Carvalho Chehab

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: default avatarJean-Francois Moine <moinejf@free.fr>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 54ab92ca
No related merge requests found
This diff is collapsed.
This diff is collapsed.
......@@ -247,7 +247,7 @@ static void isoc_transfer(struct gspca_dev *gspca_dev)
struct gspca_frame *gspca_frame_add(struct gspca_dev *gspca_dev,
int packet_type,
struct gspca_frame *frame,
__u8 *data,
const __u8 *data,
int len)
{
int i, j;
......@@ -1053,7 +1053,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv,
struct v4l2_control *ctrl)
{
struct gspca_dev *gspca_dev = priv;
struct ctrl *ctrls;
const struct ctrl *ctrls;
int i, ret;
for (i = 0, ctrls = gspca_dev->sd_desc->ctrls;
......@@ -1079,7 +1079,7 @@ static int vidioc_g_ctrl(struct file *file, void *priv,
{
struct gspca_dev *gspca_dev = priv;
struct ctrl *ctrls;
const struct ctrl *ctrls;
int i, ret;
for (i = 0, ctrls = gspca_dev->sd_desc->ctrls;
......
......@@ -9,25 +9,6 @@
#include <media/v4l2-common.h>
#include <linux/mutex.h>
/* values in 2.6.27 */
#ifndef V4L2_PIX_FMT_SPCA501
#define V4L2_PIX_FMT_SPCA501 v4l2_fourcc('S', '5', '0', '1')
#endif
#ifndef V4L2_PIX_FMT_SPCA561
#define V4L2_PIX_FMT_SPCA561 v4l2_fourcc('S', '5', '6', '1')
#endif
/* values in 2.6.26 */
#ifndef V4L2_CID_POWER_LINE_FREQUENCY
#define V4L2_CID_POWER_LINE_FREQUENCY (V4L2_CID_BASE+24)
#endif
#ifndef V4L2_CID_WHITE_BALANCE_TEMPERATURE
#define V4L2_CID_WHITE_BALANCE_TEMPERATURE (V4L2_CID_BASE + 26)
#endif
#ifndef V4L2_CID_SHARPNESS
#define V4L2_CID_SHARPNESS (V4L2_CID_BASE+27)
#endif
#ifdef CONFIG_VIDEO_ADV_DEBUG
/* GSPCA our debug messages */
extern int gspca_debug;
......@@ -76,7 +57,6 @@ struct cam_mode {
short width;
short height;
short mode; /* subdriver value */
short reserved; /* subdriver value */
};
struct cam {
char *dev_name;
......@@ -110,9 +90,9 @@ struct ctrl {
/* subdriver description */
struct sd_desc {
/* information */
char *name; /* sub-driver name */
const char *name; /* sub-driver name */
/* controls */
struct ctrl *ctrls;
const struct ctrl *ctrls;
int nctrls;
/* operations */
cam_cf_op config; /* called on probe */
......@@ -195,6 +175,6 @@ void gspca_disconnect(struct usb_interface *intf);
struct gspca_frame *gspca_frame_add(struct gspca_dev *gspca_dev,
int packet_type,
struct gspca_frame *frame,
__u8 *data,
const __u8 *data,
int len);
#endif /* GSPCAV2_H */
......@@ -24,8 +24,8 @@
#include "gspca.h"
#include "jpeg.h"
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0)
static const char version[] = "2.1.0";
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4)
static const char version[] = "2.1.4";
MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
MODULE_DESCRIPTION("GSPCA/Mars USB Camera Driver");
......@@ -140,7 +140,8 @@ static void sd_start(struct gspca_dev *gspca_dev)
__u16 MI_buf[242];
int h_size, v_size;
int intpipe;
/* struct usb_device *dev = pcam->dev; */
/* struct usb_device *dev = pcam->dev; */
memset(data, 0, sizeof data);
memset(MI_buf, 0, sizeof MI_buf);
......@@ -351,7 +352,7 @@ static void sd_close(struct gspca_dev *gspca_dev)
static void sd_pkt_scan(struct gspca_dev *gspca_dev,
struct gspca_frame *frame, /* target */
unsigned char *data, /* isoc packet */
__u8 *data, /* isoc packet */
int len) /* iso packet length */
{
struct sd *sd = (struct sd *) gspca_dev;
......@@ -389,7 +390,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
}
/* sub-driver description */
static struct sd_desc sd_desc = {
static const struct sd_desc sd_desc = {
.name = MODULE_NAME,
.ctrls = sd_ctrls,
.nctrls = ARRAY_SIZE(sd_ctrls),
......@@ -404,7 +405,7 @@ static struct sd_desc sd_desc = {
/* -- module initialisation -- */
#define DVNM(name) .driver_info = (kernel_ulong_t) name
static __devinitdata struct usb_device_id device_table[] = {
static const __devinitdata struct usb_device_id device_table[] = {
{USB_DEVICE(0x093a, 0x050f), DVNM("Mars-Semi Pc-Camera")},
{}
};
......
......@@ -24,8 +24,8 @@
#include "gspca.h"
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0)
static const char version[] = "2.1.0";
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4)
static const char version[] = "2.1.4";
MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>");
MODULE_DESCRIPTION("OV519 USB Camera Driver");
......@@ -266,15 +266,15 @@ static unsigned char ov7670_abs_to_sm(unsigned char v)
static int reg_w(struct sd *sd, __u16 index, __u8 value)
{
int ret;
__u8 buf[4];
__u8 data;
buf[0] = value;
data = value;
ret = usb_control_msg(sd->gspca_dev.dev,
usb_sndctrlpipe(sd->gspca_dev.dev, 0),
1, /* REQ_IO (ov518/519) */
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
0, index,
&buf[0], 1, 500);
&data, 1, 500);
if (ret < 0)
PDEBUG(D_ERR, "Write reg [%02x] %02x failed", index, value);
return ret;
......@@ -285,16 +285,16 @@ static int reg_w(struct sd *sd, __u16 index, __u8 value)
static int reg_r(struct sd *sd, __u16 index)
{
int ret;
__u8 buf[4];
__u8 data;
ret = usb_control_msg(sd->gspca_dev.dev,
usb_rcvctrlpipe(sd->gspca_dev.dev, 0),
1, /* REQ_IO */
USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
0, index, &buf[0], 1, 500);
0, index, &data, 1, 500);
if (ret >= 0)
ret = buf[0];
ret = data;
else
PDEBUG(D_ERR, "Read reg [0x%02x] failed", index);
return ret;
......@@ -302,7 +302,7 @@ static int reg_r(struct sd *sd, __u16 index)
/* Read 8 values from a OV519 register */
static int reg_r8(struct sd *sd,
__u16 index)
__u16 index)
{
int ret;
__u8 buf[8];
......@@ -528,7 +528,7 @@ struct ov_i2c_regvals {
};
static int write_regvals(struct sd *sd,
struct ov_regvals *regvals,
const struct ov_regvals *regvals,
int n)
{
int rc;
......@@ -543,7 +543,7 @@ static int write_regvals(struct sd *sd,
}
static int write_i2c_regvals(struct sd *sd,
struct ov_i2c_regvals *regvals,
const struct ov_i2c_regvals *regvals,
int n)
{
int rc;
......@@ -569,7 +569,7 @@ static int write_i2c_regvals(struct sd *sd,
static int ov8xx0_configure(struct sd *sd)
{
int rc;
static struct ov_i2c_regvals norm_8610[] = {
static const struct ov_i2c_regvals norm_8610[] = {
{ 0x12, 0x80 },
{ 0x00, 0x00 },
{ 0x01, 0x80 },
......@@ -707,7 +707,7 @@ static int ov7xx0_configure(struct sd *sd)
* 0x05 (old driver setting): very overexposed, too much
* contrast
*/
static struct ov_i2c_regvals norm_7610[] = {
static const struct ov_i2c_regvals norm_7610[] = {
{ 0x10, 0xff },
{ 0x16, 0x06 },
{ 0x28, 0x24 },
......@@ -737,7 +737,7 @@ static int ov7xx0_configure(struct sd *sd)
{ 0x0d, 0x24 },
};
static struct ov_i2c_regvals norm_7620[] = {
static const struct ov_i2c_regvals norm_7620[] = {
{ 0x00, 0x00 }, /* gain */
{ 0x01, 0x80 }, /* blue gain */
{ 0x02, 0x80 }, /* red gain */
......@@ -804,14 +804,14 @@ static int ov7xx0_configure(struct sd *sd)
};
/* 7640 and 7648. The defaults should be OK for most registers. */
static struct ov_i2c_regvals norm_7640[] = {
static const struct ov_i2c_regvals norm_7640[] = {
{ 0x12, 0x80 },
{ 0x12, 0x14 },
};
/* 7670. Defaults taken from OmniVision provided data,
* as provided by Jonathan Corbet of OLPC */
static struct ov_i2c_regvals norm_7670[] = {
static const struct ov_i2c_regvals norm_7670[] = {
{ OV7670_REG_COM7, OV7670_COM7_RESET },
{ OV7670_REG_TSLB, 0x04 }, /* OV */
{ OV7670_REG_COM7, OV7670_COM7_FMT_VGA }, /* VGA */
......@@ -1075,7 +1075,7 @@ static int ov7xx0_configure(struct sd *sd)
static int ov6xx0_configure(struct sd *sd)
{
int rc;
static struct ov_i2c_regvals norm_6x20[] = {
static const struct ov_i2c_regvals norm_6x20[] = {
{ 0x12, 0x80 }, /* reset */
{ 0x11, 0x01 },
{ 0x03, 0x60 },
......@@ -1118,7 +1118,7 @@ static int ov6xx0_configure(struct sd *sd)
/* Toggle 0x12[2] off and on here? */
};
static struct ov_i2c_regvals norm_6x30[] = {
static const struct ov_i2c_regvals norm_6x30[] = {
{ 0x12, 0x80 }, /* Reset */
{ 0x00, 0x1f }, /* Gain */
{ 0x01, 0x99 }, /* Blue gain */
......@@ -1284,7 +1284,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
struct cam *cam;
/* (from ov519_configure) */
static struct ov_regvals init_519[] = {
static const struct ov_regvals init_519[] = {
{ 0x5a, 0x6d }, /* EnableSystem */
/* jfm trace usbsnoop3-1.txt */
/* jfm 53 = fb */
......@@ -1302,8 +1302,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
/* windows reads 0x55 at this point*/
};
if (write_regvals(sd, init_519,
sizeof init_519 / sizeof init_519[0]))
if (write_regvals(sd, init_519, ARRAY_SIZE(init_519)))
goto error;
/* jfm: not seen in windows trace */
if (ov519_init_compression(sd))
......@@ -1389,7 +1388,7 @@ static int sd_open(struct gspca_dev *gspca_dev)
static int ov519_mode_init_regs(struct sd *sd,
int width, int height)
{
static struct ov_regvals mode_init_519_ov7670[] = {
static const struct ov_regvals mode_init_519_ov7670[] = {
{ 0x5d, 0x03 }, /* Turn off suspend mode */
{ 0x53, 0x9f }, /* was 9b in 1.65-1.08 */
{ 0x54, 0x0f }, /* bit2 (jpeg enable) */
......@@ -1412,7 +1411,7 @@ static int ov519_mode_init_regs(struct sd *sd,
/* windows reads 0x55 at this point, why? */
};
static struct ov_regvals mode_init_519[] = {
static const struct ov_regvals mode_init_519[] = {
{ 0x5d, 0x03 }, /* Turn off suspend mode */
{ 0x53, 0x9f }, /* was 9b in 1.65-1.08 */
{ 0x54, 0x0f }, /* bit2 (jpeg enable) */
......@@ -1448,12 +1447,11 @@ static int ov519_mode_init_regs(struct sd *sd,
/******** Set the mode ********/
if (sd->sensor != SEN_OV7670) {
if (write_regvals(sd, mode_init_519,
sizeof mode_init_519 / sizeof mode_init_519[0]))
ARRAY_SIZE(mode_init_519)))
return -EIO;
} else {
if (write_regvals(sd, mode_init_519_ov7670,
sizeof mode_init_519_ov7670
/ sizeof mode_init_519_ov7670[0]))
ARRAY_SIZE(mode_init_519_ov7670)))
return -EIO;
}
......@@ -1883,7 +1881,7 @@ static void sd_close(struct gspca_dev *gspca_dev)
static void sd_pkt_scan(struct gspca_dev *gspca_dev,
struct gspca_frame *frame, /* target */
unsigned char *data, /* isoc packet */
__u8 *data, /* isoc packet */
int len) /* iso packet length */
{
/* Header of ov519 is 16 bytes:
......@@ -1982,7 +1980,7 @@ static void setcontrast(struct gspca_dev *gspca_dev)
case SEN_OV6630:
i2c_w_mask(sd, OV7610_REG_CNT, val >> 4, 0x0f);
case SEN_OV8610: {
static __u8 ctab[] = {
static const __u8 ctab[] = {
0x03, 0x09, 0x0b, 0x0f, 0x53, 0x6f, 0x35, 0x7f
};
......@@ -1991,7 +1989,7 @@ static void setcontrast(struct gspca_dev *gspca_dev)
break;
}
case SEN_OV7620: {
static __u8 ctab[] = {
static const __u8 ctab[] = {
0x01, 0x05, 0x09, 0x11, 0x15, 0x35, 0x37, 0x57,
0x5b, 0xa5, 0xa7, 0xc7, 0xc9, 0xcf, 0xef, 0xff
};
......@@ -2104,7 +2102,7 @@ static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val)
}
/* sub-driver description */
static struct sd_desc sd_desc = {
static const struct sd_desc sd_desc = {
.name = MODULE_NAME,
.ctrls = sd_ctrls,
.nctrls = ARRAY_SIZE(sd_ctrls),
......@@ -2119,7 +2117,7 @@ static struct sd_desc sd_desc = {
/* -- module initialisation -- */
#define DVNM(name) .driver_info = (kernel_ulong_t) name
static __devinitdata struct usb_device_id device_table[] = {
static const __devinitdata struct usb_device_id device_table[] = {
{USB_DEVICE(0x041e, 0x4052), DVNM("Creative Live! VISTA IM")},
{USB_DEVICE(0x041e, 0x405f), DVNM("Creative Live! VISTA VF0330")},
{USB_DEVICE(0x041e, 0x4060), DVNM("Creative Live! VISTA VF0350")},
......
......@@ -27,8 +27,8 @@
#include "gspca.h"
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0)
static const char version[] = "2.1.0";
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4)
static const char version[] = "2.1.4";
MODULE_AUTHOR("Hans de Goede <j.w.r.degoede@hhs.nl>");
MODULE_DESCRIPTION("Pixart PAC207");
......@@ -716,7 +716,7 @@ static int pac207_decode_frame_data(struct gspca_dev *gspca_dev,
static void sd_pkt_scan(struct gspca_dev *gspca_dev,
struct gspca_frame *frame,
unsigned char *data,
__u8 *data,
int len)
{
unsigned char *sof;
......@@ -754,8 +754,8 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
n = pac207_decode_frame_data(gspca_dev, frame, data, len);
if (n)
frame = gspca_frame_add(gspca_dev, LAST_PACKET,
frame, NULL, 0);
gspca_frame_add(gspca_dev, LAST_PACKET,
frame, NULL, 0);
}
static void setbrightness(struct gspca_dev *gspca_dev)
......@@ -879,7 +879,7 @@ static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val)
}
/* sub-driver description */
static struct sd_desc sd_desc = {
static const struct sd_desc sd_desc = {
.name = MODULE_NAME,
.ctrls = sd_ctrls,
.nctrls = ARRAY_SIZE(sd_ctrls),
......@@ -895,7 +895,7 @@ static struct sd_desc sd_desc = {
/* -- module initialisation -- */
#define DVNM(name) .driver_info = (kernel_ulong_t) name
static __devinitdata struct usb_device_id device_table[] = {
static const __devinitdata struct usb_device_id device_table[] = {
{USB_DEVICE(0x041e, 0x4028), DVNM("Creative Webcam Vista Plus")},
{USB_DEVICE(0x093a, 0x2460), DVNM("Q-Tec Webcam 100")},
{USB_DEVICE(0x093a, 0x2463), DVNM("Philips spc200nc pac207")},
......
......@@ -23,8 +23,8 @@
#include "gspca.h"
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 3)
static const char version[] = "2.1.3";
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4)
static const char version[] = "2.1.4";
MODULE_AUTHOR("Thomas Kaiser thomas@kaiser-linux.li");
MODULE_DESCRIPTION("Pixart PAC7311");
......@@ -37,7 +37,6 @@ struct sd {
int avg_lum;
unsigned char brightness;
#define BRIGHTNESS_MAX 0x20
unsigned char contrast;
unsigned char colors;
unsigned char autogain;
......@@ -58,21 +57,21 @@ static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val);
static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val);
static struct ctrl sd_ctrls[] = {
#define SD_BRIGHTNESS 0
{
{
.id = V4L2_CID_BRIGHTNESS,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "Brightness",
.minimum = 0,
#define BRIGHTNESS_MAX 0x20
.maximum = BRIGHTNESS_MAX,
.step = 1,
.default_value = 0x10,
#define BRIGHTNESS_DEF 0x10
.default_value = BRIGHTNESS_DEF,
},
.set = sd_setbrightness,
.get = sd_getbrightness,
},
#define SD_CONTRAST 1
{
{
.id = V4L2_CID_CONTRAST,
......@@ -81,12 +80,12 @@ static struct ctrl sd_ctrls[] = {
.minimum = 0,
.maximum = 255,
.step = 1,
.default_value = 127,
#define CONTRAST_DEF 127
.default_value = CONTRAST_DEF,
},
.set = sd_setcontrast,
.get = sd_getcontrast,
},
#define SD_COLOR 2
{
{
.id = V4L2_CID_SATURATION,
......@@ -95,12 +94,12 @@ static struct ctrl sd_ctrls[] = {
.minimum = 0,
.maximum = 255,
.step = 1,
.default_value = 127,
#define COLOR_DEF 127
.default_value = COLOR_DEF,
},
.set = sd_setcolors,
.get = sd_getcolors,
},
#define SD_AUTOGAIN 3
{
{
.id = V4L2_CID_AUTOGAIN,
......@@ -109,7 +108,8 @@ static struct ctrl sd_ctrls[] = {
.minimum = 0,
.maximum = 1,
.step = 1,
.default_value = 1,
#define AUTOGAIN_DEF 1
.default_value = AUTOGAIN_DEF,
},
.set = sd_setautogain,
.get = sd_getautogain,
......@@ -124,7 +124,7 @@ static struct cam_mode vga_mode[] = {
#define PAC7311_JPEG_HEADER_SIZE (sizeof pac7311_jpeg_header) /* (594) */
const unsigned char pac7311_jpeg_header[] = {
static const __u8 pac7311_jpeg_header[] = {
0xff, 0xd8,
0xff, 0xe0, 0x00, 0x03, 0x20,
0xff, 0xc0, 0x00, 0x11, 0x08,
......@@ -195,8 +195,8 @@ const unsigned char pac7311_jpeg_header[] = {
};
static void reg_w(struct usb_device *dev,
__u16 index,
char *buffer, __u16 len)
__u16 index,
const char *buffer, __u16 len)
{
__u8 tmpbuf[8];
......@@ -263,10 +263,10 @@ static int sd_config(struct gspca_dev *gspca_dev,
cam->cam_mode = vga_mode;
cam->nmodes = ARRAY_SIZE(vga_mode);
sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value;
sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value;
sd->colors = sd_ctrls[SD_COLOR].qctrl.default_value;
sd->autogain = sd_ctrls[SD_AUTOGAIN].qctrl.default_value;
sd->brightness = BRIGHTNESS_DEF;
sd->contrast = CONTRAST_DEF;
sd->colors = COLOR_DEF;
sd->autogain = AUTOGAIN_DEF;
return 0;
}
......@@ -278,7 +278,7 @@ static void setbrightness(struct gspca_dev *gspca_dev)
/*jfm: inverted?*/
brightness = BRIGHTNESS_MAX - sd->brightness;
pac7311_reg_write(gspca_dev->dev, 0xff, 0x04);
/* pac7311_reg_write(gspca_dev->dev, 0x0e, 0x00); */
/* pac7311_reg_write(gspca_dev->dev, 0x0e, 0x00); */
pac7311_reg_write(gspca_dev->dev, 0x0f, brightness);
/* load registers to sensor (Bit 0, auto clear) */
pac7311_reg_write(gspca_dev->dev, 0x11, 0x01);
......@@ -502,7 +502,7 @@ static void setautogain(struct gspca_dev *gspca_dev, int luma)
static void sd_pkt_scan(struct gspca_dev *gspca_dev,
struct gspca_frame *frame, /* target */
unsigned char *data, /* isoc packet */
__u8 *data, /* isoc packet */
int len) /* iso packet length */
{
struct sd *sd = (struct sd *) gspca_dev;
......
This diff is collapsed.
This diff is collapsed.
......@@ -23,8 +23,8 @@
#include "gspca.h"
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0)
static const char version[] = "2.1.0";
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4)
static const char version[] = "2.1.4";
MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
MODULE_DESCRIPTION("GSPCA/SPCA501 USB Camera Driver");
......@@ -151,7 +151,7 @@ static struct cam_mode vga_mode[] = {
#define SPCA501_A33 0x10
/* Data for video camera initialization before capturing */
static __u16 spca501_open_data[][3] = {
static const __u16 spca501_open_data[][3] = {
/* bmRequest,value,index */
{0x2, 0x50, 0x00}, /* C/S enable soft reset */
......@@ -257,7 +257,7 @@ static __u16 spca501_open_data[][3] = {
*/
/* Data for chip initialization (set default values) */
static __u16 spca501_init_data[][3] = {
static const __u16 spca501_init_data[][3] = {
/* Set all the values to powerup defaults */
/* bmRequest,value,index */
{0x0, 0xAA, 0x00},
......@@ -544,7 +544,7 @@ static __u16 spca501_init_data[][3] = {
* Capture and decoding by Colin Peart.
* This is is for the 3com HomeConnect Lite which is spca501a based.
*/
static __u16 spca501_3com_open_data[][3] = {
static const __u16 spca501_3com_open_data[][3] = {
/* bmRequest,value,index */
{0x2, 0x0050, 0x0000}, /* C/S Enable TG soft reset, timing mode=010 */
{0x2, 0x0043, 0x0000}, /* C/S Disable TG soft reset, timing mode=010 */
......@@ -639,7 +639,7 @@ static __u16 spca501_3com_open_data[][3] = {
* 2) Understand why some values seem to appear more than once
* 3) Write a small comment for each line of the following arrays.
*/
static __u16 spca501c_arowana_open_data[][3] = {
static const __u16 spca501c_arowana_open_data[][3] = {
/* bmRequest,value,index */
{0x02, 0x0007, 0x0005},
{0x02, 0xa048, 0x0000},
......@@ -661,7 +661,7 @@ static __u16 spca501c_arowana_open_data[][3] = {
{}
};
static __u16 spca501c_arowana_init_data[][3] = {
static const __u16 spca501c_arowana_init_data[][3] = {
/* bmRequest,value,index */
{0x02, 0x0007, 0x0005},
{0x02, 0xa048, 0x0000},
......@@ -1595,7 +1595,7 @@ static __u16 spca501c_arowana_init_data[][3] = {
/* Unknow camera from Ori Usbid 0x0000:0x0000 */
/* Based on snoops from Ori Cohen */
static __u16 spca501c_mysterious_open_data[][3] = {
static const __u16 spca501c_mysterious_open_data[][3] = {
{0x02, 0x000f, 0x0005},
{0x02, 0xa048, 0x0000},
{0x05, 0x0022, 0x0004},
......@@ -1646,7 +1646,7 @@ static __u16 spca501c_mysterious_open_data[][3] = {
};
/* Based on snoops from Ori Cohen */
static __u16 spca501c_mysterious_init_data[][3] = {
static const __u16 spca501c_mysterious_init_data[][3] = {
/* Part 3 */
/* TG registers */
/* {0x00, 0x0000, 0x0000}, */
......@@ -1839,7 +1839,7 @@ static int reg_read(struct usb_device *dev,
}
static int write_vector(struct gspca_dev *gspca_dev,
__u16 data[][3])
const __u16 data[][3])
{
struct usb_device *dev = gspca_dev->dev;
int ret, i = 0;
......@@ -2001,7 +2001,6 @@ static int sd_open(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
PDEBUG(D_STREAM, "SPCA501 init");
switch (sd->subtype) {
case ThreeComHomeConnectLite:
/* Special handling for 3com data */
......@@ -2050,7 +2049,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
reg_write(dev, SPCA501_REG_CTLRL, 0x01, 0x02);
/* HDG atleast the Intel CreateAndShare needs to have one of its
* brightness / contrast / color set otherwise it assumes wath seems
* brightness / contrast / color set otherwise it assumes what seems
* max contrast. Note that strange enough setting any of these is
* enough to fix the max contrast problem, to be sure we set all 3 */
setbrightness(gspca_dev);
......@@ -2159,7 +2158,7 @@ static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val)
}
/* sub-driver description */
static struct sd_desc sd_desc = {
static const struct sd_desc sd_desc = {
.name = MODULE_NAME,
.ctrls = sd_ctrls,
.nctrls = ARRAY_SIZE(sd_ctrls),
......@@ -2174,7 +2173,7 @@ static struct sd_desc sd_desc = {
/* -- module initialisation -- */
#define DVNM(name) .driver_info = (kernel_ulong_t) name
static __devinitdata struct usb_device_id device_table[] = {
static const __devinitdata struct usb_device_id device_table[] = {
{USB_DEVICE(0x040a, 0x0002), DVNM("Kodak DVC-325")},
{USB_DEVICE(0x0497, 0xc001), DVNM("Smile International")},
{USB_DEVICE(0x0506, 0x00df), DVNM("3Com HomeConnect Lite")},
......
......@@ -23,8 +23,8 @@
#include "gspca.h"
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0)
static const char version[] = "2.1.0";
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4)
static const char version[] = "2.1.4";
MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
MODULE_DESCRIPTION("GSPCA/SPCA505 USB Camera Driver");
......@@ -91,7 +91,7 @@ static struct cam_mode vga_mode[] = {
/*
* Data to initialize a SPCA505. Common to the CCD and external modes
*/
static __u16 spca505_init_data[][3] = {
static const __u16 spca505_init_data[][3] = {
/* line bmRequest,value,index */
/* 1819 */
{SPCA50X_REG_GLOBAL, SPCA50X_GMISC3_SAA7113RST, SPCA50X_GLOBAL_MISC3},
......@@ -130,7 +130,7 @@ static __u16 spca505_init_data[][3] = {
/*
* Data to initialize the camera using the internal CCD
*/
static __u16 spca505_open_data_ccd[][3] = {
static const __u16 spca505_open_data_ccd[][3] = {
/* line bmRequest,value,index */
/* Internal CCD data set */
/* 1891 */ {0x3, 0x04, 0x01},
......@@ -319,7 +319,7 @@ static __u16 spca505_open_data_ccd[][3] = {
/*
* Data to initialize a SPCA505. Common to the CCD and external modes
*/
static __u16 spca505b_init_data[][3] = {
static const __u16 spca505b_init_data[][3] = {
/* start */
{0x02, 0x00, 0x00}, /* init */
{0x02, 0x00, 0x01},
......@@ -383,7 +383,7 @@ static __u16 spca505b_init_data[][3] = {
/*
* Data to initialize the camera using the internal CCD
*/
static __u16 spca505b_open_data_ccd[][3] = {
static const __u16 spca505b_open_data_ccd[][3] = {
/* {0x02,0x00,0x00}, */
{0x03, 0x04, 0x01}, /* rst */
......@@ -579,7 +579,7 @@ static int reg_read(struct usb_device *dev,
__u16 length) /* wLength (1 or 2 only) */
{
int ret;
unsigned char buf[4];
__u8 buf[4];
buf[1] = 0;
ret = usb_control_msg(dev,
......@@ -599,7 +599,7 @@ static int reg_read(struct usb_device *dev,
}
static int write_vector(struct gspca_dev *gspca_dev,
__u16 data[][3])
const __u16 data[][3])
{
struct usb_device *dev = gspca_dev->dev;
int ret, i = 0;
......@@ -801,7 +801,7 @@ static void yyuv_decode(unsigned char *out,
static void sd_pkt_scan(struct gspca_dev *gspca_dev,
struct gspca_frame *frame, /* target */
unsigned char *data, /* isoc packet */
__u8 *data, /* isoc packet */
int len) /* iso packet length */
{
struct sd *sd = (struct sd *) gspca_dev;
......@@ -878,7 +878,7 @@ static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val)
}
/* sub-driver description */
static struct sd_desc sd_desc = {
static const struct sd_desc sd_desc = {
.name = MODULE_NAME,
.ctrls = sd_ctrls,
.nctrls = ARRAY_SIZE(sd_ctrls),
......@@ -893,7 +893,7 @@ static struct sd_desc sd_desc = {
/* -- module initialisation -- */
#define DVNM(name) .driver_info = (kernel_ulong_t) name
static __devinitdata struct usb_device_id device_table[] = {
static const __devinitdata struct usb_device_id device_table[] = {
{USB_DEVICE(0x041e, 0x401d), DVNM("Creative Webcam NX ULTRA")},
{USB_DEVICE(0x0733, 0x0430), DVNM("Intel PC Camera Pro")},
{}
......
......@@ -22,8 +22,8 @@
#include "gspca.h"
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0)
static const char version[] = "2.1.0";
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4)
static const char version[] = "2.1.4";
MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
MODULE_DESCRIPTION("GSPCA/SPCA508 USB Camera Driver");
......@@ -92,7 +92,7 @@ static struct cam_mode sif_mode[] = {
* Initialization data: this is the first set-up data written to the
* device (before the open data).
*/
static __u16 spca508_init_data[][3] =
static const __u16 spca508_init_data[][3] =
#define IGN(x) /* nothing */
{
/* line URB value, index */
......@@ -584,7 +584,7 @@ static __u16 spca508_init_data[][3] =
/*
* Initialization data for Intel EasyPC Camera CS110
*/
static __u16 spca508cs110_init_data[][3] = {
static const __u16 spca508cs110_init_data[][3] = {
{0x0000, 0x870b}, /* Reset CTL3 */
{0x0003, 0x8111}, /* Soft Reset compression, memory, TG & CDSP */
{0x0000, 0x8111}, /* Normal operation on reset */
......@@ -668,7 +668,7 @@ static __u16 spca508cs110_init_data[][3] = {
{}
};
static __u16 spca508_sightcam_init_data[][3] = {
static const __u16 spca508_sightcam_init_data[][3] = {
/* This line seems to setup the frame/canvas */
/*368 */ {0x000f, 0x8402},
......@@ -752,7 +752,7 @@ static __u16 spca508_sightcam_init_data[][3] = {
{0, 0}
};
static __u16 spca508_sightcam2_init_data[][3] = {
static const __u16 spca508_sightcam2_init_data[][3] = {
/* 35 */ {0x0020, 0x8112},
/* 36 */ {0x000f, 0x8402},
......@@ -1099,7 +1099,7 @@ static __u16 spca508_sightcam2_init_data[][3] = {
/*
* Initialization data for Creative Webcam Vista
*/
static __u16 spca508_vista_init_data[][3] = {
static const __u16 spca508_vista_init_data[][3] = {
{0x0008, 0x8200}, /* Clear register */
{0x0000, 0x870b}, /* Reset CTL3 */
{0x0020, 0x8112}, /* Video Drop packet enable */
......@@ -1441,7 +1441,7 @@ static int reg_read(struct usb_device *dev,
}
static int write_vector(struct gspca_dev *gspca_dev,
__u16 data[][3])
const __u16 data[][3])
{
struct usb_device *dev = gspca_dev->dev;
int ret, i = 0;
......@@ -1639,7 +1639,7 @@ static void yuvy_decode(unsigned char *out,
static void sd_pkt_scan(struct gspca_dev *gspca_dev,
struct gspca_frame *frame, /* target */
unsigned char *data, /* isoc packet */
__u8 *data, /* isoc packet */
int len) /* iso packet length */
{
struct sd *sd = (struct sd *) gspca_dev;
......@@ -1717,7 +1717,7 @@ static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val)
}
/* sub-driver description */
static struct sd_desc sd_desc = {
static const struct sd_desc sd_desc = {
.name = MODULE_NAME,
.ctrls = sd_ctrls,
.nctrls = ARRAY_SIZE(sd_ctrls),
......@@ -1732,7 +1732,7 @@ static struct sd_desc sd_desc = {
/* -- module initialisation -- */
#define DVNM(name) .driver_info = (kernel_ulong_t) name
static __devinitdata struct usb_device_id device_table[] = {
static const __devinitdata struct usb_device_id device_table[] = {
{USB_DEVICE(0x041e, 0x4018), DVNM("Creative Webcam Vista (PD1100)")},
{USB_DEVICE(0x0461, 0x0815), DVNM("Micro Innovation IC200")},
{USB_DEVICE(0x0733, 0x0110), DVNM("ViewQuest VQ110")},
......
......@@ -24,8 +24,8 @@
#include "gspca.h"
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0)
static const char version[] = "2.1.0";
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4)
static const char version[] = "2.1.4";
MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
MODULE_DESCRIPTION("GSPCA/SPCA561 USB Camera Driver");
......@@ -148,7 +148,8 @@ static void reg_w_val(struct usb_device *dev, __u16 index, __u16 value)
PDEBUG(D_ERR, "reg write: error %d", ret);
}
static void write_vector(struct gspca_dev *gspca_dev, __u16 data[][2])
static void write_vector(struct gspca_dev *gspca_dev,
const __u16 data[][2])
{
struct usb_device *dev = gspca_dev->dev;
int i;
......@@ -171,13 +172,16 @@ static void reg_r(struct usb_device *dev,
}
static void reg_w_buf(struct usb_device *dev,
__u16 index, __u8 *buffer, __u16 length)
__u16 index, const __u8 *buffer, __u16 len)
{
__u8 tmpbuf[8];
memcpy(tmpbuf, buffer, len);
usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
0, /* request */
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
0, /* value */
index, buffer, length, 500);
index, tmpbuf, len, 500);
}
static void i2c_init(struct gspca_dev *gspca_dev, __u8 mode)
......@@ -227,7 +231,7 @@ static int i2c_read(struct gspca_dev *gspca_dev, __u16 reg, __u8 mode)
return ((int) value << 8) | vallsb;
}
static __u16 spca561_init_data[][2] = {
static const __u16 spca561_init_data[][2] = {
{0x0000, 0x8114}, /* Software GPIO output data */
{0x0001, 0x8114}, /* Software GPIO output data */
{0x0000, 0x8112}, /* Some kind of reset */
......@@ -437,7 +441,7 @@ static void sensor_reset(struct gspca_dev *gspca_dev)
}
/******************** QC Express etch2 stuff ********************/
static __u16 Pb100_1map8300[][2] = {
static const __u16 Pb100_1map8300[][2] = {
/* reg, value */
{0x8320, 0x3304},
......@@ -452,14 +456,14 @@ static __u16 Pb100_1map8300[][2] = {
{0x8302, 0x000e},
{}
};
static __u16 Pb100_2map8300[][2] = {
static const __u16 Pb100_2map8300[][2] = {
/* reg, value */
{0x8339, 0x0000},
{0x8307, 0x00aa},
{}
};
static __u16 spca561_161rev12A_data1[][2] = {
static const __u16 spca561_161rev12A_data1[][2] = {
{0x21, 0x8118},
{0x01, 0x8114},
{0x00, 0x8112},
......@@ -467,7 +471,7 @@ static __u16 spca561_161rev12A_data1[][2] = {
{0x04, 0x8802}, /* windows uses 08 */
{}
};
static __u16 spca561_161rev12A_data2[][2] = {
static const __u16 spca561_161rev12A_data2[][2] = {
{0x21, 0x8118},
{0x10, 0x8500},
{0x07, 0x8601},
......@@ -513,7 +517,7 @@ static __u16 spca561_161rev12A_data2[][2] = {
};
static void sensor_mapwrite(struct gspca_dev *gspca_dev,
__u16 sensormap[][2])
const __u16 sensormap[][2])
{
int i = 0;
__u8 usbval[2];
......@@ -956,7 +960,7 @@ static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val)
}
/* sub-driver description */
static struct sd_desc sd_desc = {
static const struct sd_desc sd_desc = {
.name = MODULE_NAME,
.ctrls = sd_ctrls,
.nctrls = ARRAY_SIZE(sd_ctrls),
......@@ -971,7 +975,7 @@ static struct sd_desc sd_desc = {
/* -- module initialisation -- */
#define DVNM(name) .driver_info = (kernel_ulong_t) name
static __devinitdata struct usb_device_id device_table[] = {
static const __devinitdata struct usb_device_id device_table[] = {
{USB_DEVICE(0x041e, 0x401a), DVNM("Creative Webcam Vista (PD1100)")},
{USB_DEVICE(0x041e, 0x403b), DVNM("Creative Webcam Vista (VF0010)")},
{USB_DEVICE(0x0458, 0x7004), DVNM("Genius VideoCAM Express V2")},
......
......@@ -23,8 +23,8 @@
#include "gspca.h"
#include "jpeg.h"
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0)
static const char version[] = "2.1.0";
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4)
static const char version[] = "2.1.4";
MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>");
MODULE_DESCRIPTION("Syntek DV4000 (STK014) USB Camera Driver");
......@@ -54,7 +54,6 @@ static int sd_setfreq(struct gspca_dev *gspca_dev, __s32 val);
static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val);
static struct ctrl sd_ctrls[] = {
#define SD_BRIGHTNESS 0
{
{
.id = V4L2_CID_BRIGHTNESS,
......@@ -63,12 +62,12 @@ static struct ctrl sd_ctrls[] = {
.minimum = 0,
.maximum = 255,
.step = 1,
.default_value = 127,
#define BRIGHTNESS_DEF 127
.default_value = BRIGHTNESS_DEF,
},
.set = sd_setbrightness,
.get = sd_getbrightness,
},
#define SD_CONTRAST 1
{
{
.id = V4L2_CID_CONTRAST,
......@@ -77,26 +76,26 @@ static struct ctrl sd_ctrls[] = {
.minimum = 0,
.maximum = 255,
.step = 1,
.default_value = 127,
#define CONTRAST_DEF 127
.default_value = CONTRAST_DEF,
},
.set = sd_setcontrast,
.get = sd_getcontrast,
},
#define SD_COLOR 2
{
{
.id = V4L2_CID_SATURATION,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "Saturation",
.name = "Color",
.minimum = 0,
.maximum = 255,
.step = 1,
.default_value = 127,
#define COLOR_DEF 127
.default_value = COLOR_DEF,
},
.set = sd_setcolors,
.get = sd_getcolors,
},
#define SD_FREQ 3
{
{
.id = V4L2_CID_POWER_LINE_FREQUENCY,
......@@ -105,7 +104,8 @@ static struct ctrl sd_ctrls[] = {
.minimum = 1,
.maximum = 2, /* 0: 0, 1: 50Hz, 2:60Hz */
.step = 1,
.default_value = 1,
#define FREQ_DEF 1
.default_value = FREQ_DEF,
},
.set = sd_setfreq,
.get = sd_getfreq,
......@@ -296,10 +296,10 @@ static int sd_config(struct gspca_dev *gspca_dev,
cam->epaddr = 0x02;
gspca_dev->cam.cam_mode = vga_mode;
gspca_dev->cam.nmodes = sizeof vga_mode / sizeof vga_mode[0];
sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value;
sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value;
sd->colors = sd_ctrls[SD_COLOR].qctrl.default_value;
sd->lightfreq = sd_ctrls[SD_FREQ].qctrl.default_value;
sd->brightness = BRIGHTNESS_DEF;
sd->contrast = CONTRAST_DEF;
sd->colors = COLOR_DEF;
sd->lightfreq = FREQ_DEF;
return 0;
}
......@@ -408,7 +408,7 @@ static void sd_close(struct gspca_dev *gspca_dev)
static void sd_pkt_scan(struct gspca_dev *gspca_dev,
struct gspca_frame *frame, /* target */
unsigned char *data, /* isoc packet */
__u8 *data, /* isoc packet */
int len) /* iso packet length */
{
static unsigned char ffd9[] = {0xff, 0xd9};
......@@ -518,10 +518,10 @@ static int sd_querymenu(struct gspca_dev *gspca_dev,
case V4L2_CID_POWER_LINE_FREQUENCY:
switch (menu->index) {
case 1: /* V4L2_CID_POWER_LINE_FREQUENCY_50HZ */
strcpy(menu->name, "50 Hz");
strcpy((char *) menu->name, "50 Hz");
return 0;
case 2: /* V4L2_CID_POWER_LINE_FREQUENCY_60HZ */
strcpy(menu->name, "60 Hz");
strcpy((char *) menu->name, "60 Hz");
return 0;
}
break;
......
......@@ -24,8 +24,8 @@
#include "gspca.h"
#include "jpeg.h"
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 1)
static const char version[] = "2.1.1";
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4)
static const char version[] = "2.1.4";
MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
MODULE_DESCRIPTION("GSPCA/SPCA5xx USB Camera Driver");
......@@ -35,7 +35,7 @@ MODULE_LICENSE("GPL");
struct sd {
struct gspca_dev gspca_dev; /* !! must be the first item */
unsigned char packet[ISO_MAX_SIZE + 128];
__u8 packet[ISO_MAX_SIZE + 128];
/* !! no more than 128 ff in an ISO packet */
unsigned char brightness;
......@@ -156,7 +156,7 @@ static struct cam_mode vga_mode2[] = {
#define SPCA536_OFFSET_FRAMSEQ 1
/* Initialisation data for the Creative PC-CAM 600 */
static __u16 spca504_pccam600_init_data[][3] = {
static const __u16 spca504_pccam600_init_data[][3] = {
/* {0xa0, 0x0000, 0x0503}, * capture mode */
{0x00, 0x0000, 0x2000},
{0x00, 0x0013, 0x2301},
......@@ -186,7 +186,7 @@ static __u16 spca504_pccam600_init_data[][3] = {
/* Creative PC-CAM 600 specific open data, sent before using the
* generic initialisation data from spca504_open_data.
*/
static __u16 spca504_pccam600_open_data[][3] = {
static const __u16 spca504_pccam600_open_data[][3] = {
{0x00, 0x0001, 0x2501},
{0x20, 0x0500, 0x0001}, /* snapshot mode */
{0x00, 0x0003, 0x2880},
......@@ -195,7 +195,7 @@ static __u16 spca504_pccam600_open_data[][3] = {
};
/* Initialisation data for the logitech clicksmart 420 */
static __u16 spca504A_clicksmart420_init_data[][3] = {
static const __u16 spca504A_clicksmart420_init_data[][3] = {
/* {0xa0, 0x0000, 0x0503}, * capture mode */
{0x00, 0x0000, 0x2000},
{0x00, 0x0013, 0x2301},
......@@ -226,7 +226,7 @@ static __u16 spca504A_clicksmart420_init_data[][3] = {
};
/* clicksmart 420 open data ? */
static __u16 spca504A_clicksmart420_open_data[][3] = {
static const __u16 spca504A_clicksmart420_open_data[][3] = {
{0x00, 0x0001, 0x2501},
{0x20, 0x0502, 0x0000},
{0x06, 0x0000, 0x0000},
......@@ -373,7 +373,7 @@ static __u16 spca504A_clicksmart420_open_data[][3] = {
{}
};
static unsigned char qtable_creative_pccam[2][64] = {
static const __u8 qtable_creative_pccam[2][64] = {
{ /* Q-table Y-components */
0x05, 0x03, 0x03, 0x05, 0x07, 0x0c, 0x0f, 0x12,
0x04, 0x04, 0x04, 0x06, 0x08, 0x11, 0x12, 0x11,
......@@ -398,7 +398,7 @@ static unsigned char qtable_creative_pccam[2][64] = {
* except for one byte. Possibly a typo?
* NWG: 18/05/2003.
*/
static unsigned char qtable_spca504_default[2][64] = {
static const __u8 qtable_spca504_default[2][64] = {
{ /* Q-table Y-components */
0x05, 0x03, 0x03, 0x05, 0x07, 0x0c, 0x0f, 0x12,
0x04, 0x04, 0x04, 0x06, 0x08, 0x11, 0x12, 0x11,
......@@ -512,7 +512,7 @@ static int reg_read(struct usb_device *dev,
}
static int write_vector(struct gspca_dev *gspca_dev,
__u16 data[][3])
const __u16 data[][3])
{
struct usb_device *dev = gspca_dev->dev;
int ret, i = 0;
......@@ -534,7 +534,7 @@ static int spca50x_setup_qtable(struct gspca_dev *gspca_dev,
unsigned int request,
unsigned int ybase,
unsigned int cbase,
unsigned char qtable[2][64])
const __u8 qtable[2][64])
{
struct usb_device *dev = gspca_dev->dev;
int i, err;
......@@ -1242,7 +1242,7 @@ static void sd_close(struct gspca_dev *gspca_dev)
static void sd_pkt_scan(struct gspca_dev *gspca_dev,
struct gspca_frame *frame, /* target */
unsigned char *data, /* isoc packet */
__u8 *data, /* isoc packet */
int len) /* iso packet length */
{
struct sd *sd = (struct sd *) gspca_dev;
......@@ -1530,7 +1530,7 @@ static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val)
}
/* sub-driver description */
static struct sd_desc sd_desc = {
static const struct sd_desc sd_desc = {
.name = MODULE_NAME,
.ctrls = sd_ctrls,
.nctrls = ARRAY_SIZE(sd_ctrls),
......@@ -1545,7 +1545,7 @@ static struct sd_desc sd_desc = {
/* -- module initialisation -- */
#define DVNM(name) .driver_info = (kernel_ulong_t) name
static __devinitdata struct usb_device_id device_table[] = {
static const __devinitdata struct usb_device_id device_table[] = {
{USB_DEVICE(0x041e, 0x400b), DVNM("Creative PC-CAM 600")},
{USB_DEVICE(0x041e, 0x4012), DVNM("PC-Cam350")},
{USB_DEVICE(0x041e, 0x4013), DVNM("Creative Pccam750")},
......
This diff is collapsed.
......@@ -22,8 +22,8 @@
#include "gspca.h"
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0)
static const char version[] = "2.1.0";
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4)
static const char version[] = "2.1.4";
MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
MODULE_DESCRIPTION("TV8532 USB Camera Driver");
......@@ -152,7 +152,7 @@ static struct cam_mode sif_mode[] = {
#define TV8532_AD_ROWBEGIN_L 0x14
#define TV8532_AD_ROWBEGIN_H 0x15
static __u32 tv_8532_eeprom_data[] = {
static const __u32 tv_8532_eeprom_data[] = {
/* add dataL dataM dataH */
0x00010001, 0x01018011, 0x02050014, 0x0305001c,
0x040d001e, 0x0505001f, 0x06050519, 0x0705011b,
......@@ -243,7 +243,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
static void tv_8532ReadRegisters(struct gspca_dev *gspca_dev)
{
struct usb_device *dev = gspca_dev->dev;
__u8 data = 0;
__u8 data;
/* __u16 vid, pid; */
reg_r(dev, 0x0001, &data);
......@@ -275,7 +275,7 @@ static void tv_8532ReadRegisters(struct gspca_dev *gspca_dev)
static void tv_8532_setReg(struct gspca_dev *gspca_dev)
{
struct usb_device *dev = gspca_dev->dev;
__u8 data = 0;
__u8 data;
__u8 value[2] = { 0, 0 };
data = ADCBEGINL;
......@@ -320,7 +320,7 @@ static void tv_8532_setReg(struct gspca_dev *gspca_dev)
static void tv_8532_PollReg(struct gspca_dev *gspca_dev)
{
struct usb_device *dev = gspca_dev->dev;
__u8 data = 0;
__u8 data;
int i;
/* strange polling from tgc */
......@@ -338,9 +338,9 @@ static void tv_8532_PollReg(struct gspca_dev *gspca_dev)
static int sd_open(struct gspca_dev *gspca_dev)
{
struct usb_device *dev = gspca_dev->dev;
__u8 data = 0;
__u8 dataStart = 0;
__u8 value[2] = { 0, 0 };
__u8 data;
__u8 dataStart;
__u8 value[2];
data = 0x32;
reg_w(dev, TV8532_AD_SLOPE, &data, 1);
......@@ -646,7 +646,7 @@ static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val)
}
/* sub-driver description */
static struct sd_desc sd_desc = {
static const struct sd_desc sd_desc = {
.name = MODULE_NAME,
.ctrls = sd_ctrls,
.nctrls = ARRAY_SIZE(sd_ctrls),
......@@ -661,7 +661,7 @@ static struct sd_desc sd_desc = {
/* -- module initialisation -- */
#define DVNM(name) .driver_info = (kernel_ulong_t) name
static __devinitdata struct usb_device_id device_table[] = {
static const __devinitdata struct usb_device_id device_table[] = {
{USB_DEVICE(0x046d, 0x0920), DVNM("QC Express")},
{USB_DEVICE(0x046d, 0x0921), DVNM("Labtec Webcam")},
{USB_DEVICE(0x0545, 0x808b), DVNM("Veo Stingray")},
......
......@@ -24,8 +24,8 @@
#include "gspca.h"
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 0)
static const char version[] = "2.1.0";
#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 4)
static const char version[] = "2.1.4";
MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
MODULE_DESCRIPTION("GSPCA/VC032X USB Camera Driver");
......@@ -97,7 +97,7 @@ static struct cam_mode vc0323_mode[] = {
{V4L2_PIX_FMT_JPEG, 640, 480, 0},
};
static __u8 mi1310_socinitVGA_JPG[][4] = {
static const __u8 mi1310_socinitVGA_JPG[][4] = {
{0xb0, 0x03, 0x19, 0xcc},
{0xb0, 0x04, 0x02, 0xcc},
{0xb3, 0x00, 0x64, 0xcc},
......@@ -249,7 +249,7 @@ static __u8 mi1310_socinitVGA_JPG[][4] = {
{0x03, 0x03, 0xc0, 0xbb},
{},
};
static __u8 mi1310_socinitQVGA_JPG[][4] = {
static const __u8 mi1310_socinitQVGA_JPG[][4] = {
{0xb0, 0x03, 0x19, 0xcc}, {0xb0, 0x04, 0x02, 0xcc},
{0xb3, 0x00, 0x64, 0xcc}, {0xb3, 0x00, 0x65, 0xcc},
{0xb3, 0x05, 0x00, 0xcc}, {0xb3, 0x06, 0x00, 0xcc},
......@@ -323,14 +323,14 @@ static __u8 mi1310_socinitQVGA_JPG[][4] = {
{},
};
static __u8 mi1320_gamma[17] = {
static const __u8 mi1320_gamma[17] = {
0x00, 0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8,
0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff
};
static __u8 mi1320_matrix[9] = {
static const __u8 mi1320_matrix[9] = {
0x54, 0xda, 0x06, 0xf1, 0x50, 0xf4, 0xf7, 0xea, 0x52
};
static __u8 mi1320_initVGA_data[][4] = {
static const __u8 mi1320_initVGA_data[][4] = {
{0xb3, 0x01, 0x01, 0xcc}, {0x00, 0x00, 0x33, 0xdd},
{0xb0, 0x03, 0x19, 0xcc}, {0x00, 0x00, 0x33, 0xdd},
{0xb0, 0x04, 0x02, 0xcc}, {0x00, 0x00, 0x33, 0xdd},
......@@ -409,7 +409,7 @@ static __u8 mi1320_initVGA_data[][4] = {
{0xb3, 0x5c, 0x01, 0xcc}, {0xb3, 0x01, 0x41, 0xcc},
{}
};
static __u8 mi1320_initQVGA_data[][4] = {
static const __u8 mi1320_initQVGA_data[][4] = {
{0xb3, 0x01, 0x01, 0xcc}, {0x00, 0x00, 0x33, 0xdd},
{0xb0, 0x03, 0x19, 0xcc}, {0x00, 0x00, 0x33, 0xdd},
{0xb0, 0x04, 0x02, 0xcc}, {0x00, 0x00, 0x33, 0xdd},
......@@ -478,15 +478,15 @@ static __u8 mi1320_initQVGA_data[][4] = {
{}
};
static __u8 po3130_gamma[17] = {
static const __u8 po3130_gamma[17] = {
0x00, 0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8,
0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff
};
static __u8 po3130_matrix[9] = {
static const __u8 po3130_matrix[9] = {
0x5f, 0xec, 0xf5, 0xf1, 0x5a, 0xf5, 0xf1, 0xec, 0x63
};
static __u8 po3130_initVGA_data[][4] = {
static const __u8 po3130_initVGA_data[][4] = {
{0xb0, 0x4d, 0x00, 0xcc}, {0xb3, 0x01, 0x01, 0xcc},
{0x00, 0x00, 0x50, 0xdd}, {0xb0, 0x03, 0x01, 0xcc},
{0xb3, 0x00, 0x04, 0xcc}, {0xb3, 0x00, 0x24, 0xcc},
......@@ -569,7 +569,7 @@ static __u8 po3130_initVGA_data[][4] = {
{0xb3, 0x5c, 0x00, 0xcc}, {0xb3, 0x01, 0x41, 0xcc},
{}
};
static __u8 po3130_rundata[][4] = {
static const __u8 po3130_rundata[][4] = {
{0x00, 0x47, 0x45, 0xaa}, {0x00, 0x48, 0x9b, 0xaa},
{0x00, 0x49, 0x3a, 0xaa}, {0x00, 0x4a, 0x01, 0xaa},
{0x00, 0x44, 0x40, 0xaa},
......@@ -584,7 +584,7 @@ static __u8 po3130_rundata[][4] = {
{}
};
static __u8 po3130_initQVGA_data[][4] = {
static const __u8 po3130_initQVGA_data[][4] = {
{0xb0, 0x4d, 0x00, 0xcc}, {0xb3, 0x01, 0x01, 0xcc},
{0x00, 0x00, 0x50, 0xdd}, {0xb0, 0x03, 0x09, 0xcc},
{0xb3, 0x00, 0x04, 0xcc}, {0xb3, 0x00, 0x24, 0xcc},
......@@ -670,16 +670,16 @@ static __u8 po3130_initQVGA_data[][4] = {
{}
};
static __u8 hv7131r_gamma[17] = {
static const __u8 hv7131r_gamma[17] = {
/* 0x00, 0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8,
* 0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff */
0x04, 0x1a, 0x36, 0x55, 0x6f, 0x87, 0x9d, 0xb0, 0xc1,
0xcf, 0xda, 0xe4, 0xec, 0xf3, 0xf8, 0xfd, 0xff
};
static __u8 hv7131r_matrix[9] = {
static const __u8 hv7131r_matrix[9] = {
0x5f, 0xec, 0xf5, 0xf1, 0x5a, 0xf5, 0xf1, 0xec, 0x63
};
static __u8 hv7131r_initVGA_data[][4] = {
static const __u8 hv7131r_initVGA_data[][4] = {
{0xb0, 0x4d, 0x00, 0xcc}, {0xb3, 0x01, 0x01, 0xcc},
{0x00, 0x00, 0x50, 0xdd}, {0xb0, 0x03, 0x01, 0xcc},
{0xb3, 0x00, 0x24, 0xcc},
......@@ -722,7 +722,7 @@ static __u8 hv7131r_initVGA_data[][4] = {
{}
};
static __u8 hv7131r_initQVGA_data[][4] = {
static const __u8 hv7131r_initQVGA_data[][4] = {
{0xb0, 0x4d, 0x00, 0xcc}, {0xb3, 0x01, 0x01, 0xcc},
{0x00, 0x00, 0x50, 0xdd}, {0xb0, 0x03, 0x01, 0xcc},
{0xb3, 0x00, 0x24, 0xcc},
......@@ -777,14 +777,14 @@ static __u8 hv7131r_initQVGA_data[][4] = {
{}
};
static __u8 ov7660_gamma[17] = {
static const __u8 ov7660_gamma[17] = {
0x00, 0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8,
0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff
};
static __u8 ov7660_matrix[9] = {
static const __u8 ov7660_matrix[9] = {
0x5a, 0xf0, 0xf6, 0xf3, 0x57, 0xf6, 0xf3, 0xef, 0x62
};
static __u8 ov7660_initVGA_data[][4] = {
static const __u8 ov7660_initVGA_data[][4] = {
{0xb0, 0x4d, 0x00, 0xcc}, {0xb3, 0x01, 0x01, 0xcc},
{0x00, 0x00, 0x50, 0xdd},
{0xb0, 0x03, 0x01, 0xcc},
......@@ -842,7 +842,7 @@ static __u8 ov7660_initVGA_data[][4] = {
{0x00, 0x29, 0x3c, 0xaa}, {0xb3, 0x01, 0x45, 0xcc},
{}
};
static __u8 ov7660_initQVGA_data[][4] = {
static const __u8 ov7660_initQVGA_data[][4] = {
{0xb0, 0x4d, 0x00, 0xcc}, {0xb3, 0x01, 0x01, 0xcc},
{0x00, 0x00, 0x50, 0xdd}, {0xb0, 0x03, 0x01, 0xcc},
{0xb3, 0x00, 0x21, 0xcc}, {0xb3, 0x00, 0x26, 0xcc},
......@@ -911,26 +911,26 @@ static __u8 ov7660_initQVGA_data[][4] = {
{0x00, 0x00, 0x00, 0x00}
};
static __u8 ov7660_50HZ[][4] = {
static const __u8 ov7660_50HZ[][4] = {
{0x00, 0x3b, 0x08, 0xaa},
{0x00, 0x9d, 0x40, 0xaa},
{0x00, 0x13, 0xa7, 0xaa},
{0x00, 0x00, 0x00, 0x00}
};
static __u8 ov7660_60HZ[][4] = {
static const __u8 ov7660_60HZ[][4] = {
{0x00, 0x3b, 0x00, 0xaa},
{0x00, 0x9e, 0x40, 0xaa},
{0x00, 0x13, 0xa7, 0xaa},
{}
};
static __u8 ov7660_NoFliker[][4] = {
static const __u8 ov7660_NoFliker[][4] = {
{0x00, 0x13, 0x87, 0xaa},
{}
};
static __u8 ov7670_initVGA_JPG[][4] = {
static const __u8 ov7670_initVGA_JPG[][4] = {
{0xb3, 0x01, 0x05, 0xcc},
{0x00, 0x00, 0x30, 0xdd}, {0xb0, 0x03, 0x19, 0xcc},
{0x00, 0x00, 0x10, 0xdd},
......@@ -1058,7 +1058,7 @@ static __u8 ov7670_initVGA_JPG[][4] = {
{},
};
static __u8 ov7670_initQVGA_JPG[][4] = {
static const __u8 ov7670_initQVGA_JPG[][4] = {
{0xb3, 0x01, 0x05, 0xcc}, {0x00, 0x00, 0x30, 0xdd},
{0xb0, 0x03, 0x19, 0xcc}, {0x00, 0x00, 0x10, 0xdd},
{0xb0, 0x04, 0x02, 0xcc}, {0x00, 0x00, 0x10, 0xdd},
......@@ -1200,7 +1200,7 @@ struct sensor_info {
__u8 op;
};
static struct sensor_info sensor_info_data[] = {
static const struct sensor_info sensor_info_data[] = {
/* sensorId, I2cAdd, IdAdd, VpId, m1, m2, op */
{SENSOR_HV7131R, 0x80 | 0x11, 0x00, 0x0209, 0x24, 0x25, 0x01},
{SENSOR_OV7660, 0x80 | 0x21, 0x0a, 0x7660, 0x26, 0x26, 0x05},
......@@ -1282,7 +1282,7 @@ static int vc032x_probe_sensor(struct gspca_dev *gspca_dev)
int i;
__u8 data;
__u16 value;
struct sensor_info *ptsensor_info;
const struct sensor_info *ptsensor_info;
reg_r(dev, 0xa1, 0xbfcf, &data, 1);
PDEBUG(D_PROBE, "check sensor header %d", data);
......@@ -1309,7 +1309,7 @@ static int vc032x_probe_sensor(struct gspca_dev *gspca_dev)
}
static __u8 i2c_write(struct usb_device *dev,
__u8 reg, __u8 *val, __u8 size)
__u8 reg, const __u8 *val, __u8 size)
{
__u8 retbyte;
......@@ -1341,7 +1341,7 @@ static __u8 i2c_write(struct usb_device *dev,
}
static void put_tab_to_reg(struct gspca_dev *gspca_dev,
__u8 *tab, __u8 tabsize, __u16 addr)
const __u8 *tab, __u8 tabsize, __u16 addr)
{
int j;
__u16 ad = addr;
......@@ -1351,7 +1351,7 @@ static void put_tab_to_reg(struct gspca_dev *gspca_dev,
}
static void usb_exchange(struct gspca_dev *gspca_dev,
__u8 data[][4])
const __u8 data[][4])
{
struct usb_device *dev = gspca_dev->dev;
int i = 0;
......@@ -1511,7 +1511,7 @@ static void setautogain(struct gspca_dev *gspca_dev)
static void setlightfreq(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
static __u8 (*ov7660_freq_tb[3])[4] =
static const __u8 (*ov7660_freq_tb[3])[4] =
{ov7660_NoFliker, ov7660_50HZ, ov7660_60HZ};
if (sd->sensor != SENSOR_OV7660)
......@@ -1523,8 +1523,8 @@ static void sd_start(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
/* __u8 tmp2; */
__u8 *GammaT = NULL;
__u8 *MatrixT = NULL;
const __u8 *GammaT = NULL;
const __u8 *MatrixT = NULL;
int mode;
/* Assume start use the good resolution from gspca_dev->mode */
......@@ -1673,7 +1673,7 @@ static void sd_close(struct gspca_dev *gspca_dev)
static void sd_pkt_scan(struct gspca_dev *gspca_dev,
struct gspca_frame *frame, /* target */
unsigned char *data, /* isoc packet */
__u8 *data, /* isoc packet */
int len) /* iso pkt length */
{
struct sd *sd = (struct sd *) gspca_dev;
......@@ -1739,13 +1739,13 @@ static int sd_querymenu(struct gspca_dev *gspca_dev,
case V4L2_CID_POWER_LINE_FREQUENCY:
switch (menu->index) {
case 0: /* V4L2_CID_POWER_LINE_FREQUENCY_DISABLED */
strcpy(menu->name, "NoFliker");
strcpy((char *) menu->name, "NoFliker");
return 0;
case 1: /* V4L2_CID_POWER_LINE_FREQUENCY_50HZ */
strcpy(menu->name, "50 Hz");
strcpy((char *) menu->name, "50 Hz");
return 0;
case 2: /* V4L2_CID_POWER_LINE_FREQUENCY_60HZ */
strcpy(menu->name, "60 Hz");
strcpy((char *) menu->name, "60 Hz");
return 0;
}
break;
......@@ -1754,7 +1754,7 @@ static int sd_querymenu(struct gspca_dev *gspca_dev,
}
/* sub-driver description */
static struct sd_desc sd_desc = {
static const struct sd_desc sd_desc = {
.name = MODULE_NAME,
.ctrls = sd_ctrls,
.nctrls = ARRAY_SIZE(sd_ctrls),
......@@ -1770,7 +1770,7 @@ static struct sd_desc sd_desc = {
/* -- module initialisation -- */
#define DVNM(name) .driver_info = (kernel_ulong_t) name
static __devinitdata struct usb_device_id device_table[] = {
static const __devinitdata struct usb_device_id device_table[] = {
{USB_DEVICE(0x046d, 0x0892), DVNM("Logitech Orbicam")},
{USB_DEVICE(0x046d, 0x0896), DVNM("Logitech Orbicam")},
{USB_DEVICE(0x0ac8, 0x0321), DVNM("Vimicro generic vc0321")},
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment