当前位置: 技术问答>linux和unix
我的驱动程序模块,不能加载!!!
来源: 互联网 发布时间:2016-02-07
本文导语: 我才学驱动程序,按自己的理解写了个open和release函数,但是加载模块时,出现错误提示,大家帮我看看我这个模块有错吗? #define MODULE #define __KERNEL__ #include #include int xy_open(struct inode *inode,struct file * filp) { printk("open...
我才学驱动程序,按自己的理解写了个open和release函数,但是加载模块时,出现错误提示,大家帮我看看我这个模块有错吗?
#define MODULE
#define __KERNEL__
#include
#include
int xy_open(struct inode *inode,struct file * filp)
{
printk("openn");
return 1;
}
int xy_release(struct inode *inode,struct file *filp)
{
printk("closen");
return 1;
}
static struct file_operations xy_fop=
{
open: xy_open,
release: xy_release,
};
int init_module(void)
{
int result;
MODULE_LICENSE("GPL");
printk("hello,worldn");
result=register_chrdev(127,"xiayu",&xy_fop);
if(result
#define MODULE
#define __KERNEL__
#include
#include
int xy_open(struct inode *inode,struct file * filp)
{
printk("openn");
return 1;
}
int xy_release(struct inode *inode,struct file *filp)
{
printk("closen");
return 1;
}
static struct file_operations xy_fop=
{
open: xy_open,
release: xy_release,
};
int init_module(void)
{
int result;
MODULE_LICENSE("GPL");
printk("hello,worldn");
result=register_chrdev(127,"xiayu",&xy_fop);
if(result