[<prev] [next>] [day] [month] [year] [list]
Message-ID: <CAPV97ycT=WF0Fy_+EZhwvCbFWvsdc1oWmHW_9iRL9xHtLhe5nQ@mail.gmail.com>
Date: Thu, 25 Jul 2013 12:31:34 +0530
From: navin patidar <navinp@...c.in>
To: Greg KH <gregkh@...uxfoundation.org>
Cc: mfm@...eddisk.com, sergei.shtylyov@...entembedded.com,
joe@...ches.com, linux-usb@...r.kernel.org,
devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4] staging: usbip: replace pr_warning() with dev_warn().
On Thu, Jul 25, 2013, Greg KH <gregkh@...uxfoundation.org> said:
> On Thu, Jul 25, 2013 at 10:19:31AM +0530, navin patidar wrote:
>> >> - 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.
>>
>> Removing '&' caused following error.
>> drivers/staging/usbip/usbip_event.c: In function ‘usbip_start_eh’:
>> drivers/staging/usbip/usbip_event.c:93:8: error: incompatible types
>> when assigning to type ‘struct device *’ from type ‘struct device’
>> drivers/staging/usbip/usbip_event.c:95:8: error: incompatible types
>> when assigning to type ‘struct device *’ from type ‘struct device’
>>
>> dev needs to be initialized with address of dev (struct device ) which
>> is member of struct usb_device pointed by the udev.
>>
>> To make it more clear i can change it to
>>
>> dev = &(container_of(ud, struct vhci_device, ud)->udev->dev);
>>
>> or
>>
>> struct vhci_device *vdev = container_of(ud, struct vhci_device, ud);
>> dev = &(vdev->udev->dev);
>
> Or perhaps:
> dev = container_of(ud, struct stub_device, ud).udev->dev;
container_of() returns stub_device pointer so "container_of(ud,
struct stub_device, ud).udev->dev" won't work.
> or ->udev.dev; I don't remember which, but that should work, right?
udev is also a pointer to usb_device structure inside stub_device structure.
->udev->dev only will work.
v4 patch gets compiled without any error or warning.
and actually Joe Perches reviewed v3 of the patch and suggested changes.
https://lkml.org/lkml/2013/6/27/15
regards,
--navin-patidar
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists