Re: How to learn a device is open

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux