在内核中异步请求设备固件firmware的测试代码
static void ghost_load_firmware_callback(const struct firmware *fw, void *context) { if(fw){ printk("firmware size=%d\n", fw->size); }else{ printk("failed to load firmware\n"); } } void ghost_load_firmware(char *name) { int error; error = request_firmware_nowait(THIS_MODULE, FW_ACTION_HOTPLUG, name, &(ghost.client->dev), NULL, GFP_KERNEL, ghost_load_firmware_callback); if(error){ printk("failed to request %s\n", name); } printk("request firmware %s\n", name); }