diff options
Diffstat (limited to 'drivers/staging/media')
23 files changed, 221 insertions, 132 deletions
diff --git a/drivers/staging/media/as102/as10x_handle.h b/drivers/staging/media/as102/as10x_handle.h index 62b9795..5638b19 100644 --- a/drivers/staging/media/as102/as10x_handle.h +++ b/drivers/staging/media/as102/as10x_handle.h @@ -28,26 +28,26 @@ struct as102_dev_t; #define REGMODE32 32 struct as102_priv_ops_t { - int (*upload_fw_pkt) (struct as10x_bus_adapter_t *bus_adap, + int (*upload_fw_pkt)(struct as10x_bus_adapter_t *bus_adap, unsigned char *buf, int buflen, int swap32); - int (*send_cmd) (struct as10x_bus_adapter_t *bus_adap, + int (*send_cmd)(struct as10x_bus_adapter_t *bus_adap, unsigned char *buf, int buflen); - int (*xfer_cmd) (struct as10x_bus_adapter_t *bus_adap, + int (*xfer_cmd)(struct as10x_bus_adapter_t *bus_adap, unsigned char *send_buf, int send_buf_len, unsigned char *recv_buf, int recv_buf_len); - int (*start_stream) (struct as102_dev_t *dev); - void (*stop_stream) (struct as102_dev_t *dev); + int (*start_stream)(struct as102_dev_t *dev); + void (*stop_stream)(struct as102_dev_t *dev); - int (*reset_target) (struct as10x_bus_adapter_t *bus_adap); + int (*reset_target)(struct as10x_bus_adapter_t *bus_adap); int (*read_write)(struct as10x_bus_adapter_t *bus_adap, uint8_t mode, uint32_t rd_addr, uint16_t rd_len, uint32_t wr_addr, uint16_t wr_len); - int (*as102_read_ep2) (struct as10x_bus_adapter_t *bus_adap, + int (*as102_read_ep2)(struct as10x_bus_adapter_t *bus_adap, unsigned char *recv_buf, int recv_buf_len); }; diff --git a/drivers/staging/media/cxd2099/cxd2099.c b/drivers/staging/media/cxd2099/cxd2099.c index 6cb74da..a2a5182 100644 --- a/drivers/staging/media/cxd2099/cxd2099.c +++ b/drivers/staging/media/cxd2099/cxd2099.c @@ -329,11 +329,14 @@ static int init(struct cxd *ci) break; #if 0 - status = write_reg(ci, 0x09, 0x4D); /* Input Mode C, BYPass Serial, TIVAL = low, MSB */ + /* Input Mode C, BYPass Serial, TIVAL = low, MSB */ + status = write_reg(ci, 0x09, 0x4D); if (status < 0) break; #endif - status = write_reg(ci, 0x0A, 0xA7); /* TOSTRT = 8, Mode B (gated clock), falling Edge, Serial, POL=HIGH, MSB */ + /* TOSTRT = 8, Mode B (gated clock), falling Edge, + * Serial, POL=HIGH, MSB */ + status = write_reg(ci, 0x0A, 0xA7); if (status < 0) break; @@ -589,7 +592,7 @@ static int campoll(struct cxd *ci) read_reg(ci, 0x01, &slotstat); if (!(2&slotstat)) { if (!ci->slot_stat) { - ci->slot_stat |= DVB_CA_EN50221_POLL_CAM_PRESENT; + ci->slot_stat = DVB_CA_EN50221_POLL_CAM_PRESENT; write_regm(ci, 0x03, 0x08, 0x08); } @@ -601,7 +604,8 @@ static int campoll(struct cxd *ci) ci->ready = 0; } } - if (istat&8 && ci->slot_stat == DVB_CA_EN50221_POLL_CAM_PRESENT) { + if (istat&8 && + ci->slot_stat == DVB_CA_EN50221_POLL_CAM_PRESENT) { ci->ready = 1; ci->slot_stat |= DVB_CA_EN50221_POLL_CAM_READY; } diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.h b/drivers/staging/media/davinci_vpfe/vpfe_video.h index df0aeec..ca9a7024 100644 --- a/drivers/staging/media/davinci_vpfe/vpfe_video.h +++ b/drivers/staging/media/davinci_vpfe/vpfe_video.h @@ -32,7 +32,7 @@ struct vpfe_device; * if there was no buffer previously queued. */ struct vpfe_video_operations { - int(*queue) (struct vpfe_device *vpfe_dev, unsigned long addr); + int (*queue)(struct vpfe_device *vpfe_dev, unsigned long addr); }; enum vpfe_pipeline_stream_state { diff --git a/drivers/staging/media/dt3155v4l/dt3155v4l.c b/drivers/staging/media/dt3155v4l/dt3155v4l.c index e729e52..97e7a9b 100644 --- a/drivers/staging/media/dt3155v4l/dt3155v4l.c +++ b/drivers/staging/media/dt3155v4l/dt3155v4l.c @@ -299,7 +299,7 @@ dt3155_buf_queue(struct vb2_buffer *vb) * end driver-specific callbacks */ -const struct vb2_ops q_ops = { +static const struct vb2_ops q_ops = { .queue_setup = dt3155_queue_setup, .wait_prepare = dt3155_wait_prepare, .wait_finish = dt3155_wait_finish, diff --git a/drivers/staging/media/go7007/go7007-loader.c b/drivers/staging/media/go7007/go7007-loader.c index eecb1f2..491d0e6 100644 --- a/drivers/staging/media/go7007/go7007-loader.c +++ b/drivers/staging/media/go7007/go7007-loader.c @@ -28,7 +28,7 @@ struct fw_config { const char * const fw_name2; }; -struct fw_config fw_configs[] = { +static struct fw_config fw_configs[] = { { 0x1943, 0xa250, "go7007/s2250-1.fw", "go7007/s2250-2.fw" }, { 0x093b, 0xa002, "go7007/px-m402u.fw", NULL }, { 0x093b, 0xa004, "go7007/px-tv402u.fw", NULL }, diff --git a/drivers/staging/media/go7007/go7007-v4l2.c b/drivers/staging/media/go7007/go7007-v4l2.c index edc52e2..bdf414e 100644 --- a/drivers/staging/media/go7007/go7007-v4l2.c +++ b/drivers/staging/media/go7007/go7007-v4l2.c @@ -433,7 +433,8 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, return set_capture_size(go, fmt, 0); } -static int go7007_queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt, +static int go7007_queue_setup(struct vb2_queue *q, + const struct v4l2_format *fmt, unsigned int *num_buffers, unsigned int *num_planes, unsigned int sizes[], void *alloc_ctxs[]) { @@ -737,7 +738,8 @@ static int vidioc_enumaudio(struct file *file, void *fh, struct v4l2_audio *a) if (a->index >= go->board_info->num_aud_inputs) return -EINVAL; - strlcpy(a->name, go->board_info->aud_inputs[a->index].name, sizeof(a->name)); + strlcpy(a->name, go->board_info->aud_inputs[a->index].name, + sizeof(a->name)); a->capability = V4L2_AUDCAP_STEREO; return 0; } @@ -747,12 +749,14 @@ static int vidioc_g_audio(struct file *file, void *fh, struct v4l2_audio *a) struct go7007 *go = video_drvdata(file); a->index = go->aud_input; - strlcpy(a->name, go->board_info->aud_inputs[go->aud_input].name, sizeof(a->name)); + strlcpy(a->name, go->board_info->aud_inputs[go->aud_input].name, + sizeof(a->name)); a->capability = V4L2_AUDCAP_STEREO; return 0; } -static int vidioc_s_audio(struct file *file, void *fh, const struct v4l2_audio *a) +static int vidioc_s_audio(struct file *file, void *fh, + const struct v4l2_audio *a) { struct go7007 *go = video_drvdata(file); @@ -760,7 +764,7 @@ static int vidioc_s_audio(struct file *file, void *fh, const struct v4l2_audio * return -EINVAL; go->aud_input = a->index; v4l2_subdev_call(go->sd_audio, audio, s_routing, - go->board_info->aud_inputs[go->aud_input].audio_input, 0, 0); + go->board_info->aud_inputs[go->aud_input].audio_input, 0, 0); return 0; } @@ -960,8 +964,10 @@ int go7007_v4l2_ctrl_init(struct go7007 *go) V4L2_MPEG_VIDEO_ASPECT_1x1); ctrl = v4l2_ctrl_new_std(hdl, NULL, V4L2_CID_JPEG_ACTIVE_MARKER, 0, - V4L2_JPEG_ACTIVE_MARKER_DQT | V4L2_JPEG_ACTIVE_MARKER_DHT, 0, - V4L2_JPEG_ACTIVE_MARKER_DQT | V4L2_JPEG_ACTIVE_MARKER_DHT); + V4L2_JPEG_ACTIVE_MARKER_DQT | + V4L2_JPEG_ACTIVE_MARKER_DHT, 0, + V4L2_JPEG_ACTIVE_MARKER_DQT | + V4L2_JPEG_ACTIVE_MARKER_DHT); if (ctrl) ctrl->flags |= V4L2_CTRL_FLAG_READ_ONLY; if (hdl->error) { diff --git a/drivers/staging/media/lirc/lirc_igorplugusb.c b/drivers/staging/media/lirc/lirc_igorplugusb.c index f2dcc4a..f508a13 100644 --- a/drivers/staging/media/lirc/lirc_igorplugusb.c +++ b/drivers/staging/media/lirc/lirc_igorplugusb.c @@ -62,7 +62,7 @@ /* debugging support */ #ifdef CONFIG_USB_DEBUG -static bool debug = 1; +static bool debug = true; #else static bool debug; #endif diff --git a/drivers/staging/media/lirc/lirc_imon.c b/drivers/staging/media/lirc/lirc_imon.c index f2d396c..a5b62ee 100644 --- a/drivers/staging/media/lirc/lirc_imon.c +++ b/drivers/staging/media/lirc/lirc_imon.c @@ -943,13 +943,17 @@ alloc_status_switch: usb_free_urb(tx_urb); case 6: usb_free_urb(rx_urb); + /* fall-through */ case 5: if (rbuf) lirc_buffer_free(rbuf); + /* fall-through */ case 4: kfree(rbuf); + /* fall-through */ case 3: kfree(driver); + /* fall-through */ case 2: kfree(context); context = NULL; diff --git a/drivers/staging/media/lirc/lirc_parallel.c b/drivers/staging/media/lirc/lirc_parallel.c index 0b58989..62f5137 100644 --- a/drivers/staging/media/lirc/lirc_parallel.c +++ b/drivers/staging/media/lirc/lirc_parallel.c @@ -68,29 +68,29 @@ static bool debug; static bool check_pselecd; -unsigned int irq = LIRC_IRQ; -unsigned int io = LIRC_PORT; +static unsigned int irq = LIRC_IRQ; +static unsigned int io = LIRC_PORT; #ifdef LIRC_TIMER -unsigned int timer; -unsigned int default_timer = LIRC_TIMER; +static unsigned int timer; +static unsigned int default_timer = LIRC_TIMER; #endif #define RBUF_SIZE (256) /* this must be a power of 2 larger than 1 */ static int rbuf[RBUF_SIZE]; -DECLARE_WAIT_QUEUE_HEAD(lirc_wait); +static DECLARE_WAIT_QUEUE_HEAD(lirc_wait); -unsigned int rptr; -unsigned int wptr; -unsigned int lost_irqs; -int is_open; +static unsigned int rptr; +static unsigned int wptr; +static unsigned int lost_irqs; +static int is_open; -struct parport *pport; -struct pardevice *ppdevice; -int is_claimed; +static struct parport *pport; +static struct pardevice *ppdevice; +static int is_claimed; -unsigned int tx_mask = 1; +static unsigned int tx_mask = 1; /*** Internal Functions ***/ diff --git a/drivers/staging/media/lirc/lirc_sasem.c b/drivers/staging/media/lirc/lirc_sasem.c index d2445fd..81f90e1 100644 --- a/drivers/staging/media/lirc/lirc_sasem.c +++ b/drivers/staging/media/lirc/lirc_sasem.c @@ -74,7 +74,7 @@ static void usb_tx_callback(struct urb *urb); static int vfd_open(struct inode *inode, struct file *file); static long vfd_ioctl(struct file *file, unsigned cmd, unsigned long arg); static int vfd_close(struct inode *inode, struct file *file); -static ssize_t vfd_write(struct file *file, const char *buf, +static ssize_t vfd_write(struct file *file, const char __user *buf, size_t n_bytes, loff_t *pos); /* LIRC driver function prototypes */ @@ -120,7 +120,7 @@ struct sasem_context { static const struct file_operations vfd_fops = { .owner = THIS_MODULE, .open = &vfd_open, - .write = &vfd_write, + .write = vfd_write, .unlocked_ioctl = &vfd_ioctl, .release = &vfd_close, .llseek = noop_llseek, @@ -360,7 +360,7 @@ static int send_packet(struct sasem_context *context) * and requires data in 9 consecutive USB interrupt packets, * each packet carrying 8 bytes. */ -static ssize_t vfd_write(struct file *file, const char *buf, +static ssize_t vfd_write(struct file *file, const char __user *buf, size_t n_bytes, loff_t *pos) { int i; @@ -389,7 +389,7 @@ static ssize_t vfd_write(struct file *file, const char *buf, goto exit; } - data_buf = memdup_user(buf, n_bytes); + data_buf = memdup_user((void const __user *)buf, n_bytes); if (IS_ERR(data_buf)) { retval = PTR_ERR(data_buf); goto exit; @@ -865,15 +865,20 @@ alloc_status_switch: usb_free_urb(tx_urb); case 6: usb_free_urb(rx_urb); + /* fall-through */ case 5: lirc_buffer_free(rbuf); + /* fall-through */ case 4: kfree(rbuf); + /* fall-through */ case 3: kfree(driver); + /* fall-through */ case 2: kfree(context); context = NULL; + /* fall-through */ case 1: if (retval == 0) retval = -ENOMEM; diff --git a/drivers/staging/media/msi3101/sdr-msi3101.c b/drivers/staging/media/msi3101/sdr-msi3101.c index 4c3bf77..5a0400f 100644 --- a/drivers/staging/media/msi3101/sdr-msi3101.c +++ b/drivers/staging/media/msi3101/sdr-msi3101.c @@ -411,7 +411,7 @@ struct msi3101_state { unsigned int vb_full; /* vb is full and packets dropped */ struct urb *urbs[MAX_ISO_BUFS]; - int (*convert_stream) (struct msi3101_state *s, u32 *dst, u8 *src, + int (*convert_stream)(struct msi3101_state *s, u32 *dst, u8 *src, unsigned int src_len); /* Controls */ diff --git a/drivers/staging/media/omap24xx/tcm825x.c b/drivers/staging/media/omap24xx/tcm825x.c index b1ae8e9..f4dd32d 100644 --- a/drivers/staging/media/omap24xx/tcm825x.c +++ b/drivers/staging/media/omap24xx/tcm825x.c @@ -249,11 +249,11 @@ static struct vcontrol { }; -static const struct tcm825x_reg *tcm825x_siz_reg[NUM_IMAGE_SIZES] = -{ &subqcif, &qqvga, &qcif, &qvga, &cif, &vga }; +static const struct tcm825x_reg *tcm825x_siz_reg[NUM_IMAGE_SIZES] = { + &subqcif, &qqvga, &qcif, &qvga, &cif, &vga }; -static const struct tcm825x_reg *tcm825x_fmt_reg[NUM_PIXEL_FORMATS] = -{ &yuv422, &rgb565 }; +static const struct tcm825x_reg *tcm825x_fmt_reg[NUM_PIXEL_FORMATS] = { + &yuv422, &rgb565 }; /* * Read a value from a register in an TCM825X sensor device. The value is diff --git a/drivers/staging/media/omap24xx/tcm825x.h b/drivers/staging/media/omap24xx/tcm825x.h index e2d1bcd..9970fb1 100644 --- a/drivers/staging/media/omap24xx/tcm825x.h +++ b/drivers/staging/media/omap24xx/tcm825x.h @@ -178,7 +178,7 @@ struct tcm825x_platform_data { /* Set power state, zero is off, non-zero is on. */ int (*power_set)(int power); /* Default registers written after power-on or reset. */ - const struct tcm825x_reg *(*default_regs)(void); + const struct tcm825x_reg * (*default_regs)(void); int (*needs_reset)(struct v4l2_int_device *s, void *buf, struct v4l2_pix_format *fmt); int (*ifparm)(struct v4l2_ifparm *p); diff --git a/drivers/staging/media/sn9c102/sn9c102_core.c b/drivers/staging/media/sn9c102/sn9c102_core.c index 2cb44de..71f594f 100644 --- a/drivers/staging/media/sn9c102/sn9c102_core.c +++ b/drivers/staging/media/sn9c102/sn9c102_core.c @@ -158,8 +158,8 @@ sn9c102_request_buffers(struct sn9c102_device* cam, u32 count, cam->nbuffers = count; while (cam->nbuffers > 0) { - if ((buff = vmalloc_32_user(cam->nbuffers * - PAGE_ALIGN(imagesize)))) + buff = vmalloc_32_user(cam->nbuffers * PAGE_ALIGN(imagesize)); + if (buff) break; cam->nbuffers--; } @@ -1121,7 +1121,8 @@ static ssize_t sn9c102_show_val(struct device* cd, return -ENODEV; } - if ((val = sn9c102_read_reg(cam, cam->sysfs.reg)) < 0) { + val = sn9c102_read_reg(cam, cam->sysfs.reg); + if (val < 0) { mutex_unlock(&sn9c102_sysfs_lock); return -EIO; } @@ -1256,7 +1257,8 @@ static ssize_t sn9c102_show_i2c_val(struct device* cd, return -ENOSYS; } - if ((val = sn9c102_i2c_read(cam, cam->sysfs.i2c_reg)) < 0) { + val = sn9c102_i2c_read(cam, cam->sysfs.i2c_reg); + if (val < 0) { mutex_unlock(&sn9c102_sysfs_lock); return -EIO; } @@ -1440,27 +1442,35 @@ static int sn9c102_create_sysfs(struct sn9c102_device* cam) struct device *dev = &(cam->v4ldev->dev); int err = 0; - if ((err = device_create_file(dev, &dev_attr_reg))) + err = device_create_file(dev, &dev_attr_reg); + if (err) goto err_out; - if ((err = device_create_file(dev, &dev_attr_val))) + err = device_create_file(dev, &dev_attr_val); + if (err) goto err_reg; - if ((err = device_create_file(dev, &dev_attr_frame_header))) + err = device_create_file(dev, &dev_attr_frame_header); + if (err) goto err_val; if (cam->sensor.sysfs_ops) { - if ((err = device_create_file(dev, &dev_attr_i2c_reg))) + err = device_create_file(dev, &dev_attr_i2c_reg); + if (err) goto err_frame_header; - if ((err = device_create_file(dev, &dev_attr_i2c_val))) + err = device_create_file(dev, &dev_attr_i2c_val); + if (err) goto err_i2c_reg; } if (cam->bridge == BRIDGE_SN9C101 || cam->bridge == BRIDGE_SN9C102) { - if ((err = device_create_file(dev, &dev_attr_green))) + err = device_create_file(dev, &dev_attr_green); + if (err) goto err_i2c_val; } else { - if ((err = device_create_file(dev, &dev_attr_blue))) + err = device_create_file(dev, &dev_attr_blue); + if (err) goto err_i2c_val; - if ((err = device_create_file(dev, &dev_attr_red))) + err = device_create_file(dev, &dev_attr_red); + if (err) goto err_blue; } @@ -1684,11 +1694,13 @@ static int sn9c102_init(struct sn9c102_device* cam) else DBG(3, "Uncompressed video format is active"); - if (s->set_crop) - if ((err = s->set_crop(cam, rect))) { + if (s->set_crop) { + err = s->set_crop(cam, rect); + if (err) { DBG(3, "set_crop() failed"); return err; } + } if (s->set_ctrl) { for (i = 0; i < ARRAY_SIZE(s->qctrl); i++) @@ -1835,7 +1847,8 @@ static int sn9c102_open(struct file *filp) cam->state &= ~DEV_MISCONFIGURED; } - if ((err = sn9c102_start_transfer(cam))) + err = sn9c102_start_transfer(cam); + if (err) goto out; filp->private_data = cam; @@ -2308,7 +2321,8 @@ sn9c102_vidioc_s_ctrl(struct sn9c102_device* cam, void __user * arg) } if (i == ARRAY_SIZE(s->qctrl)) return -EINVAL; - if ((err = s->set_ctrl(cam, &ctrl))) + err = s->set_ctrl(cam, &ctrl); + if (err) return err; s->_qctrl[i].default_value = ctrl.value; @@ -2416,9 +2430,11 @@ sn9c102_vidioc_s_crop(struct sn9c102_device* cam, void __user * arg) } else scale = 1; - if (cam->stream == STREAM_ON) - if ((err = sn9c102_stream_interrupt(cam))) + if (cam->stream == STREAM_ON) { + err = sn9c102_stream_interrupt(cam); + if (err) return err; + } if (copy_to_user(arg, &crop, sizeof(crop))) { cam->stream = stream; @@ -2672,9 +2688,11 @@ sn9c102_vidioc_try_s_fmt(struct sn9c102_device* cam, unsigned int cmd, return -EBUSY; } - if (cam->stream == STREAM_ON) - if ((err = sn9c102_stream_interrupt(cam))) + if (cam->stream == STREAM_ON) { + err = sn9c102_stream_interrupt(cam); + if (err) return err; + } if (copy_to_user(arg, &format, sizeof(format))) { cam->stream = stream; @@ -2746,9 +2764,11 @@ sn9c102_vidioc_s_jpegcomp(struct sn9c102_device* cam, void __user * arg) if (jc.quality != 0 && jc.quality != 1) return -EINVAL; - if (cam->stream == STREAM_ON) - if ((err = sn9c102_stream_interrupt(cam))) + if (cam->stream == STREAM_ON) { + err = sn9c102_stream_interrupt(cam); + if (err) return err; + } err += sn9c102_set_compression(cam, &jc); if (err) { /* atomic, no rollback in ioctl() */ @@ -2794,9 +2814,11 @@ sn9c102_vidioc_reqbufs(struct sn9c102_device* cam, void __user * arg) return -EBUSY; } - if (cam->stream == STREAM_ON) - if ((err = sn9c102_stream_interrupt(cam))) + if (cam->stream == STREAM_ON) { + err = sn9c102_stream_interrupt(cam); + if (err) return err; + } sn9c102_empty_framequeues(cam); @@ -2974,9 +2996,11 @@ sn9c102_vidioc_streamoff(struct sn9c102_device* cam, void __user * arg) if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE || cam->io != IO_MMAP) return -EINVAL; - if (cam->stream == STREAM_ON) - if ((err = sn9c102_stream_interrupt(cam))) + if (cam->stream == STREAM_ON) { + err = sn9c102_stream_interrupt(cam); + if (err) return err; + } sn9c102_empty_framequeues(cam); @@ -3250,7 +3274,8 @@ sn9c102_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) unsigned int i; int err = 0, r; - if (!(cam = kzalloc(sizeof(struct sn9c102_device), GFP_KERNEL))) + cam = kzalloc(sizeof(struct sn9c102_device), GFP_KERNEL); + if (!cam) return -ENOMEM; cam->usbdev = udev; @@ -3262,13 +3287,15 @@ sn9c102_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) goto fail; } - if (!(cam->control_buffer = kzalloc(8, GFP_KERNEL))) { + cam->control_buffer = kzalloc(8, GFP_KERNEL); + if (!cam->control_buffer) { DBG(1, "kzalloc() failed"); err = -ENOMEM; goto fail; } - if (!(cam->v4ldev = video_device_alloc())) { + cam->v4ldev = video_device_alloc(); + if (!cam->v4ldev) { DBG(1, "video_device_alloc() failed"); err = -ENOMEM; goto fail; diff --git a/drivers/staging/media/sn9c102/sn9c102_hv7131d.c b/drivers/staging/media/sn9c102/sn9c102_hv7131d.c index 2dce5c9..4680721 100644 --- a/drivers/staging/media/sn9c102/sn9c102_hv7131d.c +++ b/drivers/staging/media/sn9c102/sn9c102_hv7131d.c @@ -53,27 +53,32 @@ static int hv7131d_get_ctrl(struct sn9c102_device* cam, } return 0; case V4L2_CID_RED_BALANCE: - if ((ctrl->value = sn9c102_i2c_read(cam, 0x31)) < 0) + ctrl->value = sn9c102_i2c_read(cam, 0x31); + if (ctrl->value < 0) return -EIO; ctrl->value = 0x3f - (ctrl->value & 0x3f); return 0; case V4L2_CID_BLUE_BALANCE: - if ((ctrl->value = sn9c102_i2c_read(cam, 0x33)) < 0) + ctrl->value = sn9c102_i2c_read(cam, 0x33); + if (ctrl->value < 0) return -EIO; ctrl->value = 0x3f - (ctrl->value & 0x3f); return 0; case SN9C102_V4L2_CID_GREEN_BALANCE: - if ((ctrl->value = sn9c102_i2c_read(cam, 0x32)) < 0) + ctrl->value = sn9c102_i2c_read(cam, 0x32); + if (ctrl->value < 0) return -EIO; ctrl->value = 0x3f - (ctrl->value & 0x3f); return 0; case SN9C102_V4L2_CID_RESET_LEVEL: - if ((ctrl->value = sn9c102_i2c_read(cam, 0x30)) < 0) + ctrl->value = sn9c102_i2c_read(cam, 0x30); + if (ctrl->value < 0) return -EIO; ctrl->value &= 0x3f; return 0; case SN9C102_V4L2_CID_PIXEL_BIAS_VOLTAGE: - if ((ctrl->value = sn9c102_i2c_read(cam, 0x34)) < 0) + ctrl->value = sn9c102_i2c_read(cam, 0x34); + if (ctrl->value < 0) return -EIO; ctrl->value &= 0x07; return 0; diff --git a/drivers/staging/media/sn9c102/sn9c102_hv7131r.c b/drivers/staging/media/sn9c102/sn9c102_hv7131r.c index 4295887..26a9111 100644 --- a/drivers/staging/media/sn9c102/sn9c102_hv7131r.c +++ b/drivers/staging/media/sn9c102/sn9c102_hv7131r.c @@ -142,26 +142,31 @@ static int hv7131r_get_ctrl(struct sn9c102_device* cam, { switch (ctrl->id) { case V4L2_CID_GAIN: - if ((ctrl->value = sn9c102_i2c_read(cam, 0x30)) < 0) + ctrl->value = sn9c102_i2c_read(cam, 0x30); + if (ctrl->value < 0) return -EIO; return 0; case V4L2_CID_RED_BALANCE: - if ((ctrl->value = sn9c102_i2c_read(cam, 0x31)) < 0) + ctrl->value = sn9c102_i2c_read(cam, 0x31); + if (ctrl->value < 0) return -EIO; ctrl->value = ctrl->value & 0x3f; return 0; case V4L2_CID_BLUE_BALANCE: - if ((ctrl->value = sn9c102_i2c_read(cam, 0x33)) < 0) + ctrl->value = sn9c102_i2c_read(cam, 0x33); + if (ctrl->value < 0) return -EIO; ctrl->value = ctrl->value & 0x3f; return 0; case SN9C102_V4L2_CID_GREEN_BALANCE: - if ((ctrl->value = sn9c102_i2c_read(cam, 0x32)) < 0) + ctrl->value = sn9c102_i2c_read(cam, 0x32); + if (ctrl->value < 0) return -EIO; ctrl->value = ctrl->value & 0x3f; return 0; case V4L2_CID_BLACK_LEVEL: - if ((ctrl->value = sn9c102_i2c_read(cam, 0x01)) < 0) + ctrl->value = sn9c102_i2c_read(cam, 0x01); + if (ctrl->value < 0) return -EIO; ctrl->value = (ctrl->value & 0x08) ? 1 : 0; return 0; diff --git a/drivers/staging/media/sn9c102/sn9c102_ov7630.c b/drivers/staging/media/sn9c102/sn9c102_ov7630.c index 803712c..d3a1bd8 100644 --- a/drivers/staging/media/sn9c102/sn9c102_ov7630.c +++ b/drivers/staging/media/sn9c102/sn9c102_ov7630.c @@ -260,7 +260,8 @@ static int ov7630_get_ctrl(struct sn9c102_device* cam, switch (ctrl->id) { case V4L2_CID_EXPOSURE: - if ((ctrl->value = sn9c102_i2c_read(cam, 0x10)) < 0) + ctrl->value = sn9c102_i2c_read(cam, 0x10); + if (ctrl->value < 0) return -EIO; break; case V4L2_CID_RED_BALANCE: @@ -280,37 +281,44 @@ static int ov7630_get_ctrl(struct sn9c102_device* cam, break; break; case V4L2_CID_GAIN: - if ((ctrl->value = sn9c102_i2c_read(cam, 0x00)) < 0) + ctrl->value = sn9c102_i2c_read(cam, 0x00); + if (ctrl->value < 0) return -EIO; ctrl->value &= 0x3f; break; case V4L2_CID_DO_WHITE_BALANCE: - if ((ctrl->value = sn9c102_i2c_read(cam, 0x0c)) < 0) + ctrl->value = sn9c102_i2c_read(cam, 0x0c); + if (ctrl->value < 0) return -EIO; ctrl->value &= 0x3f; break; case V4L2_CID_WHITENESS: - if ((ctrl->value = sn9c102_i2c_read(cam, 0x0d)) < 0) + ctrl->value = sn9c102_i2c_read(cam, 0x0d); + if (ctrl->value < 0) return -EIO; ctrl->value &= 0x3f; break; case V4L2_CID_AUTOGAIN: - if ((ctrl->value = sn9c102_i2c_read(cam, 0x13)) < 0) + ctrl->value = sn9c102_i2c_read(cam, 0x13); + if (ctrl->value < 0) return -EIO; ctrl->value &= 0x01; break; case V4L2_CID_VFLIP: - if ((ctrl->value = sn9c102_i2c_read(cam, 0x75)) < 0) + ctrl->value = sn9c102_i2c_read(cam, 0x75); + if (ctrl->value < 0) return -EIO; ctrl->value = (ctrl->value & 0x80) ? 1 : 0; break; case SN9C102_V4L2_CID_GAMMA: - if ((ctrl->value = sn9c102_i2c_read(cam, 0x14)) < 0) + ctrl->value = sn9c102_i2c_read(cam, 0x14); + if (ctrl->value < 0) return -EIO; ctrl->value = (ctrl->value & 0x02) ? 1 : 0; break; case SN9C102_V4L2_CID_BAND_FILTER: - if ((ctrl->value = sn9c102_i2c_read(cam, 0x2d)) < 0) + ctrl->value = sn9c102_i2c_read(cam, 0x2d); + if (ctrl->value < 0) return -EIO; ctrl->value = (ctrl->value & 0x02) ? 1 : 0; break; diff --git a/drivers/staging/media/sn9c102/sn9c102_ov7660.c b/drivers/staging/media/sn9c102/sn9c102_ov7660.c index 7977795..530157a 100644 --- a/drivers/staging/media/sn9c102/sn9c102_ov7660.c +++ b/drivers/staging/media/sn9c102/sn9c102_ov7660.c @@ -278,41 +278,49 @@ static int ov7660_get_ctrl(struct sn9c102_device* cam, switch (ctrl->id) { case V4L2_CID_EXPOSURE: - if ((ctrl->value = sn9c102_i2c_read(cam, 0x10)) < 0) + ctrl->value = sn9c102_i2c_read(cam, 0x10); + if (ctrl->value < 0) return -EIO; break; case V4L2_CID_DO_WHITE_BALANCE: - if ((ctrl->value = sn9c102_read_reg(cam, 0x02)) < 0) + ctrl->value = sn9c102_read_reg(cam, 0x02); + if (ctrl->value < 0) return -EIO; ctrl->value = (ctrl->value & 0x04) ? 1 : 0; break; case V4L2_CID_RED_BALANCE: - if ((ctrl->value = sn9c102_read_reg(cam, 0x05)) < 0) + ctrl->value = sn9c102_read_reg(cam, 0x05); + if (ctrl->value < 0) return -EIO; ctrl->value &= 0x7f; break; case V4L2_CID_BLUE_BALANCE: - if ((ctrl->value = sn9c102_read_reg(cam, 0x06)) < 0) + ctrl->value = sn9c102_read_reg(cam, 0x06); + if (ctrl->value < 0) return -EIO; ctrl->value &= 0x7f; break; case SN9C102_V4L2_CID_GREEN_BALANCE: - if ((ctrl->value = sn9c102_read_reg(cam, 0x07)) < 0) + ctrl->value = sn9c102_read_reg(cam, 0x07); + if (ctrl->value < 0) return -EIO; ctrl->value &= 0x7f; break; case SN9C102_V4L2_CID_BAND_FILTER: - if ((ctrl->value = sn9c102_i2c_read(cam, 0x3b)) < 0) + ctrl->value = sn9c102_i2c_read(cam, 0x3b); + if (ctrl->value < 0) return -EIO; ctrl->value &= 0x08; break; case V4L2_CID_GAIN: - if ((ctrl->value = sn9c102_i2c_read(cam, 0x00)) < 0) + ctrl->value = sn9c102_i2c_read(cam, 0x00); + if (ctrl->value < 0) return -EIO; ctrl->value &= 0x1f; break; case V4L2_CID_AUTOGAIN: - if ((ctrl->value = sn9c102_i2c_read(cam, 0x13)) < 0) + ctrl->value = sn9c102_i2c_read(cam, 0x13); + if (ctrl->value < 0) return -EIO; ctrl->value &= 0x01; break; diff --git a/drivers/staging/media/sn9c102/sn9c102_pas106b.c b/drivers/staging/media/sn9c102/sn9c102_pas106b.c index 81cd969..47bd82d 100644 --- a/drivers/staging/media/sn9c102/sn9c102_pas106b.c +++ b/drivers/staging/media/sn9c102/sn9c102_pas106b.c @@ -62,32 +62,38 @@ static int pas106b_get_ctrl(struct sn9c102_device* cam, } return 0; case V4L2_CID_RED_BALANCE: - if ((ctrl->value = sn9c102_i2c_read(cam, 0x0c)) < 0) + ctrl->value = sn9c102_i2c_read(cam, 0x0c); + if (ctrl->value < 0) return -EIO; ctrl->value &= 0x1f; return 0; case V4L2_CID_BLUE_BALANCE: - if ((ctrl->value = sn9c102_i2c_read(cam, 0x09)) < 0) + ctrl->value = sn9c102_i2c_read(cam, 0x09); + if (ctrl->value < 0) return -EIO; ctrl->value &= 0x1f; return 0; case V4L2_CID_GAIN: - if ((ctrl->value = sn9c102_i2c_read(cam, 0x0e)) < 0) + ctrl->value = sn9c102_i2c_read(cam, 0x0e); + if (ctrl->value < 0) return -EIO; ctrl->value &= 0x1f; return 0; case V4L2_CID_CONTRAST: - if ((ctrl->value = sn9c102_i2c_read(cam, 0x0f)) < 0) + ctrl->value = sn9c102_i2c_read(cam, 0x0f); + if (ctrl->value < 0) return -EIO; ctrl->value &= 0x07; return 0; case SN9C102_V4L2_CID_GREEN_BALANCE: - if ((ctrl->value = sn9c102_i2c_read(cam, 0x0a)) < 0) + ctrl->value = sn9c102_i2c_read(cam, 0x0a); + if (ctrl->value < 0) return -EIO; ctrl->value = (ctrl->value & 0x1f) << 1; return 0; case SN9C102_V4L2_CID_DAC_MAGNITUDE: - if ((ctrl->value = sn9c102_i2c_read(cam, 0x08)) < 0) + ctrl->value = sn9c102_i2c_read(cam, 0x08); + if (ctrl->value < 0) return -EIO; ctrl->value &= 0xf8; return 0; diff --git a/drivers/staging/media/sn9c102/sn9c102_pas202bcb.c b/drivers/staging/media/sn9c102/sn9c102_pas202bcb.c index 2e86fdc..cbfacc2 100644 --- a/drivers/staging/media/sn9c102/sn9c102_pas202bcb.c +++ b/drivers/staging/media/sn9c102/sn9c102_pas202bcb.c @@ -92,27 +92,32 @@ static int pas202bcb_get_ctrl(struct sn9c102_device* cam, } return 0; case V4L2_CID_RED_BALANCE: - if ((ctrl->value = sn9c102_i2c_read(cam, 0x09)) < 0) + ctrl->value = sn9c102_i2c_read(cam, 0x09); + if (ctrl->value < 0) return -EIO; ctrl->value &= 0x0f; return 0; case V4L2_CID_BLUE_BALANCE: - if ((ctrl->value = sn9c102_i2c_read(cam, 0x07)) < 0) + ctrl->value = sn9c102_i2c_read(cam, 0x07); + if (ctrl->value < 0) return -EIO; ctrl->value &= 0x0f; return 0; case V4L2_CID_GAIN: - if ((ctrl->value = sn9c102_i2c_read(cam, 0x10)) < 0) + ctrl->value = sn9c102_i2c_read(cam, 0x10); + if (ctrl->value < 0) return -EIO; ctrl->value &= 0x1f; return 0; case SN9C102_V4L2_CID_GREEN_BALANCE: - if ((ctrl->value = sn9c102_i2c_read(cam, 0x08)) < 0) + ctrl->value = sn9c102_i2c_read(cam, 0x08); + if (ctrl->value < 0) return -EIO; ctrl->value &= 0x0f; return 0; case SN9C102_V4L2_CID_DAC_MAGNITUDE: - if ((ctrl->value = sn9c102_i2c_read(cam, 0x0c)) < 0) + ctrl->value = sn9c102_i2c_read(cam, 0x0c); + if (ctrl->value < 0) return -EIO; return 0; default: diff --git a/drivers/staging/media/solo6x10/solo6x10-core.c b/drivers/staging/media/solo6x10/solo6x10-core.c index 480b7c4..f670469 100644 --- a/drivers/staging/media/solo6x10/solo6x10-core.c +++ b/drivers/staging/media/solo6x10/solo6x10-core.c @@ -40,7 +40,7 @@ MODULE_AUTHOR("Bluecherry <maintainers@bluecherrydvr.com>"); MODULE_VERSION(SOLO6X10_VERSION); MODULE_LICENSE("GPL"); -unsigned video_nr = -1; +static unsigned video_nr = -1; module_param(video_nr, uint, 0644); MODULE_PARM_DESC(video_nr, "videoX start number, -1 is autodetect (default)"); diff --git a/drivers/staging/media/solo6x10/solo6x10-tw28.c b/drivers/staging/media/solo6x10/solo6x10-tw28.c index af65ea6..36daa17 100644 --- a/drivers/staging/media/solo6x10/solo6x10-tw28.c +++ b/drivers/staging/media/solo6x10/solo6x10-tw28.c @@ -516,7 +516,7 @@ static int tw2815_setup(struct solo_dev *solo_dev, u8 dev_addr) static void saa712x_write_regs(struct solo_dev *dev, const uint8_t *vals, int start, int n) { - for (;start < n; start++, vals++) { + for (; start < n; start++, vals++) { /* Skip read-only registers */ switch (start) { /* case 0x00 ... 0x25: */ diff --git a/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c b/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c index ce9e5aa..5aeb9c0 100644 --- a/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c +++ b/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c @@ -399,8 +399,8 @@ static int solo_send_desc(struct solo_enc_dev *solo_enc, int skip, if (solo_enc->desc_count <= 1) return 0; - return solo_p2m_dma_desc(solo_dev, solo_enc->desc_items, solo_enc->desc_dma, - solo_enc->desc_count - 1); + return solo_p2m_dma_desc(solo_dev, solo_enc->desc_items, + solo_enc->desc_dma, solo_enc->desc_count - 1); } /* Extract values from VOP header - VE_STATUSxx */ @@ -472,8 +472,7 @@ static int solo_fill_jpeg(struct solo_enc_dev *solo_enc, if (vb2_plane_size(vb, 0) < vop_jpeg_size(vh) + solo_enc->jpeg_len) return -EIO; - frame_size = (vop_jpeg_size(vh) + solo_enc->jpeg_len + (DMA_ALIGN - 1)) - & ~(DMA_ALIGN - 1); + frame_size = ALIGN(vop_jpeg_size(vh) + solo_enc->jpeg_len, DMA_ALIGN); vb2_set_plane_payload(vb, 0, vop_jpeg_size(vh) + solo_enc->jpeg_len); /* may discard all previous data in vbuf->sgl */ @@ -506,21 +505,22 @@ static int solo_fill_mpeg(struct solo_enc_dev *solo_enc, return -EIO; /* If this is a key frame, add extra header */ - vb->v4l2_buf.flags &= ~(V4L2_BUF_FLAG_KEYFRAME | V4L2_BUF_FLAG_PFRAME | V4L2_BUF_FLAG_BFRAME); + vb->v4l2_buf.flags &= ~(V4L2_BUF_FLAG_KEYFRAME | V4L2_BUF_FLAG_PFRAME | + V4L2_BUF_FLAG_BFRAME); if (!vop_type(vh)) { skip = solo_enc->vop_len; vb->v4l2_buf.flags |= V4L2_BUF_FLAG_KEYFRAME; - vb2_set_plane_payload(vb, 0, vop_mpeg_size(vh) + solo_enc->vop_len); + vb2_set_plane_payload(vb, 0, vop_mpeg_size(vh) + + solo_enc->vop_len); } else { vb->v4l2_buf.flags |= V4L2_BUF_FLAG_PFRAME; vb2_set_plane_payload(vb, 0, vop_mpeg_size(vh)); } /* Now get the actual mpeg payload */ - frame_off = (vop_mpeg_offset(vh) - SOLO_MP4E_EXT_ADDR(solo_dev) + sizeof(*vh)) - % SOLO_MP4E_EXT_SIZE(solo_dev); - frame_size = (vop_mpeg_size(vh) + skip + (DMA_ALIGN - 1)) - & ~(DMA_ALIGN - 1); + frame_off = (vop_mpeg_offset(vh) - SOLO_MP4E_EXT_ADDR(solo_dev) + + sizeof(*vh)) % SOLO_MP4E_EXT_SIZE(solo_dev); + frame_size = ALIGN(vop_mpeg_size(vh) + skip, DMA_ALIGN); /* may discard all previous data in vbuf->sgl */ dma_map_sg(&solo_dev->pdev->dev, vbuf->sgl, vbuf->nents, @@ -589,7 +589,8 @@ static void solo_enc_handle_one(struct solo_enc_dev *solo_enc, spin_unlock_irqrestore(&solo_enc->av_lock, flags); goto unlock; } - vb = list_first_entry(&solo_enc->vidq_active, struct solo_vb2_buf, list); + vb = list_first_entry(&solo_enc->vidq_active, struct solo_vb2_buf, + list); list_del(&vb->list); spin_unlock_irqrestore(&solo_enc->av_lock, flags); @@ -645,7 +646,8 @@ static void solo_handle_ring(struct solo_dev *solo_dev) enc_buf.vh = solo_dev->vh_buf; /* Sanity check */ - if (vop_mpeg_offset(enc_buf.vh) != SOLO_MP4E_EXT_ADDR(solo_dev) + off) + if (vop_mpeg_offset(enc_buf.vh) != + SOLO_MP4E_EXT_ADDR(solo_dev) + off) continue; if (solo_motion_detected(solo_enc)) @@ -680,9 +682,11 @@ static int solo_ring_thread(void *data) return 0; } -static int solo_enc_queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt, - unsigned int *num_buffers, unsigned int *num_planes, - unsigned int sizes[], void *alloc_ctxs[]) +static int solo_enc_queue_setup(struct vb2_queue *q, + const struct v4l2_format *fmt, + unsigned int *num_buffers, + unsigned int *num_planes, unsigned int sizes[], + void *alloc_ctxs[]) { sizes[0] = FRAME_BUF_SIZE; *num_planes = 1; @@ -1112,14 +1116,15 @@ static int solo_s_ctrl(struct v4l2_ctrl *ctrl) solo_enc->motion_thresh = ctrl->val; if (!solo_enc->motion_global || !solo_enc->motion_enabled) return 0; - return solo_set_motion_threshold(solo_dev, solo_enc->ch, ctrl->val); + return solo_set_motion_threshold(solo_dev, solo_enc->ch, + ctrl->val); case V4L2_CID_MOTION_MODE: solo_enc->motion_global = ctrl->val == 1; solo_enc->motion_enabled = ctrl->val > 0; if (ctrl->val) { if (solo_enc->motion_global) - solo_set_motion_threshold(solo_dev, solo_enc->ch, - solo_enc->motion_thresh); + solo_set_motion_threshold(solo_dev, + solo_enc->ch, solo_enc->motion_thresh); else solo_set_motion_block(solo_dev, solo_enc->ch, &solo_enc->motion_thresholds); @@ -1307,7 +1312,8 @@ static struct solo_enc_dev *solo_enc_alloc(struct solo_dev *solo_dev, solo_enc->desc_nelts = 32; solo_enc->desc_items = pci_alloc_consistent(solo_dev->pdev, sizeof(struct solo_p2m_desc) * - solo_enc->desc_nelts, &solo_enc->desc_dma); + solo_enc->desc_nelts, + &solo_enc->desc_dma); ret = -ENOMEM; if (solo_enc->desc_items == NULL) goto hdl_free; |