Skip to content

Commit 1618f63

Browse files
lrq-maxrafaeljw
authored andcommitted
PM: EM: use kfree_rcu() to simplify the code
The callback function of call_rcu() just calls kfree(), so use kfree_rcu() instead of call_rcu() + callback function. Signed-off-by: Li RongQing <[email protected]> Reviewed-by: Lukasz Luba <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent a8e6272 commit 1618f63

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

kernel/power/energy_model.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -161,22 +161,14 @@ static void em_debug_create_pd(struct device *dev) {}
161161
static void em_debug_remove_pd(struct device *dev) {}
162162
#endif
163163

164-
static void em_destroy_table_rcu(struct rcu_head *rp)
165-
{
166-
struct em_perf_table __rcu *table;
167-
168-
table = container_of(rp, struct em_perf_table, rcu);
169-
kfree(table);
170-
}
171-
172164
static void em_release_table_kref(struct kref *kref)
173165
{
174166
struct em_perf_table __rcu *table;
175167

176168
/* It was the last owner of this table so we can free */
177169
table = container_of(kref, struct em_perf_table, kref);
178170

179-
call_rcu(&table->rcu, em_destroy_table_rcu);
171+
kfree_rcu(table, rcu);
180172
}
181173

182174
/**

0 commit comments

Comments
 (0)