mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Kristian Høgsberg" <krh@bitplanet.net>
To: "Pierre Ossman" <drzeus-list@drzeus.cx>
Cc: "Kay Sievers" <kay.sievers@vrfy.org>, "Greg KH" <greg@kroah.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: Race free attributes in sysfs
Date: Tue, 22 May 2007 11:58:23 -0400	[thread overview]
Message-ID: <59ad55d30705220858i593352b6p87a6b385aea23748@mail.gmail.com> (raw)
In-Reply-To: <46530F02.7010802@drzeus.cx>

On 5/22/07, Pierre Ossman <drzeus-list@drzeus.cx> wrote:
> Kay Sievers wrote:
> > We could change the driver-core to suppress the creation of an attribute
> > if the attribute's show() or store() method returns something like
> > -ENOENT at registration time?
> > The driver would pass _all_ possible attributes of the device at
> > registration time, but the core would only create the attributes which
> > are implemented for this particular device? Would that work for you?
> >
>
> Not sure. Not in an obvious way at least.
>
> It also doesn't feel like "the kernel way". Generally you can
> create/allocate an object, assign attributes to it, then activate it.
> Couldn't it be done so that I can add sysfs stuff to a device after I
> just initialized it? (but before I add it).

I agree here - if it was just possible to do this between create and
add, this discussion would be moot.

> > You can assign any number of attribute groups to the device. If they
> > don't have a group name, they will all be created directly at the device
> > level. Would that work for you?
>
> I've had a look at sysfs groups and the biggest beef I have with those
> is that they're too low level. In order to use them I first need to
> create device attributes, then create an array of pointers to each attr
> member. It would be nice if I could just feed an array of device
> attributes (i.e. I want wrappers).

I did a little helper struct for the firewire subsystem that might be
useful on a more general level.  It's struct fw_attribute_group in
drivers/firewire/fw-device.h and the implementation is
init_fw_attribute_group in drivers/firewire/fw-device.c.  But I agree,
attribute groups require a fair bit of boiler plate code.

cheers,
Kristian

  reply	other threads:[~2007-05-22 15:58 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-20 11:01 Pierre Ossman
2007-05-21  3:12 ` Dmitry Torokhov
2007-05-21  7:47   ` Pierre Ossman
2007-05-22 21:24   ` Mark Lord
2007-05-23  2:43     ` Dmitry Torokhov
2007-05-23  4:21       ` Greg KH
2007-05-23 13:27         ` Mark Lord
2007-05-23 15:14           ` Greg KH
2007-05-26 16:12             ` Bill Davidsen
2007-05-27  8:57               ` Greg KH
2007-05-21 17:50 ` Kay Sievers
2007-05-21 18:43   ` Pierre Ossman
2007-05-21 19:28     ` Kay Sievers
2007-05-22  8:38       ` Cornelia Huck
2007-05-23  4:25         ` Greg KH
2007-05-22 15:40       ` Pierre Ossman
2007-05-22 15:58         ` Kristian Høgsberg [this message]
2007-05-22 21:25         ` Mark Lord
2007-05-23  4:24         ` Greg KH
2007-05-23  5:44           ` Pierre Ossman

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=59ad55d30705220858i593352b6p87a6b385aea23748@mail.gmail.com \
    --to=krh@bitplanet.net \
    --cc=drzeus-list@drzeus.cx \
    --cc=greg@kroah.com \
    --cc=kay.sievers@vrfy.org \
    --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®