[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.44L0.1403131017430.1292-100000@iolanthe.rowland.org>
Date: Thu, 13 Mar 2014 10:20:07 -0400 (EDT)
From: Alan Stern <stern@...land.harvard.edu>
To: Jagdish Gedia <jvgediya@...il.com>
cc: "linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: Check if usb device is suspended
On Thu, 13 Mar 2014, Jagdish Gedia wrote:
> Hi,
> I want to check in my driver if usb device is suspended or not?
Why do you need to check? Your driver gets told every time the device
suspends and every time it resumes. Therefore it should already know
the answer.
> currently i am doing it like
>
> if(udev->state==USB_STATE_SUSPENDED)
>
> Is this the proper way? Is this enough?
Aside from the fact that the device's state may change immediately
after you make this test, as Oliver pointed out, you also should
realize that this test might not give the correct answer if the device
is in the middle of suspending or resuming when the test runs.
Alan Stern
--
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