static void __exit gb_exit(void) { gb_firmware_protocol_exit(); gb_svc_protocol_exit(); gb_control_protocol_exit(); gb_endo_exit(); gb_operation_exit(); bus_unregister(&greybus_bus_type); gb_debugfs_cleanup(); }
static int __init gb_init(void) { int retval; if (greybus_disabled()) return -ENODEV; BUILD_BUG_ON(CPORT_ID_MAX >= (long)CPORT_ID_BAD); gb_debugfs_init(); retval = bus_register(&greybus_bus_type); if (retval) { pr_err("bus_register failed (%d)\n", retval); goto error_bus; } retval = gb_operation_init(); if (retval) { pr_err("gb_operation_init failed (%d)\n", retval); goto error_operation; } retval = gb_endo_init(); if (retval) { pr_err("gb_endo_init failed (%d)\n", retval); goto error_endo; } retval = gb_control_protocol_init(); if (retval) { pr_err("gb_control_protocol_init failed\n"); goto error_control; } retval = gb_svc_protocol_init(); if (retval) { pr_err("gb_svc_protocol_init failed\n"); goto error_svc; } retval = gb_firmware_protocol_init(); if (retval) { pr_err("gb_firmware_protocol_init failed\n"); goto error_firmware; } return 0; /* Success */ error_firmware: gb_svc_protocol_exit(); error_svc: gb_control_protocol_exit(); error_control: gb_endo_exit(); error_endo: gb_operation_exit(); error_operation: bus_unregister(&greybus_bus_type); error_bus: gb_debugfs_cleanup(); return retval; }