linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: gadget: f_uac1: fix coding style warnings
@ 2025-11-21 16:12 Sameeksha Sankpal
  2025-11-21 16:26 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Sameeksha Sankpal @ 2025-11-21 16:12 UTC (permalink / raw)
  To: gregkh; +Cc: sumanth.gavini, linux-usb, linux-kernel, Sameeksha Sankpal

Fix several checkpatch.pl warnings in f_uac1.c including:
- replace NULL comparisons with !ptr
- remove unnecessary parentheses around simple equality checks
- remove a redundant 'else' after a return statement
- clean up superfluous blank lines
- use 'unsigned int' instead of bare 'unsigned'
- enclose a macro with complex value (USBDHDR) in parentheses

These changes clean up coding style and improve readability without
altering the behavior of the driver.

Signed-off-by: Sameeksha Sankpal <sameekshasankpal@gmail.com>
---
 drivers/usb/gadget/function/f_uac1.c | 24 +++++++++---------------
 1 file changed, 9 insertions(+), 15 deletions(-)

diff --git a/drivers/usb/gadget/function/f_uac1.c b/drivers/usb/gadget/function/f_uac1.c
index 9da9fb4e1239..d2c6fb18ce16 100644
--- a/drivers/usb/gadget/function/f_uac1.c
+++ b/drivers/usb/gadget/function/f_uac1.c
@@ -446,13 +446,13 @@ static int audio_notify(struct g_audio *audio, int unit_id, int cs)
 	}
 
 	req = usb_ep_alloc_request(uac1->int_ep, GFP_ATOMIC);
-	if (req == NULL) {
+	if (!req) {
 		ret = -ENOMEM;
 		goto err_dec_int_count;
 	}
 
 	msg = kmalloc(sizeof(*msg), GFP_ATOMIC);
-	if (msg == NULL) {
+	if (!msg) {
 		ret = -ENOMEM;
 		goto err_free_request;
 	}
@@ -496,8 +496,8 @@ in_rq_cur(struct usb_function *fn, const struct usb_ctrlrequest *cr)
 	u8 control_selector = w_value >> 8;
 	int value = -EOPNOTSUPP;
 
-	if ((FUIN_EN(opts) && (entity_id == USB_IN_FU_ID)) ||
-			(FUOUT_EN(opts) && (entity_id == USB_OUT_FU_ID))) {
+	if ((FUIN_EN(opts) && entity_id == USB_IN_FU_ID) ||
+			(FUOUT_EN(opts) && entity_id == USB_OUT_FU_ID)) {
 		unsigned int is_playback = 0;
 
 		if (FUIN_EN(opts) && (entity_id == USB_IN_FU_ID))
@@ -547,8 +547,8 @@ in_rq_min(struct usb_function *fn, const struct usb_ctrlrequest *cr)
 	u8 control_selector = w_value >> 8;
 	int value = -EOPNOTSUPP;
 
-	if ((FUIN_EN(opts) && (entity_id == USB_IN_FU_ID)) ||
-			(FUOUT_EN(opts) && (entity_id == USB_OUT_FU_ID))) {
+	if ((FUIN_EN(opts) && entity_id == USB_IN_FU_ID) ||
+			(FUOUT_EN(opts) && entity_id == USB_OUT_FU_ID)) {
 		unsigned int is_playback = 0;
 
 		if (FUIN_EN(opts) && (entity_id == USB_IN_FU_ID))
@@ -714,11 +714,6 @@ out_rq_cur_complete(struct usb_ep *ep, struct usb_request *req)
 			u_audio_set_volume(audio, is_playback, volume);
 
 			return;
-		} else {
-			dev_err(&audio->gadget->dev,
-				"%s:%d control_selector=%d TODO!\n",
-				__func__, __LINE__, control_selector);
-			usb_ep_set_halt(ep);
 		}
 	} else {
 		dev_err(&audio->gadget->dev,
@@ -930,7 +925,7 @@ f_audio_setup(struct usb_function *f, const struct usb_ctrlrequest *ctrl)
 	return value;
 }
 
-static int f_audio_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
+static int f_audio_set_alt(struct usb_function *f, unsigned int intf, unsigned int alt)
 {
 	struct usb_composite_dev *cdev = f->config->cdev;
 	struct usb_gadget *gadget = cdev->gadget;
@@ -984,7 +979,7 @@ static int f_audio_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
 	return ret;
 }
 
-static int f_audio_get_alt(struct usb_function *f, unsigned intf)
+static int f_audio_get_alt(struct usb_function *f, unsigned int intf)
 {
 	struct usb_composite_dev *cdev = f->config->cdev;
 	struct usb_gadget *gadget = cdev->gadget;
@@ -1004,7 +999,6 @@ static int f_audio_get_alt(struct usb_function *f, unsigned intf)
 	return -EINVAL;
 }
 
-
 static void f_audio_disable(struct usb_function *f)
 {
 	struct f_uac1 *uac1 = func_to_uac1(f);
@@ -1079,7 +1073,7 @@ uac1_ac_header_descriptor *build_ac_header_desc(struct f_uac1_opts *opts)
 }
 
 /* Use macro to overcome line length limitation */
-#define USBDHDR(p) (struct usb_descriptor_header *)(p)
+#define USBDHDR(p) ((struct usb_descriptor_header *)(p))
 
 static void setup_descriptor(struct f_uac1_opts *opts)
 {
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] usb: gadget: f_uac1: fix coding style warnings
  2025-11-21 16:12 [PATCH] usb: gadget: f_uac1: fix coding style warnings Sameeksha Sankpal
@ 2025-11-21 16:26 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2025-11-21 16:26 UTC (permalink / raw)
  To: Sameeksha Sankpal; +Cc: sumanth.gavini, linux-usb, linux-kernel

On Fri, Nov 21, 2025 at 09:42:40PM +0530, Sameeksha Sankpal wrote:
> Fix several checkpatch.pl warnings in f_uac1.c including:
> - replace NULL comparisons with !ptr
> - remove unnecessary parentheses around simple equality checks
> - remove a redundant 'else' after a return statement
> - clean up superfluous blank lines
> - use 'unsigned int' instead of bare 'unsigned'
> - enclose a macro with complex value (USBDHDR) in parentheses
> 
> These changes clean up coding style and improve readability without
> altering the behavior of the driver.
> 
> Signed-off-by: Sameeksha Sankpal <sameekshasankpal@gmail.com>

Please do not do coding style cleanups all in one patch, nor for
subsystems that maintainers do not explicitly state they want them for,
as it can cause unneeded constant churn.

please do this in drivers/staging/ first.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-11-21 16:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-21 16:12 [PATCH] usb: gadget: f_uac1: fix coding style warnings Sameeksha Sankpal
2025-11-21 16:26 ` Greg KH

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).