在类似hello的模块里加了个file_fops就报错了...[已解决]
就这个hello_world模块,加了定义的结构就出了这么个问题,我原来是看2.6.11的RTC驱动,
现在想仿照写写,但是目前板子跑的是2.6.8,这俩版本间有不少区别,但是这么个结构都是抄上去的
为什么报了这一个错呢?
这是个C的基础问题... 不好意思在这显眼了~
#include <linux/config.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/miscdevice.h>
#include <linux/proc_fs.h>
#include <linux/poll.h>
#include <linux/rtc.h>
#include <linux/fs.h>
#include <asm/hardware.h>
#include <asm/uaccess.h>
#include <asm/irq.h>
#include <asm/io.h>
#include <asm/arch/regs-rtc.h>
static struct file_operations my_rtc_fops = {
owner: THIS_MODULE,
llseek: no_llseek,
read: my_rtc_read,
poll: my_rtc_poll,
ioctl: my_rtc_ioctl,
open: my_rtc_open,
release: my_rtc_release,
fasync: my_rtc_fasync,
};
static int __init rtc_init( void )
{
int ret;
printk("Hello!\n");
return ret;
}
static void __exit rtc_exit( void )
{
printk("exit!\n");
}
module_init( rtc_init );
module_exit( rtc_exit );
MODULE_AUTHOR ( "yang man" );
MODULE_LICENSE ( "GPL" );
MODULE_DESCRIPTION ( "THIS MODULE IS FOR MODULE STUDY!" );
下列错误:
vers/char/my_rtc_driver.c:22: error: `my_rtc_read' undeclared here (not in a function)
drivers/char/my_rtc_driver.c:22: error: initializer element is not constant
drivers/char/my_rtc_driver.c:22: error: (near initialization for `my_rtc_fops.read')
drivers/char/my_rtc_driver.c:23: error: `my_rtc_poll' undeclared here (not in a function)
drivers/char/my_rtc_driver.c:23: error: initializer element is not constant
drivers/char/my_rtc_driver.c:23: error: (near initialization for `my_rtc_fops.poll')
drivers/char/my_rtc_driver.c:24: error: `my_rtc_ioctl' undeclared here (not in a function)
drivers/char/my_rtc_driver.c:24: error: initializer element is not constant
drivers/char/my_rtc_driver.c:24: error: (near initialization for `my_rtc_fops.ioctl')
drivers/char/my_rtc_driver.c:25: error: `my_rtc_open' undeclared here (not in a function)
drivers/char/my_rtc_driver.c:25: error: initializer element is not constant
drivers/char/my_rtc_driver.c:25: error: (near initialization for `my_rtc_fops.open')
drivers/char/my_rtc_driver.c:26: error: `my_rtc_release' undeclared here (not in a function)
drivers/char/my_rtc_driver.c:26: error: initializer element is not constant
drivers/char/my_rtc_driver.c:26: error: (near initialization for `my_rtc_fops.release')
drivers/char/my_rtc_driver.c:27: error: `my_rtc_fasync' undeclared here (not in a function)
drivers/char/my_rtc_driver.c:27: error: initializer element is not constant
drivers/char/my_rtc_driver.c:27: error: (near initialization for `my_rtc_fops.fasync')
drivers/char/my_rtc_driver.c:19: warning: `my_rtc_fops' defined but not used
make[2]: *** [drivers/char/my_rtc_driver.o] Error 1
make[1]: *** [drivers/char] Error 2
make: *** [drivers] Error 2
[ 本帖最后由 jn200002 于 2008-6-18 13:13 编辑 ]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论