__initfunc(int ms_bus_mouse_init(void)) { int mse_byte, i; mouse.present = mouse.active = mouse.ready = 0; mouse.buttons = 0x80; mouse.dx = mouse.dy = 0; mouse.wait = NULL; if (check_region(MS_MSE_CONTROL_PORT, 0x04)) return -ENODEV; if (inb_p(MS_MSE_SIGNATURE_PORT) == 0xde) { mse_byte = inb_p(MS_MSE_SIGNATURE_PORT); for (i = 0; i < 4; i++) { if (inb_p(MS_MSE_SIGNATURE_PORT) == 0xde) { if (inb_p(MS_MSE_SIGNATURE_PORT) == mse_byte) mouse.present = 1; else mouse.present = 0; } else mouse.present = 0; } } if (mouse.present == 0) return -EIO; MS_MSE_INT_OFF(); request_region(MS_MSE_CONTROL_PORT, 0x04, "MS Busmouse"); printk(KERN_INFO "Microsoft BusMouse detected and installed.\n"); misc_register(&ms_bus_mouse); return 0; }
unsigned long ms_bus_mouse_init(unsigned long kmem_start) { int mse_byte, i; mouse.present = mouse.active = mouse.ready = 0; mouse.buttons = 0x80; mouse.dx = mouse.dy = 0; mouse.wait = NULL; if (inb_p(MS_MSE_SIGNATURE_PORT) == 0xde) { mse_byte = inb_p(MS_MSE_SIGNATURE_PORT); for (i = 0; i < 4; i++) { if (inb_p(MS_MSE_SIGNATURE_PORT) == 0xde) { if (inb_p(MS_MSE_SIGNATURE_PORT) == mse_byte) mouse.present = 1; else mouse.present = 0; } else mouse.present = 0; } } if (mouse.present == 0) { return kmem_start; } MS_MSE_INT_OFF(); printk("Microsoft BusMouse detected and installed.\n"); return kmem_start; }
static int release_mouse(struct inode * inode, struct file * file) { fasync_mouse(-1, file, 0); if (--mouse.active) return 0; MS_MSE_INT_OFF(); mouse.ready = 0; free_irq(mouse_irq, NULL); MOD_DEC_USE_COUNT; return 0; }
static int __init ms_bus_mouse_init(void) { int present = 0; int mse_byte, i; if (check_region(MS_MSE_CONTROL_PORT, 0x04)) return -ENODEV; if (inb_p(MS_MSE_SIGNATURE_PORT) == 0xde) { mse_byte = inb_p(MS_MSE_SIGNATURE_PORT); for (i = 0; i < 4; i++) { if (inb_p(MS_MSE_SIGNATURE_PORT) == 0xde) { if (inb_p(MS_MSE_SIGNATURE_PORT) == mse_byte) present = 1; else present = 0; } else present = 0; } } if (present == 0) return -EIO; if (!request_region(MS_MSE_CONTROL_PORT, 0x04, "MS Busmouse")) return -EIO; MS_MSE_INT_OFF(); msedev = register_busmouse(&msbusmouse); if (msedev < 0) { printk(KERN_WARNING "Unable to register msbusmouse driver.\n"); release_region(MS_MSE_CONTROL_PORT, 0x04); } else printk(KERN_INFO "Microsoft BusMouse detected and installed.\n"); return msedev < 0 ? msedev : 0; }
static int release_mouse(struct inode * inode, struct file * file) { MS_MSE_INT_OFF(); free_irq(mouse_irq, NULL); return 0; }
static void release_mouse(struct inode * inode, struct file * file) { MS_MSE_INT_OFF(); mouse.active = mouse.ready = 0; free_irq(MOUSE_IRQ); }