int release_qp(struct inode * inode, struct file * file) { unsigned char status; int temp_1; //assert(lockStatus == 0); //////////////////////////////////////////////////// lock_kernel(); //////////////////////////////////////////////////// fasync_qp(-1, file, 0); qp_count--; if (!qp_count) { temp_1 = poll_qp_status(); if (!temp_1) printk ("Warning: Mouse device busy in release_qp()\n"); status = inb_p(qp_status); outb_p(status & /* ~ */(0x80 | 0x10 ), qp_status); temp_1 = poll_qp_status(); if (!temp_1) printk ("Warning: Mouse device busy in release_qp()\n"); free_irq (12 , ((void *)0) ); // TRACER (atomic_dec(&( &__this_module )->uc.usecount), ( &__this_module )->flags |= 8 ) ; } // assert(lockStatus == 1); if (lockStatus != 1){ errorFn();} //////////////////////////////////////////////////// unlock_kernel(); //////////////////////////////////////////////////// return 0; }
static int release_qp(struct inode * inode, struct file * file) { unsigned char status; fasync_qp(-1, file, 0); if (!--qp_count) { if (!poll_qp_status()) printk("Warning: Mouse device busy in release_qp()\n"); status = inb_p(qp_status); outb_p(status & ~(QP_ENABLE|QP_INTS_ON), qp_status); if (!poll_qp_status()) printk("Warning: Mouse device busy in release_qp()\n"); free_irq(QP_IRQ, NULL); MOD_DEC_USE_COUNT; } return 0; }
int main() { struct inode *inode; struct file *file; char *buffer; const char *wbuffer; int fd, on; size_t count; loff_t *ppos; poll_table *wait; struct file *filp; TRACER_init_global_vars__(); lockStatus = 0; qpmouse_init(); open_qp(inode, file); read_qp(file, buffer, count, ppos); write_qp(file, wbuffer,count, ppos); poll_qp(file, wait); fasync_qp(fd, filp, on); release_qp(inode, file); if (lockStatus==1) errorFn(); }