From: danielhilst@gmail.com (Daniel Hilst Selli)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Strategies for accessing driver data from file operations!?
Date: Mon, 25 Aug 2014 15:34:45 -0300 [thread overview]
Message-ID: <53FB81C5.9010100@gmail.com> (raw)
In-Reply-To: <20140813214054.GA7214@kroah.com>
On 08/13/2014 06:40 PM, Greg KH wrote:
> On Wed, Aug 13, 2014 at 09:46:51AM -0300, Daniel Hilst Selli wrote:
>> One last question, supposing I need to create multiple /dev nodes, do I need to
>> allocate one struct cdev for each major:minor pair (cdev_alloc(), cdev_init(), cdev_add())?
>
> No, you can allocate multiple minor numbers with a single set of cdev
> calls. But watch out, you also need to create a 'struct device' for
> _each_ minor number you are actually using if you want the device nodes
> to show up in /dev automatically.
>
> Yeah, it's a pain, sorry, but this way you can allocate a whole range of
> major:minor pairs but don't actually expose them to userspace until you
> really need them (i.e. the hardware is present in the system.) This
> keeps /dev looking like only the devices that are present in the system,
> not the "old" way of "every possible device that could ever be possibly
> present".
>
> Hope this helps,
>
> greg k-h
>
It help-me alot Greg, thanks.. At last I know I'm doing in the right way :)
Cheers,
prev parent reply other threads:[~2014-08-25 18:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-12 13:47 Strategies for accessing driver data from file operations!? Daniel Hilst Selli
2014-08-12 19:53 ` Greg KH
2014-08-13 12:46 ` Daniel Hilst Selli
2014-08-13 21:40 ` Greg KH
2014-08-25 18:34 ` Daniel Hilst Selli [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53FB81C5.9010100@gmail.com \
--to=danielhilst@gmail.com \
--cc=kernelnewbies@lists.kernelnewbies.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).