From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Oliver Neukum <oliver@neukum.org>
Cc: linux-input@vger.kernel.org, Jiri Kosina <jkosina@suse.cz>
Subject: Re: How to learn a device is open
Date: Wed, 25 Nov 2009 12:15:53 -0800 [thread overview]
Message-ID: <20091125201553.GA20732@core.coreip.homeip.net> (raw)
In-Reply-To: <200911251757.17009.oliver@neukum.org>
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
prev parent reply other threads:[~2009-11-25 20:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-25 16:57 How to learn a device is open Oliver Neukum
2009-11-25 20:15 ` Dmitry Torokhov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091125201553.GA20732@core.coreip.homeip.net \
--to=dmitry.torokhov@gmail.com \
--cc=jkosina@suse.cz \
--cc=linux-input@vger.kernel.org \
--cc=oliver@neukum.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).