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: Dmitry Torokhov <dtor@mail.ru>
This commit is contained in:
Родитель
3108d42de4
Коммит
65cde54b8b
|
@ -324,7 +324,6 @@ struct aiptek {
|
|||
struct aiptek_settings curSetting; /* tablet's current programmable */
|
||||
struct aiptek_settings newSetting; /* ... and new param settings */
|
||||
unsigned int ifnum; /* interface number for IO */
|
||||
int openCount; /* module use counter */
|
||||
int diagnostic; /* tablet diagnostic codes */
|
||||
unsigned long eventCount; /* event count */
|
||||
int inDelay; /* jitter: in jitter delay? */
|
||||
|
@ -814,15 +813,9 @@ static int aiptek_open(struct input_dev *inputdev)
|
|||
{
|
||||
struct aiptek *aiptek = inputdev->private;
|
||||
|
||||
if (aiptek->openCount++ > 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
aiptek->urb->dev = aiptek->usbdev;
|
||||
if (usb_submit_urb(aiptek->urb, GFP_KERNEL) != 0) {
|
||||
aiptek->openCount--;
|
||||
if (usb_submit_urb(aiptek->urb, GFP_KERNEL) != 0)
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -834,9 +827,7 @@ static void aiptek_close(struct input_dev *inputdev)
|
|||
{
|
||||
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)
|
|||
AIPTEK_PACKET_LENGTH,
|
||||
aiptek->data, aiptek->data_dma);
|
||||
kfree(aiptek);
|
||||
aiptek = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -113,11 +113,11 @@
|
|||
#define DATA_BUFSIZE 63 /* size of URB data buffers */
|
||||
#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_PARM_DESC(channel_mask, "Bitmask of remote control channels to ignore");
|
||||
|
||||
static int debug = 0;
|
||||
static int debug;
|
||||
module_param(debug, int, 0444);
|
||||
MODULE_PARM_DESC(debug, "Enable extra debug messages and information");
|
||||
|
||||
|
@ -174,8 +174,6 @@ struct ati_remote {
|
|||
dma_addr_t inbuf_dma;
|
||||
dma_addr_t outbuf_dma;
|
||||
|
||||
int open; /* open counter */
|
||||
|
||||
unsigned char old_data[2]; /* Detect duplicate events */
|
||||
unsigned long old_jiffies;
|
||||
unsigned long acc_jiffies; /* handle acceleration */
|
||||
|
@ -328,25 +326,16 @@ static void ati_remote_dump(unsigned char *data, unsigned int len)
|
|||
static int ati_remote_open(struct input_dev *inputdev)
|
||||
{
|
||||
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. */
|
||||
ati_remote->irq_urb->dev = ati_remote->udev;
|
||||
if (usb_submit_urb(ati_remote->irq_urb, GFP_KERNEL)) {
|
||||
dev_err(&ati_remote->interface->dev,
|
||||
"%s: usb_submit_urb failed!\n", __FUNCTION__);
|
||||
ati_remote->open--;
|
||||
retval = -EIO;
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
exit:
|
||||
up(&disconnect_sem);
|
||||
return retval;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -356,8 +345,7 @@ static void ati_remote_close(struct input_dev *inputdev)
|
|||
{
|
||||
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)
|
|||
*/
|
||||
static void ati_remote_delete(struct ati_remote *ati_remote)
|
||||
{
|
||||
if (!ati_remote) return;
|
||||
|
||||
if (ati_remote->irq_urb)
|
||||
usb_kill_urb(ati_remote->irq_urb);
|
||||
|
||||
|
@ -799,8 +785,6 @@ static void ati_remote_disconnect(struct usb_interface *interface)
|
|||
{
|
||||
struct ati_remote *ati_remote;
|
||||
|
||||
down(&disconnect_sem);
|
||||
|
||||
ati_remote = usb_get_intfdata(interface);
|
||||
usb_set_intfdata(interface, NULL);
|
||||
if (!ati_remote) {
|
||||
|
@ -809,8 +793,6 @@ static void ati_remote_disconnect(struct usb_interface *interface)
|
|||
}
|
||||
|
||||
ati_remote_delete(ati_remote);
|
||||
|
||||
up(&disconnect_sem);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -137,15 +137,10 @@ static int itmtouch_open(struct input_dev *input)
|
|||
{
|
||||
struct itmtouch_dev *itmtouch = input->private;
|
||||
|
||||
if (itmtouch->users++)
|
||||
return 0;
|
||||
|
||||
itmtouch->readurb->dev = itmtouch->usbdev;
|
||||
|
||||
if (usb_submit_urb(itmtouch->readurb, GFP_KERNEL)) {
|
||||
itmtouch->users--;
|
||||
if (usb_submit_urb(itmtouch->readurb, GFP_KERNEL))
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -154,8 +149,7 @@ static void itmtouch_close(struct input_dev *input)
|
|||
{
|
||||
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)
|
||||
|
|
|
@ -36,7 +36,6 @@ struct kbtab {
|
|||
struct input_dev dev;
|
||||
struct usb_device *usbdev;
|
||||
struct urb *irq;
|
||||
int open;
|
||||
int x, y;
|
||||
int button;
|
||||
int pressure;
|
||||
|
@ -105,14 +104,9 @@ static int kbtab_open(struct input_dev *dev)
|
|||
{
|
||||
struct kbtab *kbtab = dev->private;
|
||||
|
||||
if (kbtab->open++)
|
||||
return 0;
|
||||
|
||||
kbtab->irq->dev = kbtab->usbdev;
|
||||
if (usb_submit_urb(kbtab->irq, GFP_KERNEL)) {
|
||||
kbtab->open--;
|
||||
if (usb_submit_urb(kbtab->irq, GFP_KERNEL))
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -121,8 +115,7 @@ static void kbtab_close(struct input_dev *dev)
|
|||
{
|
||||
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)
|
||||
|
|
|
@ -98,7 +98,6 @@ struct mtouch_usb {
|
|||
struct urb *irq;
|
||||
struct usb_device *udev;
|
||||
struct input_dev input;
|
||||
int open;
|
||||
char name[128];
|
||||
char phys[64];
|
||||
};
|
||||
|
@ -155,15 +154,10 @@ static int mtouchusb_open(struct input_dev *input)
|
|||
{
|
||||
struct mtouch_usb *mtouch = input->private;
|
||||
|
||||
if (mtouch->open++)
|
||||
return 0;
|
||||
|
||||
mtouch->irq->dev = mtouch->udev;
|
||||
|
||||
if (usb_submit_urb(mtouch->irq, GFP_ATOMIC)) {
|
||||
mtouch->open--;
|
||||
if (usb_submit_urb(mtouch->irq, GFP_ATOMIC))
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -172,8 +166,7 @@ static void mtouchusb_close(struct input_dev *input)
|
|||
{
|
||||
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)
|
||||
|
|
|
@ -69,7 +69,6 @@ struct touchkit_usb {
|
|||
struct urb *irq;
|
||||
struct usb_device *udev;
|
||||
struct input_dev input;
|
||||
int open;
|
||||
char name[128];
|
||||
char phys[64];
|
||||
};
|
||||
|
@ -134,15 +133,10 @@ static int touchkit_open(struct input_dev *input)
|
|||
{
|
||||
struct touchkit_usb *touchkit = input->private;
|
||||
|
||||
if (touchkit->open++)
|
||||
return 0;
|
||||
|
||||
touchkit->irq->dev = touchkit->udev;
|
||||
|
||||
if (usb_submit_urb(touchkit->irq, GFP_ATOMIC)) {
|
||||
touchkit->open--;
|
||||
if (usb_submit_urb(touchkit->irq, GFP_ATOMIC))
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -151,8 +145,7 @@ static void touchkit_close(struct input_dev *input)
|
|||
{
|
||||
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,
|
||||
|
|
|
@ -72,7 +72,6 @@ struct usb_kbd {
|
|||
unsigned char newleds;
|
||||
char name[128];
|
||||
char phys[64];
|
||||
int open;
|
||||
|
||||
unsigned char *new;
|
||||
struct usb_ctrlrequest *cr;
|
||||
|
@ -180,14 +179,9 @@ static int usb_kbd_open(struct input_dev *dev)
|
|||
{
|
||||
struct usb_kbd *kbd = dev->private;
|
||||
|
||||
if (kbd->open++)
|
||||
return 0;
|
||||
|
||||
kbd->irq->dev = kbd->usbdev;
|
||||
if (usb_submit_urb(kbd->irq, GFP_KERNEL)) {
|
||||
kbd->open--;
|
||||
if (usb_submit_urb(kbd->irq, GFP_KERNEL))
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -196,8 +190,7 @@ static void usb_kbd_close(struct input_dev *dev)
|
|||
{
|
||||
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)
|
||||
|
|
|
@ -51,7 +51,6 @@ struct usb_mouse {
|
|||
struct usb_device *usbdev;
|
||||
struct input_dev dev;
|
||||
struct urb *irq;
|
||||
int open;
|
||||
|
||||
signed char *data;
|
||||
dma_addr_t data_dma;
|
||||
|
@ -101,14 +100,9 @@ static int usb_mouse_open(struct input_dev *dev)
|
|||
{
|
||||
struct usb_mouse *mouse = dev->private;
|
||||
|
||||
if (mouse->open++)
|
||||
return 0;
|
||||
|
||||
mouse->irq->dev = mouse->usbdev;
|
||||
if (usb_submit_urb(mouse->irq, GFP_KERNEL)) {
|
||||
mouse->open--;
|
||||
if (usb_submit_urb(mouse->irq, GFP_KERNEL))
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -117,8 +111,7 @@ static void usb_mouse_close(struct input_dev *dev)
|
|||
{
|
||||
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)
|
||||
|
|
|
@ -102,7 +102,6 @@ struct wacom {
|
|||
struct urb *irq;
|
||||
struct wacom_features *features;
|
||||
int tool[2];
|
||||
int open;
|
||||
__u32 serial[2];
|
||||
char phys[32];
|
||||
};
|
||||
|
@ -771,14 +770,9 @@ static int wacom_open(struct input_dev *dev)
|
|||
{
|
||||
struct wacom *wacom = dev->private;
|
||||
|
||||
if (wacom->open++)
|
||||
return 0;
|
||||
|
||||
wacom->irq->dev = wacom->usbdev;
|
||||
if (usb_submit_urb(wacom->irq, GFP_KERNEL)) {
|
||||
wacom->open--;
|
||||
if (usb_submit_urb(wacom->irq, GFP_KERNEL))
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -787,8 +781,7 @@ static void wacom_close(struct input_dev *dev)
|
|||
{
|
||||
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)
|
||||
|
|
|
@ -110,7 +110,6 @@ struct usb_xpad {
|
|||
dma_addr_t idata_dma;
|
||||
|
||||
char phys[65]; /* physical device path */
|
||||
int open_count; /* reference count */
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -197,14 +196,9 @@ static int xpad_open (struct input_dev *dev)
|
|||
{
|
||||
struct usb_xpad *xpad = dev->private;
|
||||
|
||||
if (xpad->open_count++)
|
||||
return 0;
|
||||
|
||||
xpad->irq_in->dev = xpad->udev;
|
||||
if (usb_submit_urb(xpad->irq_in, GFP_KERNEL)) {
|
||||
xpad->open_count--;
|
||||
if (usb_submit_urb(xpad->irq_in, GFP_KERNEL))
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -213,8 +207,7 @@ static void xpad_close (struct input_dev *dev)
|
|||
{
|
||||
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)
|
||||
|
|
Загрузка…
Ссылка в новой задаче