[PATCH 06/10] ARM: i.MX: esdctl: Make use of min_t()
Andrey Smirnov
andrew.smirnov at gmail.com
Tue Apr 10 16:53:19 PDT 2018
Use min_t() instead of explicit if ().
Signed-off-by: Andrey Smirnov <andrew.smirnov at gmail.com>
---
arch/arm/mach-imx/esdctl.c | 15 +++------------
1 file changed, 3 insertions(+), 12 deletions(-)
diff --git a/arch/arm/mach-imx/esdctl.c b/arch/arm/mach-imx/esdctl.c
index 3cd7c5738..a4eb3f196 100644
--- a/arch/arm/mach-imx/esdctl.c
+++ b/arch/arm/mach-imx/esdctl.c
@@ -77,10 +77,7 @@ static inline unsigned long imx_v1_sdram_size(void __iomem *esdctlbase, int num)
size = (1 << cols) * (1 << rows) * banks * width;
- if (size > SZ_64M)
- size = SZ_64M;
-
- return size;
+ return min_t(unsigned long, size, SZ_64M);
}
/*
@@ -105,10 +102,7 @@ static inline unsigned long imx_v2_sdram_size(void __iomem *esdctlbase, int num)
size = (1 << cols) * (1 << rows) * banks * width;
- if (size > SZ_256M)
- size = SZ_256M;
-
- return size;
+ return min_t(unsigned long, size, SZ_256M);
}
/*
@@ -123,10 +117,7 @@ static inline unsigned long imx_v3_sdram_size(void __iomem *esdctlbase, int num)
if (readl(esdctlbase + IMX_ESDMISC) & ESDMISC_DDR2_8_BANK)
size *= 2;
- if (size > SZ_256M)
- size = SZ_256M;
-
- return size;
+ return min_t(unsigned long, size, SZ_256M);
}
/*
--
2.14.3
More information about the barebox
mailing list