Message ID | 20230830101642.774485-1-ruanjinjie@huawei.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [-next] dm stats: Use list_for_each_entry() helper instead of list_for_each() and container_of() | expand |
diff --git a/drivers/md/dm-stats.c b/drivers/md/dm-stats.c index db2d997a6c18..06304b0ad906 100644 --- a/drivers/md/dm-stats.c +++ b/drivers/md/dm-stats.c @@ -240,12 +240,10 @@ void dm_stats_cleanup(struct dm_stats *stats) static void dm_stats_recalc_precise_timestamps(struct dm_stats *stats) { - struct list_head *l; struct dm_stat *tmp_s; bool precise_timestamps = false; - list_for_each(l, &stats->list) { - tmp_s = container_of(l, struct dm_stat, list_entry); + list_for_each_entry(tmp_s, &stats->list, list_entry) { if (tmp_s->stat_flags & STAT_PRECISE_TIMESTAMPS) { precise_timestamps = true; break;
Convert list_for_each() and container_of() to list_for_each_entry() so that the l list_head pointer and container_of() call are no longer needed, which can reduce a few lines of code. No functional changed. Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com> --- drivers/md/dm-stats.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)