LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 02-07-2008, 03:01 AM   #1
mohit.saha
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);

and

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


?????/
 
Old 02-07-2008, 05:29 AM   #2
thorgal31
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 http://lwn.net/Kernel/LDD3/, especially chapter 3 for your question. Have fun !
 
Old 08-08-2013, 12:51 AM   #3
raulapati
Member
 
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, 02:10 AM   #4
moo-cow
Member
 
Registered: Mar 2006
Distribution: Debian
Posts: 105

Rep: Reputation: 26
Quote:
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().
 
  


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


All times are GMT -5. The time now is 09:11 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration