[PATCH -next] dm stats: Use list_for_each_entry() helper instead of list_for_each() and container_of()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 drivers/md/dm-stats.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

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;
-- 
2.34.1

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/dm-devel




[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux