Re: problem with MKDEV

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Manila Goel wrote:
> Hello all,
> i m writing a character driver for linux 2.6.14 and want to create a device
> in /dev folder at insmod, for that i m using
>
> MKDEV(major, 1); in m y driver code
>
> but it's not creating any device but giving a warning as under:
>
> drivers/char/testled.c:123: warning: statement with no effect
>
> so, how can i do it ,  is there any alternate method also to do the same.
>
>
> thanks & regards
> Manila
>   
you can try this code:

    mydev_class = class_create(THIS_MODULE, "mydev");
    if (IS_ERR(mydev_class)) {
        printk(KERN_INFO "create class error\n");
        return -1;
    }
    class_device_create(mydev_class, NULL, devid, NULL, "led" "%d", 
MINOR(devid)); 

-- 
---------------------------------
Zhenwen Xu - Open and Free
Home Page:   http://dim4.cn
Gtalk:       helight.xu@xxxxxxxxx



-------------------------------------------------------------------
List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm
FAQ:        http://www.arm.linux.org.uk/mailinglists/faq.php
Etiquette:  http://www.arm.linux.org.uk/mailinglists/etiquette.php

[Linux ARM]     [Linux ARM MSM]     [Linux ARM Kernel]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

Add to Google Follow linuxarm on Twitter