13 years C/C++/C# programing, focus on embedded and mobile device development.

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

在内核中异步请求设备固件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);
}

 

posted on 2015-02-03 09:09  woaiusd  阅读(615)  评论(0编辑  收藏  举报