Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 02-07-2008, 04:01 AM   #1
LQ Newbie
Registered: Feb 2008
Posts: 15

Rep: Reputation: 0
Question Registering character devices...

Can anyone tell me the difference between the functions:

int register_chrdev_region(dev_t first, unsigned int count,
char *name);


int register_chrdev(unsigned int major, const char *name,
struct file_operations *fops);

Old 02-07-2008, 06:29 AM   #2
LQ Newbie
Registered: Mar 2006
Posts: 12

Rep: Reputation: 0
register_chrdev() is the old way for char device registration. register_chrdev_region or even alloc_chrdev_region should be used.
Have a look at the very good book Linux Device Driver, 3rd edition by Jonathan Corbet, Alessandro Rubini, and Greg Kroah-Hartman, available on line at, especially chapter 3 for your question. Have fun !
Old 08-08-2013, 01:51 AM   #3
Registered: May 2010
Posts: 51

Rep: Reputation: 0
though we use register_chrdev() we have to use cdev_add() and cdev_init() right?
Old 08-09-2013, 03:10 AM   #4
Registered: Mar 2006
Distribution: Debian
Posts: 105

Rep: Reputation: 26
though we use register_chrdev() we have to use cdev_add() and cdev_init() right?
Yep. register_chrdev() only registers a char device (major and minor numbers). To use file operations such as read() or write(), you have to implement them and register them with the system using cdev_add() and cdev_init(). As thorgal31 pointed out, you should use alloc_chrdev_region() instead of register_chrdev().


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
iSCSI Targets for Tape (character) Devices ben.kuiper Linux - Networking 3 03-15-2007 11:18 AM
about wide character and multiple byte character George2 Programming 5 05-23-2006 02:03 AM
USB devices not registering in /dev (RH9) coolingtower Linux - General 2 08-22-2004 04:56 AM
RAM not registering? micxz Linux - Hardware 0 05-26-2004 09:36 PM
Registering Kylix 3 on RH 8 TwistorX Programming 23 07-03-2003 04:06 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:35 AM.

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