int hycapi_capi_create(hysdn_card *card) { hycapictrl_info *cinfo = NULL; struct capi_ctr *ctrl = NULL; #ifdef HYCAPI_PRINTFNAMES printk(KERN_NOTICE "hycapi_capi_create\n"); #endif if((hycapi_enable & (1 << card->myid)) == 0) { return 1; } if (!card->hyctrlinfo) { cinfo = (hycapictrl_info *) kmalloc(sizeof(hycapictrl_info), GFP_ATOMIC); if (!cinfo) { printk(KERN_WARNING "HYSDN: no memory for capi-ctrl.\n"); return -ENOMEM; } memset(cinfo, 0, sizeof(hycapictrl_info)); card->hyctrlinfo = cinfo; cinfo->card = card; spin_lock_init(&cinfo->lock); switch (card->brdtype) { case BD_PCCARD: strcpy(cinfo->cardname,"HYSDN Hycard"); break; case BD_ERGO: strcpy(cinfo->cardname,"HYSDN Ergo2"); break; case BD_METRO: strcpy(cinfo->cardname,"HYSDN Metro4"); break; case BD_CHAMP2: strcpy(cinfo->cardname,"HYSDN Champ2"); break; case BD_PLEXUS: strcpy(cinfo->cardname,"HYSDN Plexus30"); break; default: strcpy(cinfo->cardname,"HYSDN ???"); break; } cinfo->capi_ctrl = hy_di->attach_ctr(&hycapi_driver, cinfo->cardname, cinfo); ctrl = cinfo->capi_ctrl; if (!ctrl) { printk(KERN_ERR "%s: attach controller failed.\n", hycapi_driver.name); return -EBUSY; } /* fill in the blanks: */ hycapi_fill_profile(card); ctrl->ready(ctrl); } else { /* resume output on stopped ctrl */ ctrl = card->hyctrlinfo->capi_ctrl; if(ctrl) { hycapi_fill_profile(card); ctrl->ready(ctrl); hycapi_restart_internal(ctrl); /* ctrl->resume_output(ctrl); */ } else { printk(KERN_WARNING "HYSDN: No ctrl???? How come?\n"); } } return 0; }
int hycapi_capi_create(hysdn_card *card) { hycapictrl_info *cinfo = NULL; struct capi_ctr *ctrl = NULL; int retval; #ifdef HYCAPI_PRINTFNAMES printk(KERN_NOTICE "hycapi_capi_create\n"); #endif if ((hycapi_enable & (1 << card->myid)) == 0) { return 1; } if (!card->hyctrlinfo) { cinfo = kzalloc(sizeof(hycapictrl_info), GFP_ATOMIC); if (!cinfo) { printk(KERN_WARNING "HYSDN: no memory for capi-ctrl.\n"); return -ENOMEM; } card->hyctrlinfo = cinfo; cinfo->card = card; spin_lock_init(&cinfo->lock); INIT_LIST_HEAD(&cinfo->ncci_head); switch (card->brdtype) { case BD_PCCARD: strcpy(cinfo->cardname, "HYSDN Hycard"); break; case BD_ERGO: strcpy(cinfo->cardname, "HYSDN Ergo2"); break; case BD_METRO: strcpy(cinfo->cardname, "HYSDN Metro4"); break; case BD_CHAMP2: strcpy(cinfo->cardname, "HYSDN Champ2"); break; case BD_PLEXUS: strcpy(cinfo->cardname, "HYSDN Plexus30"); break; default: strcpy(cinfo->cardname, "HYSDN ???"); break; } ctrl = &cinfo->capi_ctrl; ctrl->driver_name = "hycapi"; ctrl->driverdata = cinfo; ctrl->register_appl = hycapi_register_appl; ctrl->release_appl = hycapi_release_appl; ctrl->send_message = hycapi_send_message; ctrl->load_firmware = hycapi_load_firmware; ctrl->reset_ctr = hycapi_reset_ctr; ctrl->procinfo = hycapi_procinfo; ctrl->proc_fops = &hycapi_proc_fops; strcpy(ctrl->name, cinfo->cardname); ctrl->owner = THIS_MODULE; retval = attach_capi_ctr(ctrl); if (retval) { printk(KERN_ERR "hycapi: attach controller failed.\n"); return -EBUSY; } /* fill in the blanks: */ hycapi_fill_profile(card); capi_ctr_ready(ctrl); } else { /* resume output on stopped ctrl */ ctrl = &card->hyctrlinfo->capi_ctrl; hycapi_fill_profile(card); capi_ctr_ready(ctrl); hycapi_restart_internal(ctrl); /* ctrl->resume_output(ctrl); */ } return 0; }