LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-17-2010, 10:34 AM   #1
liumeng
LQ Newbie
 
Registered: Jul 2010
Posts: 4

Rep: Reputation: 0
Unhappy can not insmod,can anybody help me ??!!!


hello,every1!
after i get utu2440_buttons.ko successful,i want to insmod my .ko.but i get error like this:
[root@utu-linux /]# insmod utu2440_buttons.ko
Using utu2440_buttons.ko
Initial utulinux 2440 Buttons driver!
buttons:can't get irq no.16
insmod: cannot insert `utu2440_buttons.ko': Operation not permitted (-1): Operad

what can i do !!!???
 
Old 09-17-2010, 10:49 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 23,284

Rep: Reputation: 6529Reputation: 6529Reputation: 6529Reputation: 6529Reputation: 6529Reputation: 6529Reputation: 6529Reputation: 6529Reputation: 6529Reputation: 6529Reputation: 6529
Quote:
Originally Posted by liumeng View Post
hello,every1!
after i get utu2440_buttons.ko successful,i want to insmod my .ko.but i get error like this:
[root@utu-linux /]# insmod utu2440_buttons.ko
Using utu2440_buttons.ko
Initial utulinux 2440 Buttons driver!
buttons:can't get irq no.16
insmod: cannot insert `utu2440_buttons.ko': Operation not permitted (-1): Operad

what can i do !!!???
Spell your words out. Text-speak is against LQ rules. You give no details about version/distro of Linux, but as far as I know, insmod is depreciated. Use "modprobe" instead, and be sure you're root when you run it.

Also, are you sure that device is plugged in and working? What kind of hardware are you running? Seems like the driver can't see the device.
 
Old 09-18-2010, 01:22 AM   #3
liumeng
LQ Newbie
 
Registered: Jul 2010
Posts: 4

Original Poster
Rep: Reputation: 0
hi,TBOne!
this is my button driver:
/*
*
* A button driver for UTU2410 a board based on s3c2440
*
* The source code in this file can be freely used, adapted,
* and redistributed in source or binary form, so long as an
* acknowledgment appears in derived source files.No warranty
* is attached;we cannot take responsibility for errors or
* fitness for use.
*
*
*/
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/input.h>


#include <linux/kernel.h> /* printk() */
#include <linux/fs.h> /* everything... */
#include <linux/cdev.h>
#include <linux/interrupt.h> /* request_irq() */
#include <asm/arch/regs-gpio.h>
#include <asm/arch/regs-irq.h>
#include <asm/io.h>
#include <asm/uaccess.h> /* copy_to_user() */
#include <linux/delay.h> /* mdelay() */
#include <linux/irq.h>


#define BUTTONSSTATUS_DOWNX 2
#define BUTTONSSTATUS_DOWN 0
#define BUTTONSSTATUS_UP 1
#define BUF_CLEAR _IO(0xFF, 0)

#define DEVICE_NAME "utu2440-buttons"
#define MAX_BUTTONS_BUF 16
#define BUTTONS_NUM 6
#define BUF_HEAD (utubuttons_dev.buf[utubuttons_dev.head])
#define BUF_TAIL (utubuttons_dev.buf[utubuttons_dev.tail])
#define ISBUTTONS_DOWN(buttons) (s3c2410_gpio_getpin(buttons_info_tab[buttons].gpio_port) == BUTTONSSTATUS_DOWN)
#define INCBUF(x,mod) ((++(x))&((mod)-1))
#define BUTTONS_TIME_DELAY (HZ/10)
#define BUTTONS_TIME_DELAY1 (HZ/100)

#define UTUBUTTONS_MAJOR 0
unsigned int utubuttons_major = UTUBUTTONS_MAJOR;


struct utubuttons_dev
{
struct cdev cdev;
unsigned int buttons_status[BUTTONS_NUM];
unsigned int buf[MAX_BUTTONS_BUF];
unsigned int head, tail;
wait_queue_head_t wq;
};

struct utubuttons_dev utubuttons_dev;
struct utubuttons_dev *utubuttons_devp;
struct timer_list buttons_timer[BUTTONS_NUM];

