LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   device drivers (https://www.linuxquestions.org/questions/linux-newbie-8/device-drivers-887697/)

vuthurpavankumar 06-22-2011 03:09 AM

device drivers
 
> may i know
>
> 1.how kernel maintains information of all the drivers present in it?
>
> 2.how the hot-plug-in mechanism identifies required driver? (especially
> network drivers which do not have major and minor number concept)
>
> 3.what is purpose of probe function in driver? does it used by driver or
> kernel? and how?
>
> Thanking you,
> PavanKumar.V


Please find my explanations to the above asked Q?

1A. Linux kernel driver model has a different types of models such as, char, block,
and network models. Every driver that is implemented in the linux will belongs to
one of these categories. Each, model has its own style to maintain data in the
kernel file system.

Suppose for example, PCI-Serial devices which belongs to char model, registers with
the PCI core, registers with the serial core and registers with the tty layer.
Here PCI is the bus, so kernel maintains its data in /sys/bus/pci/... that is while
registering with PCI core.
TTY maintains its data in /sys/class/tty/ttyXX/...
So, for every thing if you want to know the related data, go through the /sysfs.

2A. Hotplugging mechanism aysnchronously notifies the userspace when hardware is
inserted/removed/anyChange.
So, userspace will be notified by either Mj/Mn numbers or in your case
Interface name & index of its interface. Say, eth0 or eth2 etc.

3A. You know the module_init macro right? What it will do, it is only funciton
that called when you insert the module. Generally, you do register with
required subsystems passing device_ids details and return from the
module_init function.
At this stage, the corresponding bus driver will maintain supplied device_ids
structure to its probe match ids table.

When you attach/insert your product, the corresponding bus driver will
identifies its VEN/PROD ids and searches for the product_ids details that is
maintained when you do registering. So, when it found corresponding matched
ids, then driver's "probe" will be called.

brianL 06-22-2011 03:51 AM

Is this homework? If it is, take notice of this LQ rule:
Quote:

Do not expect LQ members to do your homework - you will learn much more by doing it yourself.

16pide 06-22-2011 04:51 AM

@vuthurpavankumar
As Brianl said, no homework here!

To convince us that it's not your homework you're asking us to do, you should post questions that reflect what you've tried, on which exact distro, which commands, and what result you got, what result you expected.

regarding those 3 questions, situation looks quite desperate! you're asking such broad questions that the best advice you can get is to use google to find reference documents on those subjects.

Last one, asking 3 questions in the same thread is not going to help either.

archtoad6 09-04-2011 03:24 AM

Just to remind everyone: While we won't do your homework for you, we will be happy to answer questions, especially thoughtful ones, when you get stuck.

Welcome to LQ, vuthurpavankumar.


brianL, [I]16pide[/I,

Why do you suspect homework here?

jdkaye 09-04-2011 03:31 AM

Just to add one more voice to the above, "homework" immediately sprang to mind on reading the question.
@archtoad6 Why? because of the phrasing of the questions and the kinds of information being asked for. It's hard to imagine what task would require this type of information.
ciao,
jdk

brianL 09-04-2011 06:35 AM

Quote:

Originally Posted by jdkaye (Post 4460957)
@archtoad6 Why? because of the phrasing of the questions...jdk

Same here. I'm always suspicious when questions are numbered like those.


All times are GMT -5. The time now is 10:38 AM.