Exemple #1
0
static int __init
hysdn_init(void)
{
	char tmp[50];

	strcpy(tmp, hysdn_init_revision);
	printk(KERN_NOTICE "HYSDN: module Rev: %s loaded\n", hysdn_getrev(tmp));
	strcpy(tmp, hysdn_net_revision);
	printk(KERN_NOTICE "HYSDN: network interface Rev: %s \n", hysdn_getrev(tmp));
	search_cards();
	printk(KERN_INFO "HYSDN: %d card(s) found.\n", cardmax);

	if (hysdn_procconf_init()) {
		free_resources();	/* proc file_sys not created */
		return (-1);
	}
#ifdef CONFIG_HYSDN_CAPI
	if(cardmax > 0) {
		if(hycapi_init()) {
			printk(KERN_ERR "HYCAPI: init failed\n");
			return(-1);
		}
	}
#endif /* CONFIG_HYSDN_CAPI */
	return (0);		/* no error */
}				/* init_module */
Exemple #2
0
static int __init c4_init(void)
{
	int retval;

	MOD_INC_USE_COUNT;

	retval = c4_attach_driver (&c4_driver);
	if (retval) {
		MOD_DEC_USE_COUNT;
		return retval;
	}

	retval = c4_attach_driver (&c2_driver);
	if (retval) {
		MOD_DEC_USE_COUNT;
		return retval;
	}

	retval = search_cards(&c4_driver, PCI_DEVICE_ID_AVM_C4, 4);
	if (retval && ncards == 0) {
    		detach_capi_driver(&c2_driver);
    		detach_capi_driver(&c4_driver);
		MOD_DEC_USE_COUNT;
		return retval;
	}
	retval = search_cards(&c2_driver, PCI_DEVICE_ID_AVM_C2, 2);
	if (retval && ncards == 0) {
    		detach_capi_driver(&c2_driver);
    		detach_capi_driver(&c4_driver);
		MOD_DEC_USE_COUNT;
		return retval;
	}

	if (ncards) {
		printk(KERN_INFO "%s: %d C4/C2 card(s) detected\n",
				c4_driver.name, ncards);
		MOD_DEC_USE_COUNT;
		return 0;
	}
	printk(KERN_ERR "%s: NO C4/C2 card detected\n", c4_driver.name);
	detach_capi_driver(&c4_driver);
	detach_capi_driver(&c2_driver);
	MOD_DEC_USE_COUNT;
	return -ENODEV;
}