LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices


Reply
  Search this Thread
Old 04-21-2015, 02:55 AM   #1
ayyasprings
Member
 
Registered: Aug 2014
Posts: 118

Rep: Reputation: Disabled
Doubt in register/ unregister functions in linux device driver


Hi,

An Usb driver can be a char driver or block driver or Network driver based on the hardware peripheral attached. Similarly a PCI driver can be a char driver or block driver or network driver.

Code:
int usb_register(struct usb_driver *d);
void usb_deregister(struct usb_driver *d);
If I am right then we are having separate device driver register/unregister functions for USB driver and also char driver, block driver, network driver. Similarly for PCI driver

Code:
int pci_register_driver(struct pci_driver *drv);
void pci_unregister_driver(struct pci_driver *drv);
along with char driver, block driver, network driver. So if I am going to implement USB as char driver can I use register /unregister functions of char driver?

Code:
int register_chrdev_region(dev_t first, unsigned int count, char *name);
void unregister_chrdev_region(dev_t first, unsigned int count);
if not so what is the reason of having special register/unregister functions of USB/PCI drivers and what is the difference between general char/block/network driver functions and USB/PCI/... drivers for some specific type of interfaces?

Please help!
 
Old 05-07-2015, 09:16 AM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,883
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
I've been subscribed all along here and didn't offer anything due to my lack of really strong driver experience.

But I always thought that for any driver, there really was just one register and unregister set of functions. I think the naming per driver type is merely just a choice of naming per the type. And what you've said which is that something can be either a char driver or a block driver, yes inter-changeably, but really "as architect" meaning when the author chooses to write it, they either choose to form it as a char driver versus a block driver. I didn't think there was anything specific as a PCI driver either. Block, Character, Network. With Block and Character being the most common.

Maybe a solid read of the Linux Device Driver book will help you with this. Presuming that you're still wondering on this topic.
 
Old 06-22-2015, 08:35 AM   #3
ayyasprings
Member
 
Registered: Aug 2014
Posts: 118

Original Poster
Rep: Reputation: Disabled
Unhappy

Hi,

Anybody have answer for this please help as I couldn't figure still now.

Thanks in advance.
 
  


Reply



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
linux device drivers : how can i unregister a character device ? zampa Linux - General 5 06-21-2012 05:34 AM
Can i register a ssc driver (a serial interface device) to be a spi driver ? 5883 Programming 0 03-04-2012 06:14 PM
Doubt in char device driver for linux 2.6 tomkaith13 Programming 6 11-27-2006 04:46 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 06:15 PM.

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
Open Source Consulting | Domain Registration