]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
PM: EM: use kfree_rcu() to simplify the code
authorLi RongQing <lirongqing@baidu.com>
Tue, 18 Feb 2025 08:20:21 +0000 (16:20 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 20 Feb 2025 19:53:34 +0000 (20:53 +0100)
The callback function of call_rcu() just calls kfree(), so use
kfree_rcu() instead of call_rcu() + callback function.

Signed-off-by: Li RongQing <lirongqing@baidu.com>
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Link: https://patch.msgid.link/20250218082021.2766-1-lirongqing@baidu.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
kernel/power/energy_model.c

index 066bcf1c71a1f5b90c37334115bb7c7ce85f6a5b..16f6dcafdb904330d34ac78b0a4d27dccc69b9ba 100644 (file)
@@ -161,14 +161,6 @@ static void em_debug_create_pd(struct device *dev) {}
 static void em_debug_remove_pd(struct device *dev) {}
 #endif
 
-static void em_destroy_table_rcu(struct rcu_head *rp)
-{
-       struct em_perf_table __rcu *table;
-
-       table = container_of(rp, struct em_perf_table, rcu);
-       kfree(table);
-}
-
 static void em_release_table_kref(struct kref *kref)
 {
        struct em_perf_table __rcu *table;
@@ -176,7 +168,7 @@ static void em_release_table_kref(struct kref *kref)
        /* It was the last owner of this table so we can free */
        table = container_of(kref, struct em_perf_table, kref);
 
-       call_rcu(&table->rcu, em_destroy_table_rcu);
+       kfree_rcu(table, rcu);
 }
 
 /**