Skip to contentSkip to conversation

usb: core: pass usb_get_status() 'type' argument to usb_control_msg()

PATCH In review Daewoong Kim 2 participants 2 messages Nov 2, 2022 USB

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: core: pass usb_get_status() 'type' argument to usb_control_msg()

In the commit 2e43f0fe379c
("usb: core: add a 'type' parameter to usb_get_status()"), the 'type' parameter was added. It should be passed to usb_control_msg() as an argument.

---
 drivers/usb/core/message.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/core/message.c +1 -1
index 4d59d927ae3e..a81f23d81480 100644
@@ -1150,7 +1150,7 @@ int usb_get_status(struct usb_device *dev, int recip, int type, int target,
 		return -ENOMEM;
 
 	ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
-		USB_REQ_GET_STATUS, USB_DIR_IN | recip, USB_STATUS_TYPE_STANDARD,
+		USB_REQ_GET_STATUS, USB_DIR_IN | recip, type,
 		target, status, length, USB_CTRL_GET_TIMEOUT);
 
 	switch (ret) {
Signature · 1 line
2.25.1
maintainer
#1 lore raw
Quoted 15 lines · Daewoong Kim

In the commit 2e43f0fe379c
("usb: core: add a 'type' parameter to usb_get_status()"), the 'type' parameter was added. It should be passed to usb_control_msg() as an argument.

---
 drivers/usb/core/message.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/core/message.c +0 -0
index 4d59d927ae3e..a81f23d81480 100644

drivers/usb/core/message.c int usb_get_status(struct usb_device *dev, int recip, int type, int target, · line 1153

Quoted 5 lines
drivers/usb/core/message.c +1 -1
@@ -1150,7 +1150,7 @@ int usb_get_status(struct usb_device *dev, int recip, int type, int target,
 		return -ENOMEM;
 
 	ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
-		USB_REQ_GET_STATUS, USB_DIR_IN | recip, USB_STATUS_TYPE_STANDARD,
+		USB_REQ_GET_STATUS, USB_DIR_IN | recip, type,

This shows that since 2017, no one has actually used the type field. And there is only one caller that sets it to anything other than this value. But no one even uses that!

So let's remove the one caller that is not working, and just leave this as-is and maybe make this even simpler by removing the type field as no one seems to need it.

thanks,

greg k-h