linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] staging: usbip: replace pr_warning() with dev_warn().
@ 2013-06-27  4:35 navin patidar
  2013-06-27  4:45 ` Joe Perches
  0 siblings, 1 reply; 2+ messages in thread
From: navin patidar @ 2013-06-27  4:35 UTC (permalink / raw)
  To: gregkh, mfm, sergei.shtylyov
  Cc: linux-usb, devel, linux-kernel, 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().

Signed-off-by: navin patidar <navinp@cdac.in>
---
 drivers/staging/usbip/usbip_event.c |   17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/usbip/usbip_event.c b/drivers/staging/usbip/usbip_event.c
index 82123be..eca14b7 100644
--- a/drivers/staging/usbip/usbip_event.c
+++ b/drivers/staging/usbip/usbip_event.c
@@ -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,20 @@ 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) {
+			struct stub_device *sdev;
+
+			sdev = container_of(ud, struct stub_device, ud);
+			dev = sdev->udev->dev;
+		} else {
+			struct vhci_device *vdev;
+
+			vdev = container_of(ud, struct vhci_device, ud);
+			dev = vdev->udev->dev;
+		}
+		dev_warn(&dev, "Unable to start control thread\n");
 		return PTR_ERR(ud->eh);
 	}

--
1.7.10.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v3] staging: usbip: replace pr_warning() with dev_warn().
  2013-06-27  4:35 [PATCH v3] staging: usbip: replace pr_warning() with dev_warn() navin patidar
@ 2013-06-27  4:45 ` Joe Perches
  0 siblings, 0 replies; 2+ messages in thread
From: Joe Perches @ 2013-06-27  4:45 UTC (permalink / raw)
  To: navin patidar
  Cc: gregkh, mfm, sergei.shtylyov, linux-usb, devel, linux-kernel

On Thu, 2013-06-27 at 10:05 +0530, navin patidar wrote:
> dev_warn() is preferred over pr_warning().
[]
> diff --git a/drivers/staging/usbip/usbip_event.c b/drivers/staging/usbip/usbip_event.c
[]
> @@ -85,7 +87,20 @@ 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;

Don't put a struct device on stack,
just use a struct device *

> +		if (ud->side == USBIP_STUB) {
> +			struct stub_device *sdev;
> +
> +			sdev = container_of(ud, struct stub_device, ud);
> +			dev = sdev->udev->dev;

			dev = &sdev->udev->dev;

> +		} else {
> +			struct vhci_device *vdev;
> +
> +			vdev = container_of(ud, struct vhci_device, ud);
> +			dev = vdev->udev->dev;

			dev = &vdev->udev->dev;
though maybe
			dev = &container_of(udev, struct vhci_device, ud)->udev->dev;
would work too.

> +		}
> +		dev_warn(&dev, "Unable to start control thread\n");

		dev_warn(dev, ...)




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-06-27  4:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-27  4:35 [PATCH v3] staging: usbip: replace pr_warning() with dev_warn() navin patidar
2013-06-27  4:45 ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).