Linux Driver design compilation error message collection

Source: Internet
Author: User

1, warning:passing argument 2 of ' REQUEST_IRQ ' from incompatible pointer type

Http://blog.sina.com.cn/s/blog_7321be1101012gek.html


warning:passing argument 2 of ' REQUEST_IRQ ' from incompatible pointer type

my request The _IRQ function is called as follows:
if (Request_irq (Key_info->irq_no, Key_ Eint_handler, irqf_disabled, "Mini2440_key", &i))
{
    return-1;
}
key The _eint_handler function is prototyped as follows:
static void Key_eint_handler (int IRQ, void *dev_id,struct pt_regs *regs)

The problem is the prototype of the Key_eint_handler function,
Should be by:
static void Key_eint_handler (int irq, void *dev_id,struct pt_regs *regs)//Wrong notation
Switch
static irqreturn_t key_eint_handler (int irq, void *dev_id)//correct notation

the reason from the kernel source code to start ...
in theLinux/include/linux/interrupt.h, there's such a definition on line 60.
typedef irqreturn_t (*irq_handler_t) (int, void *);
What does this definition mean?
It means: Define a function pointer type irq_handler_t, the return type of this function is irqreturn_t, the argument list is int, void*
and look at the function declaration section of REQUEST_IRQ.
kernel/irq/manage.c:
int Request_irq (
unsigned int IRQ,
irq_handler_t Handler,
unsigned long irqflags,
const char *devname,
void *dev_id)
the second parameter of the REQUEST_IRQ is the handler function, which is the type irq_handler_t,
that is to say: I define the handler function return type is irq_handler_t,
combined with the above-mentioned
typedef irqreturn_t (*irq_handler_t) (int, void *);
so ...
the handler function should be written as:
static irqreturn_t key_eint_handler (int irq, void *dev_id)//correct notation
2 parameters ... The return type of irqreturn_t is correct!

2, WARNING: "__bad_udelay" undefined!

Cause: The parameters of Udelay () are too large.

Definition of Udelay () in the kernel:

......

#define MAX_UDELAY_MS 2

#define UDELAY (N)

  (__builtin_constant_p (n)? \

((n) > (Max_udelay_ms *1000) __bad_udelay (): __const_udelay ((N) * ((2199023u*hz) >>11)): \

__udelay (n))

......

3.

Linux driver design compilation error message collection

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.