aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/mouse/inport.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/mouse/inport.c')
-rw-r--r--drivers/input/mouse/inport.c38
1 files changed, 16 insertions, 22 deletions
diff --git a/drivers/input/mouse/inport.c b/drivers/input/mouse/inport.c
index ca4e96886627..1f62c0134010 100644
--- a/drivers/input/mouse/inport.c
+++ b/drivers/input/mouse/inport.c
@@ -17,18 +17,18 @@
17/* 17/*
18 * This program is free software; you can redistribute it and/or modify 18 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by 19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation; either version 2 of the License, or 20 * the Free Software Foundation; either version 2 of the License, or
21 * (at your option) any later version. 21 * (at your option) any later version.
22 * 22 *
23 * This program is distributed in the hope that it will be useful, 23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of 24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details. 26 * GNU General Public License for more details.
27 * 27 *
28 * You should have received a copy of the GNU General Public License 28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software 29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31 * 31 *
32 * Should you need to contact me, the author, you can do so either by 32 * Should you need to contact me, the author, you can do so either by
33 * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail: 33 * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
34 * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic 34 * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
@@ -87,29 +87,23 @@ MODULE_PARM_DESC(irq, "IRQ number (5=default)");
87 87
88__obsolete_setup("inport_irq="); 88__obsolete_setup("inport_irq=");
89 89
90static int inport_used;
91
92static irqreturn_t inport_interrupt(int irq, void *dev_id, struct pt_regs *regs); 90static irqreturn_t inport_interrupt(int irq, void *dev_id, struct pt_regs *regs);
93 91
94static int inport_open(struct input_dev *dev) 92static int inport_open(struct input_dev *dev)
95{ 93{
96 if (!inport_used++) { 94 if (request_irq(inport_irq, inport_interrupt, 0, "inport", NULL))
97 if (request_irq(inport_irq, inport_interrupt, 0, "inport", NULL)) 95 return -EBUSY;
98 return -EBUSY; 96 outb(INPORT_REG_MODE, INPORT_CONTROL_PORT);
99 outb(INPORT_REG_MODE, INPORT_CONTROL_PORT); 97 outb(INPORT_MODE_IRQ | INPORT_MODE_BASE, INPORT_DATA_PORT);
100 outb(INPORT_MODE_IRQ | INPORT_MODE_BASE, INPORT_DATA_PORT);
101 }
102 98
103 return 0; 99 return 0;
104} 100}
105 101
106static void inport_close(struct input_dev *dev) 102static void inport_close(struct input_dev *dev)
107{ 103{
108 if (!--inport_used) { 104 outb(INPORT_REG_MODE, INPORT_CONTROL_PORT);
109 outb(INPORT_REG_MODE, INPORT_CONTROL_PORT); 105 outb(INPORT_MODE_BASE, INPORT_DATA_PORT);
110 outb(INPORT_MODE_BASE, INPORT_DATA_PORT); 106 free_irq(inport_irq, NULL);
111 free_irq(inport_irq, NULL);
112 }
113} 107}
114 108
115static struct input_dev inport_dev = { 109static struct input_dev inport_dev = {
@@ -120,11 +114,11 @@ static struct input_dev inport_dev = {
120 .close = inport_close, 114 .close = inport_close,
121 .name = INPORT_NAME, 115 .name = INPORT_NAME,
122 .phys = "isa023c/input0", 116 .phys = "isa023c/input0",
123 .id = { 117 .id = {
124 .bustype = BUS_ISA, 118 .bustype = BUS_ISA,
125 .vendor = INPORT_VENDOR, 119 .vendor = INPORT_VENDOR,
126 .product = 0x0001, 120 .product = 0x0001,
127 .version = 0x0100, 121 .version = 0x0100,
128 }, 122 },
129}; 123};
130 124