static int notify_push(unsigned int cmd, __u32 controller, __u16 applid, __u32 ncci) { struct capi_notifier *np; MOD_INC_USE_COUNT; np = (struct capi_notifier *)kmalloc(sizeof(struct capi_notifier), GFP_ATOMIC); if (!np) { MOD_DEC_USE_COUNT; return -1; } memset(np, 0, sizeof(struct capi_notifier)); np->cmd = cmd; np->controller = controller; np->applid = applid; np->ncci = ncci; notify_enqueue(np); /* * The notifier will result in adding/deleteing * of devices. Devices can only removed in * user process, not in bh. */ MOD_INC_USE_COUNT; if (schedule_task(&tq_state_notify) == 0) MOD_DEC_USE_COUNT; return 0; }
static int notify_push(unsigned int cmd, u32 controller, u16 applid, u32 ncci) { struct capi_notifier *np; if (!try_module_get(THIS_MODULE)) { printk(KERN_WARNING "%s: cannot reserve module\n", __FUNCTION__); return -1; } np = (struct capi_notifier *)kmalloc(sizeof(struct capi_notifier), GFP_ATOMIC); if (!np) { module_put(THIS_MODULE); return -1; } memset(np, 0, sizeof(struct capi_notifier)); np->cmd = cmd; np->controller = controller; np->applid = applid; np->ncci = ncci; notify_enqueue(np); /* * The notifier will result in adding/deleteing * of devices. Devices can only removed in * user process, not in bh. */ __module_get(THIS_MODULE); if (schedule_work(&tq_state_notify) == 0) module_put(THIS_MODULE); return 0; }