Skip to content

Commit df3ab3c

Browse files
icklejnikula
authored andcommitted
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: Chris Wilson <[email protected]> Cc: Tvrtko Ursulin <[email protected]> Cc: [email protected] Reviewed-by: Tvrtko Ursulin <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Rodrigo Vivi <[email protected]> (cherry picked from commit 27e897b) Signed-off-by: Jani Nikula <[email protected]>
1 parent e9e3086 commit df3ab3c

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

drivers/gpu/drm/i915/i915_pmu.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -445,8 +445,6 @@ static void i915_pmu_event_destroy(struct perf_event *event)
445445
container_of(event->pmu, typeof(*i915), pmu.base);
446446

447447
drm_WARN_ON(&i915->drm, event->parent);
448-
449-
module_put(THIS_MODULE);
450448
}
451449

452450
static int
@@ -538,10 +536,8 @@ static int i915_pmu_event_init(struct perf_event *event)
538536
if (ret)
539537
return ret;
540538

541-
if (!event->parent) {
542-
__module_get(THIS_MODULE);
539+
if (!event->parent)
543540
event->destroy = i915_pmu_event_destroy;
544-
}
545541

546542
return 0;
547543
}
@@ -1130,6 +1126,7 @@ void i915_pmu_register(struct drm_i915_private *i915)
11301126
if (!pmu->base.attr_groups)
11311127
goto err_attr;
11321128

1129+
pmu->base.module = THIS_MODULE;
11331130
pmu->base.task_ctx_nr = perf_invalid_context;
11341131
pmu->base.event_init = i915_pmu_event_init;
11351132
pmu->base.add = i915_pmu_event_add;

0 commit comments

Comments
 (0)