mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: corbet@lwn.net (Jonathan Corbet)
To: Rolf Eike Beer <eike-kernel@sf-tec.de>
Cc: Alexey Dobriyan <adobriyan@gmail.com>,
	Andrew Morton <akpm@osdl.org>,
	linux-kernel@vger.kernel.org
Subject: Re: cdev documentation (was Drop second arg of unregister_chrdev())
Date: Fri, 18 Aug 2006 07:02:42 -0600	[thread overview]
Message-ID: <20060818130242.12410.qmail@lwn.net> (raw)
In-Reply-To: Your message of "Fri, 18 Aug 2006 09:15:28 +0200." <200608180915.28763.eike-kernel@sf-tec.de>

Rolf Eike Beer <eike-kernel@sf-tec.de> wrote:

> Nevertheless, I ported my driver to the new interface. I see it cdev_add() 
> succeeding, but the device never shows up in sysfs. Do I have to do any more 
> tricks with class devices and stuff?

Yes, cdevs do not, themselves, show up in sysfs.  A simple class is what
you want for that part of the job.

> While I was sneaking around in the code I found this drivers/char/tty_io:3093
> 
>         cdev_init(&driver->cdev, &tty_fops);
>         driver->cdev.owner = driver->owner;
>         error = cdev_add(&driver->cdev, dev, driver->num);
>         if (error) {
>                 cdev_del(&driver->cdev);
> 
> Isn't the call to cdev_del() just wrong here?

It is correct, in that it returns the reference you hold to the cdev's
internal kobject.  If you got the cdev with cdev_alloc(), that's the
only way it will get returned to the system.  For a cdev allocated
elsewhere (as is the case here) it probably doesn't make any difference.

jon

  parent reply	other threads:[~2006-08-18 13:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-15  3:35 [PATCH] Drop second arg of unregister_chrdev() Alexey Dobriyan
2006-08-15  3:48 ` Andrew Morton
2006-08-15  4:18   ` Alexey Dobriyan
2006-08-15 19:52 ` Jonathan Corbet
2006-08-16  7:03   ` Rolf Eike Beer
2006-08-16 15:42     ` Jonathan Corbet
2006-08-17 21:22     ` cdev documentation (was Drop second arg of unregister_chrdev()) Jonathan Corbet
2006-08-18  7:15       ` Rolf Eike Beer
2006-08-18 12:32         ` Dmitry Torokhov
2006-08-18 12:46           ` [TTY] Remove bogus call to cdev_del() Rolf Eike Beer
2006-08-18 13:02         ` Jonathan Corbet [this message]
2006-08-18 13:49           ` cdev documentation (was Drop second arg of unregister_chrdev()) Dmitry Torokhov

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=20060818130242.12410.qmail@lwn.net \
    --to=corbet@lwn.net \
    --cc=adobriyan@gmail.com \
    --cc=akpm@osdl.org \
    --cc=eike-kernel@sf-tec.de \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®