static struct buttons_info
{
int irq_no;
int irq_type;
unsigned int gpio_port;
unsigned int gpio_setting;
int buttons_code;
char *name;
}buttons_info_tab[] =
{
{
IRQ_EINT0, IRQT_FALLING, S3C2410_GPF0, S3C2410_GPF0_INP, 1, "Key Up"
},
{
IRQ_EINT1, IRQT_FALLING, S3C2410_GPF1, S3C2410_GPF1_INP, 2, "Key Down"
},
{
IRQ_EINT2, IRQT_FALLING, S3C2410_GPF2,S3C2410_GPF2_INP, 3, "Key Left"
},
{
IRQ_EINT3, IRQT_FALLING, S3C2410_GPF3,S3C2410_GPF3_INP, 4, "Key Right"
},
{
IRQ_EINT11, IRQT_FALLING, S3C2410_GPG3,S3C2410_GPG3_INP, 5, "Key Enter"
},
{
IRQ_EINT19, IRQT_FALLING, S3C2410_GPG11,S3C2410_GPG11_INP, 6, "Key Exit"
},
};


static irqreturn_t utubuttons_irq(int irq, void *dev_id)
{
int buttons = (int)dev_id;
int i;
int found = 0;

for (i = 0; i < ARRAY_SIZE(buttons_info_tab); i++)
{
if (buttons_info_tab[i].irq_no == irq) {
found = 1;
break;
}
}
if (!found)
{
printk(KERN_NOTICE"bad irq %d in button\n", irq);
return IRQ_NONE;
}
disable_irq(buttons_info_tab[buttons].irq_no);
utubuttons_dev.buttons_status[buttons] = BUTTONSSTATUS_DOWNX;
buttons_timer[buttons].expires = jiffies + BUTTONS_TIME_DELAY1;
add_timer(&buttons_timer[buttons]);
return IRQ_HANDLED;
}


static int request_irqs(void)
{
int i;
for (i = 0; i < ARRAY_SIZE(buttons_info_tab); i++)
{
s3c2410_gpio_cfgpin(buttons_info_tab[i].gpio_port, buttons_info_tab[i].gpio_setting);
set_irq_type(buttons_info_tab[i].irq_no, buttons_info_tab[i].irq_type);
if (request_irq(buttons_info_tab[i].irq_no, utubuttons_irq, SA_INTERRUPT, DEVICE_NAME, (void *)i))
{
printk(KERN_WARNING "buttons:can't get irq no.%d\n", buttons_info_tab[i].irq_no);
return -1;
}
}
return 0;
}


static void free_irqs(void)
{
int i;
for (i = 0; i < ARRAY_SIZE(buttons_info_tab); i++)
{
free_irq(buttons_info_tab[i].irq_no, (void *)i);
}
}


static void buttonsEvent(unsigned buttons)
{
BUF_HEAD = buttons_info_tab[buttons].buttons_code;
utubuttons_dev.head = INCBUF(utubuttons_dev.head, MAX_BUTTONS_BUF);
wake_up_interruptible(&(utubuttons_dev.wq));
}


static ssize_t utubuttons_read(struct file *filp,char __user *buffer, size_t count, loff_t *ppos)
{
unsigned int buttons_ret;
unsigned long flags;
retry:
if (utubuttons_dev.head != utubuttons_dev.tail)
{
local_irq_save(flags);
buttons_ret = BUF_TAIL;
utubuttons_dev.tail = INCBUF(utubuttons_dev.tail, MAX_BUTTONS_BUF);
local_irq_restore(flags);
copy_to_user(buffer, &buttons_ret, sizeof(unsigned int));
return sizeof(unsigned int);
}else
{
if (filp->f_flags & O_NONBLOCK)
{
return -EAGAIN;
}
interruptible_sleep_on(&(utubuttons_dev.wq));
if (signal_pending(current))
{
return -ERESTARTSYS;
}
goto retry;
}

return sizeof(unsigned int);
}


static int utubuttons_ioctl(struct inode *inodep, struct file *filp, unsigned
int cmd, unsigned long arg)
{
unsigned long flags;

switch (cmd)
{
case BUF_CLEAR:
local_irq_save(flags);
utubuttons_dev.head = utubuttons_dev.tail = 0;
local_irq_restore(flags);

printk(KERN_INFO "buttons buffer is cleared\n");
break;

default:
return -EINVAL;
}
return 0;
}


static void utubuttons_timer_callback(unsigned long data)
{
int buttons = data;
if (ISBUTTONS_DOWN(buttons))
{
if (utubuttons_dev.buttons_status[buttons] == BUTTONSSTATUS_DOWNX)
{
utubuttons_dev.buttons_status[buttons] = BUTTONSSTATUS_DOWN;
buttons_timer[buttons].expires = jiffies + BUTTONS_TIME_DELAY;
buttonsEvent(buttons);
add_timer(&buttons_timer[buttons]);
}else
{
buttons_timer[buttons].expires = jiffies + BUTTONS_TIME_DELAY;
add_timer(&buttons_timer[buttons]);
}
}else
{
utubuttons_dev.buttons_status[buttons] = BUTTONSSTATUS_UP;
enable_irq(buttons_info_tab[buttons].irq_no);
}
}

