Skip to contentSkip to conversation

mmc: pxamci: Use DIV_ROUND_UP at appropriate places

PATCH In review Axel Lin 2 participants 2 messages Apr 10, 2012 MMC, SD and SDIO

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 mmc: pxamci: Use DIV_ROUND_UP at appropriate places

---
 drivers/mmc/host/pxamci.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/host/pxamci.c +2 -2
index cb2dc0e..4b89e73 100644
@@ -190,7 +190,7 @@ static void pxamci_setup_data(struct pxamci_host *host, struct mmc_data *data)
 	clks = (unsigned long long)data->timeout_ns * host->clkrate;
 	do_div(clks, 1000000000UL);
 	timeout = (unsigned int)clks + (data->timeout_clks << host->clkrt);
-	writel((timeout + 255) / 256, host->base + MMC_RDTO);
+	writel(DIV_ROUND_UP(timeout, 256), host->base + MMC_RDTO);
 
 	if (data->flags & MMC_DATA_READ) {
 		host->dma_dir = DMA_FROM_DEVICE;
@@ -636,7 +636,7 @@ static int pxamci_probe(struct platform_device *pdev)
 	/*
 	 * Calculate minimum clock rate, rounding up.
 	 */
-	mmc->f_min = (host->clkrate + 63) / 64;
+	mmc->f_min = DIV_ROUND_UP(host->clkrate, 64);
 	mmc->f_max = (mmc_has_26MHz()) ? 26000000 : host->clkrate;
 
 	pxamci_init_ocr(host);
Signature · 1 line
1.7.5.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 19 lines · Axel Lin
---
 drivers/mmc/host/pxamci.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/host/pxamci.c +1 -1
index cb2dc0e..4b89e73 100644
@@ -190,7 +190,7 @@ static void pxamci_setup_data(struct pxamci_host *host, struct mmc_data *data)
 	clks = (unsigned long long)data->timeout_ns * host->clkrate;
 	do_div(clks, 1000000000UL);
 	timeout = (unsigned int)clks + (data->timeout_clks << host->clkrt);
-	writel((timeout + 255) / 256, host->base + MMC_RDTO);
+	writel(DIV_ROUND_UP(timeout, 256), host->base + MMC_RDTO);
 
 	if (data->flags & MMC_DATA_READ) {
 		host->dma_dir = DMA_FROM_DEVICE;

drivers/mmc/host/pxamci.c static int pxamci_probe(struct platform_device *pdev) · line 642

Quoted 8 lines
drivers/mmc/host/pxamci.c +1 -1
@@ -636,7 +636,7 @@ static int pxamci_probe(struct platform_device *pdev)
 	/*
 	 * Calculate minimum clock rate, rounding up.
 	 */
-	mmc->f_min = (host->clkrate + 63) / 64;
+	mmc->f_min = DIV_ROUND_UP(host->clkrate, 64);
 	mmc->f_max = (mmc_has_26MHz()) ? 26000000 : host->clkrate;
 
 	pxamci_init_ocr(host);
Signature · 1 line
viresh