From 576f7d34871f64ac3064f5fc3892c67a90cd1677 Mon Sep 17 00:00:00 2001 From: "ileana@telecom-paristech.fr" Date: Tue, 18 Mar 2014 10:31:03 -0300 Subject: [media] staging: omap24xx: fix coding style Fix missing parentheses in macros Errors found by checkpatch.pl Signed-off-by: Ioana Ileana Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/omap24xx/tcm825x.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/omap24xx/tcm825x.h b/drivers/staging/media/omap24xx/tcm825x.h index 9970fb1c596a..8a29636d1ad4 100644 --- a/drivers/staging/media/omap24xx/tcm825x.h +++ b/drivers/staging/media/omap24xx/tcm825x.h @@ -21,8 +21,8 @@ #define TCM825X_NAME "tcm825x" -#define TCM825X_MASK(x) x & 0x00ff -#define TCM825X_ADDR(x) (x & 0xff00) >> 8 +#define TCM825X_MASK(x) (x & 0x00ff) +#define TCM825X_ADDR(x) ((x & 0xff00) >> 8) /* The TCM825X I2C sensor chip has a fixed slave address of 0x3d. */ #define TCM825X_I2C_ADDR 0x3d -- cgit From 07002c05c31e5aee7d2a2e2af73b414c75f302c2 Mon Sep 17 00:00:00 2001 From: Mike Sampson Date: Mon, 24 Mar 2014 06:04:49 -0300 Subject: [media] sn9c102_hv7131r: fix style warnings flagged by checkpatch.pl Signed-off-by: Mike Sampson Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/sn9c102/sn9c102_hv7131r.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/sn9c102/sn9c102_hv7131r.c b/drivers/staging/media/sn9c102/sn9c102_hv7131r.c index 26a91115b831..51b24e000e88 100644 --- a/drivers/staging/media/sn9c102/sn9c102_hv7131r.c +++ b/drivers/staging/media/sn9c102/sn9c102_hv7131r.c @@ -23,7 +23,7 @@ #include "sn9c102_devtable.h" -static int hv7131r_init(struct sn9c102_device* cam) +static int hv7131r_init(struct sn9c102_device *cam) { int err = 0; @@ -137,8 +137,8 @@ static int hv7131r_init(struct sn9c102_device* cam) } -static int hv7131r_get_ctrl(struct sn9c102_device* cam, - struct v4l2_control* ctrl) +static int hv7131r_get_ctrl(struct sn9c102_device *cam, + struct v4l2_control *ctrl) { switch (ctrl->id) { case V4L2_CID_GAIN: @@ -176,8 +176,8 @@ static int hv7131r_get_ctrl(struct sn9c102_device* cam, } -static int hv7131r_set_ctrl(struct sn9c102_device* cam, - const struct v4l2_control* ctrl) +static int hv7131r_set_ctrl(struct sn9c102_device *cam, + const struct v4l2_control *ctrl) { int err = 0; @@ -197,6 +197,7 @@ static int hv7131r_set_ctrl(struct sn9c102_device* cam, case V4L2_CID_BLACK_LEVEL: { int r = sn9c102_i2c_read(cam, 0x01); + if (r < 0) return -EIO; err += sn9c102_i2c_write(cam, 0x01, @@ -211,10 +212,10 @@ static int hv7131r_set_ctrl(struct sn9c102_device* cam, } -static int hv7131r_set_crop(struct sn9c102_device* cam, - const struct v4l2_rect* rect) +static int hv7131r_set_crop(struct sn9c102_device *cam, + const struct v4l2_rect *rect) { - struct sn9c102_sensor* s = sn9c102_get_sensor(cam); + struct sn9c102_sensor *s = sn9c102_get_sensor(cam); int err = 0; u8 h_start = (u8)(rect->left - s->cropcap.bounds.left) + 1, v_start = (u8)(rect->top - s->cropcap.bounds.top) + 1; @@ -226,8 +227,8 @@ static int hv7131r_set_crop(struct sn9c102_device* cam, } -static int hv7131r_set_pix_format(struct sn9c102_device* cam, - const struct v4l2_pix_format* pix) +static int hv7131r_set_pix_format(struct sn9c102_device *cam, + const struct v4l2_pix_format *pix) { int err = 0; @@ -347,7 +348,7 @@ static const struct sn9c102_sensor hv7131r = { }; -int sn9c102_probe_hv7131r(struct sn9c102_device* cam) +int sn9c102_probe_hv7131r(struct sn9c102_device *cam) { int devid, err; -- cgit From 933fd6e57d594ca9ae06894bb91d3fe067397dfa Mon Sep 17 00:00:00 2001 From: "Lad, Prabhakar" Date: Sun, 23 Mar 2014 03:37:24 -0300 Subject: [media] staging: media: davinci: vpfe: use v4l2_fh for priority handling Signed-off-by: Lad, Prabhakar Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/davinci_vpfe/vpfe_mc_capture.h | 2 -- drivers/staging/media/davinci_vpfe/vpfe_video.c | 8 +++----- drivers/staging/media/davinci_vpfe/vpfe_video.h | 2 -- 3 files changed, 3 insertions(+), 9 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.h b/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.h index 68f6fe43a5b5..2632a806c4a8 100644 --- a/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.h +++ b/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.h @@ -87,8 +87,6 @@ struct vpfe_fh { struct vpfe_video_device *video; /* Indicates whether this file handle is doing IO */ u8 io_allowed; - /* Used to keep track priority of this instance */ - enum v4l2_priority prio; }; void mbus_to_pix(const struct v4l2_mbus_framefmt *mbus, diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.c b/drivers/staging/media/davinci_vpfe/vpfe_video.c index acc8184c46cd..c86ab8436c99 100644 --- a/drivers/staging/media/davinci_vpfe/vpfe_video.c +++ b/drivers/staging/media/davinci_vpfe/vpfe_video.c @@ -415,7 +415,6 @@ static int vpfe_open(struct file *file) video->usrs++; /* Set io_allowed member to false */ handle->io_allowed = 0; - v4l2_prio_open(&video->prio, &handle->prio); handle->video = video; file->private_data = &handle->vfh; mutex_unlock(&video->lock); @@ -532,8 +531,8 @@ static int vpfe_release(struct file *file) } /* Decrement device users counter */ video->usrs--; - /* Close the priority */ - v4l2_prio_close(&video->prio, fh->prio); + v4l2_fh_del(&fh->vfh); + v4l2_fh_exit(&fh->vfh); /* If this is the last file handle */ if (!video->usrs) video->initialized = 0; @@ -1590,8 +1589,6 @@ int vpfe_video_init(struct vpfe_video_device *video, const char *name) snprintf(video->video_dev.name, sizeof(video->video_dev.name), "DAVINCI VIDEO %s %s", name, direction); - /* Initialize prio member of device object */ - v4l2_prio_init(&video->prio); spin_lock_init(&video->irqlock); spin_lock_init(&video->dma_queue_lock); mutex_init(&video->lock); @@ -1600,6 +1597,7 @@ int vpfe_video_init(struct vpfe_video_device *video, const char *name) if (ret < 0) return ret; + set_bit(V4L2_FL_USE_FH_PRIO, &video->video_dev.flags); video_set_drvdata(&video->video_dev, video); return 0; diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.h b/drivers/staging/media/davinci_vpfe/vpfe_video.h index ca9a70245233..1b1b6c4a56b7 100644 --- a/drivers/staging/media/davinci_vpfe/vpfe_video.h +++ b/drivers/staging/media/davinci_vpfe/vpfe_video.h @@ -102,8 +102,6 @@ struct vpfe_video_device { * user has selected */ enum v4l2_memory memory; - /* Used to keep track of state of the priority */ - struct v4l2_prio_state prio; /* number of open instances of the channel */ u32 usrs; /* flag to indicate whether decoder is initialized */ -- cgit From 8f7402a304bb80bcb5812353ef07189a1514554a Mon Sep 17 00:00:00 2001 From: "Lad, Prabhakar" Date: Sun, 23 Mar 2014 03:37:25 -0300 Subject: [media] staging: media: davinci: vpfe: release buffers in case start_streaming call back fails this patch releases the buffer by calling vb2_buffer_done(), with state marked as VB2_BUF_STATE_QUEUED if start_streaming() call back fails. Signed-off-by: Lad, Prabhakar Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/davinci_vpfe/vpfe_video.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.c b/drivers/staging/media/davinci_vpfe/vpfe_video.c index c86ab8436c99..9337d92c5939 100644 --- a/drivers/staging/media/davinci_vpfe/vpfe_video.c +++ b/drivers/staging/media/davinci_vpfe/vpfe_video.c @@ -1218,8 +1218,16 @@ static int vpfe_start_streaming(struct vb2_queue *vq, unsigned int count) video->state = VPFE_VIDEO_BUFFER_QUEUED; ret = vpfe_start_capture(video); - if (ret) + if (ret) { + struct vpfe_cap_buffer *buf, *tmp; + + vb2_buffer_done(&video->cur_frm->vb, VB2_BUF_STATE_QUEUED); + list_for_each_entry_safe(buf, tmp, &video->dma_queue, list) { + list_del(&buf->list); + vb2_buffer_done(&buf->vb, VB2_BUF_STATE_QUEUED); + } goto unlock_out; + } mutex_unlock(&video->lock); -- cgit From e37559b22c63b557d242bfa1a07ab1b8f7d5d9f1 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Thu, 17 Apr 2014 02:47:21 -0300 Subject: [media] vb2: stop_streaming should return void The vb2 core ignores any return code from the stop_streaming op. And there really isn't anything it can do anyway in case of an error. So change the return type to void and update any drivers that implement it. The int return gave drivers the idea that this operation could actually fail, but that's really not the case. The pwc amd sdr-msi3101 drivers both had this construction: if (mutex_lock_interruptible(&s->v4l2_lock)) return -ERESTARTSYS; This has been updated to just call mutex_lock(). The stop_streaming op expects this to really stop streaming and I very much doubt this will work reliably if stop_streaming just returns without really stopping the DMA. Signed-off-by: Hans Verkuil Acked-by: Pawel Osciak Acked-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/davinci_vpfe/vpfe_video.c | 3 +-- drivers/staging/media/dt3155v4l/dt3155v4l.c | 3 +-- drivers/staging/media/go7007/go7007-v4l2.c | 3 +-- drivers/staging/media/msi3101/sdr-msi3101.c | 24 ++++++++-------------- drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c | 7 ++----- drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c | 3 +-- drivers/staging/media/solo6x10/solo6x10-v4l2.c | 3 +-- 7 files changed, 15 insertions(+), 31 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.c b/drivers/staging/media/davinci_vpfe/vpfe_video.c index 9337d92c5939..7b213a7f9623 100644 --- a/drivers/staging/media/davinci_vpfe/vpfe_video.c +++ b/drivers/staging/media/davinci_vpfe/vpfe_video.c @@ -1249,7 +1249,7 @@ static int vpfe_buffer_init(struct vb2_buffer *vb) } /* abort streaming and wait for last buffer */ -static int vpfe_stop_streaming(struct vb2_queue *vq) +static void vpfe_stop_streaming(struct vb2_queue *vq) { struct vpfe_fh *fh = vb2_get_drv_priv(vq); struct vpfe_video_device *video = fh->video; @@ -1272,7 +1272,6 @@ static int vpfe_stop_streaming(struct vb2_queue *vq) list_del(&video->next_frm->list); vb2_buffer_done(&video->next_frm->vb, VB2_BUF_STATE_ERROR); } - return 0; } static void vpfe_buf_cleanup(struct vb2_buffer *vb) diff --git a/drivers/staging/media/dt3155v4l/dt3155v4l.c b/drivers/staging/media/dt3155v4l/dt3155v4l.c index afbc2e519606..14bdc19ec48f 100644 --- a/drivers/staging/media/dt3155v4l/dt3155v4l.c +++ b/drivers/staging/media/dt3155v4l/dt3155v4l.c @@ -262,7 +262,7 @@ dt3155_buf_prepare(struct vb2_buffer *vb) return 0; } -static int +static void dt3155_stop_streaming(struct vb2_queue *q) { struct dt3155_priv *pd = vb2_get_drv_priv(q); @@ -276,7 +276,6 @@ dt3155_stop_streaming(struct vb2_queue *q) } spin_unlock_irq(&pd->lock); msleep(45); /* irq hendler will stop the hardware */ - return 0; } static void diff --git a/drivers/staging/media/go7007/go7007-v4l2.c b/drivers/staging/media/go7007/go7007-v4l2.c index b397aa3c0f44..090b3e6e852a 100644 --- a/drivers/staging/media/go7007/go7007-v4l2.c +++ b/drivers/staging/media/go7007/go7007-v4l2.c @@ -516,7 +516,7 @@ static int go7007_start_streaming(struct vb2_queue *q, unsigned int count) return ret; } -static int go7007_stop_streaming(struct vb2_queue *q) +static void go7007_stop_streaming(struct vb2_queue *q) { struct go7007 *go = vb2_get_drv_priv(q); unsigned long flags; @@ -538,7 +538,6 @@ static int go7007_stop_streaming(struct vb2_queue *q) /* Turn on Capture LED */ if (go->board_id == GO7007_BOARDID_ADS_USBAV_709) go7007_write_addr(go, 0x3c82, 0x000d); - return 0; } static struct vb2_ops go7007_video_qops = { diff --git a/drivers/staging/media/msi3101/sdr-msi3101.c b/drivers/staging/media/msi3101/sdr-msi3101.c index 65d351f99da2..08d0d096b881 100644 --- a/drivers/staging/media/msi3101/sdr-msi3101.c +++ b/drivers/staging/media/msi3101/sdr-msi3101.c @@ -1074,14 +1074,13 @@ static int msi3101_start_streaming(struct vb2_queue *vq, unsigned int count) return ret; } -static int msi3101_stop_streaming(struct vb2_queue *vq) +static void msi3101_stop_streaming(struct vb2_queue *vq) { struct msi3101_state *s = vb2_get_drv_priv(vq); - int ret; + dev_dbg(&s->udev->dev, "%s:\n", __func__); - if (mutex_lock_interruptible(&s->v4l2_lock)) - return -ERESTARTSYS; + mutex_lock(&s->v4l2_lock); if (s->udev) msi3101_isoc_cleanup(s); @@ -1090,22 +1089,15 @@ static int msi3101_stop_streaming(struct vb2_queue *vq) /* according to tests, at least 700us delay is required */ msleep(20); - ret = msi3101_ctrl_msg(s, CMD_STOP_STREAMING, 0); - if (ret) - goto err_sleep_tuner; - - /* sleep USB IF / ADC */ - ret = msi3101_ctrl_msg(s, CMD_WREG, 0x01000003); - if (ret) - goto err_sleep_tuner; + if (!msi3101_ctrl_msg(s, CMD_STOP_STREAMING, 0)) { + /* sleep USB IF / ADC */ + msi3101_ctrl_msg(s, CMD_WREG, 0x01000003); + } -err_sleep_tuner: /* sleep tuner */ - ret = v4l2_subdev_call(s->v4l2_subdev, core, s_power, 0); + v4l2_subdev_call(s->v4l2_subdev, core, s_power, 0); mutex_unlock(&s->v4l2_lock); - - return ret; } static struct vb2_ops msi3101_vb2_ops = { diff --git a/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c b/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c index 104ee8af79af..093df6b6ae35 100644 --- a/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c +++ b/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c @@ -1032,13 +1032,12 @@ err: return ret; } -static int rtl2832_sdr_stop_streaming(struct vb2_queue *vq) +static void rtl2832_sdr_stop_streaming(struct vb2_queue *vq) { struct rtl2832_sdr_state *s = vb2_get_drv_priv(vq); dev_dbg(&s->udev->dev, "%s:\n", __func__); - if (mutex_lock_interruptible(&s->v4l2_lock)) - return -ERESTARTSYS; + mutex_lock(&s->v4l2_lock); rtl2832_sdr_kill_urbs(s); rtl2832_sdr_free_urbs(s); @@ -1053,8 +1052,6 @@ static int rtl2832_sdr_stop_streaming(struct vb2_queue *vq) s->d->props->power_ctrl(s->d, 0); mutex_unlock(&s->v4l2_lock); - - return 0; } static struct vb2_ops rtl2832_sdr_vb2_ops = { diff --git a/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c b/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c index 2cbe088f1697..b8ff113c20f4 100644 --- a/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c +++ b/drivers/staging/media/solo6x10/solo6x10-v4l2-enc.c @@ -745,14 +745,13 @@ static int solo_enc_start_streaming(struct vb2_queue *q, unsigned int count) return solo_ring_start(solo_enc->solo_dev); } -static int solo_enc_stop_streaming(struct vb2_queue *q) +static void solo_enc_stop_streaming(struct vb2_queue *q) { struct solo_enc_dev *solo_enc = vb2_get_drv_priv(q); solo_enc_off(solo_enc); INIT_LIST_HEAD(&solo_enc->vidq_active); solo_ring_stop(solo_enc->solo_dev); - return 0; } static struct vb2_ops solo_enc_video_qops = { diff --git a/drivers/staging/media/solo6x10/solo6x10-v4l2.c b/drivers/staging/media/solo6x10/solo6x10-v4l2.c index 1815f765d033..5d0100eb38e6 100644 --- a/drivers/staging/media/solo6x10/solo6x10-v4l2.c +++ b/drivers/staging/media/solo6x10/solo6x10-v4l2.c @@ -336,13 +336,12 @@ static int solo_start_streaming(struct vb2_queue *q, unsigned int count) return solo_start_thread(solo_dev); } -static int solo_stop_streaming(struct vb2_queue *q) +static void solo_stop_streaming(struct vb2_queue *q) { struct solo_dev *solo_dev = vb2_get_drv_priv(q); solo_stop_thread(solo_dev); INIT_LIST_HEAD(&solo_dev->vidq_active); - return 0; } static void solo_buf_queue(struct vb2_buffer *vb) -- cgit From 2e509dddc4a89583c4d1d32743149678edbfe70d Mon Sep 17 00:00:00 2001 From: Paul Bolle Date: Sun, 9 Feb 2014 12:09:37 -0300 Subject: [media] omap4iss: Remove VIDEO_OMAP4_DEBUG Kconfig option The option was supposed to control the definition of the DEBUG macro in the Makefile but has been left unused by mistake. Given that debugging should be enabled using dynamic printk, remote the Kconfig option. [Reworked the commit message] Signed-off-by: Paul Bolle Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/omap4iss/Kconfig | 6 ------ 1 file changed, 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/omap4iss/Kconfig b/drivers/staging/media/omap4iss/Kconfig index b9fe753969bd..78b0fba7047e 100644 --- a/drivers/staging/media/omap4iss/Kconfig +++ b/drivers/staging/media/omap4iss/Kconfig @@ -4,9 +4,3 @@ config VIDEO_OMAP4 select VIDEOBUF2_DMA_CONTIG ---help--- Driver for an OMAP 4 ISS controller. - -config VIDEO_OMAP4_DEBUG - bool "OMAP 4 Camera debug messages" - depends on VIDEO_OMAP4 - ---help--- - Enable debug messages on OMAP 4 ISS controller driver. -- cgit From d14cb130f359878f88fbb1e73af15ccd823cd32f Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Fri, 28 Mar 2014 14:38:17 -0300 Subject: [media] omap4iss: Don't check for DEBUG when printing IRQ debugging messages Now that the VIDEO_OMAP4_DEBUG Kconfig option has been removed in favour of dynamic printk, the DEBUG macro isn't defined anymore. Don't check for it to guard IRQ debugging messages compilation, as they're already guarded by the ISS_ISR_DEBUG macro. Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/omap4iss/iss.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/omap4iss/iss.c b/drivers/staging/media/omap4iss/iss.c index 61fbfcd13582..219519d0f029 100644 --- a/drivers/staging/media/omap4iss/iss.c +++ b/drivers/staging/media/omap4iss/iss.c @@ -204,7 +204,7 @@ void omap4iss_configure_bridge(struct iss_device *iss, iss_reg_write(iss, OMAP4_ISS_MEM_ISP_SYS1, ISP5_CTRL, isp5ctrl_val); } -#if defined(DEBUG) && defined(ISS_ISR_DEBUG) +#ifdef ISS_ISR_DEBUG static void iss_isr_dbg(struct iss_device *iss, u32 irqstatus) { static const char * const name[] = { @@ -347,14 +347,14 @@ static irqreturn_t iss_isr(int irq, void *_iss) omap4iss_resizer_isr(&iss->resizer, isp_irqstatus & resizer_events); -#if defined(DEBUG) && defined(ISS_ISR_DEBUG) +#ifdef ISS_ISR_DEBUG iss_isp_isr_dbg(iss, isp_irqstatus); #endif } omap4iss_flush(iss); -#if defined(DEBUG) && defined(ISS_ISR_DEBUG) +#ifdef ISS_ISR_DEBUG iss_isr_dbg(iss, irqstatus); #endif -- cgit From 47a963f1025690824a3f00e27d1d161a0f01cd88 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Fri, 28 Mar 2014 14:39:54 -0300 Subject: [media] omap4iss: Add missing white space The error was reported by checkpatch.pl. Fix it. Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/omap4iss/iss_video.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/omap4iss/iss_video.h b/drivers/staging/media/omap4iss/iss_video.h index 878e4a3082e7..9dccdb154e1a 100644 --- a/drivers/staging/media/omap4iss/iss_video.h +++ b/drivers/staging/media/omap4iss/iss_video.h @@ -140,7 +140,7 @@ enum iss_video_dmaqueue_flags { * if there was no buffer previously queued. */ struct iss_video_operations { - int(*queue)(struct iss_video *video, struct iss_buffer *buffer); + int (*queue)(struct iss_video *video, struct iss_buffer *buffer); }; struct iss_video { -- cgit From 05b1b986b540fe48f98a09b087b054754d67ef41 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Fri, 28 Mar 2014 15:27:32 -0300 Subject: [media] omap4iss: Use a common macro for all sleep-based poll loops Instead of implementing usleep_range-based poll loops manually (and slightly differently), create a generic iss_poll_wait_timeout() macro and use it through the driver. Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/omap4iss/iss.c | 46 ++++++++++++++----------------- drivers/staging/media/omap4iss/iss.h | 14 ++++++++++ drivers/staging/media/omap4iss/iss_csi2.c | 39 ++++++++------------------ 3 files changed, 45 insertions(+), 54 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/omap4iss/iss.c b/drivers/staging/media/omap4iss/iss.c index 219519d0f029..217d719625ce 100644 --- a/drivers/staging/media/omap4iss/iss.c +++ b/drivers/staging/media/omap4iss/iss.c @@ -734,18 +734,17 @@ static int iss_pipeline_is_last(struct media_entity *me) static int iss_reset(struct iss_device *iss) { - unsigned long timeout = 0; + unsigned int timeout; iss_reg_set(iss, OMAP4_ISS_MEM_TOP, ISS_HL_SYSCONFIG, ISS_HL_SYSCONFIG_SOFTRESET); - while (iss_reg_read(iss, OMAP4_ISS_MEM_TOP, ISS_HL_SYSCONFIG) & - ISS_HL_SYSCONFIG_SOFTRESET) { - if (timeout++ > 100) { - dev_alert(iss->dev, "cannot reset ISS\n"); - return -ETIMEDOUT; - } - usleep_range(10, 10); + timeout = iss_poll_condition_timeout( + !(iss_reg_read(iss, OMAP4_ISS_MEM_TOP, ISS_HL_SYSCONFIG) & + ISS_HL_SYSCONFIG_SOFTRESET), 1000, 10, 10); + if (timeout) { + dev_err(iss->dev, "ISS reset timeout\n"); + return -ETIMEDOUT; } iss->crashed = 0; @@ -754,7 +753,7 @@ static int iss_reset(struct iss_device *iss) static int iss_isp_reset(struct iss_device *iss) { - unsigned long timeout = 0; + unsigned int timeout; /* Fist, ensure that the ISP is IDLE (no transactions happening) */ iss_reg_update(iss, OMAP4_ISS_MEM_ISP_SYS1, ISP5_SYSCONFIG, @@ -763,29 +762,24 @@ static int iss_isp_reset(struct iss_device *iss) iss_reg_set(iss, OMAP4_ISS_MEM_ISP_SYS1, ISP5_CTRL, ISP5_CTRL_MSTANDBY); - for (;;) { - if (iss_reg_read(iss, OMAP4_ISS_MEM_ISP_SYS1, ISP5_CTRL) & - ISP5_CTRL_MSTANDBY_WAIT) - break; - if (timeout++ > 1000) { - dev_alert(iss->dev, "cannot set ISP5 to standby\n"); - return -ETIMEDOUT; - } - usleep_range(1000, 1500); + timeout = iss_poll_condition_timeout( + iss_reg_read(iss, OMAP4_ISS_MEM_ISP_SYS1, ISP5_CTRL) & + ISP5_CTRL_MSTANDBY_WAIT, 1000000, 1000, 1500); + if (timeout) { + dev_err(iss->dev, "ISP5 standby timeout\n"); + return -ETIMEDOUT; } /* Now finally, do the reset */ iss_reg_set(iss, OMAP4_ISS_MEM_ISP_SYS1, ISP5_SYSCONFIG, ISP5_SYSCONFIG_SOFTRESET); - timeout = 0; - while (iss_reg_read(iss, OMAP4_ISS_MEM_ISP_SYS1, ISP5_SYSCONFIG) & - ISP5_SYSCONFIG_SOFTRESET) { - if (timeout++ > 1000) { - dev_alert(iss->dev, "cannot reset ISP5\n"); - return -ETIMEDOUT; - } - usleep_range(1000, 1500); + timeout = iss_poll_condition_timeout( + !(iss_reg_read(iss, OMAP4_ISS_MEM_ISP_SYS1, ISP5_SYSCONFIG) & + ISP5_SYSCONFIG_SOFTRESET), 1000000, 1000, 1500); + if (timeout) { + dev_err(iss->dev, "ISP5 reset timeout\n"); + return -ETIMEDOUT; } return 0; diff --git a/drivers/staging/media/omap4iss/iss.h b/drivers/staging/media/omap4iss/iss.h index 346db9233171..05cd9bf3b41f 100644 --- a/drivers/staging/media/omap4iss/iss.h +++ b/drivers/staging/media/omap4iss/iss.h @@ -233,4 +233,18 @@ void iss_reg_update(struct iss_device *iss, enum iss_mem_resources res, iss_reg_write(iss, res, offset, (v & ~clr) | set); } +#define iss_poll_condition_timeout(cond, timeout, min_ival, max_ival) \ +({ \ + unsigned long __timeout = jiffies + usecs_to_jiffies(timeout); \ + unsigned int __min_ival = (min_ival); \ + unsigned int __max_ival = (max_ival); \ + bool __cond; \ + while (!(__cond = (cond))) { \ + if (time_after(jiffies, __timeout)) \ + break; \ + usleep_range(__min_ival, __max_ival); \ + } \ + !__cond; \ +}) + #endif /* _OMAP4_ISS_H_ */ diff --git a/drivers/staging/media/omap4iss/iss_csi2.c b/drivers/staging/media/omap4iss/iss_csi2.c index 61fc350eb251..3296115525d7 100644 --- a/drivers/staging/media/omap4iss/iss_csi2.c +++ b/drivers/staging/media/omap4iss/iss_csi2.c @@ -487,9 +487,7 @@ static void csi2_irq_status_set(struct iss_csi2_device *csi2, int enable) */ int omap4iss_csi2_reset(struct iss_csi2_device *csi2) { - u8 soft_reset_retries = 0; - u32 reg; - int i; + unsigned int timeout; if (!csi2->available) return -ENODEV; @@ -500,37 +498,22 @@ int omap4iss_csi2_reset(struct iss_csi2_device *csi2) iss_reg_set(csi2->iss, csi2->regs1, CSI2_SYSCONFIG, CSI2_SYSCONFIG_SOFT_RESET); - do { - reg = iss_reg_read(csi2->iss, csi2->regs1, CSI2_SYSSTATUS) - & CSI2_SYSSTATUS_RESET_DONE; - if (reg == CSI2_SYSSTATUS_RESET_DONE) - break; - soft_reset_retries++; - if (soft_reset_retries < 5) - usleep_range(100, 100); - } while (soft_reset_retries < 5); - - if (soft_reset_retries == 5) { - dev_err(csi2->iss->dev, - "CSI2: Soft reset try count exceeded!\n"); + timeout = iss_poll_condition_timeout( + iss_reg_read(csi2->iss, csi2->regs1, CSI2_SYSSTATUS) & + CSI2_SYSSTATUS_RESET_DONE, 500, 100, 100); + if (timeout) { + dev_err(csi2->iss->dev, "CSI2: Soft reset timeout!\n"); return -EBUSY; } iss_reg_set(csi2->iss, csi2->regs1, CSI2_COMPLEXIO_CFG, CSI2_COMPLEXIO_CFG_RESET_CTRL); - i = 100; - do { - reg = iss_reg_read(csi2->iss, csi2->phy->phy_regs, REGISTER1) - & REGISTER1_RESET_DONE_CTRLCLK; - if (reg == REGISTER1_RESET_DONE_CTRLCLK) - break; - usleep_range(100, 100); - } while (--i > 0); - - if (i == 0) { - dev_err(csi2->iss->dev, - "CSI2: Reset for CSI2_96M_FCLK domain Failed!\n"); + timeout = iss_poll_condition_timeout( + iss_reg_read(csi2->iss, csi2->phy->phy_regs, REGISTER1) & + REGISTER1_RESET_DONE_CTRLCLK, 10000, 100, 100); + if (timeout) { + dev_err(csi2->iss->dev, "CSI2: CSI2_96M_FCLK reset timeout!\n"); return -EBUSY; } -- cgit From fa7014f569b2a38b926792a9b9021df0af0556e9 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Mon, 21 Apr 2014 10:44:55 -0300 Subject: [media] omap4iss: Relax usleep ranges Allow the system to merge CPU wakeups by specifying different minimum and maximum usleep values. Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/omap4iss/iss.c | 2 +- drivers/staging/media/omap4iss/iss_csi2.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/omap4iss/iss.c b/drivers/staging/media/omap4iss/iss.c index 217d719625ce..2e422dde074e 100644 --- a/drivers/staging/media/omap4iss/iss.c +++ b/drivers/staging/media/omap4iss/iss.c @@ -741,7 +741,7 @@ static int iss_reset(struct iss_device *iss) timeout = iss_poll_condition_timeout( !(iss_reg_read(iss, OMAP4_ISS_MEM_TOP, ISS_HL_SYSCONFIG) & - ISS_HL_SYSCONFIG_SOFTRESET), 1000, 10, 10); + ISS_HL_SYSCONFIG_SOFTRESET), 1000, 10, 100); if (timeout) { dev_err(iss->dev, "ISS reset timeout\n"); return -ETIMEDOUT; diff --git a/drivers/staging/media/omap4iss/iss_csi2.c b/drivers/staging/media/omap4iss/iss_csi2.c index 3296115525d7..bf8a65726107 100644 --- a/drivers/staging/media/omap4iss/iss_csi2.c +++ b/drivers/staging/media/omap4iss/iss_csi2.c @@ -500,7 +500,7 @@ int omap4iss_csi2_reset(struct iss_csi2_device *csi2) timeout = iss_poll_condition_timeout( iss_reg_read(csi2->iss, csi2->regs1, CSI2_SYSSTATUS) & - CSI2_SYSSTATUS_RESET_DONE, 500, 100, 100); + CSI2_SYSSTATUS_RESET_DONE, 500, 100, 200); if (timeout) { dev_err(csi2->iss->dev, "CSI2: Soft reset timeout!\n"); return -EBUSY; @@ -511,7 +511,7 @@ int omap4iss_csi2_reset(struct iss_csi2_device *csi2) timeout = iss_poll_condition_timeout( iss_reg_read(csi2->iss, csi2->phy->phy_regs, REGISTER1) & - REGISTER1_RESET_DONE_CTRLCLK, 10000, 100, 100); + REGISTER1_RESET_DONE_CTRLCLK, 10000, 100, 500); if (timeout) { dev_err(csi2->iss->dev, "CSI2: CSI2_96M_FCLK reset timeout!\n"); return -EBUSY; -- cgit From cd6ff5c2dfb3f17e3b900738533a7f82a2030746 Mon Sep 17 00:00:00 2001 From: Jinqiang Zeng Date: Sat, 19 Apr 2014 00:09:47 -0300 Subject: [media] fix the code style errors in sn9c102 Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/sn9c102/sn9c102.h | 30 +- drivers/staging/media/sn9c102/sn9c102_core.c | 342 +++++++++++---------- drivers/staging/media/sn9c102/sn9c102_devtable.h | 22 +- drivers/staging/media/sn9c102/sn9c102_hv7131d.c | 22 +- drivers/staging/media/sn9c102/sn9c102_mi0343.c | 30 +- drivers/staging/media/sn9c102/sn9c102_mi0360.c | 30 +- drivers/staging/media/sn9c102/sn9c102_ov7630.c | 22 +- drivers/staging/media/sn9c102/sn9c102_ov7660.c | 22 +- drivers/staging/media/sn9c102/sn9c102_pas106b.c | 22 +- drivers/staging/media/sn9c102/sn9c102_pas202bcb.c | 22 +- drivers/staging/media/sn9c102/sn9c102_sensor.h | 34 +- drivers/staging/media/sn9c102/sn9c102_tas5110c1b.c | 18 +- drivers/staging/media/sn9c102/sn9c102_tas5110d.c | 14 +- drivers/staging/media/sn9c102/sn9c102_tas5130d1b.c | 18 +- 14 files changed, 326 insertions(+), 322 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/sn9c102/sn9c102.h b/drivers/staging/media/sn9c102/sn9c102.h index 8a917f060503..37ca7225fcf7 100644 --- a/drivers/staging/media/sn9c102/sn9c102.h +++ b/drivers/staging/media/sn9c102/sn9c102.h @@ -53,7 +53,7 @@ enum sn9c102_frame_state { }; struct sn9c102_frame_t { - void* bufmem; + void *bufmem; struct v4l2_buffer buf; enum sn9c102_frame_state state; struct list_head frame; @@ -99,17 +99,17 @@ static DEFINE_MUTEX(sn9c102_sysfs_lock); static DECLARE_RWSEM(sn9c102_dev_lock); struct sn9c102_device { - struct video_device* v4ldev; + struct video_device *v4ldev; struct v4l2_device v4l2_dev; enum sn9c102_bridge bridge; struct sn9c102_sensor sensor; - struct usb_device* usbdev; - struct urb* urb[SN9C102_URBS]; - void* transfer_buffer[SN9C102_URBS]; - u8* control_buffer; + struct usb_device *usbdev; + struct urb *urb[SN9C102_URBS]; + void *transfer_buffer[SN9C102_URBS]; + u8 *control_buffer; struct sn9c102_frame_t *frame_current, frame[SN9C102_MAX_FRAMES]; struct list_head inqueue, outqueue; @@ -139,28 +139,28 @@ struct sn9c102_device { /*****************************************************************************/ struct sn9c102_device* -sn9c102_match_id(struct sn9c102_device* cam, const struct usb_device_id *id) +sn9c102_match_id(struct sn9c102_device *cam, const struct usb_device_id *id) { return usb_match_id(usb_ifnum_to_if(cam->usbdev, 0), id) ? cam : NULL; } void -sn9c102_attach_sensor(struct sn9c102_device* cam, - const struct sn9c102_sensor* sensor) +sn9c102_attach_sensor(struct sn9c102_device *cam, + const struct sn9c102_sensor *sensor) { memcpy(&cam->sensor, sensor, sizeof(struct sn9c102_sensor)); } enum sn9c102_bridge -sn9c102_get_bridge(struct sn9c102_device* cam) +sn9c102_get_bridge(struct sn9c102_device *cam) { return cam->bridge; } -struct sn9c102_sensor* sn9c102_get_sensor(struct sn9c102_device* cam) +struct sn9c102_sensor *sn9c102_get_sensor(struct sn9c102_device *cam) { return &cam->sensor; } @@ -198,9 +198,9 @@ do { \ } \ } while (0) #else -# define DBG(level, fmt, args...) do {;} while(0) -# define V4LDBG(level, name, cmd) do {;} while(0) -# define KDBG(level, fmt, args...) do {;} while(0) +# define DBG(level, fmt, args...) do { ; } while (0) +# define V4LDBG(level, name, cmd) do { ; } while (0) +# define KDBG(level, fmt, args...) do { ; } while (0) #endif #undef PDBG @@ -209,6 +209,6 @@ dev_info(&cam->usbdev->dev, "[%s:%s:%d] " fmt "\n", __FILE__, __func__, \ __LINE__ , ## args) #undef PDBGG -#define PDBGG(fmt, args...) do {;} while(0) /* placeholder */ +#define PDBGG(fmt, args...) do { ; } while (0) /* placeholder */ #endif /* _SN9C102_H_ */ diff --git a/drivers/staging/media/sn9c102/sn9c102_core.c b/drivers/staging/media/sn9c102/sn9c102_core.c index 71f594f5aa71..98b30579b0ac 100644 --- a/drivers/staging/media/sn9c102/sn9c102_core.c +++ b/drivers/staging/media/sn9c102/sn9c102_core.c @@ -139,15 +139,15 @@ static int (*sn9c102_sensor_table[])(struct sn9c102_device *) = { /*****************************************************************************/ static u32 -sn9c102_request_buffers(struct sn9c102_device* cam, u32 count, +sn9c102_request_buffers(struct sn9c102_device *cam, u32 count, enum sn9c102_io_method io) { - struct v4l2_pix_format* p = &(cam->sensor.pix_format); - struct v4l2_rect* r = &(cam->sensor.cropcap.bounds); + struct v4l2_pix_format *p = &(cam->sensor.pix_format); + struct v4l2_rect *r = &(cam->sensor.cropcap.bounds); size_t imagesize = cam->module_param.force_munmap || io == IO_READ ? (p->width * p->height * p->priv) / 8 : (r->width * r->height * p->priv) / 8; - void* buff = NULL; + void *buff = NULL; u32 i; if (count > SN9C102_MAX_FRAMES) @@ -180,7 +180,7 @@ sn9c102_request_buffers(struct sn9c102_device* cam, u32 count, } -static void sn9c102_release_buffers(struct sn9c102_device* cam) +static void sn9c102_release_buffers(struct sn9c102_device *cam) { if (cam->nbuffers) { vfree(cam->frame[0].bufmem); @@ -190,7 +190,7 @@ static void sn9c102_release_buffers(struct sn9c102_device* cam) } -static void sn9c102_empty_framequeues(struct sn9c102_device* cam) +static void sn9c102_empty_framequeues(struct sn9c102_device *cam) { u32 i; @@ -204,7 +204,7 @@ static void sn9c102_empty_framequeues(struct sn9c102_device* cam) } -static void sn9c102_requeue_outqueue(struct sn9c102_device* cam) +static void sn9c102_requeue_outqueue(struct sn9c102_device *cam) { struct sn9c102_frame_t *i; @@ -217,7 +217,7 @@ static void sn9c102_requeue_outqueue(struct sn9c102_device* cam) } -static void sn9c102_queue_unusedframes(struct sn9c102_device* cam) +static void sn9c102_queue_unusedframes(struct sn9c102_device *cam) { unsigned long lock_flags; u32 i; @@ -237,11 +237,11 @@ static void sn9c102_queue_unusedframes(struct sn9c102_device* cam) Write a sequence of count value/register pairs. Returns -1 after the first failed write, or 0 for no errors. */ -int sn9c102_write_regs(struct sn9c102_device* cam, const u8 valreg[][2], +int sn9c102_write_regs(struct sn9c102_device *cam, const u8 valreg[][2], int count) { - struct usb_device* udev = cam->usbdev; - u8* buff = cam->control_buffer; + struct usb_device *udev = cam->usbdev; + u8 *buff = cam->control_buffer; int i, res; for (i = 0; i < count; i++) { @@ -273,10 +273,10 @@ int sn9c102_write_regs(struct sn9c102_device* cam, const u8 valreg[][2], } -int sn9c102_write_reg(struct sn9c102_device* cam, u8 value, u16 index) +int sn9c102_write_reg(struct sn9c102_device *cam, u8 value, u16 index) { - struct usb_device* udev = cam->usbdev; - u8* buff = cam->control_buffer; + struct usb_device *udev = cam->usbdev; + u8 *buff = cam->control_buffer; int res; if (index >= ARRAY_SIZE(cam->reg)) @@ -299,10 +299,10 @@ int sn9c102_write_reg(struct sn9c102_device* cam, u8 value, u16 index) /* NOTE: with the SN9C10[123] reading some registers always returns 0 */ -int sn9c102_read_reg(struct sn9c102_device* cam, u16 index) +int sn9c102_read_reg(struct sn9c102_device *cam, u16 index) { - struct usb_device* udev = cam->usbdev; - u8* buff = cam->control_buffer; + struct usb_device *udev = cam->usbdev; + u8 *buff = cam->control_buffer; int res; res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x00, 0xc1, @@ -315,7 +315,7 @@ int sn9c102_read_reg(struct sn9c102_device* cam, u16 index) } -int sn9c102_pread_reg(struct sn9c102_device* cam, u16 index) +int sn9c102_pread_reg(struct sn9c102_device *cam, u16 index) { if (index >= ARRAY_SIZE(cam->reg)) return -1; @@ -325,8 +325,8 @@ int sn9c102_pread_reg(struct sn9c102_device* cam, u16 index) static int -sn9c102_i2c_wait(struct sn9c102_device* cam, - const struct sn9c102_sensor* sensor) +sn9c102_i2c_wait(struct sn9c102_device *cam, + const struct sn9c102_sensor *sensor) { int i, r; @@ -346,8 +346,8 @@ sn9c102_i2c_wait(struct sn9c102_device* cam, static int -sn9c102_i2c_detect_read_error(struct sn9c102_device* cam, - const struct sn9c102_sensor* sensor) +sn9c102_i2c_detect_read_error(struct sn9c102_device *cam, + const struct sn9c102_sensor *sensor) { int r , err = 0; @@ -368,22 +368,23 @@ sn9c102_i2c_detect_read_error(struct sn9c102_device* cam, static int -sn9c102_i2c_detect_write_error(struct sn9c102_device* cam, - const struct sn9c102_sensor* sensor) +sn9c102_i2c_detect_write_error(struct sn9c102_device *cam, + const struct sn9c102_sensor *sensor) { int r; + r = sn9c102_read_reg(cam, 0x08); return (r < 0 || (r >= 0 && (r & 0x08))) ? -EIO : 0; } int -sn9c102_i2c_try_raw_read(struct sn9c102_device* cam, - const struct sn9c102_sensor* sensor, u8 data0, +sn9c102_i2c_try_raw_read(struct sn9c102_device *cam, + const struct sn9c102_sensor *sensor, u8 data0, u8 data1, u8 n, u8 buffer[]) { - struct usb_device* udev = cam->usbdev; - u8* data = cam->control_buffer; + struct usb_device *udev = cam->usbdev; + u8 *data = cam->control_buffer; int i = 0, err = 0, res; /* Write cycle */ @@ -437,12 +438,12 @@ sn9c102_i2c_try_raw_read(struct sn9c102_device* cam, int -sn9c102_i2c_try_raw_write(struct sn9c102_device* cam, - const struct sn9c102_sensor* sensor, u8 n, u8 data0, +sn9c102_i2c_try_raw_write(struct sn9c102_device *cam, + const struct sn9c102_sensor *sensor, u8 n, u8 data0, u8 data1, u8 data2, u8 data3, u8 data4, u8 data5) { - struct usb_device* udev = cam->usbdev; - u8* data = cam->control_buffer; + struct usb_device *udev = cam->usbdev; + u8 *data = cam->control_buffer; int err = 0, res; /* Write cycle. It usually is address + value */ @@ -476,16 +477,16 @@ sn9c102_i2c_try_raw_write(struct sn9c102_device* cam, int -sn9c102_i2c_try_read(struct sn9c102_device* cam, - const struct sn9c102_sensor* sensor, u8 address) +sn9c102_i2c_try_read(struct sn9c102_device *cam, + const struct sn9c102_sensor *sensor, u8 address) { return sn9c102_i2c_try_raw_read(cam, sensor, sensor->i2c_slave_id, address, 1, NULL); } -static int sn9c102_i2c_try_write(struct sn9c102_device* cam, - const struct sn9c102_sensor* sensor, +static int sn9c102_i2c_try_write(struct sn9c102_device *cam, + const struct sn9c102_sensor *sensor, u8 address, u8 value) { return sn9c102_i2c_try_raw_write(cam, sensor, 3, @@ -494,20 +495,20 @@ static int sn9c102_i2c_try_write(struct sn9c102_device* cam, } -int sn9c102_i2c_read(struct sn9c102_device* cam, u8 address) +int sn9c102_i2c_read(struct sn9c102_device *cam, u8 address) { return sn9c102_i2c_try_read(cam, &cam->sensor, address); } -int sn9c102_i2c_write(struct sn9c102_device* cam, u8 address, u8 value) +int sn9c102_i2c_write(struct sn9c102_device *cam, u8 address, u8 value) { return sn9c102_i2c_try_write(cam, &cam->sensor, address, value); } /*****************************************************************************/ -static size_t sn9c102_sof_length(struct sn9c102_device* cam) +static size_t sn9c102_sof_length(struct sn9c102_device *cam) { switch (cam->bridge) { case BRIDGE_SN9C101: @@ -525,7 +526,7 @@ static size_t sn9c102_sof_length(struct sn9c102_device* cam) static void* -sn9c102_find_sof_header(struct sn9c102_device* cam, void* mem, size_t len) +sn9c102_find_sof_header(struct sn9c102_device *cam, void *mem, size_t len) { static const char marker[6] = {0xff, 0xff, 0x00, 0xc4, 0xc4, 0x96}; const char *m = mem; @@ -547,7 +548,7 @@ sn9c102_find_sof_header(struct sn9c102_device* cam, void* mem, size_t len) } /* Search for the SOF marker (fixed part) in the header */ - for (j = 0, b=cam->sof.bytesread; j+b < sizeof(marker); j++) { + for (j = 0, b = cam->sof.bytesread; j+b < sizeof(marker); j++) { if (unlikely(i+j == len)) return NULL; if (*(m+i+j) == marker[cam->sof.bytesread]) { @@ -570,7 +571,7 @@ sn9c102_find_sof_header(struct sn9c102_device* cam, void* mem, size_t len) static void* -sn9c102_find_eof_header(struct sn9c102_device* cam, void* mem, size_t len) +sn9c102_find_eof_header(struct sn9c102_device *cam, void *mem, size_t len) { static const u8 eof_header[4][4] = { {0x00, 0x00, 0x00, 0x00}, @@ -600,7 +601,7 @@ sn9c102_find_eof_header(struct sn9c102_device* cam, void* mem, size_t len) static void -sn9c102_write_jpegheader(struct sn9c102_device* cam, struct sn9c102_frame_t* f) +sn9c102_write_jpegheader(struct sn9c102_device *cam, struct sn9c102_frame_t *f) { static const u8 jpeg_header[589] = { 0xff, 0xd8, 0xff, 0xdb, 0x00, 0x84, 0x00, 0x06, 0x04, 0x05, @@ -687,8 +688,8 @@ sn9c102_write_jpegheader(struct sn9c102_device* cam, struct sn9c102_frame_t* f) static void sn9c102_urb_complete(struct urb *urb) { - struct sn9c102_device* cam = urb->context; - struct sn9c102_frame_t** f; + struct sn9c102_device *cam = urb->context; + struct sn9c102_frame_t **f; size_t imagesize, soflen; u8 i; int err = 0; @@ -787,7 +788,7 @@ end_of_frame: b = (*f)->buf.bytesused; (*f)->state = F_DONE; - (*f)->buf.sequence= ++cam->frame_count; + (*f)->buf.sequence = ++cam->frame_count; spin_lock(&cam->queue_lock); list_move_tail(&(*f)->frame, @@ -796,7 +797,7 @@ end_of_frame: (*f) = list_entry( cam->inqueue.next, struct sn9c102_frame_t, - frame ); + frame); else (*f) = NULL; spin_unlock(&cam->queue_lock); @@ -883,11 +884,11 @@ resubmit_urb: } -static int sn9c102_start_transfer(struct sn9c102_device* cam) +static int sn9c102_start_transfer(struct sn9c102_device *cam) { struct usb_device *udev = cam->usbdev; - struct urb* urb; - struct usb_host_interface* altsetting = usb_altnum_to_altsetting( + struct urb *urb; + struct usb_host_interface *altsetting = usb_altnum_to_altsetting( usb_ifnum_to_if(udev, 0), SN9C102_ALTERNATE_SETTING); const unsigned int psz = le16_to_cpu(altsetting-> @@ -971,7 +972,7 @@ free_buffers: } -static int sn9c102_stop_transfer(struct sn9c102_device* cam) +static int sn9c102_stop_transfer(struct sn9c102_device *cam) { struct usb_device *udev = cam->usbdev; s8 i; @@ -994,7 +995,7 @@ static int sn9c102_stop_transfer(struct sn9c102_device* cam) } -static int sn9c102_stream_interrupt(struct sn9c102_device* cam) +static int sn9c102_stream_interrupt(struct sn9c102_device *cam) { cam->stream = STREAM_INTERRUPT; wait_event_timeout(cam->wait_stream, @@ -1017,10 +1018,10 @@ static int sn9c102_stream_interrupt(struct sn9c102_device* cam) /*****************************************************************************/ #ifdef CONFIG_VIDEO_ADV_DEBUG -static u16 sn9c102_strtou16(const char* buff, size_t len, ssize_t* count) +static u16 sn9c102_strtou16(const char *buff, size_t len, ssize_t *count) { char str[7]; - char* endp; + char *endp; unsigned long val; if (len < 6) { @@ -1048,10 +1049,10 @@ static u16 sn9c102_strtou16(const char* buff, size_t len, ssize_t* count) NOTE 2: buffers are PAGE_SIZE long */ -static ssize_t sn9c102_show_reg(struct device* cd, - struct device_attribute *attr, char* buf) +static ssize_t sn9c102_show_reg(struct device *cd, + struct device_attribute *attr, char *buf) { - struct sn9c102_device* cam; + struct sn9c102_device *cam; ssize_t count; if (mutex_lock_interruptible(&sn9c102_sysfs_lock)) @@ -1072,10 +1073,10 @@ static ssize_t sn9c102_show_reg(struct device* cd, static ssize_t -sn9c102_store_reg(struct device* cd, struct device_attribute *attr, - const char* buf, size_t len) +sn9c102_store_reg(struct device *cd, struct device_attribute *attr, + const char *buf, size_t len) { - struct sn9c102_device* cam; + struct sn9c102_device *cam; u16 index; ssize_t count; @@ -1105,10 +1106,10 @@ sn9c102_store_reg(struct device* cd, struct device_attribute *attr, } -static ssize_t sn9c102_show_val(struct device* cd, - struct device_attribute *attr, char* buf) +static ssize_t sn9c102_show_val(struct device *cd, + struct device_attribute *attr, char *buf) { - struct sn9c102_device* cam; + struct sn9c102_device *cam; ssize_t count; int val; @@ -1138,10 +1139,10 @@ static ssize_t sn9c102_show_val(struct device* cd, static ssize_t -sn9c102_store_val(struct device* cd, struct device_attribute *attr, - const char* buf, size_t len) +sn9c102_store_val(struct device *cd, struct device_attribute *attr, + const char *buf, size_t len) { - struct sn9c102_device* cam; + struct sn9c102_device *cam; u16 value; ssize_t count; int err; @@ -1177,10 +1178,10 @@ sn9c102_store_val(struct device* cd, struct device_attribute *attr, } -static ssize_t sn9c102_show_i2c_reg(struct device* cd, - struct device_attribute *attr, char* buf) +static ssize_t sn9c102_show_i2c_reg(struct device *cd, + struct device_attribute *attr, char *buf) { - struct sn9c102_device* cam; + struct sn9c102_device *cam; ssize_t count; if (mutex_lock_interruptible(&sn9c102_sysfs_lock)) @@ -1203,10 +1204,10 @@ static ssize_t sn9c102_show_i2c_reg(struct device* cd, static ssize_t -sn9c102_store_i2c_reg(struct device* cd, struct device_attribute *attr, - const char* buf, size_t len) +sn9c102_store_i2c_reg(struct device *cd, struct device_attribute *attr, + const char *buf, size_t len) { - struct sn9c102_device* cam; + struct sn9c102_device *cam; u16 index; ssize_t count; @@ -1236,10 +1237,10 @@ sn9c102_store_i2c_reg(struct device* cd, struct device_attribute *attr, } -static ssize_t sn9c102_show_i2c_val(struct device* cd, - struct device_attribute *attr, char* buf) +static ssize_t sn9c102_show_i2c_val(struct device *cd, + struct device_attribute *attr, char *buf) { - struct sn9c102_device* cam; + struct sn9c102_device *cam; ssize_t count; int val; @@ -1274,10 +1275,10 @@ static ssize_t sn9c102_show_i2c_val(struct device* cd, static ssize_t -sn9c102_store_i2c_val(struct device* cd, struct device_attribute *attr, - const char* buf, size_t len) +sn9c102_store_i2c_val(struct device *cd, struct device_attribute *attr, + const char *buf, size_t len) { - struct sn9c102_device* cam; + struct sn9c102_device *cam; u16 value; ssize_t count; int err; @@ -1319,10 +1320,10 @@ sn9c102_store_i2c_val(struct device* cd, struct device_attribute *attr, static ssize_t -sn9c102_store_green(struct device* cd, struct device_attribute *attr, - const char* buf, size_t len) +sn9c102_store_green(struct device *cd, struct device_attribute *attr, + const char *buf, size_t len) { - struct sn9c102_device* cam; + struct sn9c102_device *cam; enum sn9c102_bridge bridge; ssize_t res = 0; u16 value; @@ -1350,7 +1351,8 @@ sn9c102_store_green(struct device* cd, struct device_attribute *attr, case BRIDGE_SN9C102: if (value > 0x0f) return -EINVAL; - if ((res = sn9c102_store_reg(cd, attr, "0x11", 4)) >= 0) + res = sn9c102_store_reg(cd, attr, "0x11", 4); + if (res >= 0) res = sn9c102_store_val(cd, attr, buf, len); break; case BRIDGE_SN9C103: @@ -1358,7 +1360,8 @@ sn9c102_store_green(struct device* cd, struct device_attribute *attr, case BRIDGE_SN9C120: if (value > 0x7f) return -EINVAL; - if ((res = sn9c102_store_reg(cd, attr, "0x07", 4)) >= 0) + res = sn9c102_store_reg(cd, attr, "0x07", 4); + if (res >= 0) res = sn9c102_store_val(cd, attr, buf, len); break; } @@ -1368,8 +1371,8 @@ sn9c102_store_green(struct device* cd, struct device_attribute *attr, static ssize_t -sn9c102_store_blue(struct device* cd, struct device_attribute *attr, - const char* buf, size_t len) +sn9c102_store_blue(struct device *cd, struct device_attribute *attr, + const char *buf, size_t len) { ssize_t res = 0; u16 value; @@ -1379,7 +1382,8 @@ sn9c102_store_blue(struct device* cd, struct device_attribute *attr, if (!count || value > 0x7f) return -EINVAL; - if ((res = sn9c102_store_reg(cd, attr, "0x06", 4)) >= 0) + res = sn9c102_store_reg(cd, attr, "0x06", 4); + if (res >= 0) res = sn9c102_store_val(cd, attr, buf, len); return res; @@ -1387,8 +1391,8 @@ sn9c102_store_blue(struct device* cd, struct device_attribute *attr, static ssize_t -sn9c102_store_red(struct device* cd, struct device_attribute *attr, - const char* buf, size_t len) +sn9c102_store_red(struct device *cd, struct device_attribute *attr, + const char *buf, size_t len) { ssize_t res = 0; u16 value; @@ -1397,19 +1401,19 @@ sn9c102_store_red(struct device* cd, struct device_attribute *attr, value = sn9c102_strtou16(buf, len, &count); if (!count || value > 0x7f) return -EINVAL; - - if ((res = sn9c102_store_reg(cd, attr, "0x05", 4)) >= 0) + res = sn9c102_store_reg(cd, attr, "0x05", 4); + if (res >= 0) res = sn9c102_store_val(cd, attr, buf, len); return res; } -static ssize_t sn9c102_show_frame_header(struct device* cd, +static ssize_t sn9c102_show_frame_header(struct device *cd, struct device_attribute *attr, - char* buf) + char *buf) { - struct sn9c102_device* cam; + struct sn9c102_device *cam; ssize_t count; cam = video_get_drvdata(container_of(cd, struct video_device, dev)); @@ -1437,7 +1441,7 @@ static DEVICE_ATTR(red, S_IWUSR, NULL, sn9c102_store_red); static DEVICE_ATTR(frame_header, S_IRUGO, sn9c102_show_frame_header, NULL); -static int sn9c102_create_sysfs(struct sn9c102_device* cam) +static int sn9c102_create_sysfs(struct sn9c102_device *cam) { struct device *dev = &(cam->v4ldev->dev); int err = 0; @@ -1498,7 +1502,7 @@ err_out: /*****************************************************************************/ static int -sn9c102_set_pix_format(struct sn9c102_device* cam, struct v4l2_pix_format* pix) +sn9c102_set_pix_format(struct sn9c102_device *cam, struct v4l2_pix_format *pix) { int err = 0; @@ -1538,8 +1542,8 @@ sn9c102_set_pix_format(struct sn9c102_device* cam, struct v4l2_pix_format* pix) static int -sn9c102_set_compression(struct sn9c102_device* cam, - struct v4l2_jpegcompression* compression) +sn9c102_set_compression(struct sn9c102_device *cam, + struct v4l2_jpegcompression *compression) { int i, err = 0; @@ -1586,7 +1590,7 @@ sn9c102_set_compression(struct sn9c102_device* cam, } -static int sn9c102_set_scale(struct sn9c102_device* cam, u8 scale) +static int sn9c102_set_scale(struct sn9c102_device *cam, u8 scale) { u8 r = 0; int err = 0; @@ -1609,9 +1613,9 @@ static int sn9c102_set_scale(struct sn9c102_device* cam, u8 scale) } -static int sn9c102_set_crop(struct sn9c102_device* cam, struct v4l2_rect* rect) +static int sn9c102_set_crop(struct sn9c102_device *cam, struct v4l2_rect *rect) { - struct sn9c102_sensor* s = &cam->sensor; + struct sn9c102_sensor *s = &cam->sensor; u8 h_start = (u8)(rect->left - s->cropcap.bounds.left), v_start = (u8)(rect->top - s->cropcap.bounds.top), h_size = (u8)(rect->width / 16), @@ -1632,12 +1636,12 @@ static int sn9c102_set_crop(struct sn9c102_device* cam, struct v4l2_rect* rect) } -static int sn9c102_init(struct sn9c102_device* cam) +static int sn9c102_init(struct sn9c102_device *cam) { - struct sn9c102_sensor* s = &cam->sensor; + struct sn9c102_sensor *s = &cam->sensor; struct v4l2_control ctrl; struct v4l2_queryctrl *qctrl; - struct v4l2_rect* rect; + struct v4l2_rect *rect; u8 i = 0; int err = 0; @@ -1669,7 +1673,7 @@ static int sn9c102_init(struct sn9c102_device* cam) cam->bridge == BRIDGE_SN9C102 || cam->bridge == BRIDGE_SN9C103) { if (s->pix_format.pixelformat == V4L2_PIX_FMT_JPEG) - s->pix_format.pixelformat= V4L2_PIX_FMT_SBGGR8; + s->pix_format.pixelformat = V4L2_PIX_FMT_SBGGR8; cam->compression.quality = cam->reg[0x17] & 0x01 ? 0 : 1; } else { @@ -1761,7 +1765,7 @@ static void sn9c102_release_resources(struct kref *kref) static int sn9c102_open(struct file *filp) { - struct sn9c102_device* cam; + struct sn9c102_device *cam; int err = 0; /* @@ -1873,7 +1877,7 @@ out: static int sn9c102_release(struct file *filp) { - struct sn9c102_device* cam; + struct sn9c102_device *cam; down_write(&sn9c102_dev_lock); @@ -1895,10 +1899,10 @@ static int sn9c102_release(struct file *filp) static ssize_t -sn9c102_read(struct file* filp, char __user * buf, size_t count, loff_t* f_pos) +sn9c102_read(struct file *filp, char __user *buf, size_t count, loff_t *f_pos) { struct sn9c102_device *cam = video_drvdata(filp); - struct sn9c102_frame_t* f, * i; + struct sn9c102_frame_t *f, *i; unsigned long lock_flags; long timeout; int err = 0; @@ -1927,7 +1931,7 @@ sn9c102_read(struct file* filp, char __user * buf, size_t count, loff_t* f_pos) } if (cam->io == IO_NONE) { - if (!sn9c102_request_buffers(cam,cam->nreadbuffers, IO_READ)) { + if (!sn9c102_request_buffers(cam, cam->nreadbuffers, IO_READ)) { DBG(1, "read() failed, not enough memory"); mutex_unlock(&cam->fileop_mutex); return -ENOMEM; @@ -1954,17 +1958,17 @@ sn9c102_read(struct file* filp, char __user * buf, size_t count, loff_t* f_pos) } if (!cam->module_param.frame_timeout) { err = wait_event_interruptible - ( cam->wait_frame, + (cam->wait_frame, (!list_empty(&cam->outqueue)) || (cam->state & DEV_DISCONNECTED) || - (cam->state & DEV_MISCONFIGURED) ); + (cam->state & DEV_MISCONFIGURED)); if (err) { mutex_unlock(&cam->fileop_mutex); return err; } } else { timeout = wait_event_interruptible_timeout - ( cam->wait_frame, + (cam->wait_frame, (!list_empty(&cam->outqueue)) || (cam->state & DEV_DISCONNECTED) || (cam->state & DEV_MISCONFIGURED), @@ -2024,7 +2028,7 @@ exit: static unsigned int sn9c102_poll(struct file *filp, poll_table *wait) { struct sn9c102_device *cam = video_drvdata(filp); - struct sn9c102_frame_t* f; + struct sn9c102_frame_t *f; unsigned long lock_flags; unsigned int mask = 0; @@ -2076,17 +2080,17 @@ error: } -static void sn9c102_vm_open(struct vm_area_struct* vma) +static void sn9c102_vm_open(struct vm_area_struct *vma) { - struct sn9c102_frame_t* f = vma->vm_private_data; + struct sn9c102_frame_t *f = vma->vm_private_data; f->vma_use_count++; } -static void sn9c102_vm_close(struct vm_area_struct* vma) +static void sn9c102_vm_close(struct vm_area_struct *vma) { /* NOTE: buffers are not freed here */ - struct sn9c102_frame_t* f = vma->vm_private_data; + struct sn9c102_frame_t *f = vma->vm_private_data; f->vma_use_count--; } @@ -2097,7 +2101,7 @@ static const struct vm_operations_struct sn9c102_vm_ops = { }; -static int sn9c102_mmap(struct file* filp, struct vm_area_struct *vma) +static int sn9c102_mmap(struct file *filp, struct vm_area_struct *vma) { struct sn9c102_device *cam = video_drvdata(filp); unsigned long size = vma->vm_end - vma->vm_start, @@ -2166,7 +2170,7 @@ static int sn9c102_mmap(struct file* filp, struct vm_area_struct *vma) /*****************************************************************************/ static int -sn9c102_vidioc_querycap(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_querycap(struct sn9c102_device *cam, void __user *arg) { struct v4l2_capability cap = { .driver = "sn9c102", @@ -2188,7 +2192,7 @@ sn9c102_vidioc_querycap(struct sn9c102_device* cam, void __user * arg) static int -sn9c102_vidioc_enuminput(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_enuminput(struct sn9c102_device *cam, void __user *arg) { struct v4l2_input i; @@ -2211,7 +2215,7 @@ sn9c102_vidioc_enuminput(struct sn9c102_device* cam, void __user * arg) static int -sn9c102_vidioc_g_input(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_g_input(struct sn9c102_device *cam, void __user *arg) { int index = 0; @@ -2223,7 +2227,7 @@ sn9c102_vidioc_g_input(struct sn9c102_device* cam, void __user * arg) static int -sn9c102_vidioc_s_input(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_s_input(struct sn9c102_device *cam, void __user *arg) { int index; @@ -2238,9 +2242,9 @@ sn9c102_vidioc_s_input(struct sn9c102_device* cam, void __user * arg) static int -sn9c102_vidioc_query_ctrl(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_query_ctrl(struct sn9c102_device *cam, void __user *arg) { - struct sn9c102_sensor* s = &cam->sensor; + struct sn9c102_sensor *s = &cam->sensor; struct v4l2_queryctrl qc; u8 i; @@ -2260,9 +2264,9 @@ sn9c102_vidioc_query_ctrl(struct sn9c102_device* cam, void __user * arg) static int -sn9c102_vidioc_g_ctrl(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_g_ctrl(struct sn9c102_device *cam, void __user *arg) { - struct sn9c102_sensor* s = &cam->sensor; + struct sn9c102_sensor *s = &cam->sensor; struct v4l2_control ctrl; int err = 0; u8 i; @@ -2295,9 +2299,9 @@ exit: static int -sn9c102_vidioc_s_ctrl(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_s_ctrl(struct sn9c102_device *cam, void __user *arg) { - struct sn9c102_sensor* s = &cam->sensor; + struct sn9c102_sensor *s = &cam->sensor; struct v4l2_control ctrl; u8 i; int err = 0; @@ -2335,9 +2339,9 @@ sn9c102_vidioc_s_ctrl(struct sn9c102_device* cam, void __user * arg) static int -sn9c102_vidioc_cropcap(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_cropcap(struct sn9c102_device *cam, void __user *arg) { - struct v4l2_cropcap* cc = &(cam->sensor.cropcap); + struct v4l2_cropcap *cc = &(cam->sensor.cropcap); cc->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; cc->pixelaspect.numerator = 1; @@ -2351,9 +2355,9 @@ sn9c102_vidioc_cropcap(struct sn9c102_device* cam, void __user * arg) static int -sn9c102_vidioc_g_crop(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_g_crop(struct sn9c102_device *cam, void __user *arg) { - struct sn9c102_sensor* s = &cam->sensor; + struct sn9c102_sensor *s = &cam->sensor; struct v4l2_crop crop = { .type = V4L2_BUF_TYPE_VIDEO_CAPTURE, }; @@ -2368,13 +2372,13 @@ sn9c102_vidioc_g_crop(struct sn9c102_device* cam, void __user * arg) static int -sn9c102_vidioc_s_crop(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_s_crop(struct sn9c102_device *cam, void __user *arg) { - struct sn9c102_sensor* s = &cam->sensor; + struct sn9c102_sensor *s = &cam->sensor; struct v4l2_crop crop; - struct v4l2_rect* rect; - struct v4l2_rect* bounds = &(s->cropcap.bounds); - struct v4l2_pix_format* pix_format = &(s->pix_format); + struct v4l2_rect *rect; + struct v4l2_rect *bounds = &(s->cropcap.bounds); + struct v4l2_pix_format *pix_format = &(s->pix_format); u8 scale; const enum sn9c102_stream_state stream = cam->stream; const u32 nbuffers = cam->nbuffers; @@ -2482,7 +2486,7 @@ sn9c102_vidioc_s_crop(struct sn9c102_device* cam, void __user * arg) static int -sn9c102_vidioc_enum_framesizes(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_enum_framesizes(struct sn9c102_device *cam, void __user *arg) { struct v4l2_frmsizeenum frmsize; @@ -2523,7 +2527,7 @@ sn9c102_vidioc_enum_framesizes(struct sn9c102_device* cam, void __user * arg) static int -sn9c102_vidioc_enum_fmt(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_enum_fmt(struct sn9c102_device *cam, void __user *arg) { struct v4l2_fmtdesc fmtd; @@ -2565,10 +2569,10 @@ sn9c102_vidioc_enum_fmt(struct sn9c102_device* cam, void __user * arg) static int -sn9c102_vidioc_g_fmt(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_g_fmt(struct sn9c102_device *cam, void __user *arg) { struct v4l2_format format; - struct v4l2_pix_format* pfmt = &(cam->sensor.pix_format); + struct v4l2_pix_format *pfmt = &(cam->sensor.pix_format); if (copy_from_user(&format, arg, sizeof(format))) return -EFAULT; @@ -2593,14 +2597,14 @@ sn9c102_vidioc_g_fmt(struct sn9c102_device* cam, void __user * arg) static int -sn9c102_vidioc_try_s_fmt(struct sn9c102_device* cam, unsigned int cmd, - void __user * arg) +sn9c102_vidioc_try_s_fmt(struct sn9c102_device *cam, unsigned int cmd, + void __user *arg) { - struct sn9c102_sensor* s = &cam->sensor; + struct sn9c102_sensor *s = &cam->sensor; struct v4l2_format format; - struct v4l2_pix_format* pix; - struct v4l2_pix_format* pfmt = &(s->pix_format); - struct v4l2_rect* bounds = &(s->cropcap.bounds); + struct v4l2_pix_format *pix; + struct v4l2_pix_format *pfmt = &(s->pix_format); + struct v4l2_rect *bounds = &(s->cropcap.bounds); struct v4l2_rect rect; u8 scale; const enum sn9c102_stream_state stream = cam->stream; @@ -2742,7 +2746,7 @@ sn9c102_vidioc_try_s_fmt(struct sn9c102_device* cam, unsigned int cmd, static int -sn9c102_vidioc_g_jpegcomp(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_g_jpegcomp(struct sn9c102_device *cam, void __user *arg) { if (copy_to_user(arg, &cam->compression, sizeof(cam->compression))) return -EFAULT; @@ -2752,7 +2756,7 @@ sn9c102_vidioc_g_jpegcomp(struct sn9c102_device* cam, void __user * arg) static int -sn9c102_vidioc_s_jpegcomp(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_s_jpegcomp(struct sn9c102_device *cam, void __user *arg) { struct v4l2_jpegcompression jc; const enum sn9c102_stream_state stream = cam->stream; @@ -2788,7 +2792,7 @@ sn9c102_vidioc_s_jpegcomp(struct sn9c102_device* cam, void __user * arg) static int -sn9c102_vidioc_reqbufs(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_reqbufs(struct sn9c102_device *cam, void __user *arg) { struct v4l2_requestbuffers rb; u32 i; @@ -2839,7 +2843,7 @@ sn9c102_vidioc_reqbufs(struct sn9c102_device* cam, void __user * arg) static int -sn9c102_vidioc_querybuf(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_querybuf(struct sn9c102_device *cam, void __user *arg) { struct v4l2_buffer b; @@ -2868,7 +2872,7 @@ sn9c102_vidioc_querybuf(struct sn9c102_device* cam, void __user * arg) static int -sn9c102_vidioc_qbuf(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_qbuf(struct sn9c102_device *cam, void __user *arg) { struct v4l2_buffer b; unsigned long lock_flags; @@ -2896,8 +2900,8 @@ sn9c102_vidioc_qbuf(struct sn9c102_device* cam, void __user * arg) static int -sn9c102_vidioc_dqbuf(struct sn9c102_device* cam, struct file* filp, - void __user * arg) +sn9c102_vidioc_dqbuf(struct sn9c102_device *cam, struct file *filp, + void __user *arg) { struct v4l2_buffer b; struct sn9c102_frame_t *f; @@ -2918,20 +2922,20 @@ sn9c102_vidioc_dqbuf(struct sn9c102_device* cam, struct file* filp, return -EAGAIN; if (!cam->module_param.frame_timeout) { err = wait_event_interruptible - ( cam->wait_frame, + (cam->wait_frame, (!list_empty(&cam->outqueue)) || (cam->state & DEV_DISCONNECTED) || - (cam->state & DEV_MISCONFIGURED) ); + (cam->state & DEV_MISCONFIGURED)); if (err) return err; } else { timeout = wait_event_interruptible_timeout - ( cam->wait_frame, + (cam->wait_frame, (!list_empty(&cam->outqueue)) || (cam->state & DEV_DISCONNECTED) || (cam->state & DEV_MISCONFIGURED), cam->module_param.frame_timeout * - 1000 * msecs_to_jiffies(1) ); + 1000 * msecs_to_jiffies(1)); if (timeout < 0) return timeout; else if (timeout == 0 && @@ -2967,7 +2971,7 @@ sn9c102_vidioc_dqbuf(struct sn9c102_device* cam, struct file* filp, static int -sn9c102_vidioc_streamon(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_streamon(struct sn9c102_device *cam, void __user *arg) { int type; @@ -2986,7 +2990,7 @@ sn9c102_vidioc_streamon(struct sn9c102_device* cam, void __user * arg) static int -sn9c102_vidioc_streamoff(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_streamoff(struct sn9c102_device *cam, void __user *arg) { int type, err; @@ -3011,7 +3015,7 @@ sn9c102_vidioc_streamoff(struct sn9c102_device* cam, void __user * arg) static int -sn9c102_vidioc_g_parm(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_g_parm(struct sn9c102_device *cam, void __user *arg) { struct v4l2_streamparm sp; @@ -3032,7 +3036,7 @@ sn9c102_vidioc_g_parm(struct sn9c102_device* cam, void __user * arg) static int -sn9c102_vidioc_s_parm(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_s_parm(struct sn9c102_device *cam, void __user *arg) { struct v4l2_streamparm sp; @@ -3060,7 +3064,7 @@ sn9c102_vidioc_s_parm(struct sn9c102_device* cam, void __user * arg) static int -sn9c102_vidioc_enumaudio(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_enumaudio(struct sn9c102_device *cam, void __user *arg) { struct v4l2_audio audio; @@ -3085,7 +3089,7 @@ sn9c102_vidioc_enumaudio(struct sn9c102_device* cam, void __user * arg) static int -sn9c102_vidioc_g_audio(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_g_audio(struct sn9c102_device *cam, void __user *arg) { struct v4l2_audio audio; @@ -3106,7 +3110,7 @@ sn9c102_vidioc_g_audio(struct sn9c102_device* cam, void __user * arg) static int -sn9c102_vidioc_s_audio(struct sn9c102_device* cam, void __user * arg) +sn9c102_vidioc_s_audio(struct sn9c102_device *cam, void __user *arg) { struct v4l2_audio audio; @@ -3266,10 +3270,10 @@ static const struct v4l2_file_operations sn9c102_fops = { /* It exists a single interface only. We do not need to validate anything. */ static int -sn9c102_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) +sn9c102_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) { struct usb_device *udev = interface_to_usbdev(intf); - struct sn9c102_device* cam; + struct sn9c102_device *cam; static unsigned int dev_nr; unsigned int i; int err = 0, r; @@ -3419,9 +3423,9 @@ fail: } -static void sn9c102_usb_disconnect(struct usb_interface* intf) +static void sn9c102_usb_disconnect(struct usb_interface *intf) { - struct sn9c102_device* cam; + struct sn9c102_device *cam; down_write(&sn9c102_dev_lock); diff --git a/drivers/staging/media/sn9c102/sn9c102_devtable.h b/drivers/staging/media/sn9c102/sn9c102_devtable.h index 4ba569258498..b187a8a304eb 100644 --- a/drivers/staging/media/sn9c102/sn9c102_devtable.h +++ b/drivers/staging/media/sn9c102/sn9c102_devtable.h @@ -129,17 +129,17 @@ static const struct usb_device_id sn9c102_id_table[] = { initialization of the SN9C1XX chip. Functions must return 0 on success, the appropriate error otherwise. */ -extern int sn9c102_probe_hv7131d(struct sn9c102_device* cam); -extern int sn9c102_probe_hv7131r(struct sn9c102_device* cam); -extern int sn9c102_probe_mi0343(struct sn9c102_device* cam); -extern int sn9c102_probe_mi0360(struct sn9c102_device* cam); +extern int sn9c102_probe_hv7131d(struct sn9c102_device *cam); +extern int sn9c102_probe_hv7131r(struct sn9c102_device *cam); +extern int sn9c102_probe_mi0343(struct sn9c102_device *cam); +extern int sn9c102_probe_mi0360(struct sn9c102_device *cam); extern int sn9c102_probe_mt9v111(struct sn9c102_device *cam); -extern int sn9c102_probe_ov7630(struct sn9c102_device* cam); -extern int sn9c102_probe_ov7660(struct sn9c102_device* cam); -extern int sn9c102_probe_pas106b(struct sn9c102_device* cam); -extern int sn9c102_probe_pas202bcb(struct sn9c102_device* cam); -extern int sn9c102_probe_tas5110c1b(struct sn9c102_device* cam); -extern int sn9c102_probe_tas5110d(struct sn9c102_device* cam); -extern int sn9c102_probe_tas5130d1b(struct sn9c102_device* cam); +extern int sn9c102_probe_ov7630(struct sn9c102_device *cam); +extern int sn9c102_probe_ov7660(struct sn9c102_device *cam); +extern int sn9c102_probe_pas106b(struct sn9c102_device *cam); +extern int sn9c102_probe_pas202bcb(struct sn9c102_device *cam); +extern int sn9c102_probe_tas5110c1b(struct sn9c102_device *cam); +extern int sn9c102_probe_tas5110d(struct sn9c102_device *cam); +extern int sn9c102_probe_tas5130d1b(struct sn9c102_device *cam); #endif /* _SN9C102_DEVTABLE_H_ */ diff --git a/drivers/staging/media/sn9c102/sn9c102_hv7131d.c b/drivers/staging/media/sn9c102/sn9c102_hv7131d.c index 468072176527..f1d94f0190c6 100644 --- a/drivers/staging/media/sn9c102/sn9c102_hv7131d.c +++ b/drivers/staging/media/sn9c102/sn9c102_hv7131d.c @@ -23,7 +23,7 @@ #include "sn9c102_devtable.h" -static int hv7131d_init(struct sn9c102_device* cam) +static int hv7131d_init(struct sn9c102_device *cam) { int err; @@ -39,8 +39,8 @@ static int hv7131d_init(struct sn9c102_device* cam) } -static int hv7131d_get_ctrl(struct sn9c102_device* cam, - struct v4l2_control* ctrl) +static int hv7131d_get_ctrl(struct sn9c102_device *cam, + struct v4l2_control *ctrl) { switch (ctrl->id) { case V4L2_CID_EXPOSURE: @@ -88,8 +88,8 @@ static int hv7131d_get_ctrl(struct sn9c102_device* cam, } -static int hv7131d_set_ctrl(struct sn9c102_device* cam, - const struct v4l2_control* ctrl) +static int hv7131d_set_ctrl(struct sn9c102_device *cam, + const struct v4l2_control *ctrl) { int err = 0; @@ -121,10 +121,10 @@ static int hv7131d_set_ctrl(struct sn9c102_device* cam, } -static int hv7131d_set_crop(struct sn9c102_device* cam, - const struct v4l2_rect* rect) +static int hv7131d_set_crop(struct sn9c102_device *cam, + const struct v4l2_rect *rect) { - struct sn9c102_sensor* s = sn9c102_get_sensor(cam); + struct sn9c102_sensor *s = sn9c102_get_sensor(cam); int err = 0; u8 h_start = (u8)(rect->left - s->cropcap.bounds.left) + 2, v_start = (u8)(rect->top - s->cropcap.bounds.top) + 2; @@ -136,8 +136,8 @@ static int hv7131d_set_crop(struct sn9c102_device* cam, } -static int hv7131d_set_pix_format(struct sn9c102_device* cam, - const struct v4l2_pix_format* pix) +static int hv7131d_set_pix_format(struct sn9c102_device *cam, + const struct v4l2_pix_format *pix) { int err = 0; @@ -248,7 +248,7 @@ static const struct sn9c102_sensor hv7131d = { }; -int sn9c102_probe_hv7131d(struct sn9c102_device* cam) +int sn9c102_probe_hv7131d(struct sn9c102_device *cam) { int r0 = 0, r1 = 0, err; diff --git a/drivers/staging/media/sn9c102/sn9c102_mi0343.c b/drivers/staging/media/sn9c102/sn9c102_mi0343.c index 1f5b09bec89c..b20fdb6541d3 100644 --- a/drivers/staging/media/sn9c102/sn9c102_mi0343.c +++ b/drivers/staging/media/sn9c102/sn9c102_mi0343.c @@ -23,9 +23,9 @@ #include "sn9c102_devtable.h" -static int mi0343_init(struct sn9c102_device* cam) +static int mi0343_init(struct sn9c102_device *cam) { - struct sn9c102_sensor* s = sn9c102_get_sensor(cam); + struct sn9c102_sensor *s = sn9c102_get_sensor(cam); int err = 0; err = sn9c102_write_const_regs(cam, {0x00, 0x10}, {0x00, 0x11}, @@ -52,10 +52,10 @@ static int mi0343_init(struct sn9c102_device* cam) } -static int mi0343_get_ctrl(struct sn9c102_device* cam, - struct v4l2_control* ctrl) +static int mi0343_get_ctrl(struct sn9c102_device *cam, + struct v4l2_control *ctrl) { - struct sn9c102_sensor* s = sn9c102_get_sensor(cam); + struct sn9c102_sensor *s = sn9c102_get_sensor(cam); u8 data[2]; switch (ctrl->id) { @@ -119,10 +119,10 @@ static int mi0343_get_ctrl(struct sn9c102_device* cam, } -static int mi0343_set_ctrl(struct sn9c102_device* cam, - const struct v4l2_control* ctrl) +static int mi0343_set_ctrl(struct sn9c102_device *cam, + const struct v4l2_control *ctrl) { - struct sn9c102_sensor* s = sn9c102_get_sensor(cam); + struct sn9c102_sensor *s = sn9c102_get_sensor(cam); u16 reg = 0; int err = 0; @@ -189,10 +189,10 @@ static int mi0343_set_ctrl(struct sn9c102_device* cam, } -static int mi0343_set_crop(struct sn9c102_device* cam, - const struct v4l2_rect* rect) +static int mi0343_set_crop(struct sn9c102_device *cam, + const struct v4l2_rect *rect) { - struct sn9c102_sensor* s = sn9c102_get_sensor(cam); + struct sn9c102_sensor *s = sn9c102_get_sensor(cam); int err = 0; u8 h_start = (u8)(rect->left - s->cropcap.bounds.left) + 0, v_start = (u8)(rect->top - s->cropcap.bounds.top) + 2; @@ -204,10 +204,10 @@ static int mi0343_set_crop(struct sn9c102_device* cam, } -static int mi0343_set_pix_format(struct sn9c102_device* cam, - const struct v4l2_pix_format* pix) +static int mi0343_set_pix_format(struct sn9c102_device *cam, + const struct v4l2_pix_format *pix) { - struct sn9c102_sensor* s = sn9c102_get_sensor(cam); + struct sn9c102_sensor *s = sn9c102_get_sensor(cam); int err = 0; if (pix->pixelformat == V4L2_PIX_FMT_SN9C10X) { @@ -331,7 +331,7 @@ static const struct sn9c102_sensor mi0343 = { }; -int sn9c102_probe_mi0343(struct sn9c102_device* cam) +int sn9c102_probe_mi0343(struct sn9c102_device *cam) { u8 data[2]; diff --git a/drivers/staging/media/sn9c102/sn9c102_mi0360.c b/drivers/staging/media/sn9c102/sn9c102_mi0360.c index d973fc1973d9..5f21d1b43e32 100644 --- a/drivers/staging/media/sn9c102/sn9c102_mi0360.c +++ b/drivers/staging/media/sn9c102/sn9c102_mi0360.c @@ -23,9 +23,9 @@ #include "sn9c102_devtable.h" -static int mi0360_init(struct sn9c102_device* cam) +static int mi0360_init(struct sn9c102_device *cam) { - struct sn9c102_sensor* s = sn9c102_get_sensor(cam); + struct sn9c102_sensor *s = sn9c102_get_sensor(cam); int err = 0; switch (sn9c102_get_bridge(cam)) { @@ -147,10 +147,10 @@ static int mi0360_init(struct sn9c102_device* cam) } -static int mi0360_get_ctrl(struct sn9c102_device* cam, - struct v4l2_control* ctrl) +static int mi0360_get_ctrl(struct sn9c102_device *cam, + struct v4l2_control *ctrl) { - struct sn9c102_sensor* s = sn9c102_get_sensor(cam); + struct sn9c102_sensor *s = sn9c102_get_sensor(cam); u8 data[2]; switch (ctrl->id) { @@ -204,10 +204,10 @@ static int mi0360_get_ctrl(struct sn9c102_device* cam, } -static int mi0360_set_ctrl(struct sn9c102_device* cam, - const struct v4l2_control* ctrl) +static int mi0360_set_ctrl(struct sn9c102_device *cam, + const struct v4l2_control *ctrl) { - struct sn9c102_sensor* s = sn9c102_get_sensor(cam); + struct sn9c102_sensor *s = sn9c102_get_sensor(cam); int err = 0; switch (ctrl->id) { @@ -259,10 +259,10 @@ static int mi0360_set_ctrl(struct sn9c102_device* cam, } -static int mi0360_set_crop(struct sn9c102_device* cam, - const struct v4l2_rect* rect) +static int mi0360_set_crop(struct sn9c102_device *cam, + const struct v4l2_rect *rect) { - struct sn9c102_sensor* s = sn9c102_get_sensor(cam); + struct sn9c102_sensor *s = sn9c102_get_sensor(cam); int err = 0; u8 h_start = 0, v_start = (u8)(rect->top - s->cropcap.bounds.top) + 1; @@ -285,10 +285,10 @@ static int mi0360_set_crop(struct sn9c102_device* cam, } -static int mi0360_set_pix_format(struct sn9c102_device* cam, - const struct v4l2_pix_format* pix) +static int mi0360_set_pix_format(struct sn9c102_device *cam, + const struct v4l2_pix_format *pix) { - struct sn9c102_sensor* s = sn9c102_get_sensor(cam); + struct sn9c102_sensor *s = sn9c102_get_sensor(cam); int err = 0; if (pix->pixelformat == V4L2_PIX_FMT_SBGGR8) { @@ -418,7 +418,7 @@ static const struct sn9c102_sensor mi0360 = { }; -int sn9c102_probe_mi0360(struct sn9c102_device* cam) +int sn9c102_probe_mi0360(struct sn9c102_device *cam) { u8 data[2]; diff --git a/drivers/staging/media/sn9c102/sn9c102_ov7630.c b/drivers/staging/media/sn9c102/sn9c102_ov7630.c index d3a1bd8d5648..9ec304dc4705 100644 --- a/drivers/staging/media/sn9c102/sn9c102_ov7630.c +++ b/drivers/staging/media/sn9c102/sn9c102_ov7630.c @@ -23,7 +23,7 @@ #include "sn9c102_devtable.h" -static int ov7630_init(struct sn9c102_device* cam) +static int ov7630_init(struct sn9c102_device *cam) { int err = 0; @@ -252,8 +252,8 @@ static int ov7630_init(struct sn9c102_device* cam) } -static int ov7630_get_ctrl(struct sn9c102_device* cam, - struct v4l2_control* ctrl) +static int ov7630_get_ctrl(struct sn9c102_device *cam, + struct v4l2_control *ctrl) { enum sn9c102_bridge bridge = sn9c102_get_bridge(cam); int err = 0; @@ -330,8 +330,8 @@ static int ov7630_get_ctrl(struct sn9c102_device* cam, } -static int ov7630_set_ctrl(struct sn9c102_device* cam, - const struct v4l2_control* ctrl) +static int ov7630_set_ctrl(struct sn9c102_device *cam, + const struct v4l2_control *ctrl) { enum sn9c102_bridge bridge = sn9c102_get_bridge(cam); int err = 0; @@ -385,10 +385,10 @@ static int ov7630_set_ctrl(struct sn9c102_device* cam, } -static int ov7630_set_crop(struct sn9c102_device* cam, - const struct v4l2_rect* rect) +static int ov7630_set_crop(struct sn9c102_device *cam, + const struct v4l2_rect *rect) { - struct sn9c102_sensor* s = sn9c102_get_sensor(cam); + struct sn9c102_sensor *s = sn9c102_get_sensor(cam); int err = 0; u8 h_start = 0, v_start = (u8)(rect->top - s->cropcap.bounds.top) + 1; @@ -413,8 +413,8 @@ static int ov7630_set_crop(struct sn9c102_device* cam, } -static int ov7630_set_pix_format(struct sn9c102_device* cam, - const struct v4l2_pix_format* pix) +static int ov7630_set_pix_format(struct sn9c102_device *cam, + const struct v4l2_pix_format *pix) { int err = 0; @@ -594,7 +594,7 @@ static const struct sn9c102_sensor ov7630 = { }; -int sn9c102_probe_ov7630(struct sn9c102_device* cam) +int sn9c102_probe_ov7630(struct sn9c102_device *cam) { int pid, ver, err = 0; diff --git a/drivers/staging/media/sn9c102/sn9c102_ov7660.c b/drivers/staging/media/sn9c102/sn9c102_ov7660.c index 530157a234e6..ac07805d122e 100644 --- a/drivers/staging/media/sn9c102/sn9c102_ov7660.c +++ b/drivers/staging/media/sn9c102/sn9c102_ov7660.c @@ -23,7 +23,7 @@ #include "sn9c102_devtable.h" -static int ov7660_init(struct sn9c102_device* cam) +static int ov7660_init(struct sn9c102_device *cam) { int err = 0; @@ -271,8 +271,8 @@ static int ov7660_init(struct sn9c102_device* cam) } -static int ov7660_get_ctrl(struct sn9c102_device* cam, - struct v4l2_control* ctrl) +static int ov7660_get_ctrl(struct sn9c102_device *cam, + struct v4l2_control *ctrl) { int err = 0; @@ -332,8 +332,8 @@ static int ov7660_get_ctrl(struct sn9c102_device* cam, } -static int ov7660_set_ctrl(struct sn9c102_device* cam, - const struct v4l2_control* ctrl) +static int ov7660_set_ctrl(struct sn9c102_device *cam, + const struct v4l2_control *ctrl) { int err = 0; @@ -371,10 +371,10 @@ static int ov7660_set_ctrl(struct sn9c102_device* cam, } -static int ov7660_set_crop(struct sn9c102_device* cam, - const struct v4l2_rect* rect) +static int ov7660_set_crop(struct sn9c102_device *cam, + const struct v4l2_rect *rect) { - struct sn9c102_sensor* s = sn9c102_get_sensor(cam); + struct sn9c102_sensor *s = sn9c102_get_sensor(cam); int err = 0; u8 h_start = (u8)(rect->left - s->cropcap.bounds.left) + 1, v_start = (u8)(rect->top - s->cropcap.bounds.top) + 1; @@ -386,8 +386,8 @@ static int ov7660_set_crop(struct sn9c102_device* cam, } -static int ov7660_set_pix_format(struct sn9c102_device* cam, - const struct v4l2_pix_format* pix) +static int ov7660_set_pix_format(struct sn9c102_device *cam, + const struct v4l2_pix_format *pix) { int r0, err = 0; @@ -525,7 +525,7 @@ static const struct sn9c102_sensor ov7660 = { }; -int sn9c102_probe_ov7660(struct sn9c102_device* cam) +int sn9c102_probe_ov7660(struct sn9c102_device *cam) { int pid, ver, err; diff --git a/drivers/staging/media/sn9c102/sn9c102_pas106b.c b/drivers/staging/media/sn9c102/sn9c102_pas106b.c index 47bd82de80f9..895931ecac48 100644 --- a/drivers/staging/media/sn9c102/sn9c102_pas106b.c +++ b/drivers/staging/media/sn9c102/sn9c102_pas106b.c @@ -24,7 +24,7 @@ #include "sn9c102_devtable.h" -static int pas106b_init(struct sn9c102_device* cam) +static int pas106b_init(struct sn9c102_device *cam) { int err = 0; @@ -48,8 +48,8 @@ static int pas106b_init(struct sn9c102_device* cam) } -static int pas106b_get_ctrl(struct sn9c102_device* cam, - struct v4l2_control* ctrl) +static int pas106b_get_ctrl(struct sn9c102_device *cam, + struct v4l2_control *ctrl) { switch (ctrl->id) { case V4L2_CID_EXPOSURE: @@ -103,8 +103,8 @@ static int pas106b_get_ctrl(struct sn9c102_device* cam, } -static int pas106b_set_ctrl(struct sn9c102_device* cam, - const struct v4l2_control* ctrl) +static int pas106b_set_ctrl(struct sn9c102_device *cam, + const struct v4l2_control *ctrl) { int err = 0; @@ -141,10 +141,10 @@ static int pas106b_set_ctrl(struct sn9c102_device* cam, } -static int pas106b_set_crop(struct sn9c102_device* cam, - const struct v4l2_rect* rect) +static int pas106b_set_crop(struct sn9c102_device *cam, + const struct v4l2_rect *rect) { - struct sn9c102_sensor* s = sn9c102_get_sensor(cam); + struct sn9c102_sensor *s = sn9c102_get_sensor(cam); int err = 0; u8 h_start = (u8)(rect->left - s->cropcap.bounds.left) + 4, v_start = (u8)(rect->top - s->cropcap.bounds.top) + 3; @@ -156,8 +156,8 @@ static int pas106b_set_crop(struct sn9c102_device* cam, } -static int pas106b_set_pix_format(struct sn9c102_device* cam, - const struct v4l2_pix_format* pix) +static int pas106b_set_pix_format(struct sn9c102_device *cam, + const struct v4l2_pix_format *pix) { int err = 0; @@ -278,7 +278,7 @@ static const struct sn9c102_sensor pas106b = { }; -int sn9c102_probe_pas106b(struct sn9c102_device* cam) +int sn9c102_probe_pas106b(struct sn9c102_device *cam) { int r0 = 0, r1 = 0; unsigned int pid = 0; diff --git a/drivers/staging/media/sn9c102/sn9c102_pas202bcb.c b/drivers/staging/media/sn9c102/sn9c102_pas202bcb.c index cbfacc2dad84..f9e31ae2ad9f 100644 --- a/drivers/staging/media/sn9c102/sn9c102_pas202bcb.c +++ b/drivers/staging/media/sn9c102/sn9c102_pas202bcb.c @@ -28,7 +28,7 @@ #include "sn9c102_devtable.h" -static int pas202bcb_init(struct sn9c102_device* cam) +static int pas202bcb_init(struct sn9c102_device *cam) { int err = 0; @@ -78,8 +78,8 @@ static int pas202bcb_init(struct sn9c102_device* cam) } -static int pas202bcb_get_ctrl(struct sn9c102_device* cam, - struct v4l2_control* ctrl) +static int pas202bcb_get_ctrl(struct sn9c102_device *cam, + struct v4l2_control *ctrl) { switch (ctrl->id) { case V4L2_CID_EXPOSURE: @@ -126,8 +126,8 @@ static int pas202bcb_get_ctrl(struct sn9c102_device* cam, } -static int pas202bcb_set_pix_format(struct sn9c102_device* cam, - const struct v4l2_pix_format* pix) +static int pas202bcb_set_pix_format(struct sn9c102_device *cam, + const struct v4l2_pix_format *pix) { int err = 0; @@ -140,8 +140,8 @@ static int pas202bcb_set_pix_format(struct sn9c102_device* cam, } -static int pas202bcb_set_ctrl(struct sn9c102_device* cam, - const struct v4l2_control* ctrl) +static int pas202bcb_set_ctrl(struct sn9c102_device *cam, + const struct v4l2_control *ctrl) { int err = 0; @@ -174,10 +174,10 @@ static int pas202bcb_set_ctrl(struct sn9c102_device* cam, } -static int pas202bcb_set_crop(struct sn9c102_device* cam, - const struct v4l2_rect* rect) +static int pas202bcb_set_crop(struct sn9c102_device *cam, + const struct v4l2_rect *rect) { - struct sn9c102_sensor* s = sn9c102_get_sensor(cam); + struct sn9c102_sensor *s = sn9c102_get_sensor(cam); int err = 0; u8 h_start = 0, v_start = (u8)(rect->top - s->cropcap.bounds.top) + 3; @@ -299,7 +299,7 @@ static const struct sn9c102_sensor pas202bcb = { }; -int sn9c102_probe_pas202bcb(struct sn9c102_device* cam) +int sn9c102_probe_pas202bcb(struct sn9c102_device *cam) { int r0 = 0, r1 = 0, err = 0; unsigned int pid = 0; diff --git a/drivers/staging/media/sn9c102/sn9c102_sensor.h b/drivers/staging/media/sn9c102/sn9c102_sensor.h index 3679970dba2c..9f59c815d48b 100644 --- a/drivers/staging/media/sn9c102/sn9c102_sensor.h +++ b/drivers/staging/media/sn9c102/sn9c102_sensor.h @@ -62,19 +62,19 @@ enum sn9c102_bridge { }; /* Return the bridge name */ -enum sn9c102_bridge sn9c102_get_bridge(struct sn9c102_device* cam); +enum sn9c102_bridge sn9c102_get_bridge(struct sn9c102_device *cam); /* Return a pointer the sensor struct attached to the camera */ -struct sn9c102_sensor* sn9c102_get_sensor(struct sn9c102_device* cam); +struct sn9c102_sensor *sn9c102_get_sensor(struct sn9c102_device *cam); /* Identify a device */ extern struct sn9c102_device* -sn9c102_match_id(struct sn9c102_device* cam, const struct usb_device_id *id); +sn9c102_match_id(struct sn9c102_device *cam, const struct usb_device_id *id); /* Attach a probed sensor to the camera. */ extern void -sn9c102_attach_sensor(struct sn9c102_device* cam, - const struct sn9c102_sensor* sensor); +sn9c102_attach_sensor(struct sn9c102_device *cam, + const struct sn9c102_sensor *sensor); /* Read/write routines: they always return -1 on error, 0 or the read value @@ -99,12 +99,12 @@ extern int sn9c102_i2c_try_read(struct sn9c102_device*, version returns 0 on success, while the read version returns the first read byte. */ -extern int sn9c102_i2c_try_raw_write(struct sn9c102_device* cam, - const struct sn9c102_sensor* sensor, u8 n, +extern int sn9c102_i2c_try_raw_write(struct sn9c102_device *cam, + const struct sn9c102_sensor *sensor, u8 n, u8 data0, u8 data1, u8 data2, u8 data3, u8 data4, u8 data5); -extern int sn9c102_i2c_try_raw_read(struct sn9c102_device* cam, - const struct sn9c102_sensor* sensor, +extern int sn9c102_i2c_try_raw_read(struct sn9c102_device *cam, + const struct sn9c102_sensor *sensor, u8 data0, u8 data1, u8 n, u8 buffer[]); /* To be used after the sensor struct has been attached to the camera struct */ @@ -174,7 +174,7 @@ struct sn9c102_sensor { they must return 0 on success, the proper error otherwise. */ - int (*init)(struct sn9c102_device* cam); + int (*init)(struct sn9c102_device *cam); /* This function will be called after the sensor has been attached. It should be used to initialize the sensor only, but may also @@ -195,9 +195,9 @@ struct sn9c102_sensor { V4L2 API. Menu type controls are not handled by this interface. */ - int (*get_ctrl)(struct sn9c102_device* cam, struct v4l2_control* ctrl); - int (*set_ctrl)(struct sn9c102_device* cam, - const struct v4l2_control* ctrl); + int (*get_ctrl)(struct sn9c102_device *cam, struct v4l2_control *ctrl); + int (*set_ctrl)(struct sn9c102_device *cam, + const struct v4l2_control *ctrl); /* You must implement at least the set_ctrl method if you have defined the list above. The returned value must follow the V4L2 @@ -240,8 +240,8 @@ struct sn9c102_sensor { will be ignored. */ - int (*set_crop)(struct sn9c102_device* cam, - const struct v4l2_rect* rect); + int (*set_crop)(struct sn9c102_device *cam, + const struct v4l2_rect *rect); /* To be called on VIDIOC_C_SETCROP. The core module always calls a default routine which configures the appropriate SN9C1XX regs (also @@ -276,8 +276,8 @@ struct sn9c102_sensor { matches the RGB bayer sequence (i.e. BGBGBG...GRGRGR). */ - int (*set_pix_format)(struct sn9c102_device* cam, - const struct v4l2_pix_format* pix); + int (*set_pix_format)(struct sn9c102_device *cam, + const struct v4l2_pix_format *pix); /* To be called on VIDIOC_S_FMT, when switching from the SBGGR8 to SN9C10X pixel format or viceversa. On error return the corresponding diff --git a/drivers/staging/media/sn9c102/sn9c102_tas5110c1b.c b/drivers/staging/media/sn9c102/sn9c102_tas5110c1b.c index 04cdfdde8564..6a00b626d347 100644 --- a/drivers/staging/media/sn9c102/sn9c102_tas5110c1b.c +++ b/drivers/staging/media/sn9c102/sn9c102_tas5110c1b.c @@ -23,7 +23,7 @@ #include "sn9c102_devtable.h" -static int tas5110c1b_init(struct sn9c102_device* cam) +static int tas5110c1b_init(struct sn9c102_device *cam) { int err = 0; @@ -38,8 +38,8 @@ static int tas5110c1b_init(struct sn9c102_device* cam) } -static int tas5110c1b_set_ctrl(struct sn9c102_device* cam, - const struct v4l2_control* ctrl) +static int tas5110c1b_set_ctrl(struct sn9c102_device *cam, + const struct v4l2_control *ctrl) { int err = 0; @@ -55,10 +55,10 @@ static int tas5110c1b_set_ctrl(struct sn9c102_device* cam, } -static int tas5110c1b_set_crop(struct sn9c102_device* cam, - const struct v4l2_rect* rect) +static int tas5110c1b_set_crop(struct sn9c102_device *cam, + const struct v4l2_rect *rect) { - struct sn9c102_sensor* s = sn9c102_get_sensor(cam); + struct sn9c102_sensor *s = sn9c102_get_sensor(cam); int err = 0; u8 h_start = (u8)(rect->left - s->cropcap.bounds.left) + 69, v_start = (u8)(rect->top - s->cropcap.bounds.top) + 9; @@ -75,8 +75,8 @@ static int tas5110c1b_set_crop(struct sn9c102_device* cam, } -static int tas5110c1b_set_pix_format(struct sn9c102_device* cam, - const struct v4l2_pix_format* pix) +static int tas5110c1b_set_pix_format(struct sn9c102_device *cam, + const struct v4l2_pix_format *pix) { int err = 0; @@ -135,7 +135,7 @@ static const struct sn9c102_sensor tas5110c1b = { }; -int sn9c102_probe_tas5110c1b(struct sn9c102_device* cam) +int sn9c102_probe_tas5110c1b(struct sn9c102_device *cam) { const struct usb_device_id tas5110c1b_id_table[] = { { USB_DEVICE(0x0c45, 0x6001), }, diff --git a/drivers/staging/media/sn9c102/sn9c102_tas5110d.c b/drivers/staging/media/sn9c102/sn9c102_tas5110d.c index 9372e6f9fcff..eefbf8670c3e 100644 --- a/drivers/staging/media/sn9c102/sn9c102_tas5110d.c +++ b/drivers/staging/media/sn9c102/sn9c102_tas5110d.c @@ -23,7 +23,7 @@ #include "sn9c102_devtable.h" -static int tas5110d_init(struct sn9c102_device* cam) +static int tas5110d_init(struct sn9c102_device *cam) { int err; @@ -37,10 +37,10 @@ static int tas5110d_init(struct sn9c102_device* cam) } -static int tas5110d_set_crop(struct sn9c102_device* cam, - const struct v4l2_rect* rect) +static int tas5110d_set_crop(struct sn9c102_device *cam, + const struct v4l2_rect *rect) { - struct sn9c102_sensor* s = sn9c102_get_sensor(cam); + struct sn9c102_sensor *s = sn9c102_get_sensor(cam); int err = 0; u8 h_start = (u8)(rect->left - s->cropcap.bounds.left) + 69, v_start = (u8)(rect->top - s->cropcap.bounds.top) + 9; @@ -55,8 +55,8 @@ static int tas5110d_set_crop(struct sn9c102_device* cam, } -static int tas5110d_set_pix_format(struct sn9c102_device* cam, - const struct v4l2_pix_format* pix) +static int tas5110d_set_pix_format(struct sn9c102_device *cam, + const struct v4l2_pix_format *pix) { int err = 0; @@ -103,7 +103,7 @@ static const struct sn9c102_sensor tas5110d = { }; -int sn9c102_probe_tas5110d(struct sn9c102_device* cam) +int sn9c102_probe_tas5110d(struct sn9c102_device *cam) { const struct usb_device_id tas5110d_id_table[] = { { USB_DEVICE(0x0c45, 0x6007), }, diff --git a/drivers/staging/media/sn9c102/sn9c102_tas5130d1b.c b/drivers/staging/media/sn9c102/sn9c102_tas5130d1b.c index a30bbc4389f5..725de857de45 100644 --- a/drivers/staging/media/sn9c102/sn9c102_tas5130d1b.c +++ b/drivers/staging/media/sn9c102/sn9c102_tas5130d1b.c @@ -23,7 +23,7 @@ #include "sn9c102_devtable.h" -static int tas5130d1b_init(struct sn9c102_device* cam) +static int tas5130d1b_init(struct sn9c102_device *cam) { int err; @@ -36,8 +36,8 @@ static int tas5130d1b_init(struct sn9c102_device* cam) } -static int tas5130d1b_set_ctrl(struct sn9c102_device* cam, - const struct v4l2_control* ctrl) +static int tas5130d1b_set_ctrl(struct sn9c102_device *cam, + const struct v4l2_control *ctrl) { int err = 0; @@ -56,10 +56,10 @@ static int tas5130d1b_set_ctrl(struct sn9c102_device* cam, } -static int tas5130d1b_set_crop(struct sn9c102_device* cam, - const struct v4l2_rect* rect) +static int tas5130d1b_set_crop(struct sn9c102_device *cam, + const struct v4l2_rect *rect) { - struct sn9c102_sensor* s = sn9c102_get_sensor(cam); + struct sn9c102_sensor *s = sn9c102_get_sensor(cam); u8 h_start = (u8)(rect->left - s->cropcap.bounds.left) + 104, v_start = (u8)(rect->top - s->cropcap.bounds.top) + 12; int err = 0; @@ -76,8 +76,8 @@ static int tas5130d1b_set_crop(struct sn9c102_device* cam, } -static int tas5130d1b_set_pix_format(struct sn9c102_device* cam, - const struct v4l2_pix_format* pix) +static int tas5130d1b_set_pix_format(struct sn9c102_device *cam, + const struct v4l2_pix_format *pix) { int err = 0; @@ -146,7 +146,7 @@ static const struct sn9c102_sensor tas5130d1b = { }; -int sn9c102_probe_tas5130d1b(struct sn9c102_device* cam) +int sn9c102_probe_tas5130d1b(struct sn9c102_device *cam) { const struct usb_device_id tas5130d1b_id_table[] = { { USB_DEVICE(0x0c45, 0x6024), }, -- cgit From 5d60122b7e30f275593df93b39a76d3c2663cfc2 Mon Sep 17 00:00:00 2001 From: Pali Rohár Date: Tue, 22 Apr 2014 12:02:39 -0300 Subject: [media] radio-bcm2048: fix wrong overflow check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch fixes an off by one check in bcm2048_set_region(). Reported-by: Dan Carpenter Signed-off-by: Pali Rohár Signed-off-by: Pavel Machek Signed-off-by: Dan Carpenter Signed-off-by: Hans Verkuil Cc: stable@vger.kernel.org Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/bcm2048/radio-bcm2048.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/bcm2048/radio-bcm2048.c b/drivers/staging/media/bcm2048/radio-bcm2048.c index b2cd3a85166d..bbf236e842a9 100644 --- a/drivers/staging/media/bcm2048/radio-bcm2048.c +++ b/drivers/staging/media/bcm2048/radio-bcm2048.c @@ -737,7 +737,7 @@ static int bcm2048_set_region(struct bcm2048_device *bdev, u8 region) int err; u32 new_frequency = 0; - if (region > ARRAY_SIZE(region_configs)) + if (region >= ARRAY_SIZE(region_configs)) return -EINVAL; mutex_lock(&bdev->mutex); -- cgit From e6659ee6e924a0e290cef785f721b1acb8c93f2c Mon Sep 17 00:00:00 2001 From: Vitaly Osipov Date: Thu, 10 Apr 2014 06:01:50 -0300 Subject: [media] staging: media: omap24xx: fix up checkpatch error message tcm825x.c: fixing ERROR: Macros with complex values should be enclosed in parenthesis Signed-off-by: Vitaly Osipov Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/omap24xx/tcm825x.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/omap24xx/tcm825x.c b/drivers/staging/media/omap24xx/tcm825x.c index f4dd32df2353..232648156773 100644 --- a/drivers/staging/media/omap24xx/tcm825x.c +++ b/drivers/staging/media/omap24xx/tcm825x.c @@ -89,10 +89,10 @@ static const struct tcm825x_reg rgb565 = { 0x02, TCM825X_PICFMT }; /* Our own specific controls */ #define V4L2_CID_ALC V4L2_CID_PRIVATE_BASE -#define V4L2_CID_H_EDGE_EN V4L2_CID_PRIVATE_BASE + 1 -#define V4L2_CID_V_EDGE_EN V4L2_CID_PRIVATE_BASE + 2 -#define V4L2_CID_LENS V4L2_CID_PRIVATE_BASE + 3 -#define V4L2_CID_MAX_EXPOSURE_TIME V4L2_CID_PRIVATE_BASE + 4 +#define V4L2_CID_H_EDGE_EN (V4L2_CID_PRIVATE_BASE + 1) +#define V4L2_CID_V_EDGE_EN (V4L2_CID_PRIVATE_BASE + 2) +#define V4L2_CID_LENS (V4L2_CID_PRIVATE_BASE + 3) +#define V4L2_CID_MAX_EXPOSURE_TIME (V4L2_CID_PRIVATE_BASE + 4) #define V4L2_CID_LAST_PRIV V4L2_CID_MAX_EXPOSURE_TIME /* Video controls */ -- cgit From 6ee51a27b2404991cd19de990548d60daa99792a Mon Sep 17 00:00:00 2001 From: Vitaly Osipov Date: Thu, 10 Apr 2014 06:02:38 -0300 Subject: [media] staging: media: omap24xx: use pr_info() instead of KERN_INFO tcm825x.c: changed printk to pr_info Signed-off-by: Vitaly Osipov Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/omap24xx/tcm825x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/omap24xx/tcm825x.c b/drivers/staging/media/omap24xx/tcm825x.c index 232648156773..3367ccd1d1e8 100644 --- a/drivers/staging/media/omap24xx/tcm825x.c +++ b/drivers/staging/media/omap24xx/tcm825x.c @@ -914,8 +914,8 @@ static int __init tcm825x_init(void) rval = i2c_add_driver(&tcm825x_i2c_driver); if (rval) - printk(KERN_INFO "%s: failed registering " TCM825X_NAME "\n", - __func__); + pr_info("%s: failed registering " TCM825X_NAME "\n", + __func__); return rval; } -- cgit From 5b340ea0caac4c123a3bb989a43c021a2dc06fb2 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Fri, 9 May 2014 08:55:09 -0300 Subject: [media] Staging: dt3155v4l: set error code on failure We should be returning -ENOMEM here instead of success. Signed-off-by: Dan Carpenter Reviewed-by: Jingoo Han Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/dt3155v4l/dt3155v4l.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/dt3155v4l/dt3155v4l.c b/drivers/staging/media/dt3155v4l/dt3155v4l.c index 14bdc19ec48f..40580228a6c7 100644 --- a/drivers/staging/media/dt3155v4l/dt3155v4l.c +++ b/drivers/staging/media/dt3155v4l/dt3155v4l.c @@ -906,8 +906,10 @@ dt3155_probe(struct pci_dev *pdev, const struct pci_device_id *id) if (!pd) return -ENOMEM; pd->vdev = video_device_alloc(); - if (!pd->vdev) + if (!pd->vdev) { + err = -ENOMEM; goto err_video_device_alloc; + } *pd->vdev = dt3155_vdev; pci_set_drvdata(pdev, pd); /* for use in dt3155_remove() */ video_set_drvdata(pd->vdev, pd); /* for use in video_fops */ -- cgit From 8774bed9ce832d8d9ccb79e92800b808aa2d2ad2 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Mon, 28 Apr 2014 16:53:01 -0300 Subject: [media] v4l: subdev: Move [gs]_std operation to video ops The g_std and s_std operations are video-related, move them to the video ops where they belong. Signed-off-by: Laurent Pinchart Acked-by: Hans Verkuil Acked-by: Lad, Prabhakar Acked-by: Sakari Ailus Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/davinci_vpfe/vpfe_video.c | 2 +- drivers/staging/media/go7007/go7007-v4l2.c | 2 +- drivers/staging/media/go7007/s2250-board.c | 2 +- drivers/staging/media/go7007/saa7134-go7007.c | 4 ++++ 4 files changed, 7 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.c b/drivers/staging/media/davinci_vpfe/vpfe_video.c index 7b213a7f9623..425e2c849723 100644 --- a/drivers/staging/media/davinci_vpfe/vpfe_video.c +++ b/drivers/staging/media/davinci_vpfe/vpfe_video.c @@ -944,7 +944,7 @@ static int vpfe_s_std(struct file *file, void *priv, v4l2_std_id std_id) goto unlock_out; } ret = v4l2_device_call_until_err(&vpfe_dev->v4l2_dev, sdinfo->grp_id, - core, s_std, std_id); + video, s_std, std_id); if (ret < 0) { v4l2_err(&vpfe_dev->v4l2_dev, "Failed to set standard\n"); video->stdid = V4L2_STD_UNKNOWN; diff --git a/drivers/staging/media/go7007/go7007-v4l2.c b/drivers/staging/media/go7007/go7007-v4l2.c index 090b3e6e852a..da7b5493e13e 100644 --- a/drivers/staging/media/go7007/go7007-v4l2.c +++ b/drivers/staging/media/go7007/go7007-v4l2.c @@ -665,7 +665,7 @@ static int go7007_s_std(struct go7007 *go) go->sensor_framerate = 30000; } - call_all(&go->v4l2_dev, core, s_std, go->std); + call_all(&go->v4l2_dev, video, s_std, go->std); set_capture_size(go, NULL, 0); return 0; } diff --git a/drivers/staging/media/go7007/s2250-board.c b/drivers/staging/media/go7007/s2250-board.c index 696a80756691..eaa2b0990a1b 100644 --- a/drivers/staging/media/go7007/s2250-board.c +++ b/drivers/staging/media/go7007/s2250-board.c @@ -474,7 +474,6 @@ static const struct v4l2_ctrl_ops s2250_ctrl_ops = { static const struct v4l2_subdev_core_ops s2250_core_ops = { .log_status = s2250_log_status, - .s_std = s2250_s_std, }; static const struct v4l2_subdev_audio_ops s2250_audio_ops = { @@ -482,6 +481,7 @@ static const struct v4l2_subdev_audio_ops s2250_audio_ops = { }; static const struct v4l2_subdev_video_ops s2250_video_ops = { + .s_std = s2250_s_std, .s_routing = s2250_s_video_routing, .s_mbus_fmt = s2250_s_mbus_fmt, }; diff --git a/drivers/staging/media/go7007/saa7134-go7007.c b/drivers/staging/media/go7007/saa7134-go7007.c index 6e2ca338cdd9..e40f7fbfc0a5 100644 --- a/drivers/staging/media/go7007/saa7134-go7007.c +++ b/drivers/staging/media/go7007/saa7134-go7007.c @@ -434,11 +434,15 @@ static const struct v4l2_subdev_core_ops saa7134_go7007_core_ops = { .g_ctrl = saa7134_go7007_g_ctrl, .s_ctrl = saa7134_go7007_s_ctrl, .queryctrl = saa7134_go7007_queryctrl, +}; + +static const struct v4l2_subdev_video_ops saa7134_go7007_video_ops = { .s_std = saa7134_go7007_s_std, }; static const struct v4l2_subdev_ops saa7134_go7007_sd_ops = { .core = &saa7134_go7007_core_ops, + .video = &saa7134_go7007_video_ops, }; /* --------------------------------------------------------------------------*/ -- cgit From 3a4d339fe8803a7e7d901f61ea268af71d899169 Mon Sep 17 00:00:00 2001 From: Ismael Luceno Date: Sun, 18 May 2014 16:44:11 -0300 Subject: [media] solo6x10: Reduce OSD writes to the minimum necessary Instead of unconditionally writing SOLO_EOSD_EXT_SIZE() bytes to the OSD area (which is 64 or 128 kB depending on the PCI board) we only write the actual amount of data needed which is 16 * OSD_TEXT_MAX (= 16 * 44). Signed-off-by: Ismael Luceno Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/solo6x10/solo6x10-enc.c | 31 ++++++++++------------- drivers/staging/media/solo6x10/solo6x10-offsets.h | 2 ++ 2 files changed, 16 insertions(+), 17 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/solo6x10/solo6x10-enc.c b/drivers/staging/media/solo6x10/solo6x10-enc.c index 94d5735abf85..2db53b68c62f 100644 --- a/drivers/staging/media/solo6x10/solo6x10-enc.c +++ b/drivers/staging/media/solo6x10/solo6x10-enc.c @@ -134,51 +134,48 @@ static void solo_capture_config(struct solo_dev *solo_dev) kfree(buf); } +#define SOLO_OSD_WRITE_SIZE (16 * OSD_TEXT_MAX) + /* Should be called with enable_lock held */ int solo_osd_print(struct solo_enc_dev *solo_enc) { struct solo_dev *solo_dev = solo_enc->solo_dev; unsigned char *str = solo_enc->osd_text; u8 *buf = solo_enc->osd_buf; - u32 reg = solo_reg_read(solo_dev, SOLO_VE_OSD_CH); + u32 reg; const struct font_desc *vga = find_font("VGA8x16"); const unsigned char *vga_data; - int len; int i, j; if (WARN_ON_ONCE(!vga)) return -ENODEV; - len = strlen(str); - - if (len == 0) { + reg = solo_reg_read(solo_dev, SOLO_VE_OSD_CH); + if (!*str) { /* Disable OSD on this channel */ reg &= ~(1 << solo_enc->ch); - solo_reg_write(solo_dev, SOLO_VE_OSD_CH, reg); - return 0; + goto out; } - memset(buf, 0, SOLO_EOSD_EXT_SIZE_MAX); + memset(buf, 0, SOLO_OSD_WRITE_SIZE); vga_data = (const unsigned char *)vga->data; - for (i = 0; i < len; i++) { - unsigned char c = str[i]; - + for (i = 0; *str; i++, str++) { for (j = 0; j < 16; j++) { - buf[(j * 2) + (i % 2) + (i / 2 * 32)] = - bitrev8(vga_data[(c * 16) + j]); + buf[(j << 1) | (i & 1) | ((i & ~1) << 4)] = + bitrev8(vga_data[(*str << 4) | j]); } } solo_p2m_dma(solo_dev, 1, buf, - SOLO_EOSD_EXT_ADDR + - (solo_enc->ch * SOLO_EOSD_EXT_SIZE(solo_dev)), - SOLO_EOSD_EXT_SIZE(solo_dev), 0, 0); + SOLO_EOSD_EXT_ADDR_CHAN(solo_dev, solo_enc->ch), + SOLO_OSD_WRITE_SIZE, 0, 0); /* Enable OSD on this channel */ reg |= (1 << solo_enc->ch); - solo_reg_write(solo_dev, SOLO_VE_OSD_CH, reg); +out: + solo_reg_write(solo_dev, SOLO_VE_OSD_CH, reg); return 0; } diff --git a/drivers/staging/media/solo6x10/solo6x10-offsets.h b/drivers/staging/media/solo6x10/solo6x10-offsets.h index f005dca501f1..13eeb4470dcf 100644 --- a/drivers/staging/media/solo6x10/solo6x10-offsets.h +++ b/drivers/staging/media/solo6x10/solo6x10-offsets.h @@ -35,6 +35,8 @@ #define SOLO_EOSD_EXT_SIZE_MAX 0x20000 #define SOLO_EOSD_EXT_AREA(__solo) \ (SOLO_EOSD_EXT_SIZE(__solo) * 32) +#define SOLO_EOSD_EXT_ADDR_CHAN(__solo, ch) \ + (SOLO_EOSD_EXT_ADDR + SOLO_EOSD_EXT_SIZE(__solo) * (ch)) #define SOLO_MOTION_EXT_ADDR(__solo) \ (SOLO_EOSD_EXT_ADDR + SOLO_EOSD_EXT_AREA(__solo)) -- cgit From 523d63eb67e23a2b89d6357013257b0759292a0d Mon Sep 17 00:00:00 2001 From: Ismael Luceno Date: Sun, 18 May 2014 20:23:47 -0300 Subject: [media] solo6x10: Kconfig: Add supported card list to the SOLO6X10 knob Explicitly list the cards supported by and tested with this driver. Signed-off-by: Ismael Luceno Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/solo6x10/Kconfig | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/solo6x10/Kconfig b/drivers/staging/media/solo6x10/Kconfig index 9a4296c2e3ab..6a1906fa1117 100644 --- a/drivers/staging/media/solo6x10/Kconfig +++ b/drivers/staging/media/solo6x10/Kconfig @@ -1,5 +1,5 @@ config SOLO6X10 - tristate "Softlogic 6x10 MPEG codec cards" + tristate "Bluecherry / Softlogic 6x10 capture cards (MPEG-4/H.264)" depends on PCI && VIDEO_DEV && SND && I2C select FONT_SUPPORT select FONT_8x16 @@ -8,5 +8,11 @@ config SOLO6X10 select SND_PCM select FONT_8x16 ---help--- - This driver supports the Softlogic based MPEG-4 and h.264 codec - cards. + This driver supports the Bluecherry H.264 and MPEG-4 hardware + compression capture cards and other Softlogic-based ones. + + Following cards have been tested: + * Bluecherry BC-H16480A (PCIe, 16 port, H.264) + * Bluecherry BC-H04120A (PCIe, 4 port, H.264) + * Bluecherry BC-H04120A-MPCI (Mini-PCI, 4 port, H.264) + * Bluecherry BC-04120A (PCIe, 4 port, MPEG-4) -- cgit From 0eda185c6cd8ff47ffac172577fca9394073a4d6 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Fri, 31 Jan 2014 09:04:19 -0300 Subject: [media] media: staging: davinci: vpfe: Switch to pad-level DV operations The video-level enum_dv_timings and dv_timings_cap operations are deprecated in favor of the pad-level versions. All subdev drivers implement the pad-level versions, switch to them. Signed-off-by: Laurent Pinchart Reviewed-by: Hans Verkuil Acked-by: Lad, Prabhakar Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/davinci_vpfe/vpfe_video.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.c b/drivers/staging/media/davinci_vpfe/vpfe_video.c index 425e2c849723..d95c427043d4 100644 --- a/drivers/staging/media/davinci_vpfe/vpfe_video.c +++ b/drivers/staging/media/davinci_vpfe/vpfe_video.c @@ -986,8 +986,10 @@ vpfe_enum_dv_timings(struct file *file, void *fh, struct vpfe_device *vpfe_dev = video->vpfe_dev; struct v4l2_subdev *subdev = video->current_ext_subdev->subdev; + timings->pad = 0; + v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "vpfe_enum_dv_timings\n"); - return v4l2_subdev_call(subdev, video, enum_dv_timings, timings); + return v4l2_subdev_call(subdev, pad, enum_dv_timings, timings); } /* -- cgit From 465b8229acd01bbb72fea89ee6f3657071952bdf Mon Sep 17 00:00:00 2001 From: Tuomas Tynkkynen Date: Thu, 8 May 2014 08:13:17 -0300 Subject: [media] staging: lirc: Fix sparse warnings Fix sparse warnings by adding __user and __iomem annotations where necessary and removing certain unnecessary casts. While at it, also use u32 in place of __u32. Signed-off-by: Tuomas Tynkkynen Reviewed-by: Dan Carpenter Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/lirc/lirc_bt829.c | 6 +++--- drivers/staging/media/lirc/lirc_parallel.c | 26 ++++++++++++----------- drivers/staging/media/lirc/lirc_serial.c | 11 +++++----- drivers/staging/media/lirc/lirc_sir.c | 33 +++++++++++++++--------------- drivers/staging/media/lirc/lirc_zilog.c | 23 +++++++++++---------- 5 files changed, 52 insertions(+), 47 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/lirc/lirc_bt829.c b/drivers/staging/media/lirc/lirc_bt829.c index 30edc740ac25..fe010542ab4b 100644 --- a/drivers/staging/media/lirc/lirc_bt829.c +++ b/drivers/staging/media/lirc/lirc_bt829.c @@ -64,7 +64,7 @@ static bool debug; static int atir_minor; static phys_addr_t pci_addr_phys; -static unsigned char *pci_addr_lin; +static unsigned char __iomem *pci_addr_lin; static struct lirc_driver atir_driver; @@ -382,7 +382,7 @@ static unsigned char do_get_bits(void) static unsigned int read_index(unsigned char index) { - unsigned char *addr; + unsigned char __iomem *addr; unsigned int value; /* addr = pci_addr_lin + DATA_PCI_OFF + ((index & 0xFF) << 2); */ addr = pci_addr_lin + ((index & 0xFF) << 2); @@ -392,7 +392,7 @@ static unsigned int read_index(unsigned char index) static void write_index(unsigned char index, unsigned int reg_val) { - unsigned char *addr; + unsigned char __iomem *addr; addr = pci_addr_lin + ((index & 0xFF) << 2); writel(reg_val, addr); } diff --git a/drivers/staging/media/lirc/lirc_parallel.c b/drivers/staging/media/lirc/lirc_parallel.c index 62f5137b947b..1394f020e46b 100644 --- a/drivers/staging/media/lirc/lirc_parallel.c +++ b/drivers/staging/media/lirc/lirc_parallel.c @@ -324,7 +324,8 @@ static loff_t lirc_lseek(struct file *filep, loff_t offset, int orig) return -ESPIPE; } -static ssize_t lirc_read(struct file *filep, char *buf, size_t n, loff_t *ppos) +static ssize_t lirc_read(struct file *filep, char __user *buf, size_t n, + loff_t *ppos) { int result = 0; int count = 0; @@ -362,7 +363,7 @@ static ssize_t lirc_read(struct file *filep, char *buf, size_t n, loff_t *ppos) return count ? count : result; } -static ssize_t lirc_write(struct file *filep, const char *buf, size_t n, +static ssize_t lirc_write(struct file *filep, const char __user *buf, size_t n, loff_t *ppos) { int count; @@ -463,43 +464,44 @@ static unsigned int lirc_poll(struct file *file, poll_table *wait) static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) { int result; - __u32 features = LIRC_CAN_SET_TRANSMITTER_MASK | - LIRC_CAN_SEND_PULSE | LIRC_CAN_REC_MODE2; - __u32 mode; - __u32 value; + u32 __user *uptr = (u32 __user *)arg; + u32 features = LIRC_CAN_SET_TRANSMITTER_MASK | + LIRC_CAN_SEND_PULSE | LIRC_CAN_REC_MODE2; + u32 mode; + u32 value; switch (cmd) { case LIRC_GET_FEATURES: - result = put_user(features, (__u32 *) arg); + result = put_user(features, uptr); if (result) return result; break; case LIRC_GET_SEND_MODE: - result = put_user(LIRC_MODE_PULSE, (__u32 *) arg); + result = put_user(LIRC_MODE_PULSE, uptr); if (result) return result; break; case LIRC_GET_REC_MODE: - result = put_user(LIRC_MODE_MODE2, (__u32 *) arg); + result = put_user(LIRC_MODE_MODE2, uptr); if (result) return result; break; case LIRC_SET_SEND_MODE: - result = get_user(mode, (__u32 *) arg); + result = get_user(mode, uptr); if (result) return result; if (mode != LIRC_MODE_PULSE) return -EINVAL; break; case LIRC_SET_REC_MODE: - result = get_user(mode, (__u32 *) arg); + result = get_user(mode, uptr); if (result) return result; if (mode != LIRC_MODE_MODE2) return -ENOSYS; break; case LIRC_SET_TRANSMITTER_MASK: - result = get_user(value, (__u32 *) arg); + result = get_user(value, uptr); if (result) return result; if ((value & LIRC_PARALLEL_TRANSMITTER_MASK) != value) diff --git a/drivers/staging/media/lirc/lirc_serial.c b/drivers/staging/media/lirc/lirc_serial.c index 10c685d5de7c..dc5ba43116c7 100644 --- a/drivers/staging/media/lirc/lirc_serial.c +++ b/drivers/staging/media/lirc/lirc_serial.c @@ -1011,7 +1011,8 @@ static ssize_t lirc_write(struct file *file, const char __user *buf, static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) { int result; - __u32 value; + u32 __user *uptr = (u32 __user *)arg; + u32 value; switch (cmd) { case LIRC_GET_SEND_MODE: @@ -1020,7 +1021,7 @@ static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) result = put_user(LIRC_SEND2MODE (hardware[type].features&LIRC_CAN_SEND_MASK), - (__u32 *) arg); + uptr); if (result) return result; break; @@ -1029,7 +1030,7 @@ static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) if (!(hardware[type].features&LIRC_CAN_SEND_MASK)) return -ENOIOCTLCMD; - result = get_user(value, (__u32 *) arg); + result = get_user(value, uptr); if (result) return result; /* only LIRC_MODE_PULSE supported */ @@ -1046,7 +1047,7 @@ static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) if (!(hardware[type].features&LIRC_CAN_SET_SEND_DUTY_CYCLE)) return -ENOIOCTLCMD; - result = get_user(value, (__u32 *) arg); + result = get_user(value, uptr); if (result) return result; if (value <= 0 || value > 100) @@ -1059,7 +1060,7 @@ static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) if (!(hardware[type].features&LIRC_CAN_SET_SEND_CARRIER)) return -ENOIOCTLCMD; - result = get_user(value, (__u32 *) arg); + result = get_user(value, uptr); if (result) return result; if (value > 500000 || value < 20000) diff --git a/drivers/staging/media/lirc/lirc_sir.c b/drivers/staging/media/lirc/lirc_sir.c index f781c532b3c4..e31cbb81f059 100644 --- a/drivers/staging/media/lirc/lirc_sir.c +++ b/drivers/staging/media/lirc/lirc_sir.c @@ -187,10 +187,10 @@ static bool debug; /* Communication with user-space */ static unsigned int lirc_poll(struct file *file, poll_table *wait); -static ssize_t lirc_read(struct file *file, char *buf, size_t count, - loff_t *ppos); -static ssize_t lirc_write(struct file *file, const char *buf, size_t n, - loff_t *pos); +static ssize_t lirc_read(struct file *file, char __user *buf, size_t count, + loff_t *ppos); +static ssize_t lirc_write(struct file *file, const char __user *buf, size_t n, + loff_t *pos); static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg); static void add_read_queue(int flag, unsigned long val); static int init_chrdev(void); @@ -252,8 +252,8 @@ static unsigned int lirc_poll(struct file *file, poll_table *wait) return 0; } -static ssize_t lirc_read(struct file *file, char *buf, size_t count, - loff_t *ppos) +static ssize_t lirc_read(struct file *file, char __user *buf, size_t count, + loff_t *ppos) { int n = 0; int retval = 0; @@ -266,9 +266,9 @@ static ssize_t lirc_read(struct file *file, char *buf, size_t count, set_current_state(TASK_INTERRUPTIBLE); while (n < count) { if (rx_head != rx_tail) { - if (copy_to_user((void *) buf + n, - (void *) (rx_buf + rx_head), - sizeof(int))) { + if (copy_to_user(buf + n, + rx_buf + rx_head, + sizeof(int))) { retval = -EFAULT; break; } @@ -291,8 +291,8 @@ static ssize_t lirc_read(struct file *file, char *buf, size_t count, set_current_state(TASK_RUNNING); return n ? n : retval; } -static ssize_t lirc_write(struct file *file, const char *buf, size_t n, - loff_t *pos) +static ssize_t lirc_write(struct file *file, const char __user *buf, size_t n, + loff_t *pos) { unsigned long flags; int i, count; @@ -338,8 +338,9 @@ static ssize_t lirc_write(struct file *file, const char *buf, size_t n, static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) { + u32 __user *uptr = (u32 __user *)arg; int retval = 0; - __u32 value = 0; + u32 value = 0; #ifdef LIRC_ON_SA1100 if (cmd == LIRC_GET_FEATURES) @@ -364,16 +365,16 @@ static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) case LIRC_GET_FEATURES: case LIRC_GET_SEND_MODE: case LIRC_GET_REC_MODE: - retval = put_user(value, (__u32 *) arg); + retval = put_user(value, uptr); break; case LIRC_SET_SEND_MODE: case LIRC_SET_REC_MODE: - retval = get_user(value, (__u32 *) arg); + retval = get_user(value, uptr); break; #ifdef LIRC_ON_SA1100 case LIRC_SET_SEND_DUTY_CYCLE: - retval = get_user(value, (__u32 *) arg); + retval = get_user(value, uptr); if (retval) return retval; if (value <= 0 || value > 100) @@ -388,7 +389,7 @@ static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) space_width -= LIRC_ON_SA1100_TRANSMITTER_LATENCY; break; case LIRC_SET_SEND_CARRIER: - retval = get_user(value, (__u32 *) arg); + retval = get_user(value, uptr); if (retval) return retval; if (value > 500000 || value < 20000) diff --git a/drivers/staging/media/lirc/lirc_zilog.c b/drivers/staging/media/lirc/lirc_zilog.c index e1feb6164593..3259aacfd350 100644 --- a/drivers/staging/media/lirc/lirc_zilog.c +++ b/drivers/staging/media/lirc/lirc_zilog.c @@ -892,7 +892,8 @@ out: } /* copied from lirc_dev */ -static ssize_t read(struct file *filep, char *outbuf, size_t n, loff_t *ppos) +static ssize_t read(struct file *filep, char __user *outbuf, size_t n, + loff_t *ppos) { struct IR *ir = filep->private_data; struct IR_rx *rx; @@ -954,7 +955,7 @@ static ssize_t read(struct file *filep, char *outbuf, size_t n, loff_t *ppos) } m = lirc_buffer_read(rbuf, buf); if (m == rbuf->chunk_size) { - ret = copy_to_user((void *)outbuf+written, buf, + ret = copy_to_user(outbuf + written, buf, rbuf->chunk_size); written += rbuf->chunk_size; } else { @@ -1094,8 +1095,8 @@ static int send_code(struct IR_tx *tx, unsigned int code, unsigned int key) * sent to the device. We have a spin lock as per i2c documentation to prevent * multiple concurrent sends which would probably cause the device to explode. */ -static ssize_t write(struct file *filep, const char *buf, size_t n, - loff_t *ppos) +static ssize_t write(struct file *filep, const char __user *buf, size_t n, + loff_t *ppos) { struct IR *ir = filep->private_data; struct IR_tx *tx; @@ -1237,6 +1238,7 @@ static unsigned int poll(struct file *filep, poll_table *wait) static long ioctl(struct file *filep, unsigned int cmd, unsigned long arg) { struct IR *ir = filep->private_data; + unsigned long __user *uptr = (unsigned long __user *)arg; int result; unsigned long mode, features; @@ -1244,11 +1246,10 @@ static long ioctl(struct file *filep, unsigned int cmd, unsigned long arg) switch (cmd) { case LIRC_GET_LENGTH: - result = put_user((unsigned long)13, - (unsigned long *)arg); + result = put_user(13UL, uptr); break; case LIRC_GET_FEATURES: - result = put_user(features, (unsigned long *) arg); + result = put_user(features, uptr); break; case LIRC_GET_REC_MODE: if (!(features&LIRC_CAN_REC_MASK)) @@ -1256,13 +1257,13 @@ static long ioctl(struct file *filep, unsigned int cmd, unsigned long arg) result = put_user(LIRC_REC2MODE (features&LIRC_CAN_REC_MASK), - (unsigned long *)arg); + uptr); break; case LIRC_SET_REC_MODE: if (!(features&LIRC_CAN_REC_MASK)) return -ENOSYS; - result = get_user(mode, (unsigned long *)arg); + result = get_user(mode, uptr); if (!result && !(LIRC_MODE2REC(mode) & features)) result = -EINVAL; break; @@ -1270,13 +1271,13 @@ static long ioctl(struct file *filep, unsigned int cmd, unsigned long arg) if (!(features&LIRC_CAN_SEND_MASK)) return -ENOSYS; - result = put_user(LIRC_MODE_PULSE, (unsigned long *) arg); + result = put_user(LIRC_MODE_PULSE, uptr); break; case LIRC_SET_SEND_MODE: if (!(features&LIRC_CAN_SEND_MASK)) return -ENOSYS; - result = get_user(mode, (unsigned long *) arg); + result = get_user(mode, uptr); if (!result && mode != LIRC_MODE_PULSE) return -EINVAL; break; -- cgit From 444f8bda81a35ae7b1e7558e971b2dbc397d3ca9 Mon Sep 17 00:00:00 2001 From: Peter Senna Tschudin Date: Tue, 20 May 2014 07:33:46 -0300 Subject: [media] USB: as102_usb_drv.c: Remove useless return variables This patch remove variables that are initialized with a constant, are never updated, and are only used as parameter of return. Return the constant instead of using a variable. Verified by compilation only. The coccinelle script that find and fixes this issue is: // @@ type T; constant C; identifier ret; @@ - T ret = C; ... when != ret - return ret; + return C; // Signed-off-by: Peter Senna Tschudin Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/as102/as102_usb_drv.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/as102/as102_usb_drv.c b/drivers/staging/media/as102/as102_usb_drv.c index e4a69454ebeb..e6f6278e97d6 100644 --- a/drivers/staging/media/as102/as102_usb_drv.c +++ b/drivers/staging/media/as102/as102_usb_drv.c @@ -249,7 +249,7 @@ static void as102_free_usb_stream_buffer(struct as102_dev_t *dev) static int as102_alloc_usb_stream_buffer(struct as102_dev_t *dev) { - int i, ret = 0; + int i; dev->stream = usb_alloc_coherent(dev->bus_adap.usb_dev, MAX_STREAM_URB * AS102_USB_BUF_SIZE, @@ -280,7 +280,7 @@ static int as102_alloc_usb_stream_buffer(struct as102_dev_t *dev) dev->stream_urb[i] = urb; } - return ret; + return 0; } static void as102_usb_stop_stream(struct as102_dev_t *dev) @@ -458,7 +458,6 @@ exit: static int as102_release(struct inode *inode, struct file *file) { - int ret = 0; struct as102_dev_t *dev = NULL; dev = file->private_data; @@ -467,7 +466,7 @@ static int as102_release(struct inode *inode, struct file *file) kref_put(&dev->kref, as102_usb_release); } - return ret; + return 0; } MODULE_DEVICE_TABLE(usb, as102_usb_id_table); -- cgit