]> www.infradead.org Git - users/jedix/linux-maple.git/commit
perf hwmon_pmu: Add hwmon filename parser
authorIan Rogers <irogers@google.com>
Sat, 9 Nov 2024 00:37:54 +0000 (16:37 -0800)
committerNamhyung Kim <namhyung@kernel.org>
Sat, 9 Nov 2024 16:26:53 +0000 (08:26 -0800)
commit4810b761f812da3ca33badd7861a04b58613a4a1
tree75e048ecd65161472c7c29bf00cedad662bcf3df
parentf4db95b68ae68ebaf91d35cc0487ac1cbd04261e
perf hwmon_pmu: Add hwmon filename parser

hwmon filenames have a specific encoding that will be used to give a
config value. The encoding is described in:
Documentation/hwmon/sysfs-interface.rst
Add a function to parse the filename into consituent enums/ints that
will then be amenable to config encoding.

Note, things are done this way to allow mapping names to config and
back without the use of hash/dynamic lookup tables.

Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Ravi Bangoria <ravi.bangoria@amd.com>
Cc: Yoshihiro Furudera <fj5100bi@fujitsu.com>
Cc: Howard Chu <howardchu95@gmail.com>
Cc: Ze Gao <zegao2021@gmail.com>
Cc: Changbin Du <changbin.du@huawei.com>
Cc: Junhao He <hejunhao3@huawei.com>
Cc: Weilin Wang <weilin.wang@intel.com>
Cc: James Clark <james.clark@linaro.org>
Cc: Oliver Upton <oliver.upton@linux.dev>
Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
[namhyung: add #include <linux/string.h> for strlcpy()]
Link: https://lore.kernel.org/r/20241109003759.473460-3-irogers@google.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/util/Build
tools/perf/util/hwmon_pmu.c [new file with mode: 0644]
tools/perf/util/hwmon_pmu.h [new file with mode: 0644]