Commit 27e897be authored by Chris Wilson's avatar Chris Wilson Committed by Rodrigo Vivi

drm/i915: Provide the perf pmu.module

Rather than manually implement our own module reference counting for perf
pmu events, finally realise that there is a module parameter to struct
pmu for this very purpose.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: stable@vger.kernel.org
Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200716094643.31410-1-chris@chris-wilson.co.ukSigned-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
parent a5bcf8dd
...@@ -445,8 +445,6 @@ static void i915_pmu_event_destroy(struct perf_event *event) ...@@ -445,8 +445,6 @@ static void i915_pmu_event_destroy(struct perf_event *event)
container_of(event->pmu, typeof(*i915), pmu.base); container_of(event->pmu, typeof(*i915), pmu.base);
drm_WARN_ON(&i915->drm, event->parent); drm_WARN_ON(&i915->drm, event->parent);
module_put(THIS_MODULE);
} }
static int static int
...@@ -538,10 +536,8 @@ static int i915_pmu_event_init(struct perf_event *event) ...@@ -538,10 +536,8 @@ static int i915_pmu_event_init(struct perf_event *event)
if (ret) if (ret)
return ret; return ret;
if (!event->parent) { if (!event->parent)
__module_get(THIS_MODULE);
event->destroy = i915_pmu_event_destroy; event->destroy = i915_pmu_event_destroy;
}
return 0; return 0;
} }
...@@ -1130,6 +1126,7 @@ void i915_pmu_register(struct drm_i915_private *i915) ...@@ -1130,6 +1126,7 @@ void i915_pmu_register(struct drm_i915_private *i915)
if (!pmu->base.attr_groups) if (!pmu->base.attr_groups)
goto err_attr; goto err_attr;
pmu->base.module = THIS_MODULE;
pmu->base.task_ctx_nr = perf_invalid_context; pmu->base.task_ctx_nr = perf_invalid_context;
pmu->base.event_init = i915_pmu_event_init; pmu->base.event_init = i915_pmu_event_init;
pmu->base.add = i915_pmu_event_add; pmu->base.add = i915_pmu_event_add;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment