kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: gaspa@yattaweb.it (Gasparini Andrea)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Attr Groups in sysfs.
Date: Mon, 18 Apr 2011 16:29:57 +0200	[thread overview]
Message-ID: <BANLkTi=Nt5wZ4ZXv2Y5efEDDD4_7EBybxw@mail.gmail.com> (raw)
In-Reply-To: <20110418141435.GA26865@kroah.com>

Hi,

On Mon, Apr 18, 2011 at 4:14 PM, Greg KH <greg@kroah.com> wrote:
>> I'm missing only the myattr_group name... anyone has a clue of how can
>> I access this?
>
> You can't.

ok.

>> And adding to my kobject this way:
>> ? ? retval = sysfs_create_group(mykobj, &my_attr_group_0);
>
> Ick, no, please don't do that, you want the group to be created before
> the device shows up to userspace, otherwise you just raced with
> userspace and bad things will happen.

Understand, you're completely right.
I'll try to refactor in a different way to avoid race.

> Why are you using a struct kobject directly and not a struct device
> instead? ?Please don't use kobjects unless you are doing something very
> strange, and even then, please reconsider.
>
> Care to explain what you are using sysfs for?

Sure, It's quite complicated, in fact ;)
I'm doing an "extension" for a video device, in terms of a module that
handle some addictional logic that do some sort of stats about the
stream passed through it.
For example, I've a certain number of areas inside a frame, given in
form of (x,y,width,heigth) that behave to the same device, so I'd like
to call them: mydev/region_{0,1,2...}/{x,y,width,height}

That's why I'd like to have the "region_0" name, so I can distinguish
between the right attribute group.

Too caotic perhaps? (suggestions and existing examples are obviuosly welcome)


> thanks,

Thank *you* ;)
bye
--
-gaspa-

  reply	other threads:[~2011-04-18 14:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-18  9:45 Attr Groups in sysfs Gasparini Andrea
2011-04-18 14:14 ` Greg KH
2011-04-18 14:29   ` Gasparini Andrea [this message]
2011-04-18 16:08     ` Greg KH

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='BANLkTi=Nt5wZ4ZXv2Y5efEDDD4_7EBybxw@mail.gmail.com' \
    --to=gaspa@yattaweb.it \
    --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).