kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: greg@kroah.com (Greg KH)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Is there any way to add an attribute under sysfs at the “platform” level?
Date: Mon, 19 Jun 2017 23:25:39 +0800	[thread overview]
Message-ID: <20170619152539.GB22977@kroah.com> (raw)
In-Reply-To: <20170619150928.GA7788@home>

On Mon, Jun 19, 2017 at 06:09:28PM +0300, Roman Storozhenko wrote:
> On Mon, Jun 19, 2017 at 08:55:22AM +0800, Greg KH wrote:
> > On Sun, Jun 18, 2017 at 05:38:36PM +0300, Roman Storozhenko wrote:
> > > Hello everybody!
> > > 
> > > I am trying to modify "pcspkr" driver undere linux kernel source tree. I added a new line there:
> > > 
> > > sample_id_dir = kobject_create_and_add("devices/platform/pcspkr/sample", NULL);
> > 
> > Ick, really?  What are you trying to do with "raw" kobjects?
> 
> I am trying to add "read/write" attribute under
> "devices/platform/pcspkr". Just for educational purposes. Didn't find another way to do it.

Using a kobject is not how to do that at all, attributes need to be
added to the structure that owns the directory.  kobjects are a
directory themselves.

good luck!

greg k-h

      reply	other threads:[~2017-06-19 15:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-18 14:38 Is there any way to add an attribute under sysfs at the “platform” level? Roman Storozhenko
2017-06-19  0:55 ` Greg KH
2017-06-19 15:09   ` Roman Storozhenko
2017-06-19 15:25     ` Greg KH [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=20170619152539.GB22977@kroah.com \
    --to=greg@kroah.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).