Commit 4d74063e authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] irqs: input drivers

Update the input and joystick drivers to the new IRQ API.
parent 2efd7260
......@@ -78,40 +78,38 @@ static void iforce_serio_write_wakeup(struct serio *serio)
iforce_serial_xmit((struct iforce *)serio->private);
}
static void iforce_serio_irq(struct serio *serio, unsigned char data, unsigned int flags, struct pt_regs *regs)
static irqreturn_t iforce_serio_irq(struct serio *serio,
unsigned char data, unsigned int flags, struct pt_regs *regs)
{
struct iforce* iforce = serio->private;
if (!iforce->pkt) {
if (data != 0x2b) {
return;
}
if (data == 0x2b)
iforce->pkt = 1;
return;
goto out;
}
if (!iforce->id) {
if (data > 3 && data != 0xff) {
if (data > 3 && data != 0xff)
iforce->pkt = 0;
return;
}
else
iforce->id = data;
return;
goto out;
}
if (!iforce->len) {
if (data > IFORCE_MAX_LENGTH) {
iforce->pkt = 0;
iforce->id = 0;
return;
}
} else {
iforce->len = data;
return;
}
goto out;
}
if (iforce->idx < iforce->len) {
iforce->csum += iforce->data[iforce->idx++] = data;
return;
goto out;
}
if (iforce->idx == iforce->len) {
......@@ -122,6 +120,8 @@ static void iforce_serio_irq(struct serio *serio, unsigned char data, unsigned i
iforce->idx = 0;
iforce->csum = 0;
}
out:
return IRQ_HANDLED;
}
static void iforce_serio_connect(struct serio *serio, struct serio_dev *dev)
......
......@@ -113,7 +113,8 @@ static void magellan_process_packet(struct magellan* magellan, struct pt_regs *r
input_sync(dev);
}
static void magellan_interrupt(struct serio *serio, unsigned char data, unsigned int flags, struct pt_regs *regs)
static irqreturn_t magellan_interrupt(struct serio *serio,
unsigned char data, unsigned int flags, struct pt_regs *regs)
{
struct magellan* magellan = serio->private;
......@@ -124,6 +125,7 @@ static void magellan_interrupt(struct serio *serio, unsigned char data, unsigned
if (magellan->idx < MAGELLAN_MAX_LENGTH)
magellan->data[magellan->idx++] = data;
}
return IRQ_HANDLED;
}
/*
......
......@@ -149,7 +149,8 @@ static void spaceball_process_packet(struct spaceball* spaceball, struct pt_regs
* can occur in the axis values.
*/
static void spaceball_interrupt(struct serio *serio, unsigned char data, unsigned int flags, struct pt_regs *regs)
static irqreturn_t spaceball_interrupt(struct serio *serio,
unsigned char data, unsigned int flags, struct pt_regs *regs)
{
struct spaceball *spaceball = serio->private;
......@@ -158,11 +159,11 @@ static void spaceball_interrupt(struct serio *serio, unsigned char data, unsigne
spaceball_process_packet(spaceball, regs);
spaceball->idx = 0;
spaceball->escape = 0;
return;
break;
case '^':
if (!spaceball->escape) {
spaceball->escape = 1;
return;
break;
}
spaceball->escape = 0;
case 'M':
......@@ -177,8 +178,9 @@ static void spaceball_interrupt(struct serio *serio, unsigned char data, unsigne
spaceball->escape = 0;
if (spaceball->idx < SPACEBALL_MAX_LENGTH)
spaceball->data[spaceball->idx++] = data;
return;
break;
}
return IRQ_HANDLED;
}
/*
......
......@@ -130,7 +130,8 @@ static void spaceorb_process_packet(struct spaceorb *spaceorb, struct pt_regs *r
input_sync(dev);
}
static void spaceorb_interrupt(struct serio *serio, unsigned char data, unsigned int flags, struct pt_regs *regs)
static irqreturn_t spaceorb_interrupt(struct serio *serio,
unsigned char data, unsigned int flags, struct pt_regs *regs)
{
struct spaceorb* spaceorb = serio->private;
......@@ -140,6 +141,7 @@ static void spaceorb_interrupt(struct serio *serio, unsigned char data, unsigned
}
if (spaceorb->idx < SPACEORB_MAX_LENGTH)
spaceorb->data[spaceorb->idx++] = data & 0x7f;
return IRQ_HANDLED;
}
/*
......
......@@ -98,7 +98,8 @@ static void stinger_process_packet(struct stinger *stinger, struct pt_regs *regs
* packet processing routine.
*/
static void stinger_interrupt(struct serio *serio, unsigned char data, unsigned int flags, struct pt_regs *regs)
static irqreturn_t stinger_interrupt(struct serio *serio,
unsigned char data, unsigned int flags, struct pt_regs *regs)
{
struct stinger* stinger = serio->private;
......@@ -112,7 +113,7 @@ static void stinger_interrupt(struct serio *serio, unsigned char data, unsigned
stinger->idx = 0;
}
return;
return IRQ_HANDLED;
}
/*
......
......@@ -99,7 +99,8 @@ static void warrior_process_packet(struct warrior *warrior, struct pt_regs *regs
* packet processing routine.
*/
static void warrior_interrupt(struct serio *serio, unsigned char data, unsigned int flags, struct pt_regs *regs)
static irqreturn_t warrior_interrupt(struct serio *serio,
unsigned char data, unsigned int flags, struct pt_regs *regs)
{
struct warrior* warrior = serio->private;
......@@ -117,6 +118,7 @@ static void warrior_interrupt(struct serio *serio, unsigned char data, unsigned
warrior->idx = 0;
warrior->len = 0;
}
return IRQ_HANDLED;
}
/*
......
......@@ -132,7 +132,8 @@ struct atkbd {
* the keyboard into events.
*/
static void atkbd_interrupt(struct serio *serio, unsigned char data, unsigned int flags, struct pt_regs *regs)
static irqreturn_t atkbd_interrupt(struct serio *serio, unsigned char data,
unsigned int flags, struct pt_regs *regs)
{
struct atkbd *atkbd = serio->private;
int code = data;
......@@ -145,7 +146,7 @@ static void atkbd_interrupt(struct serio *serio, unsigned char data, unsigned in
printk("atkbd.c: frame/parity error: %02x\n", flags);
serio_write(serio, ATKBD_CMD_RESEND);
atkbd->resend = 1;
return;
goto out;
}
if (!flags)
......@@ -154,34 +155,35 @@ static void atkbd_interrupt(struct serio *serio, unsigned char data, unsigned in
switch (code) {
case ATKBD_RET_ACK:
atkbd->ack = 1;
return;
goto out;
case ATKBD_RET_NAK:
atkbd->ack = -1;
return;
goto out;
}
if (atkbd->cmdcnt) {
atkbd->cmdbuf[--atkbd->cmdcnt] = code;
return;
goto out;
}
switch (atkbd->keycode[code]) {
case ATKBD_KEY_BAT:
serio_rescan(atkbd->serio);
return;
goto out;
case ATKBD_KEY_EMUL0:
atkbd->emul = 1;
return;
goto out;
case ATKBD_KEY_EMUL1:
atkbd->emul = 2;
return;
goto out;
case ATKBD_KEY_RELEASE:
atkbd->release = 1;
return;
goto out;
}
if (atkbd->emul) {
if (--atkbd->emul) return;
if (--atkbd->emul)
goto out;
code |= 0x100;
}
......@@ -199,6 +201,8 @@ static void atkbd_interrupt(struct serio *serio, unsigned char data, unsigned in
}
atkbd->release = 0;
out:
return IRQ_HANDLED;
}
/*
......
......@@ -62,7 +62,8 @@ struct nkbd {
char phys[32];
};
void nkbd_interrupt(struct serio *serio, unsigned char data, unsigned int flags, struct pt_regs *regs)
irqreturn_t nkbd_interrupt(struct serio *serio,
unsigned char data, unsigned int flags, struct pt_regs *regs)
{
struct nkbd *nkbd = serio->private;
......@@ -75,6 +76,7 @@ void nkbd_interrupt(struct serio *serio, unsigned char data, unsigned int flags,
else if (data == 0xe7) /* end of init sequence */
printk(KERN_INFO "input: %s on %s\n", nkbd_name, serio->phys);
return IRQ_HANDLED;
}
......
......@@ -89,18 +89,19 @@ struct sunkbd {
* is received.
*/
static void sunkbd_interrupt(struct serio *serio, unsigned char data, unsigned int flags, struct pt_regs *regs)
static irqreturn_t sunkbd_interrupt(struct serio *serio,
unsigned char data, unsigned int flags, struct pt_regs *regs)
{
struct sunkbd* sunkbd = serio->private;
if (sunkbd->reset <= -1) { /* If cp[i] is 0xff, sunkbd->reset will stay -1. */
sunkbd->reset = data; /* The keyboard sends 0xff 0xff 0xID on powerup */
return;
goto out;
}
if (sunkbd->layout == -1) {
sunkbd->layout = data;
return;
goto out;
}
switch (data) {
......@@ -108,14 +109,14 @@ static void sunkbd_interrupt(struct serio *serio, unsigned char data, unsigned i
case SUNKBD_RET_RESET:
schedule_work(&sunkbd->tq);
sunkbd->reset = -1;
return;
break;
case SUNKBD_RET_LAYOUT:
sunkbd->layout = -1;
return;
break;
case SUNKBD_RET_ALLUP: /* All keys released */
return;
break;
default:
if (sunkbd->keycode[data & SUNKBD_KEY]) {
......@@ -127,6 +128,8 @@ static void sunkbd_interrupt(struct serio *serio, unsigned char data, unsigned i
data & SUNKBD_KEY, data & SUNKBD_RELEASE ? "released" : "pressed");
}
}
out:
return IRQ_HANDLED;
}
/*
......
......@@ -63,14 +63,15 @@ struct xtkbd {
char phys[32];
};
void xtkbd_interrupt(struct serio *serio, unsigned char data, unsigned int flags, struct pt_regs *regs)
irqreturn_t xtkbd_interrupt(struct serio *serio,
unsigned char data, unsigned int flags, struct pt_regs *regs)
{
struct xtkbd *xtkbd = serio->private;
switch (data) {
case XTKBD_EMUL0:
case XTKBD_EMUL1:
return;
break;
default:
if (xtkbd->keycode[data & XTKBD_KEY]) {
......@@ -82,6 +83,7 @@ void xtkbd_interrupt(struct serio *serio, unsigned char data, unsigned int flags
data & XTKBD_KEY, data & XTKBD_RELEASE ? "released" : "pressed");
}
}
return IRQ_HANDLED;
}
void xtkbd_connect(struct serio *serio, struct serio_dev *dev)
......
......@@ -85,7 +85,7 @@ MODULE_PARM(inport_irq, "i");
static int inport_irq = INPORT_IRQ;
static int inport_used = 0;
static void inport_interrupt(int irq, void *dev_id, struct pt_regs *regs);
static irqreturn_t inport_interrupt(int irq, void *dev_id, struct pt_regs *regs);
static int inport_open(struct input_dev *dev)
{
......@@ -124,7 +124,7 @@ static struct input_dev inport_dev = {
},
};
static void inport_interrupt(int irq, void *dev_id, struct pt_regs *regs)
static irqreturn_t inport_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
unsigned char buttons;
......@@ -150,6 +150,7 @@ static void inport_interrupt(int irq, void *dev_id, struct pt_regs *regs)
outb(INPORT_MODE_IRQ | INPORT_MODE_BASE, INPORT_DATA_PORT);
input_sync(&inport_dev);
return IRQ_HANDLED;
}
#ifndef MODULE
......
......@@ -75,7 +75,7 @@ MODULE_PARM(logibm_irq, "i");
static int logibm_irq = LOGIBM_IRQ;
static int logibm_used = 0;
static void logibm_interrupt(int irq, void *dev_id, struct pt_regs *regs);
static irqreturn_t logibm_interrupt(int irq, void *dev_id, struct pt_regs *regs);
static int logibm_open(struct input_dev *dev)
{
......@@ -114,7 +114,7 @@ static struct input_dev logibm_dev = {
},
};
static void logibm_interrupt(int irq, void *dev_id, struct pt_regs *regs)
static irqreturn_t logibm_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
char dx, dy;
unsigned char buttons;
......@@ -139,6 +139,7 @@ static void logibm_interrupt(int irq, void *dev_id, struct pt_regs *regs)
input_sync(&logibm_dev);
outb(LOGIBM_ENABLE_IRQ, LOGIBM_CONTROL_PORT);
return IRQ_HANDLED;
}
#ifndef MODULE
......
......@@ -60,7 +60,7 @@ static int pc110pad_used;
static char *pc110pad_name = "IBM PC110 TouchPad";
static char *pc110pad_phys = "isa15e0/input0";
static void pc110pad_interrupt(int irq, void *ptr, struct pt_regs *regs)
static irqreturn_t pc110pad_interrupt(int irq, void *ptr, struct pt_regs *regs)
{
int value = inb_p(pc110pad_io);
int handshake = inb_p(pc110pad_io + 2);
......@@ -83,6 +83,7 @@ static void pc110pad_interrupt(int irq, void *ptr, struct pt_regs *regs)
input_sync(&pc110pad_dev);
pc110pad_count = 0;
return IRQ_HANDLED;
}
static void pc110pad_close(struct input_dev *dev)
......
......@@ -167,7 +167,8 @@ static void psmouse_process_packet(struct psmouse *psmouse, struct pt_regs *regs
* packets or passing them to the command routine as command output.
*/
static void psmouse_interrupt(struct serio *serio, unsigned char data, unsigned int flags, struct pt_regs *regs)
static irqreturn_t psmouse_interrupt(struct serio *serio,
unsigned char data, unsigned int flags, struct pt_regs *regs)
{
struct psmouse *psmouse = serio->private;
......@@ -186,12 +187,12 @@ static void psmouse_interrupt(struct serio *serio, unsigned char data, unsigned
break;
}
psmouse->acking = 0;
return;
goto out;
}
if (psmouse->cmdcnt) {
psmouse->cmdbuf[--psmouse->cmdcnt] = data;
return;
goto out;
}
if (psmouse->pktcnt && time_after(jiffies, psmouse->last + HZ/2)) {
......@@ -205,13 +206,15 @@ static void psmouse_interrupt(struct serio *serio, unsigned char data, unsigned
if (psmouse->pktcnt == 3 + (psmouse->type >= PSMOUSE_GENPS)) {
psmouse_process_packet(psmouse, regs);
psmouse->pktcnt = 0;
return;
goto out;
}
if (psmouse->pktcnt == 1 && psmouse->packet[0] == PSMOUSE_RET_BAT) {
serio_rescan(serio);
return;
goto out;
}
out:
return IRQ_HANDLED;
}
/*
......
......@@ -204,7 +204,8 @@ static void sermouse_process_ms(struct sermouse *sermouse, signed char data, str
* packets or passing them to the command routine as command output.
*/
static void sermouse_interrupt(struct serio *serio, unsigned char data, unsigned int flags, struct pt_regs *regs)
static irqreturn_t sermouse_interrupt(struct serio *serio,
unsigned char data, unsigned int flags, struct pt_regs *regs)
{
struct sermouse *sermouse = serio->private;
......@@ -215,6 +216,7 @@ static void sermouse_interrupt(struct serio *serio, unsigned char data, unsigned
sermouse_process_ms(sermouse, data, regs);
else
sermouse_process_msc(sermouse, data, regs);
return IRQ_HANDLED;
}
/*
......
......@@ -64,7 +64,7 @@ static char ct82c710_phys[16];
static int ct82c710_data;
static int ct82c710_status;
static void ct82c710_interrupt(int cpl, void *dev_id, struct pt_regs * regs);
static irqreturn_t ct82c710_interrupt(int cpl, void *dev_id, struct pt_regs * regs);
/*
* Wait for device to send output char and flush any input char.
......@@ -154,9 +154,9 @@ static struct serio ct82c710_port =
* is waiting in the 82C710.
*/
static void ct82c710_interrupt(int cpl, void *dev_id, struct pt_regs * regs)
static irqreturn_t ct82c710_interrupt(int cpl, void *dev_id, struct pt_regs * regs)
{
serio_interrupt(&ct82c710_port, inb(ct82c710_data), 0, regs);
return serio_interrupt(&ct82c710_port, inb(ct82c710_data), 0, regs);
}
/*
......
......@@ -135,13 +135,20 @@ void serio_rescan(struct serio *serio)
wake_up(&serio_wait);
}
void serio_interrupt(struct serio *serio, unsigned char data, unsigned int flags, struct pt_regs *regs)
irqreturn_t serio_interrupt(struct serio *serio,
unsigned char data, unsigned int flags, struct pt_regs *regs)
{
if (serio->dev && serio->dev->interrupt)
serio->dev->interrupt(serio, data, flags, regs);
else
if (!flags)
irqreturn_t ret = IRQ_NONE;
if (serio->dev && serio->dev->interrupt) {
ret = serio->dev->interrupt(serio, data, flags, regs);
} else {
if (!flags) {
serio_rescan(serio);
ret = IRQ_HANDLED;
}
}
return ret;
}
void serio_register_port(struct serio *serio)
......
......@@ -78,7 +78,8 @@ static void gunze_process_packet(struct gunze* gunze, struct pt_regs *regs)
input_sync(dev);
}
static void gunze_interrupt(struct serio *serio, unsigned char data, unsigned int flags, struct pt_regs *regs)
static irqreturn_t gunze_interrupt(struct serio *serio,
unsigned char data, unsigned int flags, struct pt_regs *regs)
{
struct gunze* gunze = serio->private;
......@@ -89,6 +90,7 @@ static void gunze_interrupt(struct serio *serio, unsigned char data, unsigned in
if (gunze->idx < GUNZE_MAX_LENGTH)
gunze->data[gunze->idx++] = data;
}
return IRQ_HANDLED;
}
/*
......
......@@ -10,6 +10,7 @@
*/
#include <linux/ioctl.h>
#include <linux/interrupt.h>
#define SPIOCSTYPE _IOW('q', 0x01, unsigned long)
......@@ -50,7 +51,8 @@ struct serio_dev {
char *name;
void (*write_wakeup)(struct serio *);
void (*interrupt)(struct serio *, unsigned char, unsigned int, struct pt_regs *);
irqreturn_t (*interrupt)(struct serio *, unsigned char,
unsigned int, struct pt_regs *);
void (*connect)(struct serio *, struct serio_dev *dev);
void (*disconnect)(struct serio *);
void (*cleanup)(struct serio *);
......@@ -61,7 +63,7 @@ struct serio_dev {
int serio_open(struct serio *serio, struct serio_dev *dev);
void serio_close(struct serio *serio);
void serio_rescan(struct serio *serio);
void serio_interrupt(struct serio *serio, unsigned char data, unsigned int flags, struct pt_regs *regs);
irqreturn_t serio_interrupt(struct serio *serio, unsigned char data, unsigned int flags, struct pt_regs *regs);
void serio_register_port(struct serio *serio);
void serio_unregister_port(struct serio *serio);
......
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