diff mbox series

usb: core: Minor improvements to usb_hub_create_port_device

Message ID 4793f68e-cb16-4058-9704-230ae0e32b8e@gmail.com (mailing list archive)
State New, archived
Headers show
Series usb: core: Minor improvements to usb_hub_create_port_device | expand

Commit Message

Heiner Kallweit Oct. 17, 2023, 4:43 p.m. UTC
Minor improvements, no functional change intended.
- Use variable hdev instead of hub->hdev
- Don't call hub_is_superspeed() twice
- Style fix for else clause

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/usb/core/port.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Comments

Greg KH Oct. 17, 2023, 4:59 p.m. UTC | #1
On Tue, Oct 17, 2023 at 06:43:51PM +0200, Heiner Kallweit wrote:
> Minor improvements, no functional change intended.
> - Use variable hdev instead of hub->hdev
> - Don't call hub_is_superspeed() twice
> - Style fix for else clause

Please do not do multiple things in the same patch.  These need to be
all broken up into "one patch per logical change" to be able to properly
review and potentially revert them in the future.

thanks,

greg k-h
diff mbox series

Patch

diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c
index 77be0dc28..84bd83d99 100644
--- a/drivers/usb/core/port.c
+++ b/drivers/usb/core/port.c
@@ -698,17 +698,16 @@  int usb_hub_create_port_device(struct usb_hub *hub, int port1)
 	set_bit(port1, hub->power_bits);
 	port_dev->dev.parent = hub->intfdev;
 	if (hub_is_superspeed(hdev)) {
+		port_dev->is_superspeed = 1;
 		port_dev->usb3_lpm_u1_permit = 1;
 		port_dev->usb3_lpm_u2_permit = 1;
 		port_dev->dev.groups = port_dev_usb3_group;
-	} else
+	} else {
 		port_dev->dev.groups = port_dev_group;
+	}
 	port_dev->dev.type = &usb_port_device_type;
 	port_dev->dev.driver = &usb_port_driver;
-	if (hub_is_superspeed(hub->hdev))
-		port_dev->is_superspeed = 1;
-	dev_set_name(&port_dev->dev, "%s-port%d", dev_name(&hub->hdev->dev),
-			port1);
+	dev_set_name(&port_dev->dev, "%s-port%d", dev_name(&hdev->dev), port1);
 	mutex_init(&port_dev->status_lock);
 	retval = device_register(&port_dev->dev);
 	if (retval) {