Re: How to create node in /dev

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

 



On Mon, Dec 26, 2005 at 10:11:02AM +0530, Nori, Soma Sekhar wrote:
>  
> > static int __init my_init(void) {
> > ??? int err = 0;
> > ??? if (alloc_chrdev_region(&dev, 0, 1, "my_device") != 0) {
> > ??? ??? printk("<1>error: alloc_chrdev_region failed!");
> > ??? ??? return -1;
> > ??? }
> 
> Just calling register_chrdev should be enough for you case. See
> drivers\char\mem.c for an example.

No, you need to create the file in sysfs somehow, the chrdev stuff does
not do this for you.  See the driver model chapter in the book, Linux
Device Drivers, third edition (free online) for how to do this properly
for udev.

Hope this helps,

greg k-h

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux