PM: EM: use kfree_rcu() to simplify the code
[ Upstream commit 1618f635bdf56f3ac158171114e9bf18db234cbf ] 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> Stable-dep-of: 3ee7be9e10dd ("PM: EM: Address RCU-related sparse warnings") Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
27ce35d80a
commit
db3b3964af
@@ -161,14 +161,6 @@ static void em_debug_create_pd(struct device *dev) {}
|
|||||||
static void em_debug_remove_pd(struct device *dev) {}
|
static void em_debug_remove_pd(struct device *dev) {}
|
||||||
#endif
|
#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)
|
static void em_release_table_kref(struct kref *kref)
|
||||||
{
|
{
|
||||||
struct em_perf_table __rcu *table;
|
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 */
|
/* It was the last owner of this table so we can free */
|
||||||
table = container_of(kref, struct em_perf_table, kref);
|
table = container_of(kref, struct em_perf_table, kref);
|
||||||
|
|
||||||
call_rcu(&table->rcu, em_destroy_table_rcu);
|
kfree_rcu(table, rcu);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user