Re: Delivery Status Notification (Failure)

From: Alan Stern
Date: Thu Mar 06 2014 - 10:25:51 EST


On Thu, 6 Mar 2014, Jagdish Gedia wrote:

> Hi Alan,
>
> Thanks for you informative reply.
> I will try your suggestion. yes, i will not get more than one wakeup per second.
>
> I have tried below things.
> My usb device is using the cdc-acm.c driver.
>
> inside cdc-acm.c file,
>
> static struct usb_device *usb_device;
>
> static int acm_probe(........, ....)
> {
> usb_device = interface_to_usbdev(intf);
> ..........
> }
>
> inside interrupt handler
>
> static irqhandle_t int_handler(..., ..)
> {
> usb_lock_device(usb_device);
> usb_remote_wakeup(usb_device);
> usb_unlock_device(usb_device);
> return IRQ_HANDLED;
> }
>
> but these things are not working. kernel is crashing when interrupt occurs.

Because you didn't do what I said: Call pm_request_resume. Not
usb_remote_wakeup.

> I have some other doubt also.
>
> 1. If usb is runtime suspended and if global suspend happens , do i
> need to do anything special to wakeup the usb device?

No.

> 2. How can i address particularly my usb device. right now, i am using
> usb_device = interface_to_usbdev(intf) to get pointer to my usb device
> inside probe function,

That's a perfectly good way to do it. Lots of other drivers do the
same thing.

> but probe function is getting called for every
> interface of the device. Is there any other way through which i can
> get the pointer to my usb device like i can traverse all the available
> usb device and on basis of vendor and product id i can address my usb
> device or by any other way?

You can't get the device pointer unless you have something to start
from. For example, if you already have an interface pointer then you
can use interface_to_usbdev.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/