]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
usb: vhci-hcd: Replace pr_*() with dev_*() logging
authorCristian Ciocaltea <cristian.ciocaltea@collabora.com>
Wed, 8 Oct 2025 16:54:27 +0000 (19:54 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 13 Oct 2025 07:35:16 +0000 (09:35 +0200)
Where possible, use driver model logging helpers dev_*() instead of
pr_*() to ensure the messages are always associated with the
corresponding device/driver.

While at it, join the split strings to make checkpatch happy and regain
ability to grep for those log messages in the source code:

  WARNING: quoted string split across lines

Acked-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Link: https://lore.kernel.org/r/20251008-vhci-hcd-cleanup-v2-2-b6acc4dd6e44@collabora.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/usbip/vhci_hcd.c

index c3f24bf8610a59a725383b173705a53c9f0db9ad..e55690da19e54414516b3fa0f591f33b1bbc858e 100644 (file)
@@ -346,9 +346,10 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
        if (wIndex < 1 || wIndex > VHCI_HC_PORTS) {
                invalid_rhport = true;
                if (wIndex > VHCI_HC_PORTS)
-                       pr_err("invalid port number %d\n", wIndex);
-       } else
+                       dev_err(hcd_dev(hcd), "invalid port number %d\n", wIndex);
+       } else {
                rhport = wIndex - 1;
+       }
 
        vhci_hcd = hcd_to_vhci_hcd(hcd);
        vhci = vhci_hcd->vhci;
@@ -368,14 +369,14 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
                break;
        case ClearPortFeature:
                if (invalid_rhport) {
-                       pr_err("invalid port number %d\n", wIndex);
+                       dev_err(hcd_dev(hcd), "invalid port number %d\n", wIndex);
                        goto error;
                }
                switch (wValue) {
                case USB_PORT_FEAT_SUSPEND:
                        if (hcd->speed >= HCD_USB3) {
-                               pr_err(" ClearPortFeature: USB_PORT_FEAT_SUSPEND req not "
-                                      "supported for USB 3.0 roothub\n");
+                               dev_err(hcd_dev(hcd),
+                                       "ClearPortFeature: USB_PORT_FEAT_SUSPEND req not supported for USB 3.0 roothub\n");
                                goto error;
                        }
                        usbip_dbg_vhci_rh(
@@ -408,7 +409,8 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
                if (hcd->speed >= HCD_USB3 &&
                                (wLength < USB_DT_SS_HUB_SIZE ||
                                 wValue != (USB_DT_SS_HUB << 8))) {
-                       pr_err("Wrong hub descriptor type for USB 3.0 roothub.\n");
+                       dev_err(hcd_dev(hcd),
+                               "Wrong hub descriptor type for USB 3.0 roothub.\n");
                        goto error;
                }
                if (hcd->speed >= HCD_USB3)
@@ -433,7 +435,7 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
        case GetPortStatus:
                usbip_dbg_vhci_rh(" GetPortStatus port %x\n", wIndex);
                if (invalid_rhport) {
-                       pr_err("invalid port number %d\n", wIndex);
+                       dev_err(hcd_dev(hcd), "invalid port number %d\n", wIndex);
                        retval = -EPIPE;
                        goto error;
                }
@@ -483,7 +485,7 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
                                                USB_PORT_STAT_LOW_SPEED;
                                        break;
                                default:
-                                       pr_err("vhci_device speed not set\n");
+                                       dev_err(hcd_dev(hcd), "vhci_device speed not set\n");
                                        break;
                                }
                        }
@@ -505,8 +507,8 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
                        usbip_dbg_vhci_rh(
                                " SetPortFeature: USB_PORT_FEAT_LINK_STATE\n");
                        if (hcd->speed < HCD_USB3) {
-                               pr_err("USB_PORT_FEAT_LINK_STATE req not "
-                                      "supported for USB 2.0 roothub\n");
+                               dev_err(hcd_dev(hcd),
+                                       "USB_PORT_FEAT_LINK_STATE req not supported for USB 2.0 roothub\n");
                                goto error;
                        }
                        /*
@@ -523,8 +525,8 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
                                " SetPortFeature: USB_PORT_FEAT_U2_TIMEOUT\n");
                        /* TODO: add suspend/resume support! */
                        if (hcd->speed < HCD_USB3) {
-                               pr_err("USB_PORT_FEAT_U1/2_TIMEOUT req not "
-                                      "supported for USB 2.0 roothub\n");
+                               dev_err(hcd_dev(hcd),
+                                       "USB_PORT_FEAT_U1/2_TIMEOUT req not supported for USB 2.0 roothub\n");
                                goto error;
                        }
                        break;