static int utubuttons_open(struct inode *inode, struct file *filp)
{
printk(KERN_NOTICE "utubuttons opened\n");
return 0;
}

static int utubuttons_release(struct inode *inode, struct file *filp)
{
printk(KERN_NOTICE "utubuttons released\n");
return 0;
}

static const struct file_operations utubuttons_fops =
{
.owner = THIS_MODULE,
.read = utubuttons_read,
.ioctl = utubuttons_ioctl,
.open = utubuttons_open,
.release = utubuttons_release,
};


static void utubuttons_setup_cdev(void)
{
int err,devno = MKDEV(utubuttons_major,0);
cdev_init(&utubuttons_dev.cdev,&utubuttons_fops);
utubuttons_dev.cdev.owner = THIS_MODULE;
utubuttons_dev.cdev.ops = &utubuttons_fops;
err = cdev_add(&utubuttons_dev.cdev, devno, 1);
if (err)
printk(KERN_NOTICE "Error %d adding utubuttons", err);
}


static int __init utubuttons_init(void)
{
int result, i;
dev_t devno = MKDEV(utubuttons_major,0);
printk(KERN_INFO "Initial utulinux 2440 Buttons driver!\n");

result = request_irqs();
if (result) {
unregister_chrdev_region(devno,1);
return result;
}


if (utubuttons_major)
result = register_chrdev_region(devno, 1, DEVICE_NAME);
else
{
result = alloc_chrdev_region(&devno, 0, 1, DEVICE_NAME);
utubuttons_major = MAJOR(devno);
printk(KERN_INFO "Todo: mknod /dev/%s c %d 0\n", DEVICE_NAME, utubuttons_major);
}

if (result < 0)
return result;


utubuttons_devp = kmalloc(sizeof(struct utubuttons_dev), GFP_KERNEL);
if (!utubuttons_devp)
{
result = -ENOMEM;
goto fail_malloc;
}

memset(utubuttons_devp, 0, sizeof(struct utubuttons_dev));
utubuttons_setup_cdev();
init_waitqueue_head(&(utubuttons_dev.wq));
utubuttons_dev.head = utubuttons_dev.tail = 0;


for(i = 0; i < BUTTONS_NUM; i++)
{
utubuttons_dev.buttons_status[i] = BUTTONSSTATUS_UP;
}


for(i = 0; i < BUTTONS_NUM; i++)
{
buttons_timer[i].function = utubuttons_timer_callback;
buttons_timer[i].data = i;
init_timer(&buttons_timer[i]);
}
return 0;

fail_malloc: unregister_chrdev_region(devno, 1);
return result;
}


static void __exit utubuttons_exit(void)
{
int i;
cdev_del(&utubuttons_dev.cdev);
kfree(utubuttons_devp);
unregister_chrdev_region(MKDEV(utubuttons_major, 0), 1);
free_irqs();
for(i = 0; i < BUTTONS_NUM; i++)
{
del_timer(&buttons_timer[i]);
}
}

MODULE_AUTHOR("");
MODULE_LICENSE("Dual BSD/GPL");

module_init(utubuttons_init);
module_exit(utubuttons_exit);


and my makefile is like this :
# Makefile2.6
ifneq ($(KERNELRELEASE),)
#kbuild syntax. dependency relationshsip of files and target modules are listed here.
obj-m := utu2440_buttons.o
else
PWD := $(shell pwd)
KVER ?= $(shell uname -r)
KDIR := /lib/modules/$(KVER)/build
all:
$(MAKE) -C $(KDIR) M=$(PWD)
clean:
rm -rf .*.cmd *.o *.mod.c *.ko .tmp_versions
endif
my linux kernel is 2.6.18 ,my driver kernel is 2.6.24.
 
Old 09-18-2010, 01:30 AM   #4
liumeng
LQ Newbie
 
Registered: Jul 2010
Posts: 4

