[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250726-vhci-hcd-suspend-fix-v2-5-189266dfdfaa@collabora.com>
Date: Sat, 26 Jul 2025 01:08:07 +0300
From: Cristian Ciocaltea <cristian.ciocaltea@...labora.com>
To: Valentina Manea <valentina.manea.m@...il.com>,
Shuah Khan <shuah@...nel.org>, Hongren Zheng <i@...ithal.me>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Brian G. Merrell" <bgmerrell@...ell.com>
Cc: kernel@...labora.com, Greg Kroah-Hartman <gregkh@...e.de>,
linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH v2 05/18] usb: vhci-hcd: Consistently use blank lines
Add blank lines where it helps improve code readability and drop those
which are really not required, as indicated by checkpatch:
CHECK: Blank lines aren't necessary after an open brace '{'
CHECK: Blank lines aren't necessary before a close brace '}'
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@...labora.com>
---
drivers/usb/usbip/vhci_hcd.c | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c
index cace9bbbd528602703869cf955f93b311fddd045..c739107a3e0411ba2e8227ea6db46802b4882177 100644
--- a/drivers/usb/usbip/vhci_hcd.c
+++ b/drivers/usb/usbip/vhci_hcd.c
@@ -145,6 +145,7 @@ static void dump_port_status_diff(u32 prev_status, u32 new_status, bool usb3)
if (bit == 1) /* USB_PORT_STAT_CONNECTION */
pr_debug(" %c%s\n", change, "USB_PORT_STAT_SPEED_5GBPS");
}
+
bit <<= 1;
i++;
}
@@ -267,7 +268,6 @@ static struct {
struct usb_bos_descriptor bos;
struct usb_ss_cap_descriptor ss_cap;
} __packed usb3_bos_desc = {
-
.bos = {
.bLength = USB_DT_BOS_SIZE,
.bDescriptorType = USB_DT_BOS,
@@ -306,6 +306,7 @@ static inline void hub_descriptor(struct usb_hub_descriptor *desc)
HUB_CHAR_COMMON_OCPM);
desc->bNbrPorts = VHCI_HC_PORTS;
BUILD_BUG_ON(VHCI_HC_PORTS > USB_MAXCHILDREN);
+
width = desc->bNbrPorts / 8 + 1;
desc->bDescLength = USB_DT_HUB_NONVAR_SIZE + 2 * width;
memset(&desc->u.hs.DeviceRemovable[0], 0, width);
@@ -371,6 +372,7 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
pr_err("invalid port number %d\n", wIndex);
goto error;
}
+
switch (wValue) {
case USB_PORT_FEAT_SUSPEND:
if (hcd->speed >= HCD_USB3) {
@@ -398,6 +400,7 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
wValue);
if (wValue >= 32)
goto error;
+
vhci_hcd->port_status[rhport] &= ~(1 << wValue);
break;
}
@@ -410,6 +413,7 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
pr_err("Wrong hub descriptor type for USB 3.0 roothub.\n");
goto error;
}
+
if (hcd->speed >= HCD_USB3)
ss_hub_descriptor((struct usb_hub_descriptor *) buf);
else
@@ -506,6 +510,7 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
"supported for USB 2.0 roothub\n");
goto error;
}
+
/*
* Since this is dummy we don't have an actual link so
* there is nothing to do for the SET_LINK_STATE cmd
@@ -545,6 +550,7 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
pr_err("invalid port number %d\n", wIndex);
goto error;
}
+
if (hcd->speed >= HCD_USB3)
vhci_hcd->port_status[rhport] |= USB_SS_PORT_STAT_POWER;
else
@@ -556,6 +562,7 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
pr_err("invalid port number %d\n", wIndex);
goto error;
}
+
/* Applicable only for USB3.0 hub */
if (hcd->speed < HCD_USB3) {
pr_err("USB_PORT_FEAT_BH_PORT_RESET req not "
@@ -569,6 +576,7 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
pr_err("invalid port number %d\n", wIndex);
goto error;
}
+
/* if it's already enabled, disable */
if (hcd->speed >= HCD_USB3) {
vhci_hcd->port_status[rhport] = 0;
@@ -592,8 +600,10 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
pr_err("invalid port number %d\n", wIndex);
goto error;
}
+
if (wValue >= 32)
goto error;
+
if (hcd->speed >= HCD_USB3) {
if ((vhci_hcd->port_status[rhport] &
USB_SS_PORT_STAT_POWER) != 0) {
@@ -722,6 +732,7 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flag
spin_unlock_irqrestore(&vhci->lock, flags);
return -ENODEV;
}
+
spin_unlock(&vdev->ud.lock);
ret = usb_hcd_link_urb_to_ep(hcd, urb);
@@ -811,7 +822,6 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flag
ret = -EINVAL;
goto no_need_xmit;
}
-
}
out:
@@ -832,6 +842,7 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flag
usb_hcd_giveback_urb(hcd, urb, urb->status);
local_irq_enable();
}
+
return ret;
}
@@ -1222,12 +1233,14 @@ static int vhci_start(struct usb_hcd *hcd)
dev_err(hcd_dev(hcd), "init attr group failed, err = %d\n", err);
return err;
}
+
err = sysfs_create_group(&hcd_dev(hcd)->kobj, &vhci_attr_group);
if (err) {
dev_err(hcd_dev(hcd), "create sysfs files failed, err = %d\n", err);
vhci_finish_attr_group();
return err;
}
+
pr_info("created sysfs %s\n", hcd_name(hcd));
}
@@ -1289,10 +1302,12 @@ static int vhci_bus_resume(struct usb_hcd *hcd)
dev_dbg(&hcd->self.root_hub->dev, "%s\n", __func__);
spin_lock_irqsave(&vhci->lock, flags);
+
if (!HCD_HW_ACCESSIBLE(hcd))
rc = -ESHUTDOWN;
else
hcd->state = HC_STATE_RUNNING;
+
spin_unlock_irqrestore(&vhci->lock, flags);
return rc;
@@ -1365,6 +1380,7 @@ static int vhci_hcd_probe(struct platform_device *pdev)
pr_err("create primary hcd failed\n");
return -ENOMEM;
}
+
hcd_hs->has_tt = 1;
/*
@@ -1480,6 +1496,7 @@ static int vhci_hcd_resume(struct platform_device *pdev)
hcd = platform_get_drvdata(pdev);
if (!hcd)
return 0;
+
set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
usb_hcd_poll_rh_status(hcd);
@@ -1511,6 +1528,7 @@ static void del_platform_devices(void)
platform_device_unregister(vhcis[i].pdev);
vhcis[i].pdev = NULL;
}
+
sysfs_remove_link(&platform_bus.kobj, driver_name);
}
--
2.50.0
Powered by blists - more mailing lists