lkml.org 
[lkml]   [2012]   [Nov]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] LDT - Linux Driver Template
On Wed, Nov 14, 2012 at 01:19:06AM +0200, Constantine Shulyupin wrote:
> On Wed, Nov 14, 2012 at 1:02 AM, Greg KH <gregkh@linuxfoundation.org> wrote:
> > On Wed, Nov 14, 2012 at 12:31:13AM +0200, Constantine Shulyupin wrote:
> >> >> + * Device Model (class, device)
> >> > Don't use class code in an example, it is slowly going away from the
> >> > whole kernel.
> >> What to use instead class_create and device_create?
> >
> > What are you trying to do?
>
> I trying to properly register char device and device region.
> Single char device could be registered as misc device with just misc_register.

When you do that, the struct device is automatically registered with the
system, why do you need to do it again?

> How to register properly char devices region?

Using the proper calls, which are not the misc_register ones :)

> Should to use device_register instead device_create to create dev files?

Depends on what you want to do :)

> Which other registration functions char device must to call besides
> alloc_chrdev_region, cdev_add?

Again, I think you are mixing two different things here. You can't mix
the char interface with the misc_register interface, they don't play
well, it's either one or the other.

Now I agree using the char interface isn't the most "obvious" and I have
a set of ideas/half-baked patches floating around that aim to clean it
up, but for now, I'd recommend just using the misc interface, it's
worlds simpler, makes sense, and handles all of the struct device work
for you automatically.

thanks,

greg k-h


\
 
 \ /
  Last update: 2012-11-14 01:21    [W:0.051 / U:0.308 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site