Skip to contentSkip to conversation

staging: usbip: replace pr_warning() with dev_warn().

PATCH In review navin patidar 2 participants 2 messages Jun 27, 2013 – Jul 23, 2013 Staging

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 staging: usbip: replace pr_warning() with dev_warn().

dev_warn() is preferred over pr_warning().

container_of() is used to get usb_driver pointer from usbip_device container (stub_device or vhci_device), to get device structure required for dev_warn().

---
 drivers/staging/usbip/usbip_event.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/staging/usbip/usbip_event.c +10 -1
index 82123be..1f3a571 100644
@@ -21,6 +21,8 @@
 #include <linux/export.h>
 
 #include "usbip_common.h"
+#include "stub.h"
+#include "vhci.h"
 
 static int event_handler(struct usbip_device *ud)
 {
@@ -85,7 +87,14 @@ int usbip_start_eh(struct usbip_device *ud)
 
 	ud->eh = kthread_run(event_handler_loop, ud, "usbip_eh");
 	if (IS_ERR(ud->eh)) {
-		pr_warning("Unable to start control thread\n");
+		struct device *dev;
+
+		if (ud->side == USBIP_STUB)
+			dev = &container_of(ud, struct stub_device, ud)->udev->dev;
+		else
+			dev = &container_of(ud, struct vhci_device, ud)->udev->dev;
+
+		dev_warn(dev, "Unable to start control thread\n");
 		return PTR_ERR(ud->eh);
 	}
 

--
1.7.10.4

maintainer
#1 lore raw
Quoted 24 lines · navin patidar

dev_warn() is preferred over pr_warning().

container_of() is used to get usb_driver pointer from usbip_device container (stub_device or vhci_device), to get device structure required for dev_warn().

---
 drivers/staging/usbip/usbip_event.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/staging/usbip/usbip_event.c +2 -0
index 82123be..1f3a571 100644
@@ -21,6 +21,8 @@
 #include <linux/export.h>
 
 #include "usbip_common.h"
+#include "stub.h"
+#include "vhci.h"
 
 static int event_handler(struct usbip_device *ud)
 {

drivers/staging/usbip/usbip_event.c int usbip_start_eh(struct usbip_device *ud) · line 95

Quoted 10 lines
drivers/staging/usbip/usbip_event.c +6 -1
@@ -85,7 +87,14 @@ int usbip_start_eh(struct usbip_device *ud)
 
 	ud->eh = kthread_run(event_handler_loop, ud, "usbip_eh");
 	if (IS_ERR(ud->eh)) {
-		pr_warning("Unable to start control thread\n");
+		struct device *dev;
+
+		if (ud->side == USBIP_STUB)
+			dev = &container_of(ud, struct stub_device, ud)->udev->dev;
+		else
+			dev = &container_of(ud, struct vhci_device, ud)->udev->dev;

Putting '&' in front of container_of seems odd, are you sure it's needed here? If ud is a pointer, everything else should "just work" properly without that.

Can you please fix this up?

thanks,

greg k-h