[lkml]   [2007]   [May]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: Race free attributes in sysfs
    On 5/22/07, Pierre Ossman <> 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.

    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2007-05-22 18:01    [W:0.023 / U:41.908 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site