devfreq: exynos-ppmu: simplify parsing event-type from DT
authorKrzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Mon, 20 Sep 2021 07:17:52 +0000 (09:17 +0200)
committerChanwoo Choi <cw00.choi@samsung.com>
Wed, 27 Oct 2021 05:22:12 +0000 (14:22 +0900)
commit14714135a8358830ccd156c335fe6447e7e6e923
tree9bfe9718598a5eabd4c5987de50e418dfcaefe38
parent28d7f0f3f10be9d6ecca15669fa17d561581a843
devfreq: exynos-ppmu: simplify parsing event-type from DT

When parsing devicetree, the function of_get_devfreq_events(), for each
device child node, iterates over array of possible events "ppmu_events"
till it finds one matching by node name.  When match is found the
ppmu_events[i] points to element having both the name of the event and
the counters ID.

Each PPMU device child node might have an "event-name" property with the
name of the event, however due to the design of devfreq it must be the
same as the device node name.  If it is not the same, the devfreq client
won't be able to use it via devfreq_event_get_edev_by_phandle().

Since PPMU device child node name must be equal to the "event-name"
property (event-name == ppmu_events[i].name), there is no need to find
the counters ID by the "event-name".  Instead use ppmu_events[i].id
which must be equal to it.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
drivers/devfreq/event/exynos-ppmu.c