[PATCH] usb: gadget: uvc: clean up code style for checkpatch compliance

Darshan Rathod posted 1 patch 2 months, 1 week ago
drivers/usb/gadget/function/uvc_video.c | 26 +++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)
[PATCH] usb: gadget: uvc: clean up code style for checkpatch compliance
Posted by Darshan Rathod 2 months, 1 week ago
This patch fixes a few coding style issues:
- Avoids assignments in if conditions
- Corrects parameter indentation and alignment
- Trims inconsistent spacing

All updates conform to kernel coding standards and improve maintainability.

Signed-off-by: Darshan Rathod <darshanrathod475@gmail.com>
---
 drivers/usb/gadget/function/uvc_video.c | 26 +++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/drivers/usb/gadget/function/uvc_video.c b/drivers/usb/gadget/function/uvc_video.c
index fb77b0b21790..fe176ba4ac6b 100644
--- a/drivers/usb/gadget/function/uvc_video.c
+++ b/drivers/usb/gadget/function/uvc_video.c
@@ -27,7 +27,7 @@
 
 static int
 uvc_video_encode_header(struct uvc_video *video, struct uvc_buffer *buf,
-		u8 *data, int len)
+			u8 *data, int len)
 {
 	struct uvc_device *uvc = container_of(video, struct uvc_device, video);
 	struct usb_composite_dev *cdev = uvc->func.config->cdev;
@@ -57,7 +57,7 @@ uvc_video_encode_header(struct uvc_video *video, struct uvc_buffer *buf,
 
 		data[1] |= UVC_STREAM_SCR;
 		put_unaligned_le32(stc, &data[pos]);
-		put_unaligned_le16(sof, &data[pos+4]);
+		put_unaligned_le16(sof, &data[pos + 4]);
 		pos += 6;
 	}
 
@@ -71,7 +71,7 @@ uvc_video_encode_header(struct uvc_video *video, struct uvc_buffer *buf,
 
 static int
 uvc_video_encode_data(struct uvc_video *video, struct uvc_buffer *buf,
-		u8 *data, int len)
+		      u8 *data, int len)
 {
 	struct uvc_video_queue *queue = &video->queue;
 	unsigned int nbytes;
@@ -89,7 +89,7 @@ uvc_video_encode_data(struct uvc_video *video, struct uvc_buffer *buf,
 
 static void
 uvc_video_encode_bulk(struct usb_request *req, struct uvc_video *video,
-		struct uvc_buffer *buf)
+		      struct uvc_buffer *buf)
 {
 	void *mem = req->buf;
 	struct uvc_request *ureq = req->context;
@@ -132,7 +132,7 @@ uvc_video_encode_bulk(struct usb_request *req, struct uvc_video *video,
 
 static void
 uvc_video_encode_isoc_sg(struct usb_request *req, struct uvc_video *video,
-		struct uvc_buffer *buf)
+			 struct uvc_buffer *buf)
 {
 	unsigned int pending = buf->bytesused - video->queue.buf_used;
 	struct uvc_request *ureq = req->context;
@@ -187,7 +187,7 @@ uvc_video_encode_isoc_sg(struct usb_request *req, struct uvc_video *video,
 	video->queue.buf_used += req->length - header_len;
 
 	if (buf->bytesused == video->queue.buf_used || !buf->sg ||
-			video->queue.flags & UVC_QUEUE_DROP_INCOMPLETE) {
+	    video->queue.flags & UVC_QUEUE_DROP_INCOMPLETE) {
 		video->queue.buf_used = 0;
 		buf->state = UVC_BUF_STATE_DONE;
 		buf->offset = 0;
@@ -199,7 +199,7 @@ uvc_video_encode_isoc_sg(struct usb_request *req, struct uvc_video *video,
 
 static void
 uvc_video_encode_isoc(struct usb_request *req, struct uvc_video *video,
-		struct uvc_buffer *buf)
+		      struct uvc_buffer *buf)
 {
 	void *mem = req->buf;
 	struct uvc_request *ureq = req->context;
@@ -218,7 +218,7 @@ uvc_video_encode_isoc(struct usb_request *req, struct uvc_video *video,
 	req->length = buf->req_payload_size - len;
 
 	if (buf->bytesused == video->queue.buf_used ||
-			video->queue.flags & UVC_QUEUE_DROP_INCOMPLETE) {
+	    video->queue.flags & UVC_QUEUE_DROP_INCOMPLETE) {
 		video->queue.buf_used = 0;
 		buf->state = UVC_BUF_STATE_DONE;
 		list_del(&buf->queue);
@@ -473,7 +473,6 @@ static void uvcg_video_hw_submit(struct kthread_work *work)
 			 * There is a new free request - wake up the pump.
 			 */
 			queue_work(video->async_wq, &video->pump);
-
 		}
 
 		spin_unlock_irqrestore(&video->req_lock, flags);
@@ -777,18 +776,21 @@ int uvcg_video_enable(struct uvc_video *video)
 	 */
 	video->is_enabled = true;
 
-	if ((ret = uvcg_queue_enable(&video->queue, 1)) < 0)
+	ret = uvcg_queue_enable(&video->queue, 1);
+	if (ret < 0)
 		return ret;
 
-	if ((ret = uvc_video_alloc_requests(video)) < 0)
+	ret = uvc_video_alloc_requests(video);
+	if (ret < 0)
 		return ret;
 
 	if (video->max_payload_size) {
 		video->encode = uvc_video_encode_bulk;
 		video->payload_size = 0;
-	} else
+	} else {
 		video->encode = video->queue.use_sg ?
 			uvc_video_encode_isoc_sg : uvc_video_encode_isoc;
+	}
 
 	video->req_int_count = 0;
 
-- 
2.43.0
Re: [PATCH] usb: gadget: uvc: clean up code style for checkpatch compliance
Posted by Greg KH 2 months, 1 week ago
On Wed, Jul 30, 2025 at 08:19:15AM +0000, Darshan Rathod wrote:
> This patch fixes a few coding style issues:
> - Avoids assignments in if conditions
> - Corrects parameter indentation and alignment
> - Trims inconsistent spacing
> 
> All updates conform to kernel coding standards and improve maintainability.
> 
> Signed-off-by: Darshan Rathod <darshanrathod475@gmail.com>
> ---
>  drivers/usb/gadget/function/uvc_video.c | 26 +++++++++++++------------
>  1 file changed, 14 insertions(+), 12 deletions(-)

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman.  You have sent him
a patch that has triggered this response.  He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created.  Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.

You are receiving this message because of the following common error(s)
as indicated below:

- Your patch did many different things all at once, making it difficult
  to review.  All Linux kernel patches need to only do one thing at a
  time.  If you need to do multiple things (such as clean up all coding
  style issues in a file/driver), do it in a sequence of patches, each
  one doing only one thing.  This will make it easier to review the
  patches to ensure that they are correct, and to help alleviate any
  merge issues that larger patches can cause.

If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.

thanks,

greg k-h's patch email bot