mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Darshan Rathod <darshanrathod475@gmail.com>
To: gregkh@linuxfoundation.org, m.grzeschik@pengutronix.de
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	Darshan Rathod <darshanrathod475@gmail.com>
Subject: [PATCH] usb: gadget: uvc: clean up code style for checkpatch compliance
Date: Wed, 30 Jul 2025 08:19:15 +0000	[thread overview]
Message-ID: <20250730081915.12878-1-darshanrathod475@gmail.com> (raw)

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


             reply	other threads:[~2025-07-30  9:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-30  8:19 Darshan Rathod [this message]
2025-07-30  9:45 ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250730081915.12878-1-darshanrathod475@gmail.com \
    --to=darshanrathod475@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=m.grzeschik@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®