perf/core: Introduce perf_get_pmu_by_node API
Add a new public API to fetch a pointer to struct pmu from a devicetree
node devicetree node. This is meant to be used by other drivers to
create in-kernel counter for custom hardware PMUs with automatically
allocated pmu->type.
This is implementated by adding a new "parent_dev" field which pmu
drivers can optionally fill. This parent device is set as the parent of
the pmu->dev created on the pmu_bus. This also has the nice side-effect
of creating additional symlinks inside sysfs.
The actual per_get_pmu_by_node function is implemented through
bus_find_device and callers are asked to "put_device(pmu->dev)" when
done. This might cause problems if pmu_bus is initialize late but
consumers should handle errors by returning -EPROBE_DEFER anyway.
Signed-off-by:
Leonard Crestez <leonard.crestez@nxp.com>
Showing
Please register or sign in to comment