static int __init dcdrbu_init(void) { int rc = 0; spin_lock_init(&rbu_data.lock); init_packet_head(); rbu_device = platform_device_register_simple("dell_rbu", -1, NULL, 0); if (!rbu_device) { printk(KERN_ERR "dell_rbu:%s:platform_device_register_simple " "failed\n", __FUNCTION__); return -EIO; } sysfs_create_bin_file(&rbu_device->dev.kobj, &rbu_data_attr); sysfs_create_bin_file(&rbu_device->dev.kobj, &rbu_image_type_attr); sysfs_create_bin_file(&rbu_device->dev.kobj, &rbu_packet_size_attr); rc = request_firmware_nowait(THIS_MODULE, FW_ACTION_NOHOTPLUG, "dell_rbu", &rbu_device->dev, &context, callbackfn_rbu); if (rc) printk(KERN_ERR "dell_rbu:%s:request_firmware_nowait" " failed %d\n", __FUNCTION__, rc); else rbu_data.entry_created = 1; return rc; }
static int __init dcdrbu_init(void) { int rc; #ifdef CONFIG_XEN if (!is_initial_xendomain()) return -ENODEV; #endif spin_lock_init(&rbu_data.lock); init_packet_head(); rbu_device = platform_device_register_simple("dell_rbu", -1, NULL, 0); if (IS_ERR(rbu_device)) { printk(KERN_ERR "dell_rbu:%s:platform_device_register_simple " "failed\n", __func__); return PTR_ERR(rbu_device); } rc = sysfs_create_bin_file(&rbu_device->dev.kobj, &rbu_data_attr); if (rc) goto out_devreg; rc = sysfs_create_bin_file(&rbu_device->dev.kobj, &rbu_image_type_attr); if (rc) goto out_data; rc = sysfs_create_bin_file(&rbu_device->dev.kobj, &rbu_packet_size_attr); if (rc) goto out_imtype; rbu_data.entry_created = 0; return 0; out_imtype: sysfs_remove_bin_file(&rbu_device->dev.kobj, &rbu_image_type_attr); out_data: sysfs_remove_bin_file(&rbu_device->dev.kobj, &rbu_data_attr); out_devreg: platform_device_unregister(rbu_device); return rc; }