当前位置: 技术问答>linux和unix
unknown symbol in module or invalid parameter的问题
来源: 互联网 发布时间:2016-11-11
本文导语: 做一个led驱动insmod时出现了上面的问题 在驱动里随机加句话或者减句话 可能能加载上 但再改改其他的问题又出来了 #include #include #include #include #include #include #include #include #include #include #include #incl...
做一个led驱动insmod时出现了上面的问题 在驱动里随机加句话或者减句话 可能能加载上 但再改改其他的问题又出来了
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
int mem_major;
struct device *dev;
struct class *myclass;
struct cdev cdev;
int led[4]={S3C2410_GPB(5),S3C2410_GPB(6),S3C2410_GPB(7),S3C2410_GPB(8)};
int bright[4]={1,2,4,8};
int led_ctl(struct inode* node,struct file* led_file,unsigned int cmd,unsigned long arg){
int *a;
int i;
if((a=kmalloc(4,GFP_KERNEL))==NULL)return -EINVAL;
copy_from_user(a,(int *)arg,4);
printk("""ioctl:%dn",arg);
switch(cmd) {
case 0:
case 1:
if (arg > 4) {
return -EINVAL;
}
s3c2410_gpio_setpin(led[arg], !cmd);
return 0;
default:
return -EINVAL;
}
return 0;
}
int led_open(struct inode *inode, struct file *filp){
printk("""openn");
return 0;
}
int mem_release(struct inode *inode, struct file *filp)
{
return 0;
}
static struct file_operations mem_fops={
.owner= THIS_MODULE,
.open=led_open,
.ioctl=led_ctl,
.release = mem_release,
};
static int __init ledinit(void){
dev_t devno=0;
int i;
if(alloc_chrdev_region(&devno, 0, 1, "leddev")
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
int mem_major;
struct device *dev;
struct class *myclass;
struct cdev cdev;
int led[4]={S3C2410_GPB(5),S3C2410_GPB(6),S3C2410_GPB(7),S3C2410_GPB(8)};
int bright[4]={1,2,4,8};
int led_ctl(struct inode* node,struct file* led_file,unsigned int cmd,unsigned long arg){
int *a;
int i;
if((a=kmalloc(4,GFP_KERNEL))==NULL)return -EINVAL;
copy_from_user(a,(int *)arg,4);
printk("""ioctl:%dn",arg);
switch(cmd) {
case 0:
case 1:
if (arg > 4) {
return -EINVAL;
}
s3c2410_gpio_setpin(led[arg], !cmd);
return 0;
default:
return -EINVAL;
}
return 0;
}
int led_open(struct inode *inode, struct file *filp){
printk("""openn");
return 0;
}
int mem_release(struct inode *inode, struct file *filp)
{
return 0;
}
static struct file_operations mem_fops={
.owner= THIS_MODULE,
.open=led_open,
.ioctl=led_ctl,
.release = mem_release,
};
static int __init ledinit(void){
dev_t devno=0;
int i;
if(alloc_chrdev_region(&devno, 0, 1, "leddev")