void __exit rtas_flash_cleanup(void) { remove_flash_pde(firmware_flash_pde); remove_flash_pde(firmware_update_pde); remove_flash_pde(validate_pde); remove_flash_pde(manage_pde); }
static void __exit rtas_flash_cleanup(void) { rtas_flash_term_hook = NULL; if (flash_block_cache) kmem_cache_destroy(flash_block_cache); remove_flash_pde(firmware_flash_pde); remove_flash_pde(firmware_update_pde); remove_flash_pde(validate_pde); remove_flash_pde(manage_pde); }
static int initialize_flash_pde_data(const char *rtas_call_name, size_t buf_size, struct proc_dir_entry *dp) { int *status; int token; dp->data = kzalloc(buf_size, GFP_KERNEL); if (dp->data == NULL) { remove_flash_pde(dp); return -ENOMEM; } /* * This code assumes that the status int is the first member of the * struct */ status = (int *) dp->data; token = rtas_token(rtas_call_name); if (token == RTAS_UNKNOWN_SERVICE) *status = FLASH_AUTH; else *status = FLASH_NO_OP; return 0; }
static int __init rtas_flash_init(void) { int rc; if (rtas_token("ibm,update-flash-64-and-reboot") == RTAS_UNKNOWN_SERVICE) { printk(KERN_ERR "rtas_flash: no firmware flash support\n"); return 1; } firmware_flash_pde = create_flash_pde("ppc64/rtas/" FIRMWARE_FLASH_NAME, &rtas_flash_operations); if (firmware_flash_pde == NULL) { rc = -ENOMEM; goto cleanup; } rc = initialize_flash_pde_data("ibm,update-flash-64-and-reboot", sizeof(struct rtas_update_flash_t), firmware_flash_pde); if (rc != 0) goto cleanup; firmware_update_pde = create_flash_pde("ppc64/rtas/" FIRMWARE_UPDATE_NAME, &rtas_flash_operations); if (firmware_update_pde == NULL) { rc = -ENOMEM; goto cleanup; } rc = initialize_flash_pde_data("ibm,update-flash-64-and-reboot", sizeof(struct rtas_update_flash_t), firmware_update_pde); if (rc != 0) goto cleanup; validate_pde = create_flash_pde("ppc64/rtas/" VALIDATE_FLASH_NAME, &validate_flash_operations); if (validate_pde == NULL) { rc = -ENOMEM; goto cleanup; } rc = initialize_flash_pde_data("ibm,validate-flash-image", sizeof(struct rtas_validate_flash_t), validate_pde); if (rc != 0) goto cleanup; manage_pde = create_flash_pde("ppc64/rtas/" MANAGE_FLASH_NAME, &manage_flash_operations); if (manage_pde == NULL) { rc = -ENOMEM; goto cleanup; } rc = initialize_flash_pde_data("ibm,manage-flash-image", sizeof(struct rtas_manage_flash_t), manage_pde); if (rc != 0) goto cleanup; rtas_flash_term_hook = rtas_flash_firmware; flash_block_cache = kmem_cache_create("rtas_flash_cache", RTAS_BLK_SIZE, RTAS_BLK_SIZE, 0, rtas_block_ctor); if (!flash_block_cache) { printk(KERN_ERR "%s: failed to create block cache\n", __func__); rc = -ENOMEM; goto cleanup; } return 0; cleanup: remove_flash_pde(firmware_flash_pde); remove_flash_pde(firmware_update_pde); remove_flash_pde(validate_pde); remove_flash_pde(manage_pde); return rc; }
int __init rtas_flash_init(void) { int rc; if (rtas_token("ibm,update-flash-64-and-reboot") == RTAS_UNKNOWN_SERVICE) { printk(KERN_ERR "rtas_flash: no firmware flash support\n"); return 1; } firmware_flash_pde = create_flash_pde("ppc64/rtas/" FIRMWARE_FLASH_NAME, &rtas_flash_operations); if (firmware_flash_pde == NULL) { rc = -ENOMEM; goto cleanup; } rc = initialize_flash_pde_data("ibm,update-flash-64-and-reboot", sizeof(struct rtas_update_flash_t), firmware_flash_pde); if (rc != 0) goto cleanup; firmware_update_pde = create_flash_pde("ppc64/rtas/" FIRMWARE_UPDATE_NAME, &rtas_flash_operations); if (firmware_update_pde == NULL) { rc = -ENOMEM; goto cleanup; } rc = initialize_flash_pde_data("ibm,update-flash-64-and-reboot", sizeof(struct rtas_update_flash_t), firmware_update_pde); if (rc != 0) goto cleanup; validate_pde = create_flash_pde("ppc64/rtas/" VALIDATE_FLASH_NAME, &validate_flash_operations); if (validate_pde == NULL) { rc = -ENOMEM; goto cleanup; } rc = initialize_flash_pde_data("ibm,validate-flash-image", sizeof(struct rtas_validate_flash_t), validate_pde); if (rc != 0) goto cleanup; manage_pde = create_flash_pde("ppc64/rtas/" MANAGE_FLASH_NAME, &manage_flash_operations); if (manage_pde == NULL) { rc = -ENOMEM; goto cleanup; } rc = initialize_flash_pde_data("ibm,manage-flash-image", sizeof(struct rtas_manage_flash_t), manage_pde); if (rc != 0) goto cleanup; return 0; cleanup: remove_flash_pde(firmware_flash_pde); remove_flash_pde(firmware_update_pde); remove_flash_pde(validate_pde); remove_flash_pde(manage_pde); return rc; }