@@ -533,13 +535,13 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
                                " SetPortFeature: USB_PORT_FEAT_SUSPEND\n");
                        /* Applicable only for USB2.0 hub */
                        if (hcd->speed >= HCD_USB3) {
-                               pr_err("USB_PORT_FEAT_SUSPEND req not "
-                                      "supported for USB 3.0 roothub\n");
+                               dev_err(hcd_dev(hcd),
+                                       "USB_PORT_FEAT_SUSPEND req not supported for USB 3.0 roothub\n");
                                goto error;
                        }
 
                        if (invalid_rhport) {
-                               pr_err("invalid port number %d\n", wIndex);
+                               dev_err(hcd_dev(hcd), "invalid port number %d\n", wIndex);
                                goto error;
                        }
 
@@ -549,7 +551,7 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
                        usbip_dbg_vhci_rh(
                                " SetPortFeature: USB_PORT_FEAT_POWER\n");
                        if (invalid_rhport) {
-                               pr_err("invalid port number %d\n", wIndex);
+                               dev_err(hcd_dev(hcd), "invalid port number %d\n", wIndex);
                                goto error;
                        }
                        if (hcd->speed >= HCD_USB3)
@@ -561,13 +563,13 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
                        usbip_dbg_vhci_rh(
                                " SetPortFeature: USB_PORT_FEAT_BH_PORT_RESET\n");
                        if (invalid_rhport) {
-                               pr_err("invalid port number %d\n", wIndex);
+                               dev_err(hcd_dev(hcd), "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 "
-                                      "supported for USB 2.0 roothub\n");
+                               dev_err(hcd_dev(hcd),
+                                       "USB_PORT_FEAT_BH_PORT_RESET req not supported for USB 2.0 roothub\n");
                                goto error;
                        }
                        fallthrough;
@@ -575,7 +577,7 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
                        usbip_dbg_vhci_rh(
                                " SetPortFeature: USB_PORT_FEAT_RESET\n");
                        if (invalid_rhport) {
-                               pr_err("invalid port number %d\n", wIndex);
+                               dev_err(hcd_dev(hcd), "invalid port number %d\n", wIndex);
                                goto error;
                        }
                        /* if it's already enabled, disable */
@@ -598,7 +600,7 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
                        usbip_dbg_vhci_rh(" SetPortFeature: default %d\n",
                                          wValue);
                        if (invalid_rhport) {
-                               pr_err("invalid port number %d\n", wIndex);
+                               dev_err(hcd_dev(hcd), "invalid port number %d\n", wIndex);
                                goto error;
                        }
                        if (wValue >= 32)
@@ -618,8 +620,8 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
        case GetPortErrorCount:
                usbip_dbg_vhci_rh(" GetPortErrorCount\n");
                if (hcd->speed < HCD_USB3) {
-                       pr_err("GetPortErrorCount req not "
-                              "supported for USB 2.0 roothub\n");
+                       dev_err(hcd_dev(hcd),
+                               "GetPortErrorCount req not supported for USB 2.0 roothub\n");
                        goto error;
                }
                /* We'll always return 0 since this is a dummy hub */
@@ -628,13 +630,14 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
        case SetHubDepth:
                usbip_dbg_vhci_rh(" SetHubDepth\n");
                if (hcd->speed < HCD_USB3) {
-                       pr_err("SetHubDepth req not supported for "
-                              "USB 2.0 roothub\n");
+                       dev_err(hcd_dev(hcd),
+                               "SetHubDepth req not supported for USB 2.0 roothub\n");
                        goto error;
                }
                break;
        default:
