* How to learn a device is open
@ 2009-11-25 16:57 Oliver Neukum
2009-11-25 20:15 ` Dmitry Torokhov
0 siblings, 1 reply; 2+ messages in thread
From: Oliver Neukum @ 2009-11-25 16:57 UTC (permalink / raw)
To: Dmitry Torokhov, linux-input, Jiri Kosina
Hi,
I need a way to determine whether an input device has been opened.
A private flag seems wasteful. Is this an acceptable method?
Regards
Oliver
+static int usbtouch_resume(struct usb_interface *intf)
+{
+ struct usbtouch_usb *usbtouch = usb_get_intfdata(intf);
+ struct input_dev *input = usbtouch->input;
+ int result = 0;
+
+ mutex_lock(&input->mutex);
+ if (input->users)
+ result = usb_submit_urb(usbtouch->irq, GFP_NOIO);
+ mutex_unlock(&input->mutex);
+ return result;
+}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: How to learn a device is open
2009-11-25 16:57 How to learn a device is open Oliver Neukum
@ 2009-11-25 20:15 ` Dmitry Torokhov
0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2009-11-25 20:15 UTC (permalink / raw)
To: Oliver Neukum; +Cc: linux-input, Jiri Kosina
Hi Oliver,
On Wed, Nov 25, 2009 at 05:57:16PM +0100, Oliver Neukum wrote:
> Hi,
>
> I need a way to determine whether an input device has been opened.
> A private flag seems wasteful. Is this an acceptable method?
>
Yes, I thhink it is reasonable. I really don't think that adding a
wrapper for input->mutex worth it but I would not oppose adding one
either.
> Regards
> Oliver
>
> +static int usbtouch_resume(struct usb_interface *intf)
> +{
> + struct usbtouch_usb *usbtouch = usb_get_intfdata(intf);
> + struct input_dev *input = usbtouch->input;
> + int result = 0;
> +
> + mutex_lock(&input->mutex);
> + if (input->users)
> + result = usb_submit_urb(usbtouch->irq, GFP_NOIO);
> + mutex_unlock(&input->mutex);
> + return result;
> +}
>
--
Dmitry
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-11-25 20:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-25 16:57 How to learn a device is open Oliver Neukum
2009-11-25 20:15 ` Dmitry Torokhov
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).