Skip to content

RFC Use udev for accessing sysfs

Nanley Chery powertop 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest9 patches 6 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9build with udev libraryconfigure.ac src/Makefile.am+8 -00 replies
2/9add udev helper functionssrc/lib.cpp src/lib.h src/main.cpp+59 -00 replies
3/9usb_tunable: use udevsrc/tuning/tuningusb.cpp src/tuning/tuningusb.h+47 -1000 replies
4/9syfs_tunable: use udevsrc/tuning/tuningsysfs.cpp src/tuning/tuningsysfs.h+10 -30 replies
5/9runtime_tunable: use udevsrc/devices/runtime_pm.cpp src/devices/runtime_pm.h src/tuning/runtime.cpp +1 more+56 -980 replies
6/9replace pciutils usage with udevhwdbsrc/lib.cpp src/lib.h src/tuning/runtime.cpp+31 -82 replies
7/9runtime_pm: use udevsrc/devices/runtime_pm.cpp+27 -710 replies
8/9remove libpci and most dead codeAndroid.mk README configure.ac +4 more+2 -720 replies
9/9calibrate: use udevsrc/calibrate/calibrate.cpp+12 -320 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [Powertop] [RFC 0/9] Use udev for accessing sysfs

From: Nanley Chery <nanley.g.chery(a)intel.com>

This patch series changes PowerTOP's method of accessing sysfs (for tunables mainly) from explicitly accessing files to using the standard udev device management library and API.

The current codebase collects data on devices by probing sysfs files directly with the usual low-level file handling API. This method is not recommended by the Linux kernel maintainers because the sysfs organization is not guaranteed to be stable over time. This can lead to dependent applications breaking with newer kernel releases. Instead using an abstraction layer, like udev, is suggested
(see https://www.kernel.org/doc/Documentation/sysfs-rules.txt).

The benefits of switching to udev include:
* The removal of libpci and a reduction in repetitive code.
* Improved readability of the tunable code.
* Faster reading of device state values due to caching provided by udev.

I've tried to make this transition as simple as possible by including the bare minimum of changes required for this feature. There's at least one more tunable that can be converted (i2c), but I would like to get feedback on the current implementation first.

Nanley Chery (9):
build with udev library
add udev helper functions
usb_tunable: use udev
syfs_tunable: use udev
runtime_tunable: use udev
replace pciutils usage with udevhwdb
runtime_pm: use udev
remove libpci and most dead code
calibrate: use udev

 Android.mk                  |   1 -
 README                      |   1 -
 configure.ac                |  20 ++-----
 src/Makefile.am             |   6 +-
 src/calibrate/calibrate.cpp |  44 ++++----------
 src/devices/runtime_pm.cpp  | 105 +++++++++++---------------------
 src/devices/runtime_pm.h    |   1 +
 src/lib.cpp                 | 100 +++++++++++++++++++++----------
 src/lib.h                   |   7 ++-
 src/main.cpp                |   4 +-
 src/tuning/runtime.cpp      | 139 +++++++++++++------------------------------
 src/tuning/runtime.h        |   6 +-
 src/tuning/tuningsysfs.cpp  |  12 +++-
 src/tuning/tuningsysfs.h    |   1 +
 src/tuning/tuningusb.cpp    | 142 ++++++++++++++------------------------------
 src/tuning/tuningusb.h      |   5 +-
 16 files changed, 231 insertions(+), 363 deletions(-)
Signature · 1 line
2.4.1