Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

usb: vhci-hcd: Replace pr_*() with dev_*() logging

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>

authored by

Cristian Ciocaltea and committed by
Greg Kroah-Hartman
a3a8c9c1 e361b2bf

+39 -35
+39 -35
drivers/usb/usbip/vhci_hcd.c
··· 346 346 if (wIndex < 1 || wIndex > VHCI_HC_PORTS) { 347 347 invalid_rhport = true; 348 348 if (wIndex > VHCI_HC_PORTS) 349 - pr_err("invalid port number %d\n", wIndex); 350 - } else 349 + dev_err(hcd_dev(hcd), "invalid port number %d\n", wIndex); 350 + } else { 351 351 rhport = wIndex - 1; 352 + } 352 353 353 354 vhci_hcd = hcd_to_vhci_hcd(hcd); 354 355 vhci = vhci_hcd->vhci; ··· 369 368 break; 370 369 case ClearPortFeature: 371 370 if (invalid_rhport) { 372 - pr_err("invalid port number %d\n", wIndex); 371 + dev_err(hcd_dev(hcd), "invalid port number %d\n", wIndex); 373 372 goto error; 374 373 } 375 374 switch (wValue) { 376 375 case USB_PORT_FEAT_SUSPEND: 377 376 if (hcd->speed >= HCD_USB3) { 378 - pr_err(" ClearPortFeature: USB_PORT_FEAT_SUSPEND req not " 379 - "supported for USB 3.0 roothub\n"); 377 + dev_err(hcd_dev(hcd), 378 + "ClearPortFeature: USB_PORT_FEAT_SUSPEND req not supported for USB 3.0 roothub\n"); 380 379 goto error; 381 380 } 382 381 usbip_dbg_vhci_rh( ··· 409 408 if (hcd->speed >= HCD_USB3 && 410 409 (wLength < USB_DT_SS_HUB_SIZE || 411 410 wValue != (USB_DT_SS_HUB << 8))) { 412 - pr_err("Wrong hub descriptor type for USB 3.0 roothub.\n"); 411 + dev_err(hcd_dev(hcd), 412 + "Wrong hub descriptor type for USB 3.0 roothub.\n"); 413 413 goto error; 414 414 } 415 415 if (hcd->speed >= HCD_USB3) ··· 435 433 case GetPortStatus: 436 434 usbip_dbg_vhci_rh(" GetPortStatus port %x\n", wIndex); 437 435 if (invalid_rhport) { 438 - pr_err("invalid port number %d\n", wIndex); 436 + dev_err(hcd_dev(hcd), "invalid port number %d\n", wIndex); 439 437 retval = -EPIPE; 440 438 goto error; 441 439 } ··· 485 483 USB_PORT_STAT_LOW_SPEED; 486 484 break; 487 485 default: 488 - pr_err("vhci_device speed not set\n"); 486 + dev_err(hcd_dev(hcd), "vhci_device speed not set\n"); 489 487 break; 490 488 } 491 489 } ··· 507 505 usbip_dbg_vhci_rh( 508 506 " SetPortFeature: USB_PORT_FEAT_LINK_STATE\n"); 509 507 if (hcd->speed < HCD_USB3) { 510 - pr_err("USB_PORT_FEAT_LINK_STATE req not " 511 - "supported for USB 2.0 roothub\n"); 508 + dev_err(hcd_dev(hcd), 509 + "USB_PORT_FEAT_LINK_STATE req not supported for USB 2.0 roothub\n"); 512 510 goto error; 513 511 } 514 512 /* ··· 525 523 " SetPortFeature: USB_PORT_FEAT_U2_TIMEOUT\n"); 526 524 /* TODO: add suspend/resume support! */ 527 525 if (hcd->speed < HCD_USB3) { 528 - pr_err("USB_PORT_FEAT_U1/2_TIMEOUT req not " 529 - "supported for USB 2.0 roothub\n"); 526 + dev_err(hcd_dev(hcd), 527 + "USB_PORT_FEAT_U1/2_TIMEOUT req not supported for USB 2.0 roothub\n"); 530 528 goto error; 531 529 } 532 530 break; ··· 535 533 " SetPortFeature: USB_PORT_FEAT_SUSPEND\n"); 536 534 /* Applicable only for USB2.0 hub */ 537 535 if (hcd->speed >= HCD_USB3) { 538 - pr_err("USB_PORT_FEAT_SUSPEND req not " 539 - "supported for USB 3.0 roothub\n"); 536 + dev_err(hcd_dev(hcd), 537 + "USB_PORT_FEAT_SUSPEND req not supported for USB 3.0 roothub\n"); 540 538 goto error; 541 539 } 542 540 543 541 if (invalid_rhport) { 544 - pr_err("invalid port number %d\n", wIndex); 542 + dev_err(hcd_dev(hcd), "invalid port number %d\n", wIndex); 545 543 goto error; 546 544 } 547 545 ··· 551 549 usbip_dbg_vhci_rh( 552 550 " SetPortFeature: USB_PORT_FEAT_POWER\n"); 553 551 if (invalid_rhport) { 554 - pr_err("invalid port number %d\n", wIndex); 552 + dev_err(hcd_dev(hcd), "invalid port number %d\n", wIndex); 555 553 goto error; 556 554 } 557 555 if (hcd->speed >= HCD_USB3) ··· 563 561 usbip_dbg_vhci_rh( 564 562 " SetPortFeature: USB_PORT_FEAT_BH_PORT_RESET\n"); 565 563 if (invalid_rhport) { 566 - pr_err("invalid port number %d\n", wIndex); 564 + dev_err(hcd_dev(hcd), "invalid port number %d\n", wIndex); 567 565 goto error; 568 566 } 569 567 /* Applicable only for USB3.0 hub */ 570 568 if (hcd->speed < HCD_USB3) { 571 - pr_err("USB_PORT_FEAT_BH_PORT_RESET req not " 572 - "supported for USB 2.0 roothub\n"); 569 + dev_err(hcd_dev(hcd), 570 + "USB_PORT_FEAT_BH_PORT_RESET req not supported for USB 2.0 roothub\n"); 573 571 goto error; 574 572 } 575 573 fallthrough; ··· 577 575 usbip_dbg_vhci_rh( 578 576 " SetPortFeature: USB_PORT_FEAT_RESET\n"); 579 577 if (invalid_rhport) { 580 - pr_err("invalid port number %d\n", wIndex); 578 + dev_err(hcd_dev(hcd), "invalid port number %d\n", wIndex); 581 579 goto error; 582 580 } 583 581 /* if it's already enabled, disable */ ··· 600 598 usbip_dbg_vhci_rh(" SetPortFeature: default %d\n", 601 599 wValue); 602 600 if (invalid_rhport) { 603 - pr_err("invalid port number %d\n", wIndex); 601 + dev_err(hcd_dev(hcd), "invalid port number %d\n", wIndex); 604 602 goto error; 605 603 } 606 604 if (wValue >= 32) ··· 620 618 case GetPortErrorCount: 621 619 usbip_dbg_vhci_rh(" GetPortErrorCount\n"); 622 620 if (hcd->speed < HCD_USB3) { 623 - pr_err("GetPortErrorCount req not " 624 - "supported for USB 2.0 roothub\n"); 621 + dev_err(hcd_dev(hcd), 622 + "GetPortErrorCount req not supported for USB 2.0 roothub\n"); 625 623 goto error; 626 624 } 627 625 /* We'll always return 0 since this is a dummy hub */ ··· 630 628 case SetHubDepth: 631 629 usbip_dbg_vhci_rh(" SetHubDepth\n"); 632 630 if (hcd->speed < HCD_USB3) { 633 - pr_err("SetHubDepth req not supported for " 634 - "USB 2.0 roothub\n"); 631 + dev_err(hcd_dev(hcd), 632 + "SetHubDepth req not supported for USB 2.0 roothub\n"); 635 633 goto error; 636 634 } 637 635 break; 638 636 default: 639 - pr_err("default hub control req: %04x v%04x i%04x l%d\n", 637 + dev_err(hcd_dev(hcd), 638 + "default hub control req: %04x v%04x i%04x l%d\n", 640 639 typeReq, wValue, wIndex, wLength); 641 640 error: 642 641 /* "protocol stall" on error */ ··· 645 642 } 646 643 647 644 if (usbip_dbg_flag_vhci_rh) { 648 - pr_debug("port %d\n", rhport); 645 + dev_dbg(hcd_dev(hcd), "%s port %d\n", __func__, rhport); 649 646 /* Only dump valid port status */ 650 647 if (!invalid_rhport) { 651 648 dump_port_status_diff(prev_port_status[rhport], ··· 705 702 unsigned long flags; 706 703 707 704 if (portnum > VHCI_HC_PORTS) { 708 - pr_err("invalid port number %d\n", portnum); 705 + dev_err(hcd_dev(hcd), "invalid port number %d\n", portnum); 709 706 return -ENODEV; 710 707 } 711 708 vdev = &vhci_hcd->vdev[portnum-1]; ··· 961 958 962 959 unlink->seqnum = atomic_inc_return(&vhci_hcd->seqnum); 963 960 if (unlink->seqnum == 0xffff) 964 - pr_info("seqnum max\n"); 961 + dev_info(hcd_dev(hcd), "seqnum max\n"); 965 962 966 963 unlink->unlink_seqnum = priv->seqnum; 967 964 ··· 1039 1036 static void vhci_shutdown_connection(struct usbip_device *ud) 1040 1037 { 1041 1038 struct vhci_device *vdev = container_of(ud, struct vhci_device, ud); 1039 + struct usb_hcd *hcd = vhci_hcd_to_hcd(vdev_to_vhci_hcd(vdev)); 1042 1040 1043 1041 /* need this? see stub_dev.c */ 1044 1042 if (ud->tcp_socket) { 1045 - pr_debug("shutdown tcp_socket %d\n", ud->sockfd); 1043 + dev_dbg(hcd_dev(hcd), "shutdown tcp_socket %d\n", ud->sockfd); 1046 1044 kernel_sock_shutdown(ud->tcp_socket, SHUT_RDWR); 1047 1045 } 1048 1046 ··· 1056 1052 kthread_stop_put(vdev->ud.tcp_tx); 1057 1053 vdev->ud.tcp_tx = NULL; 1058 1054 } 1059 - pr_info("stop threads\n"); 1055 + dev_info(hcd_dev(hcd), "stop threads\n"); 1060 1056 1061 1057 /* active connection is closed */ 1062 1058 if (vdev->ud.tcp_socket) { ··· 1064 1060 vdev->ud.tcp_socket = NULL; 1065 1061 vdev->ud.sockfd = -1; 1066 1062 } 1067 - pr_info("release socket\n"); 1063 + dev_info(hcd_dev(hcd), "release socket\n"); 1068 1064 1069 1065 vhci_device_unlink_cleanup(vdev); 1070 1066 ··· 1090 1086 */ 1091 1087 rh_port_disconnect(vdev); 1092 1088 1093 - pr_info("disconnect device\n"); 1089 + dev_info(hcd_dev(hcd), "disconnect device\n"); 1094 1090 } 1095 1091 1096 1092 static void vhci_device_reset(struct usbip_device *ud) ··· 1226 1222 1227 1223 id = hcd_name_to_id(hcd_name(hcd)); 1228 1224 if (id < 0) { 1229 - pr_err("invalid vhci name %s\n", hcd_name(hcd)); 1225 + dev_err(hcd_dev(hcd), "invalid vhci name %s\n", hcd_name(hcd)); 1230 1226 return -EINVAL; 1231 1227 } 1232 1228 ··· 1243 1239 vhci_finish_attr_group(); 1244 1240 return err; 1245 1241 } 1246 - pr_info("created sysfs %s\n", hcd_name(hcd)); 1242 + dev_info(hcd_dev(hcd), "created sysfs %s\n", hcd_name(hcd)); 1247 1243 } 1248 1244 1249 1245 return 0;