static int __init zdtc_init(void) { int err; err = zio_register_driver(&zdtc_zdrv); if (err) return err; zdtc_init_dev = zio_allocate_device(); if (IS_ERR(zdtc_init_dev)) { err = PTR_ERR(zdtc_init_dev); goto out_alloc; } zdtc_init_dev->owner = THIS_MODULE; err = zio_register_device(zdtc_init_dev, "zdtc", 0); if (err) goto out_register; hrtimer_init(&zdtc.timer, CLOCK_REALTIME, HRTIMER_MODE_ABS); zdtc.timer.function = zdtc_fn; return 0; out_register: zio_free_device(zdtc_init_dev); out_alloc: zio_unregister_driver(&zdtc_zdrv); return err; }
static int __init ob_init(void) { int err; /* * If the user choose a different buffer/trigger, then fix the template * to apply the user choice */ if (ob_trigger) ob_tmpl.preferred_trigger = ob_trigger; if (ob_buffer) ob_tmpl.preferred_buffer = ob_buffer; /* Register the OBS-BOX ZIO driver */ err = zio_register_driver(&ob_driver); if (err) return err; /* Register the OBS-BOX FMC driver */ err = fmc_driver_register(&ob_fmc_drv); if (err) { zio_unregister_driver(&ob_driver); return err; } return 0; }
static void __exit zdtc_exit(void) { zio_unregister_device(zdtc_init_dev); zio_free_device(zdtc_init_dev); zio_unregister_driver(&zdtc_zdrv); }
/* * fa_zio_unregister * * It is a simple wrapper invoked by module_exit to unregister this zio driver */ void fa_zio_unregister(void) { zio_unregister_driver(&fa_zdrv); }
static void __exit ob_exit(void) { fmc_driver_unregister(&ob_fmc_drv); zio_unregister_driver(&ob_driver); }