diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1998-03-17 22:05:47 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 1998-03-17 22:05:47 +0000 |
commit | 27cfca1ec98e91261b1a5355d10a8996464b63af (patch) | |
tree | 8e895a53e372fa682b4c0a585b9377d67ed70d0e /drivers/char/amigamouse.c | |
parent | 6a76fb7214c477ccf6582bd79c5b4ccc4f9c41b1 (diff) |
Look Ma' what I found on my harddisk ...
o New faster syscalls for 2.1.x, too
o Upgrade to 2.1.89.
Don't try to run this. It's flaky as hell. But feel free to debug ...
Diffstat (limited to 'drivers/char/amigamouse.c')
-rw-r--r-- | drivers/char/amigamouse.c | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/drivers/char/amigamouse.c b/drivers/char/amigamouse.c index 6977d2398..96a7e019d 100644 --- a/drivers/char/amigamouse.c +++ b/drivers/char/amigamouse.c @@ -44,17 +44,17 @@ #include <linux/random.h> #include <linux/poll.h> #include <linux/init.h> +#include <linux/busmouse.h> #include <asm/setup.h> #include <asm/system.h> #include <asm/uaccess.h> #include <asm/irq.h> -#include <asm/amigamouse.h> #include <asm/amigahw.h> #include <asm/amigaints.h> -#define MSE_INT_ON() mouseint_allowed = 1 -#define MSE_INT_OFF() mouseint_allowed = 0 +#define AMI_MSE_INT_ON() mouseint_allowed = 1 +#define AMI_MSE_INT_OFF() mouseint_allowed = 0 static struct mouse_status mouse; @@ -72,7 +72,7 @@ static void mouse_interrupt(int irq, void *dummy, struct pt_regs *fp) if(!mouseint_allowed) return; - MSE_INT_OFF(); + AMI_MSE_INT_OFF(); /* * This routine assumes, just like Kickstart, that the mouse @@ -156,7 +156,7 @@ static void mouse_interrupt(int irq, void *dummy, struct pt_regs *fp) if (mouse.fasyncptr) kill_fasync(mouse.fasyncptr, SIGIO); } - MSE_INT_ON(); + AMI_MSE_INT_ON(); } static int fasync_mouse(struct file *filp, int on) @@ -178,7 +178,7 @@ static int release_mouse(struct inode * inode, struct file * file) if (--mouse.active) return 0; free_irq(IRQ_AMIGA_VERTB, mouse_interrupt); - MSE_INT_OFF(); + AMI_MSE_INT_OFF(); MOD_DEC_USE_COUNT; return 0; } @@ -211,7 +211,7 @@ static int open_mouse(struct inode * inode, struct file * file) mouse.buttons = 0x87; mouse.active = 1; MOD_INC_USE_COUNT; - MSE_INT_ON(); + AMI_MSE_INT_ON(); return 0; } @@ -219,8 +219,8 @@ static int open_mouse(struct inode * inode, struct file * file) * writes are disallowed */ -static long write_mouse(struct inode * inode, struct file * file, - const char * buffer, unsigned long count) +static ssize_t write_mouse(struct file * file, const char * buffer, + size_t count, loff_t *ppos) { return -EINVAL; } @@ -229,18 +229,15 @@ static long write_mouse(struct inode * inode, struct file * file, * read mouse data. Currently never blocks. */ -static long read_mouse(struct inode * inode, struct file * file, - char * buffer, unsigned long count) +static ssize_t read_mouse(struct file * file, char * buffer, + size_t count, loff_t *ppos) { - int r; int dx; int dy; unsigned char buttons; if (count < 3) return -EINVAL; - if ((r = verify_area(VERIFY_WRITE, buffer, count))) - return r; if (!mouse.ready) return -EAGAIN; @@ -251,7 +248,7 @@ static long read_mouse(struct inode * inode, struct file * file, * so paging in put_user() does not effect mouse tracking. */ - MSE_INT_OFF(); + AMI_MSE_INT_OFF(); dx = mouse.dx; dy = mouse.dy; if (dx < -127) @@ -268,14 +265,17 @@ static long read_mouse(struct inode * inode, struct file * file, mouse.dx -= dx; mouse.dy -= dy; mouse.ready = 0; - MSE_INT_ON(); - - put_user(buttons | 0x80, buffer); - put_user((char)dx, buffer + 1); - put_user((char)dy, buffer + 2); - for (r = 3; r < count; r++) - put_user(0x00, buffer + r); - return r; + AMI_MSE_INT_ON(); + + if ((put_user(buttons | 0x80, buffer++)) || + put_user((char)dx, buffer++) || + put_user((char)dy, buffer++)) + return -EINVAL; + + if (count > 3) + if (clear_user(buffer, count - 3)) + return -EFAULT; + return count; } /* @@ -284,7 +284,7 @@ static long read_mouse(struct inode * inode, struct file * file, static unsigned int mouse_poll(struct file *file, poll_table * wait) { - poll_wait(&mouse.wait, wait); + poll_wait(file, &mouse.wait, wait); if (mouse.ready) return POLLIN | POLLRDNORM; return 0; @@ -315,7 +315,7 @@ __initfunc(int amiga_mouse_init(void)) custom.joytest = 0; /* reset counters */ - MSE_INT_OFF(); + AMI_MSE_INT_OFF(); mouse.active = 0; mouse.ready = 0; |