From e4b5f415391a56ec6c5f2158bf25d1d3e7936ccc Mon Sep 17 00:00:00 2001 From: Stefan Eichenberger Date: Wed, 19 Feb 2025 09:36:44 +0100 Subject: [PATCH] usb: core: replace usb_sndaddr0pipe macro with usb_sndctrlpipe The usb_sndaddr0pipe macro is only used in the hub_set_address function. Replace it with usb_sndctrlpipe which provides the same functionality but would also consider the endpoint device number. If the device has not been initialised, it is safe to use usb_sndctrlpipe in this context because udev->devnum is set to 0. Therefore, this change does not affect behaviour, but reduces code complexity by reusing the existing macro. Signed-off-by: Stefan Eichenberger Acked-by: Alan Stern Link: https://lore.kernel.org/r/20250219083745.10406-1-eichest@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/core/hub.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index a76bb50b6202..f34c5acb48fc 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -4708,8 +4708,6 @@ void usb_ep0_reinit(struct usb_device *udev) } EXPORT_SYMBOL_GPL(usb_ep0_reinit); -#define usb_sndaddr0pipe() (PIPE_CONTROL << 30) - static int hub_set_address(struct usb_device *udev, int devnum) { int retval; @@ -4733,7 +4731,7 @@ static int hub_set_address(struct usb_device *udev, int devnum) if (hcd->driver->address_device) retval = hcd->driver->address_device(hcd, udev, timeout_ms); else - retval = usb_control_msg(udev, usb_sndaddr0pipe(), + retval = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), USB_REQ_SET_ADDRESS, 0, devnum, 0, NULL, 0, timeout_ms); if (retval == 0) { -- 2.50.1