Original Poster
Rep: Reputation: 0
when i compile ,i do songthing like this :
[root@localhost myutubutton]# make
Makefile:12: *** missing separator. Stop.
[root@localhost myutubutton]# make -C /usr/src/linux-2.6.18/ M=$(pwd) modules
make: Entering directory `/usr/src/linux-2.6.18'
CC [M] /home/liumeng/lmldd/myutubutton/utu2440_buttons.o
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:22:32: asm/arch/regs-gpio.h:
没有那个文件或目录
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:23:31: asm/arch/regs-irq.h: 没有那个文件或目录
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:73: `IRQ_EINT0' undeclared here (not in a function)
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:73: initializer element is not constant
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:73: (near initialization for `buttons_info_tab[0].irq_no')
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:73: `IRQT_FALLING' undeclared
here (not in a function)
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:73: initializer element is not constant
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:73: (near initialization for `buttons_info_tab[0].irq_type')
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:73: `S3C2410_GPF0' undeclared
here (not in a function)
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:73: initializer element is not constant
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:73: (near initialization for `buttons_info_tab[0].gpio_port')
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:73: `S3C2410_GPF0_INP' undeclared here (not in a function)
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:73: initializer element is not constant
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:73: (near initialization for `buttons_info_tab[0].gpio_setting')
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:74: initializer element is not constant
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:74: (near initialization for `buttons_info_tab[0]')
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:76: `IRQ_EINT1' undeclared here (not in a function)
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:76: initializer element is not constant
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:76: (near initialization for `buttons_info_tab[1].irq_no')
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:76: `IRQT_FALLING' undeclared
here (not in a function)
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:76: initializer element is not constant
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:76: (near initialization for `buttons_info_tab[1].irq_type')
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:76: `S3C2410_GPF1' undeclared
here (not in a function)
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:76: initializer element is not constant
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:76: (near initialization for `buttons_info_tab[1].gpio_port')
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:76: `S3C2410_GPF1_INP' undeclared here (not in a function)
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:76: initializer element is not constant
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:76: (near initialization for `buttons_info_tab[1].gpio_setting')
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:77: initializer element is not constant
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:77: (near initialization for `buttons_info_tab[1]')
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:79: `IRQ_EINT2' undeclared here (not in a function)
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:79: initializer element is not constant
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:79: (near initialization for `buttons_info_tab[2].irq_no')
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:79: `IRQT_FALLING' undeclared
here (not in a function)
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:79: initializer element is not constant
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:79: (near initialization for `buttons_info_tab[2].irq_type')
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:79: `S3C2410_GPF2' undeclared
here (not in a function)
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:79: initializer element is not constant
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:79: (near initialization for `buttons_info_tab[2].gpio_port')
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:79: `S3C2410_GPF2_INP' undeclared here (not in a function)
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:79: initializer element is not constant
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:79: (near initialization for `buttons_info_tab[2].gpio_setting')
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:80: initializer element is not constant
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:80: (near initialization for `buttons_info_tab[2]')
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:82: `IRQ_EINT3' undeclared here (not in a function)
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:82: initializer element is not constant
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:82: (near initialization for `buttons_info_tab[3].irq_no')
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:82: `IRQT_FALLING' undeclared
here (not in a function)
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:82: initializer element is not constant
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:82: (near initialization for `buttons_info_tab[3].irq_type')
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:82: `S3C2410_GPF3' undeclared
here (not in a function)
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:82: initializer element is not constant
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:82: (near initialization for `buttons_info_tab[3].gpio_port')
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:82: `S3C2410_GPF3_INP' undeclared here (not in a function)
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:82: initializer element is not constant
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:82: (near initialization for `buttons_info_tab[3].gpio_setting')
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:83: initializer element is not constant
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:83: (near initialization for `buttons_info_tab[3]')
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:85: `IRQ_EINT11' undeclared here (not in a function)
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:85: initializer element is not constant
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:85: (near initialization for `buttons_info_tab[4].irq_no')
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:85: `IRQT_FALLING' undeclared
here (not in a function)
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:85: initializer element is not constant
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:85: (near initialization for `buttons_info_tab[4].irq_type')
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:85: `S3C2410_GPG3' undeclared
here (not in a function)
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:85: initializer element is not constant
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:85: (near initialization for `buttons_info_tab[4].gpio_port')
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:85: `S3C2410_GPG3_INP' undeclared here (not in a function)
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:85: initializer element is not constant
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:85: (near initialization for `buttons_info_tab[4].gpio_setting')
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:86: initializer element is not constant
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:86: (near initialization for `buttons_info_tab[4]')
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:88: `IRQ_EINT19' undeclared here (not in a function)
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:88: initializer element is not constant
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:88: (near initialization for `buttons_info_tab[5].irq_no')
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:88: `IRQT_FALLING' undeclared
here (not in a function)
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:88: initializer element is not constant
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:88: (near initialization for `buttons_info_tab[5].irq_type')
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:88: `S3C2410_GPG11' undeclared here (not in a function)
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:88: initializer element is not constant
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:88: (near initialization for `buttons_info_tab[5].gpio_port')
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:88: `S3C2410_GPG11_INP' undeclared here (not in a function)
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:88: initializer element is not constant
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:88: (near initialization for `buttons_info_tab[5].gpio_setting')
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:89: initializer element is not constant
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:89: (near initialization for `buttons_info_tab[5]')
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c: In function `request_irqs':
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:124: warning: implicit declaration of function `s3c2410_gpio_cfgpin'
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:126: warning: passing arg 2 of `request_irq' from incompatible pointer type
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c: In function `utubuttons_timer_callback':
/home/liumeng/lmldd/myutubutton/utu2440_buttons.c:210: warning: implicit declaration of function `s3c2410_gpio_getpin'
make[1]: *** [/home/liumeng/lmldd/myutubutton/utu2440_buttons.o] Error 1
make: *** [_module_/home/liumeng/lmldd/myutubutton] Error 2
make: Leaving directory `/usr/src/linux-2.6.18'
[root@localhost myutubutton]# make -C /usr/src/Linux2.6.24/ M=$(pwd) modules
make: Entering directory `/usr/src/Linux2.6.24'
CC [M] /home/liumeng/lmldd/myutubutton/utu2440_buttons.o
Building modules, stage 2.
MODPOST 1 modules
CC /home/liumeng/lmldd/myutubutton/utu2440_buttons.mod.o
LD [M] /home/liumeng/lmldd/myutubutton/utu2440_buttons.ko
make: Leaving directory `/usr/src/Linux2.6.24'


i know it is some bussiness on kernel ,but when i compile what can i do to choose the right
kernel as quickly as i can ???!!!
 
Old 09-18-2010, 12:01 PM   #5
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 23,284

Rep: Reputation: 6529Reputation: 6529Reputation: 6529Reputation: 6529Reputation: 6529Reputation: 6529Reputation: 6529Reputation: 6529Reputation: 6529Reputation: 6529Reputation: 6529
As posted before: you don't give version/distro of Linux you're running, on what kind of hardware, or what the "button" device is. From the looks of it, you've got problems in your code, but this:
Quote:
Originally Posted by liumeng
my linux kernel is 2.6.18 ,my driver kernel is 2.6.24.
is a problem too. You need to have your kernel source headers match your running kernel.
 
1 members found this post helpful.
Old 09-20-2010, 06:06 AM   #6
linux_hy
Member
 
Registered: Oct 2006
Posts: 66

Rep: Reputation: -2
the red font maybe a error
the type of i is int
the "(void*)i" maybe "(void*)&i" ?
static int request_irqs(void)
{
int i;
for (i = 0; i < ARRAY_SIZE(buttons_info_tab); i++)
{
s3c2410_gpio_cfgpin(buttons_info_tab[i].gpio_port, buttons_info_tab[i].gpio_setting);
set_irq_type(buttons_info_tab[i].irq_no, buttons_info_tab[i].irq_type);
if (request_irq(buttons_info_tab[i].irq_no, utubuttons_irq, SA_INTERRUPT, DEVICE_NAME, (void *)i))
{
printk(KERN_WARNING "buttons:can't get irq no.%d\n", buttons_info_tab[i].irq_no);
return -1;
}
}
return 0;
}
 
1 members found this post helpful.
Old 09-20-2010, 06:07 AM   #7
linux_hy
Member
 
Registered: Oct 2006
Posts: 66

Rep: Reputation: -2
here maybe the same error

static void free_irqs(void)
{
int i;
for (i = 0; i < ARRAY_SIZE(buttons_info_tab); i++)
{
free_irq(buttons_info_tab[i].irq_no, (void *)i);
}
}
 
1 members found this post helpful.
Old 09-20-2010, 06:41 AM   #8
TheIndependentAquarius
Senior Member
 
Registered: Dec 2008
Posts: 4,710
Blog Entries: 29

Rep: Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929
liumeng

Your code is not readable.
Edit your posts (by pressing the "Edit" button on the bottom right), indent your code and use Code tags.
 
1 members found this post helpful.
Old 09-20-2010, 11:58 AM   #9
linux_hy
Member
 
Registered: Oct 2006
Posts: 66

Rep: Reputation: -2
take the following lines at the begin of your file maybe help you
#include <linux/init.h>
#include <linux/module.h>
MODULE_LICENSE("Dual BSD/GPL")

and to reference the book linux device driver 3rd edition chapter 2
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Insmod hadyy Linux - Hardware 4 12-14-2007 07:20 AM
insmod pantera Programming 1 05-24-2005 12:40 PM
Help with insmod. I have a problem with insmod. RJARRRPCGP Linux - Newbie 5 08-24-2004 09:23 PM
Where is insmod??? yalanop Linux - Newbie 1 01-26-2003 04:16 PM
insmod tincat2 Linux - Software 12 07-07-2002 03:11 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration