/* * This function is called while kernel-module is loaded */ static int __init usb_gigaset_init(void) { int result; /* allocate memory for our driver state and initialize it */ driver = gigaset_initdriver(GIGASET_MINOR, GIGASET_MINORS, GIGASET_MODULENAME, GIGASET_DEVNAME, &ops, THIS_MODULE); if (driver == NULL) goto error; /* register this driver with the USB subsystem */ result = usb_register(&gigaset_usb_driver); if (result < 0) { pr_err("error %d registering USB driver\n", -result); goto error; } pr_info(DRIVER_DESC "\n"); return 0; error: if (driver) gigaset_freedriver(driver); driver = NULL; return -1; }
/** * usb_gigaset_init * This function is called while kernel-module is loaded */ static int __init usb_gigaset_init(void) { int result; /* allocate memory for our driver state and intialize it */ if ((driver = gigaset_initdriver(GIGASET_MINOR, GIGASET_MINORS, GIGASET_MODULENAME, GIGASET_DEVNAME, &ops, THIS_MODULE)) == NULL) goto error; /* register this driver with the USB subsystem */ result = usb_register(&gigaset_usb_driver); if (result < 0) { err("usb_gigaset: usb_register failed (error %d)", -result); goto error; } info(DRIVER_AUTHOR); info(DRIVER_DESC); return 0; error: if (driver) gigaset_freedriver(driver); driver = NULL; return -1; }
static int __init usb_gigaset_init(void) { int result; if ((driver = gigaset_initdriver(GIGASET_MINOR, GIGASET_MINORS, GIGASET_MODULENAME, GIGASET_DEVNAME, &ops, THIS_MODULE)) == NULL) goto error; result = usb_register(&gigaset_usb_driver); if (result < 0) { pr_err("error %d registering USB driver\n", -result); goto error; } pr_info(DRIVER_DESC "\n"); return 0; error: if (driver) gigaset_freedriver(driver); driver = NULL; return -1; }
/** * usb_gigaset_exit * This function is called while unloading the kernel-module */ static void __exit usb_gigaset_exit(void) { gigaset_blockdriver(driver); /* => probe will fail * => no gigaset_start any more */ gigaset_shutdown(cardstate); /* from now on, no isdn callback should be possible */ /* deregister this driver with the USB subsystem */ usb_deregister(&gigaset_usb_driver); /* this will call the disconnect-callback */ /* from now on, no disconnect/probe callback should be running */ gigaset_freecs(cardstate); cardstate = NULL; gigaset_freedriver(driver); driver = NULL; }
static void __exit usb_gigaset_exit(void) { int i; gigaset_blockdriver(driver); for (i = 0; i < driver->minors; i++) gigaset_shutdown(driver->cs + i); usb_deregister(&gigaset_usb_driver); gigaset_freedriver(driver); driver = NULL; }
/* * This function is called while unloading the kernel-module */ static void __exit usb_gigaset_exit(void) { int i; gigaset_blockdriver(driver); /* => probe will fail * => no gigaset_start any more */ /* stop all connected devices */ for (i = 0; i < driver->minors; i++) gigaset_shutdown(driver->cs + i); /* from now on, no isdn callback should be possible */ /* deregister this driver with the USB subsystem */ usb_deregister(&gigaset_usb_driver); /* this will call the disconnect-callback */ /* from now on, no disconnect/probe callback should be running */ gigaset_freedriver(driver); driver = NULL; }