From: Yani Ioannou <yani.ioannou@gmail.com>
To: Greg KH <greg@kroah.com>,
linux-kernel@vger.kernel.org, lm-sensors@lm-sensors.org
Cc: Russell King <rmk+lkml@arm.linux.org.uk>
Subject: [PATCH 2.6.12-rc4 1/15] (dynamic sysfs callbacks) device attribute callbacks - take 2
Date: Tue, 17 May 2005 06:39:07 -0400 [thread overview]
Message-ID: <2538186705051703394944e949@mail.gmail.com> (raw)
Hi,
The following patches implement dynamic sysfs callbacks for
device_attribute, and provide a possible standard sensor attribute
macro for the majority of the i2c sensor chip/hwmon drivers. Finally a
patch against adm1026 shows how the patch can be used to reduce the
footprint and clean up an existing driver.
The new form of dynamic sysfs callback simply passes a reference to
the device_attribute struct, instead of a void *, along the lines of
the suggestion by Russell King (see
http://lkml.org/lkml/2005/5/14/116). Embedding the device_attribute
struct in a custom struct one can use a macro based on container_of to
access the custom attribute specific data.
Although functionally as capable as the void *, this solution I feel
is better in that it rids of some error-prone casting, and the
resulting code seems generally cleaner and easier to understand, there
is also no need for the extra void * member in the base sysfs
attribute. On the other hand a bit more work is required to implement
this on a grand scale, and in many cases a new attribute struct might
have to be defined for a driver, along with any convenience macros. My
example patch implements a new attribute struct
sensor_device_attribute that should be reusable by the majority of i2c
chip drivers (as suggested by Greg).
Signed-off-by: Yani Ioannou <yani.ioannou@gmail.com>
Thanks,
Yani
next reply other threads:[~2005-05-17 10:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-17 10:39 Yani Ioannou [this message]
2005-05-18 7:22 ` [PATCH 2.6.12-rc4 1/15] (dynamic sysfs callbacks) device attribute callbacks - take 2 Greg KH
2005-05-18 7:28 ` Yani Ioannou
2005-05-18 7:37 ` Greg KH
2005-05-18 7:41 ` Yani Ioannou
2005-05-18 16:41 ` 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=2538186705051703394944e949@mail.gmail.com \
--to=yani.ioannou@gmail.com \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lm-sensors@lm-sensors.org \
--cc=rmk+lkml@arm.linux.org.uk \
/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