* [PATCH 1/4] media: usb: cpia2: Fixed coding style issues
@ 2021-04-30 15:43 Piyush Thange
2021-04-30 15:43 ` [PATCH 2/4] " Piyush Thange
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Piyush Thange @ 2021-04-30 15:43 UTC (permalink / raw)
To: mchehab, leon; +Cc: linux-media, linux-kernel, Piyush Thange
Fixed coding style issues with spaces for if condition &
others statements.
Signed-off-by: Piyush Thange <pthange19@gmail.com>
---
drivers/media/usb/cpia2/cpia2_v4l.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/media/usb/cpia2/cpia2_v4l.c b/drivers/media/usb/cpia2/cpia2_v4l.c
index 69d5c628a797..4b58b1e7847e 100644
--- a/drivers/media/usb/cpia2/cpia2_v4l.c
+++ b/drivers/media/usb/cpia2/cpia2_v4l.c
@@ -143,7 +143,7 @@ static ssize_t cpia2_v4l_read(struct file *file, char __user *buf, size_t count,
int noblock = file->f_flags&O_NONBLOCK;
ssize_t ret;
- if(!cam)
+ if (!cam)
return -EINVAL;
if (mutex_lock_interruptible(&cam->v4l2_lock))
@@ -247,8 +247,8 @@ static int cpia2_querycap(struct file *file, void *fh, struct v4l2_capability *v
break;
}
- if (usb_make_path(cam->dev, vc->bus_info, sizeof(vc->bus_info)) <0)
- memset(vc->bus_info,0, sizeof(vc->bus_info));
+ if (usb_make_path(cam->dev, vc->bus_info, sizeof(vc->bus_info)) < 0)
+ memset(vc->bus_info, 0, sizeof(vc->bus_info));
return 0;
}
@@ -377,7 +377,7 @@ static int cpia2_s_fmt_vid_cap(struct file *file, void *_fh,
int err, frame;
err = cpia2_try_fmt_vid_cap(file, _fh, f);
- if(err != 0)
+ if (err != 0)
return err;
cam->pixelformat = f->fmt.pix.pixelformat;
@@ -665,13 +665,13 @@ static int cpia2_g_jpegcomp(struct file *file, void *fh, struct v4l2_jpegcompres
parms->quality = 80; // TODO: Can this be made meaningful?
parms->jpeg_markers = V4L2_JPEG_MARKER_DQT | V4L2_JPEG_MARKER_DRI;
- if(!cam->params.compression.inhibit_htables) {
+ if (!cam->params.compression.inhibit_htables)
parms->jpeg_markers |= V4L2_JPEG_MARKER_DHT;
- }
+
parms->APPn = cam->APPn;
parms->APP_len = cam->APP_len;
- if(cam->APP_len > 0) {
+ if (cam->APP_len > 0) {
memcpy(parms->APP_data, cam->APP_data, cam->APP_len);
parms->jpeg_markers |= V4L2_JPEG_MARKER_APP;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/4] media: usb: cpia2: Fixed coding style issues
2021-04-30 15:43 [PATCH 1/4] media: usb: cpia2: Fixed coding style issues Piyush Thange
@ 2021-04-30 15:43 ` Piyush Thange
2021-04-30 15:43 ` [PATCH 3/4] " Piyush Thange
2021-04-30 15:43 ` [PATCH 4/4] " Piyush Thange
2 siblings, 0 replies; 5+ messages in thread
From: Piyush Thange @ 2021-04-30 15:43 UTC (permalink / raw)
To: mchehab, leon; +Cc: linux-media, linux-kernel, Piyush Thange
Adding more fixes on coding style issues.
Signed-off-by: Piyush Thange <pthange19@gmail.com>
---
drivers/media/usb/cpia2/cpia2_v4l.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/media/usb/cpia2/cpia2_v4l.c b/drivers/media/usb/cpia2/cpia2_v4l.c
index 4b58b1e7847e..2d9156ea7652 100644
--- a/drivers/media/usb/cpia2/cpia2_v4l.c
+++ b/drivers/media/usb/cpia2/cpia2_v4l.c
@@ -677,7 +677,7 @@ static int cpia2_g_jpegcomp(struct file *file, void *fh, struct v4l2_jpegcompres
}
parms->COM_len = cam->COM_len;
- if(cam->COM_len > 0) {
+ if (cam->COM_len > 0) {
memcpy(parms->COM_data, cam->COM_data, cam->COM_len);
parms->jpeg_markers |= JPEG_MARKER_COM;
}
@@ -708,8 +708,8 @@ static int cpia2_s_jpegcomp(struct file *file, void *fh,
cam->params.compression.inhibit_htables =
!(parms->jpeg_markers & V4L2_JPEG_MARKER_DHT);
- if(parms->APP_len != 0) {
- if(parms->APP_len > 0 &&
+ if (parms->APP_len != 0) {
+ if (parms->APP_len > 0 &&
parms->APP_len <= sizeof(cam->APP_data) &&
parms->APPn >= 0 && parms->APPn <= 15) {
cam->APPn = parms->APPn;
@@ -724,8 +724,8 @@ static int cpia2_s_jpegcomp(struct file *file, void *fh,
cam->APP_len = 0;
}
- if(parms->COM_len != 0) {
- if(parms->COM_len > 0 &&
+ if (parms->COM_len != 0) {
+ if (parms->COM_len > 0 &&
parms->COM_len <= sizeof(cam->COM_data)) {
cam->COM_len = parms->COM_len;
memcpy(cam->COM_data, parms->COM_data, parms->COM_len);
@@ -751,7 +751,7 @@ static int cpia2_reqbufs(struct file *file, void *fh, struct v4l2_requestbuffers
{
struct camera_data *cam = video_drvdata(file);
- if(req->type != V4L2_BUF_TYPE_VIDEO_CAPTURE ||
+ if (req->type != V4L2_BUF_TYPE_VIDEO_CAPTURE ||
req->memory != V4L2_MEMORY_MMAP)
return -EINVAL;
@@ -774,7 +774,7 @@ static int cpia2_querybuf(struct file *file, void *fh, struct v4l2_buffer *buf)
{
struct camera_data *cam = video_drvdata(file);
- if(buf->type != V4L2_BUF_TYPE_VIDEO_CAPTURE ||
+ if (buf->type != V4L2_BUF_TYPE_VIDEO_CAPTURE ||
buf->index >= cam->num_frames)
return -EINVAL;
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/4] media: usb: cpia2: Fixed coding style issues
2021-04-30 15:43 [PATCH 1/4] media: usb: cpia2: Fixed coding style issues Piyush Thange
2021-04-30 15:43 ` [PATCH 2/4] " Piyush Thange
@ 2021-04-30 15:43 ` Piyush Thange
2021-04-30 15:43 ` [PATCH 4/4] " Piyush Thange
2 siblings, 0 replies; 5+ messages in thread
From: Piyush Thange @ 2021-04-30 15:43 UTC (permalink / raw)
To: mchehab, leon; +Cc: linux-media, linux-kernel, Piyush Thange
Additional fixes about coding style.
Signed-off-by: Piyush Thange <pthange19@gmail.com>
---
drivers/media/usb/cpia2/cpia2_v4l.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/drivers/media/usb/cpia2/cpia2_v4l.c b/drivers/media/usb/cpia2/cpia2_v4l.c
index 2d9156ea7652..261ced144793 100644
--- a/drivers/media/usb/cpia2/cpia2_v4l.c
+++ b/drivers/media/usb/cpia2/cpia2_v4l.c
@@ -783,7 +783,7 @@ static int cpia2_querybuf(struct file *file, void *fh, struct v4l2_buffer *buf)
buf->memory = V4L2_MEMORY_MMAP;
- if(cam->mmapped)
+ if (cam->mmapped)
buf->flags = V4L2_BUF_FLAG_MAPPED;
else
buf->flags = 0;
@@ -824,14 +824,14 @@ static int cpia2_qbuf(struct file *file, void *fh, struct v4l2_buffer *buf)
{
struct camera_data *cam = video_drvdata(file);
- if(buf->type != V4L2_BUF_TYPE_VIDEO_CAPTURE ||
+ if (buf->type != V4L2_BUF_TYPE_VIDEO_CAPTURE ||
buf->memory != V4L2_MEMORY_MMAP ||
buf->index >= cam->num_frames)
return -EINVAL;
DBG("QBUF #%d\n", buf->index);
- if(cam->buffers[buf->index].status == FRAME_READY)
+ if (cam->buffers[buf->index].status == FRAME_READY)
cam->buffers[buf->index].status = FRAME_EMPTY;
return 0;
@@ -849,9 +849,10 @@ static int find_earliest_filled_buffer(struct camera_data *cam)
{
int i;
int found = -1;
- for (i=0; i<cam->num_frames; i++) {
- if(cam->buffers[i].status == FRAME_READY) {
- if(found < 0) {
+
+ for (i = 0; i < cam->num_frames; i++) {
+ if (cam->buffers[i].status == FRAME_READY) {
+ if (found < 0) {
found = i;
} else {
/* find which buffer is earlier */
@@ -876,7 +877,7 @@ static int cpia2_dqbuf(struct file *file, void *fh, struct v4l2_buffer *buf)
struct camera_data *cam = video_drvdata(file);
int frame;
- if(buf->type != V4L2_BUF_TYPE_VIDEO_CAPTURE ||
+ if (buf->type != V4L2_BUF_TYPE_VIDEO_CAPTURE ||
buf->memory != V4L2_MEMORY_MMAP)
return -EINVAL;
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 4/4] media: usb: cpia2: Fixed coding style issues
2021-04-30 15:43 [PATCH 1/4] media: usb: cpia2: Fixed coding style issues Piyush Thange
2021-04-30 15:43 ` [PATCH 2/4] " Piyush Thange
2021-04-30 15:43 ` [PATCH 3/4] " Piyush Thange
@ 2021-04-30 15:43 ` Piyush Thange
2021-05-26 13:15 ` Hans Verkuil
2 siblings, 1 reply; 5+ messages in thread
From: Piyush Thange @ 2021-04-30 15:43 UTC (permalink / raw)
To: mchehab, leon; +Cc: linux-media, linux-kernel, Piyush Thange
Addition of more fixes on coding style.
Signed-off-by: Piyush Thange <pthange19@gmail.com>
---
drivers/media/usb/cpia2/cpia2_v4l.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/media/usb/cpia2/cpia2_v4l.c b/drivers/media/usb/cpia2/cpia2_v4l.c
index 261ced144793..d950f9171208 100644
--- a/drivers/media/usb/cpia2/cpia2_v4l.c
+++ b/drivers/media/usb/cpia2/cpia2_v4l.c
@@ -883,12 +883,12 @@ static int cpia2_dqbuf(struct file *file, void *fh, struct v4l2_buffer *buf)
frame = find_earliest_filled_buffer(cam);
- if(frame < 0 && file->f_flags&O_NONBLOCK)
+ if (frame < 0 && file->f_flags&O_NONBLOCK)
return -EAGAIN;
- if(frame < 0) {
+ if (frame < 0) {
/* Wait for a frame to become available */
- struct framebuf *cb=cam->curbuff;
+ struct framebuf *cb = cam->curbuff;
mutex_unlock(&cam->v4l2_lock);
wait_event_interruptible(cam->wq_stream,
!video_is_registered(&cam->vdev) ||
@@ -970,7 +970,7 @@ static int cpia2_mmap(struct file *file, struct vm_area_struct *area)
return -ERESTARTSYS;
retval = cpia2_remap_buffer(cam, area);
- if(!retval)
+ if (!retval)
cam->stream_fh = file->private_data;
mutex_unlock(&cam->v4l2_lock);
return retval;
@@ -1160,10 +1160,10 @@ void cpia2_unregister_camera(struct camera_data *cam)
*****************************************************************************/
static void __init check_parameters(void)
{
- if(buffer_size < PAGE_SIZE) {
+ if (buffer_size < PAGE_SIZE) {
buffer_size = PAGE_SIZE;
LOG("buffer_size too small, setting to %d\n", buffer_size);
- } else if(buffer_size > 1024*1024) {
+ } else if (buffer_size > 1024*1024) {
/* arbitrary upper limiit */
buffer_size = 1024*1024;
LOG("buffer_size ridiculously large, setting to %d\n",
@@ -1173,15 +1173,15 @@ static void __init check_parameters(void)
buffer_size &= ~(PAGE_SIZE-1);
}
- if(num_buffers < 1) {
+ if (num_buffers < 1) {
num_buffers = 1;
LOG("num_buffers too small, setting to %d\n", num_buffers);
- } else if(num_buffers > VIDEO_MAX_FRAME) {
+ } else if (num_buffers > VIDEO_MAX_FRAME) {
num_buffers = VIDEO_MAX_FRAME;
LOG("num_buffers too large, setting to %d\n", num_buffers);
}
- if(alternate < USBIF_ISO_1 || alternate > USBIF_ISO_6) {
+ if (alternate < USBIF_ISO_1 || alternate > USBIF_ISO_6) {
alternate = DEFAULT_ALT;
LOG("alternate specified is invalid, using %d\n", alternate);
}
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 4/4] media: usb: cpia2: Fixed coding style issues
2021-04-30 15:43 ` [PATCH 4/4] " Piyush Thange
@ 2021-05-26 13:15 ` Hans Verkuil
0 siblings, 0 replies; 5+ messages in thread
From: Hans Verkuil @ 2021-05-26 13:15 UTC (permalink / raw)
To: Piyush Thange, mchehab, leon; +Cc: linux-media, linux-kernel
On 30/04/2021 17:43, Piyush Thange wrote:
> Addition of more fixes on coding style.
>
> Signed-off-by: Piyush Thange <pthange19@gmail.com>
> ---
> drivers/media/usb/cpia2/cpia2_v4l.c | 18 +++++++++---------
> 1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/media/usb/cpia2/cpia2_v4l.c b/drivers/media/usb/cpia2/cpia2_v4l.c
> index 261ced144793..d950f9171208 100644
> --- a/drivers/media/usb/cpia2/cpia2_v4l.c
> +++ b/drivers/media/usb/cpia2/cpia2_v4l.c
> @@ -883,12 +883,12 @@ static int cpia2_dqbuf(struct file *file, void *fh, struct v4l2_buffer *buf)
>
> frame = find_earliest_filled_buffer(cam);
>
> - if(frame < 0 && file->f_flags&O_NONBLOCK)
> + if (frame < 0 && file->f_flags&O_NONBLOCK)
Add spaces around & as well.
There is no need to split this up into four patches. Just post a single patch
for all these changes.
> return -EAGAIN;
>
> - if(frame < 0) {
> + if (frame < 0) {
> /* Wait for a frame to become available */
> - struct framebuf *cb=cam->curbuff;
> + struct framebuf *cb = cam->curbuff;
> mutex_unlock(&cam->v4l2_lock);
> wait_event_interruptible(cam->wq_stream,
> !video_is_registered(&cam->vdev) ||
> @@ -970,7 +970,7 @@ static int cpia2_mmap(struct file *file, struct vm_area_struct *area)
> return -ERESTARTSYS;
> retval = cpia2_remap_buffer(cam, area);
>
> - if(!retval)
> + if (!retval)
> cam->stream_fh = file->private_data;
> mutex_unlock(&cam->v4l2_lock);
> return retval;
> @@ -1160,10 +1160,10 @@ void cpia2_unregister_camera(struct camera_data *cam)
> *****************************************************************************/
> static void __init check_parameters(void)
> {
> - if(buffer_size < PAGE_SIZE) {
> + if (buffer_size < PAGE_SIZE) {
> buffer_size = PAGE_SIZE;
> LOG("buffer_size too small, setting to %d\n", buffer_size);
> - } else if(buffer_size > 1024*1024) {
> + } else if (buffer_size > 1024*1024) {
Add spaces around * as well. checkpatch.pl --strict warns about that!
Regards,
Hans
> /* arbitrary upper limiit */
> buffer_size = 1024*1024;
> LOG("buffer_size ridiculously large, setting to %d\n",
> @@ -1173,15 +1173,15 @@ static void __init check_parameters(void)
> buffer_size &= ~(PAGE_SIZE-1);
> }
>
> - if(num_buffers < 1) {
> + if (num_buffers < 1) {
> num_buffers = 1;
> LOG("num_buffers too small, setting to %d\n", num_buffers);
> - } else if(num_buffers > VIDEO_MAX_FRAME) {
> + } else if (num_buffers > VIDEO_MAX_FRAME) {
> num_buffers = VIDEO_MAX_FRAME;
> LOG("num_buffers too large, setting to %d\n", num_buffers);
> }
>
> - if(alternate < USBIF_ISO_1 || alternate > USBIF_ISO_6) {
> + if (alternate < USBIF_ISO_1 || alternate > USBIF_ISO_6) {
> alternate = DEFAULT_ALT;
> LOG("alternate specified is invalid, using %d\n", alternate);
> }
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-05-26 13:15 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-30 15:43 [PATCH 1/4] media: usb: cpia2: Fixed coding style issues Piyush Thange
2021-04-30 15:43 ` [PATCH 2/4] " Piyush Thange
2021-04-30 15:43 ` [PATCH 3/4] " Piyush Thange
2021-04-30 15:43 ` [PATCH 4/4] " Piyush Thange
2021-05-26 13:15 ` Hans Verkuil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).