-               pr_err("default hub control req: %04x v%04x i%04x l%d\n",
+               dev_err(hcd_dev(hcd),
+                       "default hub control req: %04x v%04x i%04x l%d\n",
                        typeReq, wValue, wIndex, wLength);
 error:
                /* "protocol stall" on error */
@@ -642,7 +645,7 @@ error:
        }
 
        if (usbip_dbg_flag_vhci_rh) {
-               pr_debug("port %d\n", rhport);
+               dev_dbg(hcd_dev(hcd), "%s port %d\n", __func__, rhport);
                /* Only dump valid port status */
                if (!invalid_rhport) {
                        dump_port_status_diff(prev_port_status[rhport],
@@ -702,7 +705,7 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flag
        unsigned long flags;
 
        if (portnum > VHCI_HC_PORTS) {
-               pr_err("invalid port number %d\n", portnum);
+               dev_err(hcd_dev(hcd), "invalid port number %d\n", portnum);
                return -ENODEV;
        }
        vdev = &vhci_hcd->vdev[portnum-1];
@@ -958,7 +961,7 @@ static int vhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
 
                unlink->seqnum = atomic_inc_return(&vhci_hcd->seqnum);
                if (unlink->seqnum == 0xffff)
-                       pr_info("seqnum max\n");
+                       dev_info(hcd_dev(hcd), "seqnum max\n");
 
                unlink->unlink_seqnum = priv->seqnum;
 
@@ -1036,10 +1039,11 @@ static void vhci_device_unlink_cleanup(struct vhci_device *vdev)
 static void vhci_shutdown_connection(struct usbip_device *ud)
 {
        struct vhci_device *vdev = container_of(ud, struct vhci_device, ud);
+       struct usb_hcd *hcd = vhci_hcd_to_hcd(vdev_to_vhci_hcd(vdev));
 
        /* need this? see stub_dev.c */
        if (ud->tcp_socket) {
-               pr_debug("shutdown tcp_socket %d\n", ud->sockfd);
+               dev_dbg(hcd_dev(hcd), "shutdown tcp_socket %d\n", ud->sockfd);
                kernel_sock_shutdown(ud->tcp_socket, SHUT_RDWR);
        }
 
@@ -1052,7 +1056,7 @@ static void vhci_shutdown_connection(struct usbip_device *ud)
                kthread_stop_put(vdev->ud.tcp_tx);
                vdev->ud.tcp_tx = NULL;
        }
-       pr_info("stop threads\n");
+       dev_info(hcd_dev(hcd), "stop threads\n");
 
        /* active connection is closed */
        if (vdev->ud.tcp_socket) {
@@ -1060,7 +1064,7 @@ static void vhci_shutdown_connection(struct usbip_device *ud)
                vdev->ud.tcp_socket = NULL;
                vdev->ud.sockfd = -1;
        }
-       pr_info("release socket\n");
+       dev_info(hcd_dev(hcd), "release socket\n");
 
        vhci_device_unlink_cleanup(vdev);
 
@@ -1086,7 +1090,7 @@ static void vhci_shutdown_connection(struct usbip_device *ud)
         */
        rh_port_disconnect(vdev);
 
-       pr_info("disconnect device\n");
+       dev_info(hcd_dev(hcd), "disconnect device\n");
 }
 
 static void vhci_device_reset(struct usbip_device *ud)
@@ -1222,7 +1226,7 @@ static int vhci_start(struct usb_hcd *hcd)
 
        id = hcd_name_to_id(hcd_name(hcd));
        if (id < 0) {
-               pr_err("invalid vhci name %s\n", hcd_name(hcd));
+               dev_err(hcd_dev(hcd), "invalid vhci name %s\n", hcd_name(hcd));
                return -EINVAL;
        }
 
@@ -1239,7 +1243,7 @@ static int vhci_start(struct usb_hcd *hcd)
                        vhci_finish_attr_group();
                        return err;
                }
-               pr_info("created sysfs %s\n", hcd_name(hcd));
+               dev_info(hcd_dev(hcd), "created sysfs %s\n", hcd_name(hcd));
        }
 
        return 0;