/* serialize access to open/suspend */
struct mutex pm_mutex;
+ bool is_open;
char name[128];
char phys[64];
if (error)
goto err_kill_urb;
+ pegasus->is_open = true;
mutex_unlock(&pegasus->pm_mutex);
return 0;
mutex_lock(&pegasus->pm_mutex);
usb_kill_urb(pegasus->irq);
cancel_work_sync(&pegasus->init);
+ pegasus->is_open = false;
mutex_unlock(&pegasus->pm_mutex);
usb_autopm_put_interface(pegasus->intf);
int retval = 0;
mutex_lock(&pegasus->pm_mutex);
- if (pegasus->dev->users && usb_submit_urb(pegasus->irq, GFP_NOIO) < 0)
+ if (pegasus->is_open && usb_submit_urb(pegasus->irq, GFP_NOIO) < 0)
retval = -EIO;
mutex_unlock(&pegasus->pm_mutex);
int retval = 0;
mutex_lock(&pegasus->pm_mutex);
- if (pegasus->dev->users) {
+ if (pegasus->is_open) {
retval = pegasus_set_mode(pegasus, PEN_MODE_XY,
NOTETAKER_LED_MOUSE);
if (!retval && usb_submit_urb(pegasus->irq, GFP_NOIO) < 0)