]> git.baikalelectronics.ru Git - kernel.git/commit
drm/i915/pmu: Only enumerate available counters in sysfs
authorTvrtko Ursulin <tvrtko.ursulin@intel.com>
Thu, 11 Jan 2018 08:35:25 +0000 (08:35 +0000)
committerTvrtko Ursulin <tvrtko.ursulin@intel.com>
Thu, 11 Jan 2018 09:55:52 +0000 (09:55 +0000)
commit0ba7483d34c16850076afaa7a28d862b6b676c55
treec5a597b1e5a157bb402137d09cf7f528fdc1ca65
parent5e9401745601441ec9d5f8b0b048e1a257cba055
drm/i915/pmu: Only enumerate available counters in sysfs

Switch over to dynamically creating device attributes, which are in turn
used by the perf core to expose available counters in sysfs.

This way we do not expose counters which are not avaiable on the current
platform, and are so more consistent between what we reply to open
attempts via the perf_event_open(2), and what is discoverable in sysfs.

v2:
 * Simplify attribute pointer freeing loop.
 * Changed attr init from macro to function.
 * More common error unwind. (Chris Wilson)
 * Rename some locals. (Chris Wilson)

v3:
 * Fixed double semi-colon. (Chris Wilson)

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20180111083525.32394-1-tvrtko.ursulin@linux.intel.com
drivers/gpu/drm/i915/i915_pmu.c
drivers/gpu/drm/i915/i915_pmu.h