]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915: Add i915_sched_engine destroy vfunc
authorMatthew Brost <matthew.brost@intel.com>
Tue, 27 Jul 2021 00:23:21 +0000 (17:23 -0700)
committerJohn Harrison <John.C.Harrison@Intel.com>
Wed, 28 Jul 2021 00:31:38 +0000 (17:31 -0700)
This is required to allow backend specific cleanup

v2:
 (John H)
  - Rework commit message

Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: John Harrison <John.C.Harrison@Intel.com>
Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210727002348.97202-7-matthew.brost@intel.com
drivers/gpu/drm/i915/i915_scheduler.c
drivers/gpu/drm/i915/i915_scheduler.h
drivers/gpu/drm/i915/i915_scheduler_types.h

index 561c649e59f77602eb4b88899503ad320876a70b..2804fd5b660ba851322e067d93f7aee2aeb29bfe 100644 (file)
@@ -431,7 +431,7 @@ void i915_request_show_with_schedule(struct drm_printer *m,
        rcu_read_unlock();
 }
 
-void i915_sched_engine_free(struct kref *kref)
+static void default_destroy(struct kref *kref)
 {
        struct i915_sched_engine *sched_engine =
                container_of(kref, typeof(*sched_engine), ref);
@@ -453,6 +453,7 @@ i915_sched_engine_create(unsigned int subclass)
 
        sched_engine->queue = RB_ROOT_CACHED;
        sched_engine->queue_priority_hint = INT_MIN;
+       sched_engine->destroy = default_destroy;
 
        INIT_LIST_HEAD(&sched_engine->requests);
        INIT_LIST_HEAD(&sched_engine->hold);
index 650ab8e0db9f08879b085058974b1fd66052ee63..3c9504e9f409f98f425f9869791290f272140c54 100644 (file)
@@ -51,8 +51,6 @@ static inline void i915_priolist_free(struct i915_priolist *p)
 struct i915_sched_engine *
 i915_sched_engine_create(unsigned int subclass);
 
-void i915_sched_engine_free(struct kref *kref);
-
 static inline struct i915_sched_engine *
 i915_sched_engine_get(struct i915_sched_engine *sched_engine)
 {
@@ -63,7 +61,7 @@ i915_sched_engine_get(struct i915_sched_engine *sched_engine)
 static inline void
 i915_sched_engine_put(struct i915_sched_engine *sched_engine)
 {
-       kref_put(&sched_engine->ref, i915_sched_engine_free);
+       kref_put(&sched_engine->ref, sched_engine->destroy);
 }
 
 static inline bool
index 5935c3152bdc96a3062aa1b3ba14926c1da8fbed..00384e2c52739b5355860fd5d6f584f418b68de4 100644 (file)
@@ -163,6 +163,11 @@ struct i915_sched_engine {
         */
        void *private_data;
 
+       /**
+        * @destroy: destroy schedule engine / cleanup in backend
+        */
+       void    (*destroy)(struct kref *kref);
+
        /**
         * @kick_backend: kick backend after a request's priority has changed
         */