Lines Matching refs:mse

80 	struct busmouse_data *mse = busmouse_data[mousedev];  in busmouse_add_movementbuttons()  local
83 spin_lock(&mse->lock); in busmouse_add_movementbuttons()
84 changed = (dx != 0 || dy != 0 || mse->buttons != buttons); in busmouse_add_movementbuttons()
89 mse->buttons = buttons; in busmouse_add_movementbuttons()
90 mse->dxpos += dx; in busmouse_add_movementbuttons()
91 mse->dypos += dy; in busmouse_add_movementbuttons()
92 mse->ready = 1; in busmouse_add_movementbuttons()
99 if (mse->dxpos < -2048) in busmouse_add_movementbuttons()
100 mse->dxpos = -2048; in busmouse_add_movementbuttons()
101 if (mse->dxpos > 2048) in busmouse_add_movementbuttons()
102 mse->dxpos = 2048; in busmouse_add_movementbuttons()
103 if (mse->dypos < -2048) in busmouse_add_movementbuttons()
104 mse->dypos = -2048; in busmouse_add_movementbuttons()
105 if (mse->dypos > 2048) in busmouse_add_movementbuttons()
106 mse->dypos = 2048; in busmouse_add_movementbuttons()
109 spin_unlock(&mse->lock); in busmouse_add_movementbuttons()
112 wake_up(&mse->wait); in busmouse_add_movementbuttons()
114 kill_fasync(&mse->fasyncptr, SIGIO, POLL_IN); in busmouse_add_movementbuttons()
131 struct busmouse_data *mse = busmouse_data[mousedev]; in busmouse_add_movement() local
133 busmouse_add_movementbuttons(mousedev, dx, dy, mse->buttons); in busmouse_add_movement()
150 struct busmouse_data *mse = busmouse_data[mousedev]; in busmouse_add_buttons() local
152 busmouse_add_movementbuttons(mousedev, 0, 0, (mse->buttons & ~clear) ^ eor); in busmouse_add_buttons()
157 struct busmouse_data *mse = (struct busmouse_data *)filp->private_data; in busmouse_fasync() local
160 retval = fasync_helper(fd, filp, on, &mse->fasyncptr); in busmouse_fasync()
168 struct busmouse_data *mse = (struct busmouse_data *)file->private_data; in busmouse_release() local
174 if (--mse->active == 0) { in busmouse_release()
175 if (mse->ops->release) in busmouse_release()
176 ret = mse->ops->release(inode, file); in busmouse_release()
177 if (mse->ops->owner) in busmouse_release()
178 __MOD_DEC_USE_COUNT(mse->ops->owner); in busmouse_release()
179 mse->ready = 0; in busmouse_release()
188 struct busmouse_data *mse; in busmouse_open() local
197 mse = busmouse_data[mousedev]; in busmouse_open()
199 if (!mse || !mse->ops) /* shouldn't happen, but... */ in busmouse_open()
202 if (mse->ops->owner && !try_inc_mod_count(mse->ops->owner)) in busmouse_open()
206 if (mse->ops->open) { in busmouse_open()
207 ret = mse->ops->open(inode, file); in busmouse_open()
208 if (ret && mse->ops->owner) in busmouse_open()
209 __MOD_DEC_USE_COUNT(mse->ops->owner); in busmouse_open()
215 file->private_data = mse; in busmouse_open()
217 if (mse->active++) in busmouse_open()
220 spin_lock_irq(&mse->lock); in busmouse_open()
222 mse->ready = 0; in busmouse_open()
223 mse->dxpos = 0; in busmouse_open()
224 mse->dypos = 0; in busmouse_open()
225 mse->buttons = mse->ops->init_button_state; in busmouse_open()
227 spin_unlock_irq(&mse->lock); in busmouse_open()
240 struct busmouse_data *mse = (struct busmouse_data *)file->private_data; in busmouse_read() local
247 spin_lock_irq(&mse->lock); in busmouse_read()
249 if (!mse->ready) { in busmouse_read()
251 spin_unlock_irq(&mse->lock); in busmouse_read()
255 spin_unlock_irq(&mse->lock); in busmouse_read()
259 add_wait_queue(&mse->wait, &wait); in busmouse_read()
262 if (!mse->ready && !signal_pending(current)) { in busmouse_read()
263 spin_unlock_irq(&mse->lock); in busmouse_read()
265 spin_lock_irq(&mse->lock); in busmouse_read()
270 remove_wait_queue(&mse->wait, &wait); in busmouse_read()
273 spin_unlock_irq(&mse->lock); in busmouse_read()
279 dxpos = mse->dxpos; in busmouse_read()
280 dypos = mse->dypos; in busmouse_read()
281 buttons = mse->buttons; in busmouse_read()
292 mse->dxpos -= dxpos; in busmouse_read()
293 mse->dypos -= dypos; in busmouse_read()
300 mse->ready = mse->dxpos || mse->dypos; in busmouse_read()
302 spin_unlock_irq(&mse->lock); in busmouse_read()
325 struct busmouse_data *mse = (struct busmouse_data *)file->private_data; in busmouse_poll() local
327 poll_wait(file, &mse->wait, wait); in busmouse_poll()
329 if (mse->ready) in busmouse_poll()
358 struct busmouse_data *mse; in register_busmouse() local
367 mse = kmalloc(sizeof(*mse), GFP_KERNEL); in register_busmouse()
368 if (!mse) in register_busmouse()
375 kfree(mse); in register_busmouse()
379 memset(mse, 0, sizeof(*mse)); in register_busmouse()
381 mse->miscdev.minor = ops->minor; in register_busmouse()
382 mse->miscdev.name = ops->name; in register_busmouse()
383 mse->miscdev.fops = &busmouse_fops; in register_busmouse()
384 mse->ops = ops; in register_busmouse()
385 mse->lock = (spinlock_t)SPIN_LOCK_UNLOCKED; in register_busmouse()
386 init_waitqueue_head(&mse->wait); in register_busmouse()
388 busmouse_data[msedev] = mse; in register_busmouse()
390 ret = misc_register(&mse->miscdev); in register_busmouse()