Re: Strategies for accessing driver data from file operations!?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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,

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies




[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux