Commit 65cde54b authored by Dmitry Torokhov's avatar Dmitry Torokhov

Input: remove user counters from drivers/usb/input since input

       core takes care of calling open and close methods only
       when needed.
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent 3108d42d
...@@ -324,7 +324,6 @@ struct aiptek { ...@@ -324,7 +324,6 @@ struct aiptek {
struct aiptek_settings curSetting; /* tablet's current programmable */ struct aiptek_settings curSetting; /* tablet's current programmable */
struct aiptek_settings newSetting; /* ... and new param settings */ struct aiptek_settings newSetting; /* ... and new param settings */
unsigned int ifnum; /* interface number for IO */ unsigned int ifnum; /* interface number for IO */
int openCount; /* module use counter */
int diagnostic; /* tablet diagnostic codes */ int diagnostic; /* tablet diagnostic codes */
unsigned long eventCount; /* event count */ unsigned long eventCount; /* event count */
int inDelay; /* jitter: in jitter delay? */ int inDelay; /* jitter: in jitter delay? */
...@@ -814,15 +813,9 @@ static int aiptek_open(struct input_dev *inputdev) ...@@ -814,15 +813,9 @@ static int aiptek_open(struct input_dev *inputdev)
{ {
struct aiptek *aiptek = inputdev->private; struct aiptek *aiptek = inputdev->private;
if (aiptek->openCount++ > 0) {
return 0;
}
aiptek->urb->dev = aiptek->usbdev; aiptek->urb->dev = aiptek->usbdev;
if (usb_submit_urb(aiptek->urb, GFP_KERNEL) != 0) { if (usb_submit_urb(aiptek->urb, GFP_KERNEL) != 0)
aiptek->openCount--;
return -EIO; return -EIO;
}
return 0; return 0;
} }
...@@ -834,9 +827,7 @@ static void aiptek_close(struct input_dev *inputdev) ...@@ -834,9 +827,7 @@ static void aiptek_close(struct input_dev *inputdev)
{ {
struct aiptek *aiptek = inputdev->private; struct aiptek *aiptek = inputdev->private;
if (--aiptek->openCount == 0) { usb_kill_urb(aiptek->urb);
usb_kill_urb(aiptek->urb);
}
} }
/*********************************************************************** /***********************************************************************
...@@ -2252,7 +2243,6 @@ static void aiptek_disconnect(struct usb_interface *intf) ...@@ -2252,7 +2243,6 @@ static void aiptek_disconnect(struct usb_interface *intf)
AIPTEK_PACKET_LENGTH, AIPTEK_PACKET_LENGTH,
aiptek->data, aiptek->data_dma); aiptek->data, aiptek->data_dma);
kfree(aiptek); kfree(aiptek);
aiptek = NULL;
} }
} }
......
...@@ -113,11 +113,11 @@ ...@@ -113,11 +113,11 @@
#define DATA_BUFSIZE 63 /* size of URB data buffers */ #define DATA_BUFSIZE 63 /* size of URB data buffers */
#define ATI_INPUTNUM 1 /* Which input device to register as */ #define ATI_INPUTNUM 1 /* Which input device to register as */
static unsigned long channel_mask = 0; static unsigned long channel_mask;
module_param(channel_mask, ulong, 0444); module_param(channel_mask, ulong, 0444);
MODULE_PARM_DESC(channel_mask, "Bitmask of remote control channels to ignore"); MODULE_PARM_DESC(channel_mask, "Bitmask of remote control channels to ignore");
static int debug = 0; static int debug;
module_param(debug, int, 0444); module_param(debug, int, 0444);
MODULE_PARM_DESC(debug, "Enable extra debug messages and information"); MODULE_PARM_DESC(debug, "Enable extra debug messages and information");
...@@ -174,8 +174,6 @@ struct ati_remote { ...@@ -174,8 +174,6 @@ struct ati_remote {
dma_addr_t inbuf_dma; dma_addr_t inbuf_dma;
dma_addr_t outbuf_dma; dma_addr_t outbuf_dma;
int open; /* open counter */
unsigned char old_data[2]; /* Detect duplicate events */ unsigned char old_data[2]; /* Detect duplicate events */
unsigned long old_jiffies; unsigned long old_jiffies;
unsigned long acc_jiffies; /* handle acceleration */ unsigned long acc_jiffies; /* handle acceleration */
...@@ -328,25 +326,16 @@ static void ati_remote_dump(unsigned char *data, unsigned int len) ...@@ -328,25 +326,16 @@ static void ati_remote_dump(unsigned char *data, unsigned int len)
static int ati_remote_open(struct input_dev *inputdev) static int ati_remote_open(struct input_dev *inputdev)
{ {
struct ati_remote *ati_remote = inputdev->private; struct ati_remote *ati_remote = inputdev->private;
int retval = 0;
down(&disconnect_sem);
if (ati_remote->open++)
goto exit;
/* On first open, submit the read urb which was set up previously. */ /* On first open, submit the read urb which was set up previously. */
ati_remote->irq_urb->dev = ati_remote->udev; ati_remote->irq_urb->dev = ati_remote->udev;
if (usb_submit_urb(ati_remote->irq_urb, GFP_KERNEL)) { if (usb_submit_urb(ati_remote->irq_urb, GFP_KERNEL)) {
dev_err(&ati_remote->interface->dev, dev_err(&ati_remote->interface->dev,
"%s: usb_submit_urb failed!\n", __FUNCTION__); "%s: usb_submit_urb failed!\n", __FUNCTION__);
ati_remote->open--; return -EIO;
retval = -EIO;
} }
exit: return 0;
up(&disconnect_sem);
return retval;
} }
/* /*
...@@ -356,8 +345,7 @@ static void ati_remote_close(struct input_dev *inputdev) ...@@ -356,8 +345,7 @@ static void ati_remote_close(struct input_dev *inputdev)
{ {
struct ati_remote *ati_remote = inputdev->private; struct ati_remote *ati_remote = inputdev->private;
if (!--ati_remote->open) usb_kill_urb(ati_remote->irq_urb);
usb_kill_urb(ati_remote->irq_urb);
} }
/* /*
...@@ -602,8 +590,6 @@ static void ati_remote_irq_in(struct urb *urb, struct pt_regs *regs) ...@@ -602,8 +590,6 @@ static void ati_remote_irq_in(struct urb *urb, struct pt_regs *regs)
*/ */
static void ati_remote_delete(struct ati_remote *ati_remote) static void ati_remote_delete(struct ati_remote *ati_remote)
{ {
if (!ati_remote) return;
if (ati_remote->irq_urb) if (ati_remote->irq_urb)
usb_kill_urb(ati_remote->irq_urb); usb_kill_urb(ati_remote->irq_urb);
...@@ -799,8 +785,6 @@ static void ati_remote_disconnect(struct usb_interface *interface) ...@@ -799,8 +785,6 @@ static void ati_remote_disconnect(struct usb_interface *interface)
{ {
struct ati_remote *ati_remote; struct ati_remote *ati_remote;
down(&disconnect_sem);
ati_remote = usb_get_intfdata(interface); ati_remote = usb_get_intfdata(interface);
usb_set_intfdata(interface, NULL); usb_set_intfdata(interface, NULL);
if (!ati_remote) { if (!ati_remote) {
...@@ -809,8 +793,6 @@ static void ati_remote_disconnect(struct usb_interface *interface) ...@@ -809,8 +793,6 @@ static void ati_remote_disconnect(struct usb_interface *interface)
} }
ati_remote_delete(ati_remote); ati_remote_delete(ati_remote);
up(&disconnect_sem);
} }
/* /*
......
...@@ -137,15 +137,10 @@ static int itmtouch_open(struct input_dev *input) ...@@ -137,15 +137,10 @@ static int itmtouch_open(struct input_dev *input)
{ {
struct itmtouch_dev *itmtouch = input->private; struct itmtouch_dev *itmtouch = input->private;
if (itmtouch->users++)
return 0;
itmtouch->readurb->dev = itmtouch->usbdev; itmtouch->readurb->dev = itmtouch->usbdev;
if (usb_submit_urb(itmtouch->readurb, GFP_KERNEL)) { if (usb_submit_urb(itmtouch->readurb, GFP_KERNEL))
itmtouch->users--;
return -EIO; return -EIO;
}
return 0; return 0;
} }
...@@ -154,8 +149,7 @@ static void itmtouch_close(struct input_dev *input) ...@@ -154,8 +149,7 @@ static void itmtouch_close(struct input_dev *input)
{ {
struct itmtouch_dev *itmtouch = input->private; struct itmtouch_dev *itmtouch = input->private;
if (!--itmtouch->users) usb_kill_urb(itmtouch->readurb);
usb_kill_urb(itmtouch->readurb);
} }
static int itmtouch_probe(struct usb_interface *intf, const struct usb_device_id *id) static int itmtouch_probe(struct usb_interface *intf, const struct usb_device_id *id)
......
...@@ -36,7 +36,6 @@ struct kbtab { ...@@ -36,7 +36,6 @@ struct kbtab {
struct input_dev dev; struct input_dev dev;
struct usb_device *usbdev; struct usb_device *usbdev;
struct urb *irq; struct urb *irq;
int open;
int x, y; int x, y;
int button; int button;
int pressure; int pressure;
...@@ -105,14 +104,9 @@ static int kbtab_open(struct input_dev *dev) ...@@ -105,14 +104,9 @@ static int kbtab_open(struct input_dev *dev)
{ {
struct kbtab *kbtab = dev->private; struct kbtab *kbtab = dev->private;
if (kbtab->open++)
return 0;
kbtab->irq->dev = kbtab->usbdev; kbtab->irq->dev = kbtab->usbdev;
if (usb_submit_urb(kbtab->irq, GFP_KERNEL)) { if (usb_submit_urb(kbtab->irq, GFP_KERNEL))
kbtab->open--;
return -EIO; return -EIO;
}
return 0; return 0;
} }
...@@ -121,8 +115,7 @@ static void kbtab_close(struct input_dev *dev) ...@@ -121,8 +115,7 @@ static void kbtab_close(struct input_dev *dev)
{ {
struct kbtab *kbtab = dev->private; struct kbtab *kbtab = dev->private;
if (!--kbtab->open) usb_kill_urb(kbtab->irq);
usb_kill_urb(kbtab->irq);
} }
static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *id) static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *id)
......
...@@ -98,7 +98,6 @@ struct mtouch_usb { ...@@ -98,7 +98,6 @@ struct mtouch_usb {
struct urb *irq; struct urb *irq;
struct usb_device *udev; struct usb_device *udev;
struct input_dev input; struct input_dev input;
int open;
char name[128]; char name[128];
char phys[64]; char phys[64];
}; };
...@@ -155,15 +154,10 @@ static int mtouchusb_open(struct input_dev *input) ...@@ -155,15 +154,10 @@ static int mtouchusb_open(struct input_dev *input)
{ {
struct mtouch_usb *mtouch = input->private; struct mtouch_usb *mtouch = input->private;
if (mtouch->open++)
return 0;
mtouch->irq->dev = mtouch->udev; mtouch->irq->dev = mtouch->udev;
if (usb_submit_urb(mtouch->irq, GFP_ATOMIC)) { if (usb_submit_urb(mtouch->irq, GFP_ATOMIC))
mtouch->open--;
return -EIO; return -EIO;
}
return 0; return 0;
} }
...@@ -172,8 +166,7 @@ static void mtouchusb_close(struct input_dev *input) ...@@ -172,8 +166,7 @@ static void mtouchusb_close(struct input_dev *input)
{ {
struct mtouch_usb *mtouch = input->private; struct mtouch_usb *mtouch = input->private;
if (!--mtouch->open) usb_kill_urb(mtouch->irq);
usb_kill_urb(mtouch->irq);
} }
static int mtouchusb_alloc_buffers(struct usb_device *udev, struct mtouch_usb *mtouch) static int mtouchusb_alloc_buffers(struct usb_device *udev, struct mtouch_usb *mtouch)
......
...@@ -69,7 +69,6 @@ struct touchkit_usb { ...@@ -69,7 +69,6 @@ struct touchkit_usb {
struct urb *irq; struct urb *irq;
struct usb_device *udev; struct usb_device *udev;
struct input_dev input; struct input_dev input;
int open;
char name[128]; char name[128];
char phys[64]; char phys[64];
}; };
...@@ -134,15 +133,10 @@ static int touchkit_open(struct input_dev *input) ...@@ -134,15 +133,10 @@ static int touchkit_open(struct input_dev *input)
{ {
struct touchkit_usb *touchkit = input->private; struct touchkit_usb *touchkit = input->private;
if (touchkit->open++)
return 0;
touchkit->irq->dev = touchkit->udev; touchkit->irq->dev = touchkit->udev;
if (usb_submit_urb(touchkit->irq, GFP_ATOMIC)) { if (usb_submit_urb(touchkit->irq, GFP_ATOMIC))
touchkit->open--;
return -EIO; return -EIO;
}
return 0; return 0;
} }
...@@ -151,8 +145,7 @@ static void touchkit_close(struct input_dev *input) ...@@ -151,8 +145,7 @@ static void touchkit_close(struct input_dev *input)
{ {
struct touchkit_usb *touchkit = input->private; struct touchkit_usb *touchkit = input->private;
if (!--touchkit->open) usb_kill_urb(touchkit->irq);
usb_kill_urb(touchkit->irq);
} }
static int touchkit_alloc_buffers(struct usb_device *udev, static int touchkit_alloc_buffers(struct usb_device *udev,
......
...@@ -72,7 +72,6 @@ struct usb_kbd { ...@@ -72,7 +72,6 @@ struct usb_kbd {
unsigned char newleds; unsigned char newleds;
char name[128]; char name[128];
char phys[64]; char phys[64];
int open;
unsigned char *new; unsigned char *new;
struct usb_ctrlrequest *cr; struct usb_ctrlrequest *cr;
...@@ -180,14 +179,9 @@ static int usb_kbd_open(struct input_dev *dev) ...@@ -180,14 +179,9 @@ static int usb_kbd_open(struct input_dev *dev)
{ {
struct usb_kbd *kbd = dev->private; struct usb_kbd *kbd = dev->private;
if (kbd->open++)
return 0;
kbd->irq->dev = kbd->usbdev; kbd->irq->dev = kbd->usbdev;
if (usb_submit_urb(kbd->irq, GFP_KERNEL)) { if (usb_submit_urb(kbd->irq, GFP_KERNEL))
kbd->open--;
return -EIO; return -EIO;
}
return 0; return 0;
} }
...@@ -196,8 +190,7 @@ static void usb_kbd_close(struct input_dev *dev) ...@@ -196,8 +190,7 @@ static void usb_kbd_close(struct input_dev *dev)
{ {
struct usb_kbd *kbd = dev->private; struct usb_kbd *kbd = dev->private;
if (!--kbd->open) usb_kill_urb(kbd->irq);
usb_kill_urb(kbd->irq);
} }
static int usb_kbd_alloc_mem(struct usb_device *dev, struct usb_kbd *kbd) static int usb_kbd_alloc_mem(struct usb_device *dev, struct usb_kbd *kbd)
......
...@@ -51,7 +51,6 @@ struct usb_mouse { ...@@ -51,7 +51,6 @@ struct usb_mouse {
struct usb_device *usbdev; struct usb_device *usbdev;
struct input_dev dev; struct input_dev dev;
struct urb *irq; struct urb *irq;
int open;
signed char *data; signed char *data;
dma_addr_t data_dma; dma_addr_t data_dma;
...@@ -101,14 +100,9 @@ static int usb_mouse_open(struct input_dev *dev) ...@@ -101,14 +100,9 @@ static int usb_mouse_open(struct input_dev *dev)
{ {
struct usb_mouse *mouse = dev->private; struct usb_mouse *mouse = dev->private;
if (mouse->open++)
return 0;
mouse->irq->dev = mouse->usbdev; mouse->irq->dev = mouse->usbdev;
if (usb_submit_urb(mouse->irq, GFP_KERNEL)) { if (usb_submit_urb(mouse->irq, GFP_KERNEL))
mouse->open--;
return -EIO; return -EIO;
}
return 0; return 0;
} }
...@@ -117,8 +111,7 @@ static void usb_mouse_close(struct input_dev *dev) ...@@ -117,8 +111,7 @@ static void usb_mouse_close(struct input_dev *dev)
{ {
struct usb_mouse *mouse = dev->private; struct usb_mouse *mouse = dev->private;
if (!--mouse->open) usb_kill_urb(mouse->irq);
usb_kill_urb(mouse->irq);
} }
static int usb_mouse_probe(struct usb_interface * intf, const struct usb_device_id * id) static int usb_mouse_probe(struct usb_interface * intf, const struct usb_device_id * id)
......
...@@ -102,7 +102,6 @@ struct wacom { ...@@ -102,7 +102,6 @@ struct wacom {
struct urb *irq; struct urb *irq;
struct wacom_features *features; struct wacom_features *features;
int tool[2]; int tool[2];
int open;
__u32 serial[2]; __u32 serial[2];
char phys[32]; char phys[32];
}; };
...@@ -771,14 +770,9 @@ static int wacom_open(struct input_dev *dev) ...@@ -771,14 +770,9 @@ static int wacom_open(struct input_dev *dev)
{ {
struct wacom *wacom = dev->private; struct wacom *wacom = dev->private;
if (wacom->open++)
return 0;
wacom->irq->dev = wacom->usbdev; wacom->irq->dev = wacom->usbdev;
if (usb_submit_urb(wacom->irq, GFP_KERNEL)) { if (usb_submit_urb(wacom->irq, GFP_KERNEL))
wacom->open--;
return -EIO; return -EIO;
}
return 0; return 0;
} }
...@@ -787,8 +781,7 @@ static void wacom_close(struct input_dev *dev) ...@@ -787,8 +781,7 @@ static void wacom_close(struct input_dev *dev)
{ {
struct wacom *wacom = dev->private; struct wacom *wacom = dev->private;
if (!--wacom->open) usb_kill_urb(wacom->irq);
usb_kill_urb(wacom->irq);
} }
static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *id) static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *id)
......
...@@ -110,7 +110,6 @@ struct usb_xpad { ...@@ -110,7 +110,6 @@ struct usb_xpad {
dma_addr_t idata_dma; dma_addr_t idata_dma;
char phys[65]; /* physical device path */ char phys[65]; /* physical device path */
int open_count; /* reference count */
}; };
/* /*
...@@ -197,14 +196,9 @@ static int xpad_open (struct input_dev *dev) ...@@ -197,14 +196,9 @@ static int xpad_open (struct input_dev *dev)
{ {
struct usb_xpad *xpad = dev->private; struct usb_xpad *xpad = dev->private;
if (xpad->open_count++)
return 0;
xpad->irq_in->dev = xpad->udev; xpad->irq_in->dev = xpad->udev;
if (usb_submit_urb(xpad->irq_in, GFP_KERNEL)) { if (usb_submit_urb(xpad->irq_in, GFP_KERNEL))
xpad->open_count--;
return -EIO; return -EIO;
}
return 0; return 0;
} }
...@@ -213,8 +207,7 @@ static void xpad_close (struct input_dev *dev) ...@@ -213,8 +207,7 @@ static void xpad_close (struct input_dev *dev)
{ {
struct usb_xpad *xpad = dev->private; struct usb_xpad *xpad = dev->private;
if (!--xpad->open_count) usb_kill_urb(xpad->irq_in);
usb_kill_urb(xpad->irq_in);
} }
static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id) static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment