Re: [PATCH] usb: core: hub: fix coding style and prefer unsigned int

From: Andre Moreira

Date: Wed Jun 24 2026 - 02:28:26 EST


Hi Greg and all,

*Please disregard this patch. I am new to kernel development and was
just trying to clear checkpatch.pl warnings on drivers/usb/core/hub.c.
*

I realize now that style-only cleanups in mature/core drivers cause
unnecessary noise in git blame and overhead for maintainers. Sorry for
the noise, I will look into drivers/staging/ for this kind of
contribution instead.

Best regards,
André

Em qua., 24 de jun. de 2026 às 03:18, André Moreira
<andrem.33333@xxxxxxxxx> escreveu:
>
> Fix indentation issues and clear checkpatch warnings by replacing
> bare uses of 'unsigned' with 'unsigned int' throughout the file.
>
> Signed-off-by: André Moreira <andrem.33333@xxxxxxxxx>
> ---
> drivers/usb/core/hub.c | 52 +++++++++++++++++++++---------------------
> 1 file changed, 26 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> index 24960ba9caa91..a75db12506388 100644
> --- a/drivers/usb/core/hub.c
> +++ b/drivers/usb/core/hub.c
> @@ -410,7 +410,7 @@ static int get_hub_descriptor(struct usb_device *hdev,
> struct usb_hub_descriptor *desc)
> {
> int i, ret, size;
> - unsigned dtype;
> + unsigned int dtype;
>
> if (hub_is_superspeed(hdev)) {
> dtype = USB_DT_SS_HUB;
> @@ -506,15 +506,15 @@ static void led_work(struct work_struct *work)
> struct usb_hub *hub =
> container_of(work, struct usb_hub, leds.work);
> struct usb_device *hdev = hub->hdev;
> - unsigned i;
> - unsigned changed = 0;
> + unsigned int i;
> + unsigned int changed = 0;
> int cursor = -1;
>
> if (hdev->state != USB_STATE_CONFIGURED || hub->quiescing)
> return;
>
> for (i = 0; i < hdev->maxchild; i++) {
> - unsigned selector, mode;
> + unsigned int selector, mode;
>
> /* 30%-50% duty cycle */
>
> @@ -774,7 +774,7 @@ static void hub_irq(struct urb *urb)
> {
> struct usb_hub *hub = urb->context;
> int status = urb->status;
> - unsigned i;
> + unsigned int i;
> unsigned long bits;
>
> switch (status) {
> @@ -1084,7 +1084,7 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
> int port1;
> int status;
> bool need_debounce_delay = false;
> - unsigned delay;
> + unsigned int delay;
>
> /* Continue a partial initialization */
> if (type == HUB_INIT2 || type == HUB_INIT3) {
> @@ -1457,9 +1457,9 @@ static int hub_configure(struct usb_hub *hub,
> unsigned int pipe;
> int maxp, ret, i;
> char *message = "out of memory";
> - unsigned unit_load;
> - unsigned full_load;
> - unsigned maxchild;
> + unsigned int unit_load;
> + unsigned int full_load;
> + unsigned int maxchild;
>
> hub->buffer = kmalloc_obj(*hub->buffer);
> if (!hub->buffer) {
> @@ -1792,7 +1792,7 @@ void hub_put(struct usb_hub *hub)
> kref_put(&hub->kref, hub_release);
> }
>
> -static unsigned highspeed_hubs;
> +static unsigned int highspeed_hubs;
>
> static void hub_disconnect(struct usb_interface *intf)
> {
> @@ -1859,7 +1859,7 @@ static bool hub_descriptor_is_sane(struct usb_host_interface *desc)
> if (!usb_endpoint_is_int_in(&desc->endpoint[0].desc))
> return false;
>
> - return true;
> + return true;
> }
>
> static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id)
> @@ -2047,7 +2047,7 @@ hub_ioctl(struct usb_interface *intf, unsigned int code, void *user_data)
> * Allow user programs to claim ports on a hub. When a device is attached
> * to one of these "claimed" ports, the program will "own" the device.
> */
> -static int find_port_owner(struct usb_device *hdev, unsigned port1,
> +static int find_port_owner(struct usb_device *hdev, unsigned int port1,
> struct usb_dev_state ***ppowner)
> {
> struct usb_hub *hub = usb_hub_to_struct_hub(hdev);
> @@ -3263,7 +3263,7 @@ static void usb_unlock_port(struct usb_port *port_dev)
> #ifdef CONFIG_PM
>
> /* Check if a port is suspended(USB2.0 port) or in U3 state(USB3.0 port) */
> -static int port_is_suspended(struct usb_hub *hub, unsigned portstatus)
> +static int port_is_suspended(struct usb_hub *hub, unsigned int portstatus)
> {
> int ret = 0;
>
> @@ -3441,7 +3441,7 @@ static int usb_disable_remote_wakeup(struct usb_device *udev)
> }
>
> /* Count of wakeup-enabled devices at or below udev */
> -unsigned usb_wakeup_enabled_descendants(struct usb_device *udev)
> +unsigned int usb_wakeup_enabled_descendants(struct usb_device *udev)
> {
> struct usb_hub *hub = usb_hub_to_struct_hub(udev);
>
> @@ -3959,7 +3959,7 @@ static int hub_suspend(struct usb_interface *intf, pm_message_t msg)
> {
> struct usb_hub *hub = usb_get_intfdata(intf);
> struct usb_device *hdev = hub->hdev;
> - unsigned port1;
> + unsigned int port1;
>
> /*
> * Warn if children aren't already suspended.
> @@ -4697,7 +4697,7 @@ int hub_port_debounce(struct usb_hub *hub, int port1, bool must_be_connected)
> {
> int ret;
> u16 portchange, portstatus;
> - unsigned connection = 0xffff;
> + unsigned int connection = 0xffff;
> int total_time, stable_time = 0;
> struct usb_port *port_dev = hub->ports[port1 - 1];
>
> @@ -4906,7 +4906,7 @@ hub_port_init(struct usb_hub *hub, struct usb_device *udev, int port1,
> struct usb_hcd *hcd = bus_to_hcd(hdev->bus);
> struct usb_port *port_dev = hub->ports[port1 - 1];
> int retries, operations, retval, i;
> - unsigned delay = HUB_SHORT_RESET_TIME;
> + unsigned int delay = HUB_SHORT_RESET_TIME;
> enum usb_device_speed oldspeed = udev->speed;
> const char *speed;
> int devnum = udev->devnum;
> @@ -5269,7 +5269,7 @@ hub_power_remaining(struct usb_hub *hub)
> for (port1 = 1; port1 <= hdev->maxchild; ++port1) {
> struct usb_port *port_dev = hub->ports[port1 - 1];
> struct usb_device *udev = port_dev->child;
> - unsigned unit_load;
> + unsigned int unit_load;
> int delta;
>
> if (!udev)
> @@ -5308,10 +5308,10 @@ static int descriptors_changed(struct usb_device *udev,
> struct usb_host_bos *old_bos)
> {
> int changed = 0;
> - unsigned index;
> - unsigned serial_len = 0;
> - unsigned len;
> - unsigned old_length;
> + unsigned int index;
> + unsigned int serial_len = 0;
> + unsigned int len;
> + unsigned int old_length;
> int length;
> char *buf;
>
> @@ -5392,7 +5392,7 @@ static void hub_port_connect(struct usb_hub *hub, int port1, u16 portstatus,
> {
> int status = -ENODEV;
> int i;
> - unsigned unit_load;
> + unsigned int unit_load;
> struct usb_device *hdev = hub->hdev;
> struct usb_hcd *hcd = bus_to_hcd(hdev->bus);
> struct usb_port *port_dev = hub->ports[port1 - 1];
> @@ -6000,14 +6000,14 @@ static void hub_event(struct work_struct *work)
>
> static const struct usb_device_id hub_id_table[] = {
> { .match_flags = USB_DEVICE_ID_MATCH_VENDOR
> - | USB_DEVICE_ID_MATCH_PRODUCT
> - | USB_DEVICE_ID_MATCH_INT_CLASS,
> + | USB_DEVICE_ID_MATCH_PRODUCT
> + | USB_DEVICE_ID_MATCH_INT_CLASS,
> .idVendor = USB_VENDOR_SMSC,
> .idProduct = USB_PRODUCT_USB5534B,
> .bInterfaceClass = USB_CLASS_HUB,
> .driver_info = HUB_QUIRK_DISABLE_AUTOSUSPEND},
> { .match_flags = USB_DEVICE_ID_MATCH_VENDOR
> - | USB_DEVICE_ID_MATCH_PRODUCT,
> + | USB_DEVICE_ID_MATCH_PRODUCT,
> .idVendor = USB_VENDOR_CYPRESS,
> .idProduct = USB_PRODUCT_CY7C65632,
> .driver_info = HUB_QUIRK_DISABLE_AUTOSUSPEND},
> --
> 2.43.0
>