public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Aubrey <aubreylee@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: How to add a device file to sysfs?
Date: Thu, 2 Nov 2006 20:52:35 -0800	[thread overview]
Message-ID: <20061103045235.GA24467@kroah.com> (raw)
In-Reply-To: <6d6a94c50610302130u55fc3f59n7be157a73c50805e@mail.gmail.com>

On Tue, Oct 31, 2006 at 01:30:36PM +0800, Aubrey wrote:
> Hi all,
> 
> When a misc device file is registered, there are two files under my
> own class directory:
> 
> /sys --> class --> misc --> myprog --> dev
>                                                   --> uevent
>                                                   --> myprog_show (to be 
>                                                   added)
> 
> Now, my question is, is it possbile to add the third file
> "myprog_show" under "myprog" directory without modify any common code?

Yes.

> I've read the doc under linux-2.6.x/Documentation, I can add it to
> some other directory, but not found a way to add it to my own
> directory.

After misc_register() has been successfully called, the variable "class"
will be set in the miscdevice structure.  Use that pointer to call
class_device_create_file() to create your new file in this directory.

Hope this helps,

greg k-h

  reply	other threads:[~2006-11-03  4:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-31  5:30 How to add a device file to sysfs? Aubrey
2006-11-03  4:52 ` Greg KH [this message]
2006-11-13 10:45   ` Brice Goglin
2006-11-13 17:07     ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2006-11-01  7:51 Aubrey

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=20061103045235.GA24467@kroah.com \
    --to=greg@kroah.com \
    --cc=aubreylee@gmail.com \
    --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