[PATCH 3/3] spi: mvebu: various non-critical improvements to armada_370_xp_spi_set_baudrate

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

 



 - Initialize pdiv in declaration
 - fix format specifiers
 - simplify range check, pdiv can never be > 7

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>
---
 drivers/spi/mvebu_spi.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/spi/mvebu_spi.c b/drivers/spi/mvebu_spi.c
index 319d213872e0..58ac6057afe3 100644
--- a/drivers/spi/mvebu_spi.c
+++ b/drivers/spi/mvebu_spi.c
@@ -135,22 +135,21 @@ static int mvebu_spi_set_baudrate(struct mvebu_spi *p, u32 speed)
 #if defined(CONFIG_ARCH_ARMADA_370) || defined(CONFIG_ARCH_ARMADA_XP)
 static int armada_370_xp_spi_set_baudrate(struct mvebu_spi *p, u32 speed)
 {
-	u32 pscl, pdiv, val;
+	u32 pscl, pdiv = 0, val;
 
 	/* prescaler values: 1,2,3,...,15 */
 	pscl = DIV_ROUND_UP(clk_get_rate(p->clk), speed);
 
 	/* additional prescaler divider: 1, 2, 4, 8, 16, 32, 64, 128 */
-	pdiv = 0;
 	while (pscl > 15 && pdiv <= 7) {
 		pscl = DIV_ROUND_UP(pscl, 2);
 		pdiv++;
 	}
 
-	dev_dbg(p->master.dev, "%s: clk = %lu, speed = %u, pscl = %d, pdiv = %d\n",
+	dev_dbg(p->master.dev, "%s: clk = %lu, speed = %u, pscl = %u, pdiv = %u\n",
 		__func__, clk_get_rate(p->clk), speed, pscl, pdiv);
 
-	if (pscl > 15 || pdiv > 7)
+	if (pscl > 15)
 		return -EINVAL;
 
 	val = readl(p->base + SPI_IF_CONFIG) & ~(IF_CLK_PRESCALE_MASK);
-- 
2.10.2


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux