S5PV210之led-bus模型 linux3.0.8驱动

时间:2014-08-14 19:31:42   收藏:0   阅读:331

led-bus模型:

 

步骤一:驱动运行结果:bubuko.com,布布扣

从上图红色线可知,卸载led_dev失败原因是因为led_dev.c  platform_device中没有加release()函数;所以正确的方法如下:在led_dev.c 中:

static struct platform_device led_dev = {
    .name = "mini210_led",
    .id = 0,
    .dev = {
        .release = led_release,    //必须在.dev中加入
        //.platform_data = &smsc911x_config,
    },
    .num_resources = ARRAY_SIZE(led_resources),
    .resource = led_resources,
};

步骤二:改正步骤一的问题后,重新编译,下载到板上,又出现下面情况

错误:

通过开发板串口返回的错:[root@FriendlyARM driver]# rmmod led_dev
rmmod: remove ‘led_dev‘: Device or resource busy

再查看编译出现的警告:

bubuko.com,布布扣

上图说led_dev_exit定义了,但没有使用,所以原来是modele_exit(led_dev_exit); //这里错了,会导致rmmod 失败:Device or resource busy;

正确写法:module_exit(led_dev_exit);

解决上面2个步骤后,这驱动程序问题就解决了。

S5PV210之led-bus模型 linux3.0.8驱动,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!