All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] mmc: tmio, renesas-sdhi: cleanups
@ 2017-05-30 12:50 Simon Horman
  2017-05-30 12:50 ` [PATCH 1/5] MAINTAINERS: Update files for TMIO/SDHI MMC driver Simon Horman
                   ` (5 more replies)
  0 siblings, 6 replies; 14+ messages in thread
From: Simon Horman @ 2017-05-30 12:50 UTC (permalink / raw)
  To: Wolfram Sang, Ulf Hansson
  Cc: Magnus Damm, linux-mmc, linux-renesas-soc, Simon Horman

Hi,

this short series provides some cleanups to the tmio and renesas-sdhi
drivers.

* Update files listed in MAINTAINERS
* Consistently use EXPORT_SYMBOL_GPL
* Update Renesas related copyrights
* Improve checkpatch cleanness

Simon Horman (5):
  MAINTAINERS: Update files for TMIO/SDHI MMC driver
  mmc: tmio: use EXPORT_SYMBOL_GPL
  mmc: tmio, renesas-sdhi: update Renesas related copyrights
  mmc: tmio: improve checkpatch cleanness
  mmc: renesas-sdhi: improve checkpatch cleanness

 MAINTAINERS                              |   2 +-
 drivers/mmc/host/renesas_sdhi.h          |   4 +-
 drivers/mmc/host/renesas_sdhi_core.c     |  53 +++++++-----
 drivers/mmc/host/renesas_sdhi_sys_dmac.c |  28 ++++---
 drivers/mmc/host/tmio_mmc.c              |  10 ++-
 drivers/mmc/host/tmio_mmc.h              |  22 +++--
 drivers/mmc/host/tmio_mmc_core.c         | 139 ++++++++++++++++++-------------
 include/linux/mfd/tmio.h                 |  33 ++++----
 8 files changed, 167 insertions(+), 124 deletions(-)

-- 
2.1.4

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/5] MAINTAINERS: Update files for TMIO/SDHI MMC driver
  2017-05-30 12:50 [PATCH 0/5] mmc: tmio, renesas-sdhi: cleanups Simon Horman
@ 2017-05-30 12:50 ` Simon Horman
  2017-05-30 19:31   ` Wolfram Sang
  2017-05-30 12:50 ` [PATCH 2/5] mmc: tmio: use EXPORT_SYMBOL_GPL Simon Horman
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 14+ messages in thread
From: Simon Horman @ 2017-05-30 12:50 UTC (permalink / raw)
  To: Wolfram Sang, Ulf Hansson
  Cc: Magnus Damm, linux-mmc, linux-renesas-soc, Simon Horman

Update files for tmio/sdhi MMC driver to reflect recent filename
changes.

Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 MAINTAINERS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 053c3bdd1fe5..5b4c477573dd 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -12882,7 +12882,7 @@ M:	Wolfram Sang <wsa+renesas@sang-engineering.com>
 L:	linux-mmc@vger.kernel.org
 S:	Supported
 F:	drivers/mmc/host/tmio_mmc*
-F:	drivers/mmc/host/sh_mobile_sdhi.c
+F:	drivers/mmc/host/renesas_sdhi*
 F:	include/linux/mfd/tmio.h
 
 TMP401 HARDWARE MONITOR DRIVER
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/5] mmc: tmio: use EXPORT_SYMBOL_GPL
  2017-05-30 12:50 [PATCH 0/5] mmc: tmio, renesas-sdhi: cleanups Simon Horman
  2017-05-30 12:50 ` [PATCH 1/5] MAINTAINERS: Update files for TMIO/SDHI MMC driver Simon Horman
@ 2017-05-30 12:50 ` Simon Horman
  2017-05-30 19:35   ` Wolfram Sang
  2017-05-30 12:50 ` [PATCH 3/5] mmc: tmio, renesas-sdhi: update Renesas related copyrights Simon Horman
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 14+ messages in thread
From: Simon Horman @ 2017-05-30 12:50 UTC (permalink / raw)
  To: Wolfram Sang, Ulf Hansson
  Cc: Magnus Damm, linux-mmc, linux-renesas-soc, Simon Horman

Use EXPORT_SYMBOL_GPL rather than the non _GPL variant as there seems to be
no reason not to.

Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 drivers/mmc/host/tmio_mmc_core.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c
index e1ad461c4b8c..242d9bcc365a 100644
--- a/drivers/mmc/host/tmio_mmc_core.c
+++ b/drivers/mmc/host/tmio_mmc_core.c
@@ -91,14 +91,14 @@ void tmio_mmc_enable_mmc_irqs(struct tmio_mmc_host *host, u32 i)
 	host->sdcard_irq_mask &= ~(i & TMIO_MASK_IRQ);
 	sd_ctrl_write32_as_16_and_16(host, CTL_IRQ_MASK, host->sdcard_irq_mask);
 }
-EXPORT_SYMBOL(tmio_mmc_enable_mmc_irqs);
+EXPORT_SYMBOL_GPL(tmio_mmc_enable_mmc_irqs);
 
 void tmio_mmc_disable_mmc_irqs(struct tmio_mmc_host *host, u32 i)
 {
 	host->sdcard_irq_mask |= (i & TMIO_MASK_IRQ);
 	sd_ctrl_write32_as_16_and_16(host, CTL_IRQ_MASK, host->sdcard_irq_mask);
 }
-EXPORT_SYMBOL(tmio_mmc_disable_mmc_irqs);
+EXPORT_SYMBOL_GPL(tmio_mmc_disable_mmc_irqs);
 
 static void tmio_mmc_ack_mmc_irqs(struct tmio_mmc_host *host, u32 i)
 {
@@ -562,7 +562,7 @@ void tmio_mmc_do_data_irq(struct tmio_mmc_host *host)
 
 	schedule_work(&host->done);
 }
-EXPORT_SYMBOL(tmio_mmc_do_data_irq);
+EXPORT_SYMBOL_GPL(tmio_mmc_do_data_irq);
 
 static void tmio_mmc_data_irq(struct tmio_mmc_host *host, unsigned int stat)
 {
@@ -766,7 +766,7 @@ irqreturn_t tmio_mmc_irq(int irq, void *devid)
 
 	return IRQ_HANDLED;
 }
-EXPORT_SYMBOL(tmio_mmc_irq);
+EXPORT_SYMBOL_GPL(tmio_mmc_irq);
 
 static int tmio_mmc_start_data(struct tmio_mmc_host *host,
 	struct mmc_data *data)
@@ -1189,13 +1189,13 @@ tmio_mmc_host_alloc(struct platform_device *pdev)
 
 	return host;
 }
-EXPORT_SYMBOL(tmio_mmc_host_alloc);
+EXPORT_SYMBOL_GPL(tmio_mmc_host_alloc);
 
 void tmio_mmc_host_free(struct tmio_mmc_host *host)
 {
 	mmc_free_host(host->mmc);
 }
-EXPORT_SYMBOL(tmio_mmc_host_free);
+EXPORT_SYMBOL_GPL(tmio_mmc_host_free);
 
 int tmio_mmc_host_probe(struct tmio_mmc_host *_host,
 			struct tmio_mmc_data *pdata,
@@ -1338,7 +1338,7 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host,
 
 	return 0;
 }
-EXPORT_SYMBOL(tmio_mmc_host_probe);
+EXPORT_SYMBOL_GPL(tmio_mmc_host_probe);
 
 void tmio_mmc_host_remove(struct tmio_mmc_host *host)
 {
@@ -1363,7 +1363,7 @@ void tmio_mmc_host_remove(struct tmio_mmc_host *host)
 
 	tmio_mmc_clk_disable(host);
 }
-EXPORT_SYMBOL(tmio_mmc_host_remove);
+EXPORT_SYMBOL_GPL(tmio_mmc_host_remove);
 
 #ifdef CONFIG_PM
 int tmio_mmc_host_runtime_suspend(struct device *dev)
@@ -1380,7 +1380,7 @@ int tmio_mmc_host_runtime_suspend(struct device *dev)
 
 	return 0;
 }
-EXPORT_SYMBOL(tmio_mmc_host_runtime_suspend);
+EXPORT_SYMBOL_GPL(tmio_mmc_host_runtime_suspend);
 
 static bool tmio_mmc_can_retune(struct tmio_mmc_host *host)
 {
@@ -1405,7 +1405,7 @@ int tmio_mmc_host_runtime_resume(struct device *dev)
 
 	return 0;
 }
-EXPORT_SYMBOL(tmio_mmc_host_runtime_resume);
+EXPORT_SYMBOL_GPL(tmio_mmc_host_runtime_resume);
 #endif
 
 MODULE_LICENSE("GPL v2");
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 3/5] mmc: tmio, renesas-sdhi: update Renesas related copyrights
  2017-05-30 12:50 [PATCH 0/5] mmc: tmio, renesas-sdhi: cleanups Simon Horman
  2017-05-30 12:50 ` [PATCH 1/5] MAINTAINERS: Update files for TMIO/SDHI MMC driver Simon Horman
  2017-05-30 12:50 ` [PATCH 2/5] mmc: tmio: use EXPORT_SYMBOL_GPL Simon Horman
@ 2017-05-30 12:50 ` Simon Horman
  2017-05-30 19:37   ` Wolfram Sang
  2017-05-30 12:50 ` [PATCH 4/5] mmc: tmio: improve checkpatch cleanness Simon Horman
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 14+ messages in thread
From: Simon Horman @ 2017-05-30 12:50 UTC (permalink / raw)
  To: Wolfram Sang, Ulf Hansson
  Cc: Magnus Damm, linux-mmc, linux-renesas-soc, Simon Horman

Update copyrights to reflect work by Wolfram Sang and myself since last
year.

Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 drivers/mmc/host/renesas_sdhi_core.c     | 5 +++--
 drivers/mmc/host/renesas_sdhi_sys_dmac.c | 3 +++
 drivers/mmc/host/tmio_mmc.c              | 2 ++
 drivers/mmc/host/tmio_mmc.h              | 5 +++--
 drivers/mmc/host/tmio_mmc_core.c         | 5 +++--
 5 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
index 82150a966391..f4690cba3443 100644
--- a/drivers/mmc/host/renesas_sdhi_core.c
+++ b/drivers/mmc/host/renesas_sdhi_core.c
@@ -1,8 +1,9 @@
 /*
  * Renesas SDHI
  *
- * Copyright (C) 2016 Sang Engineering, Wolfram Sang
- * Copyright (C) 2015-16 Renesas Electronics Corporation
+ * Copyright (C) 2015-17 Renesas Electronics Corporation
+ * Copyright (C) 2016-17 Sang Engineering, Wolfram Sang
+ * Copyright (C) 2016-17 Horms Solutions, Simon Horman
  * Copyright (C) 2009 Magnus Damm
  *
  * This program is free software; you can redistribute it and/or modify
diff --git a/drivers/mmc/host/renesas_sdhi_sys_dmac.c b/drivers/mmc/host/renesas_sdhi_sys_dmac.c
index 7eab55adc5b2..202cf4346fdf 100644
--- a/drivers/mmc/host/renesas_sdhi_sys_dmac.c
+++ b/drivers/mmc/host/renesas_sdhi_sys_dmac.c
@@ -1,6 +1,9 @@
 /*
  * DMA function for TMIO MMC implementations
  *
+ * Copyright (C) 2016-17 Renesas Electronics Corporation
+ * Copyright (C) 2016-17 Sang Engineering, Wolfram Sang
+ * Copyright (C) 2017 Horms Solutions, Simon Horman
  * Copyright (C) 2010-2011 Guennadi Liakhovetski
  *
  * This program is free software; you can redistribute it and/or modify
diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c
index 59880146e7f9..61cf36fb270b 100644
--- a/drivers/mmc/host/tmio_mmc.c
+++ b/drivers/mmc/host/tmio_mmc.c
@@ -3,6 +3,8 @@
  *
  * TC6393XB TC6391XB TC6387XB T7L66XB ASIC3
  *
+ * Copyright (C) 2017 Renesas Electronics Corporation
+ * Copyright (C) 2017 Horms Solutions, Simon Horman
  * Copyright (C) 2007 Ian Molton
  * Copyright (C) 2004 Ian Molton
  *
diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
index 9c94b6eb9b49..768c8abaedda 100644
--- a/drivers/mmc/host/tmio_mmc.h
+++ b/drivers/mmc/host/tmio_mmc.h
@@ -3,8 +3,9 @@
  *
  * TC6393XB TC6391XB TC6387XB T7L66XB ASIC3
  *
- * Copyright (C) 2016 Sang Engineering, Wolfram Sang
- * Copyright (C) 2015-16 Renesas Electronics Corporation
+ * Copyright (C) 2015-17 Renesas Electronics Corporation
+ * Copyright (C) 2016-17 Sang Engineering, Wolfram Sang
+ * Copyright (C) 2016-17 Horms Solutions, Simon Horman
  * Copyright (C) 2007 Ian Molton
  * Copyright (C) 2004 Ian Molton
  *
diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c
index 242d9bcc365a..70516abd50a1 100644
--- a/drivers/mmc/host/tmio_mmc_core.c
+++ b/drivers/mmc/host/tmio_mmc_core.c
@@ -3,8 +3,9 @@
  *
  * TC6393XB, TC6391XB, TC6387XB, T7L66XB, ASIC3, SH-Mobile SoCs
  *
- * Copyright (C) 2016 Sang Engineering, Wolfram Sang
- * Copyright (C) 2015-16 Renesas Electronics Corporation
+ * Copyright (C) 2015-17 Renesas Electronics Corporation
+ * Copyright (C) 2016-17 Sang Engineering, Wolfram Sang
+ * Copyright (C) 2017 Horms Solutions, Simon Horman
  * Copyright (C) 2011 Guennadi Liakhovetski
  * Copyright (C) 2007 Ian Molton
  * Copyright (C) 2004 Ian Molton
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 4/5] mmc: tmio: improve checkpatch cleanness
  2017-05-30 12:50 [PATCH 0/5] mmc: tmio, renesas-sdhi: cleanups Simon Horman
                   ` (2 preceding siblings ...)
  2017-05-30 12:50 ` [PATCH 3/5] mmc: tmio, renesas-sdhi: update Renesas related copyrights Simon Horman
@ 2017-05-30 12:50 ` Simon Horman
  2017-05-30 19:58   ` Wolfram Sang
  2017-05-31 20:02   ` Simon Horman
  2017-05-30 12:50 ` [PATCH 5/5] mmc: renesas-sdhi: " Simon Horman
  2017-06-08 13:52 ` [PATCH 0/5] mmc: tmio, renesas-sdhi: cleanups Ulf Hansson
  5 siblings, 2 replies; 14+ messages in thread
From: Simon Horman @ 2017-05-30 12:50 UTC (permalink / raw)
  To: Wolfram Sang, Ulf Hansson
  Cc: Magnus Damm, linux-mmc, linux-renesas-soc, Simon Horman

Trivial updates to improve checkpatch cleanness.

Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 drivers/mmc/host/renesas_sdhi.h  |   2 +-
 drivers/mmc/host/tmio_mmc.c      |   8 +--
 drivers/mmc/host/tmio_mmc.h      |  17 +++---
 drivers/mmc/host/tmio_mmc_core.c | 114 +++++++++++++++++++++++----------------
 include/linux/mfd/tmio.h         |  33 ++++++------
 5 files changed, 100 insertions(+), 74 deletions(-)

diff --git a/drivers/mmc/host/renesas_sdhi.h b/drivers/mmc/host/renesas_sdhi.h
index eb3ea15ff92d..6b4a79508c6b 100644
--- a/drivers/mmc/host/renesas_sdhi.h
+++ b/drivers/mmc/host/renesas_sdhi.h
@@ -27,7 +27,7 @@ struct renesas_sdhi_of_data {
 	unsigned long capabilities2;
 	enum dma_slave_buswidth dma_buswidth;
 	dma_addr_t dma_rx_offset;
-	unsigned bus_shift;
+	unsigned int bus_shift;
 	int scc_offset;
 	struct renesas_sdhi_scc *taps;
 	int taps_num;
diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c
index 61cf36fb270b..64b7e9f18361 100644
--- a/drivers/mmc/host/tmio_mmc.c
+++ b/drivers/mmc/host/tmio_mmc.c
@@ -104,8 +104,8 @@ static int tmio_mmc_probe(struct platform_device *pdev)
 		goto host_free;
 
 	ret = devm_request_irq(&pdev->dev, irq, tmio_mmc_irq,
-				IRQF_TRIGGER_FALLING,
-				dev_name(&pdev->dev), host);
+			       IRQF_TRIGGER_FALLING,
+			       dev_name(&pdev->dev), host);
 	if (ret)
 		goto host_remove;
 
@@ -132,6 +132,7 @@ static int tmio_mmc_remove(struct platform_device *pdev)
 
 	if (mmc) {
 		struct tmio_mmc_host *host = mmc_priv(mmc);
+
 		tmio_mmc_host_remove(host);
 		if (cell->disable)
 			cell->disable(pdev);
@@ -145,8 +146,7 @@ static int tmio_mmc_remove(struct platform_device *pdev)
 static const struct dev_pm_ops tmio_mmc_dev_pm_ops = {
 	SET_SYSTEM_SLEEP_PM_OPS(tmio_mmc_suspend, tmio_mmc_resume)
 	SET_RUNTIME_PM_OPS(tmio_mmc_host_runtime_suspend,
-			tmio_mmc_host_runtime_resume,
-			NULL)
+			   tmio_mmc_host_runtime_resume, NULL)
 };
 
 static struct platform_driver tmio_mmc_driver = {
diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
index 768c8abaedda..6ad6704175dc 100644
--- a/drivers/mmc/host/tmio_mmc.h
+++ b/drivers/mmc/host/tmio_mmc.h
@@ -239,24 +239,26 @@ static inline u16 sd_ctrl_read16(struct tmio_mmc_host *host, int addr)
 }
 
 static inline void sd_ctrl_read16_rep(struct tmio_mmc_host *host, int addr,
-		u16 *buf, int count)
+				      u16 *buf, int count)
 {
 	readsw(host->ctl + (addr << host->bus_shift), buf, count);
 }
 
-static inline u32 sd_ctrl_read16_and_16_as_32(struct tmio_mmc_host *host, int addr)
+static inline u32 sd_ctrl_read16_and_16_as_32(struct tmio_mmc_host *host,
+					      int addr)
 {
 	return readw(host->ctl + (addr << host->bus_shift)) |
 	       readw(host->ctl + ((addr + 2) << host->bus_shift)) << 16;
 }
 
 static inline void sd_ctrl_read32_rep(struct tmio_mmc_host *host, int addr,
-		u32 *buf, int count)
+				      u32 *buf, int count)
 {
 	readsl(host->ctl + (addr << host->bus_shift), buf, count);
 }
 
-static inline void sd_ctrl_write16(struct tmio_mmc_host *host, int addr, u16 val)
+static inline void sd_ctrl_write16(struct tmio_mmc_host *host, int addr,
+				   u16 val)
 {
 	/* If there is a hook and it returns non-zero then there
 	 * is an error and the write should be skipped
@@ -267,19 +269,20 @@ static inline void sd_ctrl_write16(struct tmio_mmc_host *host, int addr, u16 val
 }
 
 static inline void sd_ctrl_write16_rep(struct tmio_mmc_host *host, int addr,
-		u16 *buf, int count)
+				       u16 *buf, int count)
 {
 	writesw(host->ctl + (addr << host->bus_shift), buf, count);
 }
 
-static inline void sd_ctrl_write32_as_16_and_16(struct tmio_mmc_host *host, int addr, u32 val)
+static inline void sd_ctrl_write32_as_16_and_16(struct tmio_mmc_host *host,
+						int addr, u32 val)
 {
 	writew(val & 0xffff, host->ctl + (addr << host->bus_shift));
 	writew(val >> 16, host->ctl + ((addr + 2) << host->bus_shift));
 }
 
 static inline void sd_ctrl_write32_rep(struct tmio_mmc_host *host, int addr,
-		const u32 *buf, int count)
+				       const u32 *buf, int count)
 {
 	writesl(host->ctl + (addr << host->bus_shift), buf, count);
 }
diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c
index 70516abd50a1..07905c05f356 100644
--- a/drivers/mmc/host/tmio_mmc_core.c
+++ b/drivers/mmc/host/tmio_mmc_core.c
@@ -127,16 +127,17 @@ static int tmio_mmc_next_sg(struct tmio_mmc_host *host)
 
 #define STATUS_TO_TEXT(a, status, i) \
 	do { \
-		if (status & TMIO_STAT_##a) { \
-			if (i++) \
-				printk(" | "); \
-			printk(#a); \
+		if ((status) & TMIO_STAT_##a) { \
+			if ((i)++) \
+				printk(KERN_DEBUG, " | "); \
+			printk(KERN_DEBUG, #a); \
 		} \
 	} while (0)
 
 static void pr_debug_status(u32 status)
 {
 	int i = 0;
+
 	pr_debug("status: %08x = ", status);
 	STATUS_TO_TEXT(CARD_REMOVE, status, i);
 	STATUS_TO_TEXT(CARD_INSERT, status, i);
@@ -181,7 +182,8 @@ static void tmio_mmc_enable_sdio_irq(struct mmc_host *mmc, int enable)
 					~TMIO_SDIO_STAT_IOIRQ;
 
 		/* Clear obsolete interrupts before enabling */
-		sdio_status = sd_ctrl_read16(host, CTL_SDIO_STATUS) & ~TMIO_SDIO_MASK_ALL;
+		sdio_status = sd_ctrl_read16(host, CTL_SDIO_STATUS) &
+			~TMIO_SDIO_MASK_ALL;
 		if (host->pdata->flags & TMIO_MMC_SDIO_STATUS_SETBITS)
 			sdio_status |= TMIO_SDIO_SETBITS_MASK;
 		sd_ctrl_write16(host, CTL_SDIO_STATUS, sdio_status);
@@ -222,7 +224,7 @@ static void tmio_mmc_clk_stop(struct tmio_mmc_host *host)
 }
 
 static void tmio_mmc_set_clock(struct tmio_mmc_host *host,
-				unsigned int new_clock)
+			       unsigned int new_clock)
 {
 	u32 clk = 0, clock;
 
@@ -283,16 +285,16 @@ static void tmio_mmc_reset_work(struct work_struct *work)
 	 * cancel_delayed_work(), it can happen, that a .set_ios() call preempts
 	 * us, so, have to check for IS_ERR(host->mrq)
 	 */
-	if (IS_ERR_OR_NULL(mrq)
-	    || time_is_after_jiffies(host->last_req_ts +
-		msecs_to_jiffies(CMDREQ_TIMEOUT))) {
+	if (IS_ERR_OR_NULL(mrq) ||
+	    time_is_after_jiffies(host->last_req_ts +
+				  msecs_to_jiffies(CMDREQ_TIMEOUT))) {
 		spin_unlock_irqrestore(&host->lock, flags);
 		return;
 	}
 
 	dev_warn(&host->pdev->dev,
-		"timeout waiting for hardware interrupt (CMD%u)\n",
-		mrq->cmd->opcode);
+		 "timeout waiting for hardware interrupt (CMD%u)\n",
+		 mrq->cmd->opcode);
 
 	if (host->data)
 		host->data->error = -ETIMEDOUT;
@@ -330,7 +332,8 @@ static void tmio_mmc_reset_work(struct work_struct *work)
 #define SECURITY_CMD   0x4000
 #define NO_CMD12_ISSUE 0x4000 /* TMIO_MMC_HAVE_CMD12_CTRL */
 
-static int tmio_mmc_start_command(struct tmio_mmc_host *host, struct mmc_command *cmd)
+static int tmio_mmc_start_command(struct tmio_mmc_host *host,
+				  struct mmc_command *cmd)
 {
 	struct mmc_data *data = host->data;
 	int c = cmd->opcode;
@@ -343,13 +346,22 @@ static int tmio_mmc_start_command(struct tmio_mmc_host *host, struct mmc_command
 	}
 
 	switch (mmc_resp_type(cmd)) {
-	case MMC_RSP_NONE: c |= RESP_NONE; break;
+	case MMC_RSP_NONE:
+		c |= RESP_NONE;
+		break;
 	case MMC_RSP_R1:
 	case MMC_RSP_R1_NO_CRC:
-			   c |= RESP_R1;   break;
-	case MMC_RSP_R1B:  c |= RESP_R1B;  break;
-	case MMC_RSP_R2:   c |= RESP_R2;   break;
-	case MMC_RSP_R3:   c |= RESP_R3;   break;
+		c |= RESP_R1;
+		break;
+	case MMC_RSP_R1B:
+		c |= RESP_R1B;
+		break;
+	case MMC_RSP_R2:
+		c |= RESP_R2;
+		break;
+	case MMC_RSP_R3:
+		c |= RESP_R3;
+		break;
 	default:
 		pr_debug("Unknown response type %d\n", mmc_resp_type(cmd));
 		return -EINVAL;
@@ -365,15 +377,18 @@ static int tmio_mmc_start_command(struct tmio_mmc_host *host, struct mmc_command
 	if (data) {
 		c |= DATA_PRESENT;
 		if (data->blocks > 1) {
-			sd_ctrl_write16(host, CTL_STOP_INTERNAL_ACTION, TMIO_STOP_SEC);
+			sd_ctrl_write16(host, CTL_STOP_INTERNAL_ACTION,
+					TMIO_STOP_SEC);
 			c |= TRANSFER_MULTI;
 
 			/*
-			 * Disable auto CMD12 at IO_RW_EXTENDED and SET_BLOCK_COUNT
-			 * when doing multiple block transfer
+			 * Disable auto CMD12 at IO_RW_EXTENDED and
+			 * SET_BLOCK_COUNT when doing multiple block
+			 * transfer
 			 */
 			if ((host->pdata->flags & TMIO_MMC_HAVE_CMD12_CTRL) &&
-			    (cmd->opcode == SD_IO_RW_EXTENDED || host->mrq->sbc))
+			    (cmd->opcode == SD_IO_RW_EXTENDED ||
+			     host->mrq->sbc))
 				c |= NO_CMD12_ISSUE;
 		}
 		if (data->flags & MMC_DATA_READ)
@@ -495,8 +510,6 @@ static void tmio_mmc_pio_irq(struct tmio_mmc_host *host)
 
 	if (host->sg_off == host->sg_ptr->length)
 		tmio_mmc_next_sg(host);
-
-	return;
 }
 
 static void tmio_mmc_check_bounce_buffer(struct tmio_mmc_host *host)
@@ -504,6 +517,7 @@ static void tmio_mmc_check_bounce_buffer(struct tmio_mmc_host *host)
 	if (host->sg_ptr == &host->bounce_sg) {
 		unsigned long flags;
 		void *sg_vaddr = tmio_mmc_kmap_atomic(host->sg_orig, &flags);
+
 		memcpy(sg_vaddr, host->bounce_buf, host->bounce_sg.length);
 		tmio_mmc_kunmap_atomic(host->sg_orig, &flags, sg_vaddr);
 	}
@@ -568,6 +582,7 @@ EXPORT_SYMBOL_GPL(tmio_mmc_do_data_irq);
 static void tmio_mmc_data_irq(struct tmio_mmc_host *host, unsigned int stat)
 {
 	struct mmc_data *data;
+
 	spin_lock(&host->lock);
 	data = host->data;
 
@@ -577,7 +592,8 @@ static void tmio_mmc_data_irq(struct tmio_mmc_host *host, unsigned int stat)
 	if (stat & TMIO_STAT_CRCFAIL || stat & TMIO_STAT_STOPBIT_ERR ||
 	    stat & TMIO_STAT_TXUNDERRUN)
 		data->error = -EILSEQ;
-	if (host->chan_tx && (data->flags & MMC_DATA_WRITE) && !host->force_pio) {
+	if (host->chan_tx && (data->flags & MMC_DATA_WRITE) &&
+	    !host->force_pio) {
 		u32 status = sd_ctrl_read16_and_16_as_32(host, CTL_STATUS);
 		bool done = false;
 
@@ -601,19 +617,20 @@ static void tmio_mmc_data_irq(struct tmio_mmc_host *host, unsigned int stat)
 			tmio_mmc_disable_mmc_irqs(host, TMIO_STAT_DATAEND);
 			complete(&host->dma_dataend);
 		}
-	} else if (host->chan_rx && (data->flags & MMC_DATA_READ) && !host->force_pio) {
+	} else if (host->chan_rx && (data->flags & MMC_DATA_READ) &&
+		   !host->force_pio) {
 		tmio_mmc_disable_mmc_irqs(host, TMIO_STAT_DATAEND);
 		complete(&host->dma_dataend);
 	} else {
 		tmio_mmc_do_data_irq(host);
-		tmio_mmc_disable_mmc_irqs(host, TMIO_MASK_READOP | TMIO_MASK_WRITEOP);
+		tmio_mmc_disable_mmc_irqs(host,
+					  TMIO_MASK_READOP | TMIO_MASK_WRITEOP);
 	}
 out:
 	spin_unlock(&host->lock);
 }
 
-static void tmio_mmc_cmd_irq(struct tmio_mmc_host *host,
-	unsigned int stat)
+static void tmio_mmc_cmd_irq(struct tmio_mmc_host *host, unsigned int stat)
 {
 	struct mmc_command *cmd = host->cmd;
 	int i, addr;
@@ -656,12 +673,14 @@ static void tmio_mmc_cmd_irq(struct tmio_mmc_host *host,
 	if (host->data && (!cmd->error || cmd->error == -EILSEQ)) {
 		if (host->data->flags & MMC_DATA_READ) {
 			if (host->force_pio || !host->chan_rx)
-				tmio_mmc_enable_mmc_irqs(host, TMIO_MASK_READOP);
+				tmio_mmc_enable_mmc_irqs(host,
+							 TMIO_MASK_READOP);
 			else
 				tasklet_schedule(&host->dma_issue);
 		} else {
 			if (host->force_pio || !host->chan_tx)
-				tmio_mmc_enable_mmc_irqs(host, TMIO_MASK_WRITEOP);
+				tmio_mmc_enable_mmc_irqs(host,
+							 TMIO_MASK_WRITEOP);
 			else
 				tasklet_schedule(&host->dma_issue);
 		}
@@ -674,7 +693,7 @@ static void tmio_mmc_cmd_irq(struct tmio_mmc_host *host,
 }
 
 static bool __tmio_mmc_card_detect_irq(struct tmio_mmc_host *host,
-				      int ireg, int status)
+				       int ireg, int status)
 {
 	struct mmc_host *mmc = host->mmc;
 
@@ -692,14 +711,13 @@ static bool __tmio_mmc_card_detect_irq(struct tmio_mmc_host *host,
 	return false;
 }
 
-static bool __tmio_mmc_sdcard_irq(struct tmio_mmc_host *host,
-				 int ireg, int status)
+static bool __tmio_mmc_sdcard_irq(struct tmio_mmc_host *host, int ireg,
+				  int status)
 {
 	/* Command completion */
 	if (ireg & (TMIO_STAT_CMDRESPEND | TMIO_STAT_CMDTIMEOUT)) {
-		tmio_mmc_ack_mmc_irqs(host,
-			     TMIO_STAT_CMDRESPEND |
-			     TMIO_STAT_CMDTIMEOUT);
+		tmio_mmc_ack_mmc_irqs(host, TMIO_STAT_CMDRESPEND |
+				      TMIO_STAT_CMDTIMEOUT);
 		tmio_mmc_cmd_irq(host, status);
 		return true;
 	}
@@ -770,7 +788,7 @@ irqreturn_t tmio_mmc_irq(int irq, void *devid)
 EXPORT_SYMBOL_GPL(tmio_mmc_irq);
 
 static int tmio_mmc_start_data(struct tmio_mmc_host *host,
-	struct mmc_data *data)
+			       struct mmc_data *data)
 {
 	struct tmio_mmc_data *pdata = host->pdata;
 
@@ -824,8 +842,7 @@ static int tmio_mmc_execute_tuning(struct mmc_host *mmc, u32 opcode)
 		goto out;
 
 	if (host->tap_num * 2 >= sizeof(host->taps) * BITS_PER_BYTE) {
-		dev_warn_once(&host->pdev->dev,
-		      "Too many taps, skipping tuning. Please consider updating size of taps field of tmio_mmc_host\n");
+		dev_warn_once(&host->pdev->dev, "Too many taps, skipping tuning. Please consider updating size of taps field of tmio_mmc_host\n");
 		goto out;
 	}
 
@@ -856,7 +873,8 @@ static int tmio_mmc_execute_tuning(struct mmc_host *mmc, u32 opcode)
 	return ret;
 }
 
-static void tmio_process_mrq(struct tmio_mmc_host *host, struct mmc_request *mrq)
+static void tmio_process_mrq(struct tmio_mmc_host *host,
+			     struct mmc_request *mrq)
 {
 	struct mmc_command *cmd;
 	int ret;
@@ -1024,7 +1042,7 @@ static void tmio_mmc_power_off(struct tmio_mmc_host *host)
 }
 
 static void tmio_mmc_set_bus_width(struct tmio_mmc_host *host,
-				unsigned char bus_width)
+				   unsigned char bus_width)
 {
 	u16 reg = sd_ctrl_read16(host, CTL_SD_MEM_CARD_OPT)
 				& ~(CARD_OPT_WIDTH | CARD_OPT_WIDTH8);
@@ -1064,7 +1082,8 @@ static void tmio_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 			dev_dbg(dev,
 				"%s.%d: CMD%u active since %lu, now %lu!\n",
 				current->comm, task_pid_nr(current),
-				host->mrq->cmd->opcode, host->last_req_ts, jiffies);
+				host->mrq->cmd->opcode, host->last_req_ts,
+				jiffies);
 		}
 		spin_unlock_irqrestore(&host->lock, flags);
 
@@ -1111,11 +1130,13 @@ static int tmio_mmc_get_ro(struct mmc_host *mmc)
 	struct tmio_mmc_host *host = mmc_priv(mmc);
 	struct tmio_mmc_data *pdata = host->pdata;
 	int ret = mmc_gpio_get_ro(mmc);
+
 	if (ret >= 0)
 		return ret;
 
 	ret = !((pdata->flags & TMIO_MMC_WRPROTECT_DISABLE) ||
-		(sd_ctrl_read16_and_16_as_32(host, CTL_STATUS) & TMIO_STAT_WRPROTECT));
+		(sd_ctrl_read16_and_16_as_32(host, CTL_STATUS) &
+		 TMIO_STAT_WRPROTECT));
 
 	return ret;
 }
@@ -1167,6 +1188,7 @@ static void tmio_mmc_of_parse(struct platform_device *pdev,
 			      struct tmio_mmc_data *pdata)
 {
 	const struct device_node *np = pdev->dev.of_node;
+
 	if (!np)
 		return;
 
@@ -1237,7 +1259,8 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host,
 		return -ENOMEM;
 
 	tmio_mmc_ops.card_busy = _host->card_busy;
-	tmio_mmc_ops.start_signal_voltage_switch = _host->start_signal_voltage_switch;
+	tmio_mmc_ops.start_signal_voltage_switch =
+		_host->start_signal_voltage_switch;
 	mmc->ops = &tmio_mmc_ops;
 
 	mmc->caps |= MMC_CAP_4_BIT_DATA | pdata->capabilities;
@@ -1284,7 +1307,8 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host,
 	tmio_mmc_clk_stop(_host);
 	tmio_mmc_reset(_host);
 
-	_host->sdcard_irq_mask = sd_ctrl_read16_and_16_as_32(_host, CTL_IRQ_MASK);
+	_host->sdcard_irq_mask = sd_ctrl_read16_and_16_as_32(_host,
+							     CTL_IRQ_MASK);
 	tmio_mmc_disable_mmc_irqs(_host, TMIO_MASK_ALL);
 
 	/* Unmask the IRQs we want to know about */
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index c83c16b931a8..26e8f8c0a6db 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -13,15 +13,15 @@
 #define tmio_ioread16(addr) readw(addr)
 #define tmio_ioread16_rep(r, b, l) readsw(r, b, l)
 #define tmio_ioread32(addr) \
-	(((u32) readw((addr))) | (((u32) readw((addr) + 2)) << 16))
+	(((u32)readw((addr))) | (((u32)readw((addr) + 2)) << 16))
 
 #define tmio_iowrite8(val, addr) writeb((val), (addr))
 #define tmio_iowrite16(val, addr) writew((val), (addr))
 #define tmio_iowrite16_rep(r, b, l) writesw(r, b, l)
 #define tmio_iowrite32(val, addr) \
 	do { \
-	writew((val),       (addr)); \
-	writew((val) >> 16, (addr) + 2); \
+		writew((val),       (addr)); \
+		writew((val) >> 16, (addr) + 2); \
 	} while (0)
 
 #define CNF_CMD     0x04
@@ -55,57 +55,57 @@
 	} while (0)
 
 /* tmio MMC platform flags */
-#define TMIO_MMC_WRPROTECT_DISABLE	(1 << 0)
+#define TMIO_MMC_WRPROTECT_DISABLE	BIT(0)
 /*
  * Some controllers can support a 2-byte block size when the bus width
  * is configured in 4-bit mode.
  */
-#define TMIO_MMC_BLKSZ_2BYTES		(1 << 1)
+#define TMIO_MMC_BLKSZ_2BYTES		BIT(1)
 /*
  * Some controllers can support SDIO IRQ signalling.
  */
-#define TMIO_MMC_SDIO_IRQ		(1 << 2)
+#define TMIO_MMC_SDIO_IRQ		BIT(2)
 
 /* Some features are only available or tested on R-Car Gen2 or later */
-#define TMIO_MMC_MIN_RCAR2		(1 << 3)
+#define TMIO_MMC_MIN_RCAR2		BIT(3)
 
 /*
  * Some controllers require waiting for the SD bus to become
  * idle before writing to some registers.
  */
-#define TMIO_MMC_HAS_IDLE_WAIT		(1 << 4)
+#define TMIO_MMC_HAS_IDLE_WAIT		BIT(4)
 /*
  * A GPIO is used for card hotplug detection. We need an extra flag for this,
  * because 0 is a valid GPIO number too, and requiring users to specify
  * cd_gpio < 0 to disable GPIO hotplug would break backwards compatibility.
  */
-#define TMIO_MMC_USE_GPIO_CD		(1 << 5)
+#define TMIO_MMC_USE_GPIO_CD		BIT(5)
 
 /*
  * Some controllers doesn't have over 0x100 register.
  * it is used to checking accessibility of
  * CTL_SD_CARD_CLK_CTL / CTL_CLK_AND_WAIT_CTL
  */
-#define TMIO_MMC_HAVE_HIGH_REG		(1 << 6)
+#define TMIO_MMC_HAVE_HIGH_REG		BIT(6)
 
 /*
  * Some controllers have CMD12 automatically
  * issue/non-issue register
  */
-#define TMIO_MMC_HAVE_CMD12_CTRL	(1 << 7)
+#define TMIO_MMC_HAVE_CMD12_CTRL	BIT(7)
 
 /* Controller has some SDIO status bits which must be 1 */
-#define TMIO_MMC_SDIO_STATUS_SETBITS	(1 << 8)
+#define TMIO_MMC_SDIO_STATUS_SETBITS	BIT(8)
 
 /*
  * Some controllers have a 32-bit wide data port register
  */
-#define TMIO_MMC_32BIT_DATA_PORT	(1 << 9)
+#define TMIO_MMC_32BIT_DATA_PORT	BIT(9)
 
 /*
  * Some controllers allows to set SDx actual clock
  */
-#define TMIO_MMC_CLK_ACTUAL		(1 << 10)
+#define TMIO_MMC_CLK_ACTUAL		BIT(10)
 
 int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base);
 int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base);
@@ -146,9 +146,9 @@ struct tmio_nand_data {
 
 struct tmio_fb_data {
 	int			(*lcd_set_power)(struct platform_device *fb_dev,
-								bool on);
+						 bool on);
 	int			(*lcd_mode)(struct platform_device *fb_dev,
-					const struct fb_videomode *mode);
+					    const struct fb_videomode *mode);
 	int			num_modes;
 	struct fb_videomode	*modes;
 
@@ -157,5 +157,4 @@ struct tmio_fb_data {
 	int			width;
 };
 
-
 #endif
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 5/5] mmc: renesas-sdhi: improve checkpatch cleanness
  2017-05-30 12:50 [PATCH 0/5] mmc: tmio, renesas-sdhi: cleanups Simon Horman
                   ` (3 preceding siblings ...)
  2017-05-30 12:50 ` [PATCH 4/5] mmc: tmio: improve checkpatch cleanness Simon Horman
@ 2017-05-30 12:50 ` Simon Horman
  2017-05-30 19:57   ` Wolfram Sang
  2017-06-08 13:52 ` [PATCH 0/5] mmc: tmio, renesas-sdhi: cleanups Ulf Hansson
  5 siblings, 1 reply; 14+ messages in thread
From: Simon Horman @ 2017-05-30 12:50 UTC (permalink / raw)
  To: Wolfram Sang, Ulf Hansson
  Cc: Magnus Damm, linux-mmc, linux-renesas-soc, Simon Horman

Trivial updates to improve checkpatch cleanness.

Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 drivers/mmc/host/renesas_sdhi.h          |  2 +-
 drivers/mmc/host/renesas_sdhi_core.c     | 48 ++++++++++++++++++--------------
 drivers/mmc/host/renesas_sdhi_sys_dmac.c | 25 +++++++++--------
 3 files changed, 42 insertions(+), 33 deletions(-)

diff --git a/drivers/mmc/host/renesas_sdhi.h b/drivers/mmc/host/renesas_sdhi.h
index 6b4a79508c6b..ca83acc113b8 100644
--- a/drivers/mmc/host/renesas_sdhi.h
+++ b/drivers/mmc/host/renesas_sdhi.h
@@ -34,6 +34,6 @@ struct renesas_sdhi_of_data {
 };
 
 int renesas_sdhi_probe(struct platform_device *pdev,
-                       const struct tmio_mmc_dma_ops *dma_ops);
+		       const struct tmio_mmc_dma_ops *dma_ops);
 int renesas_sdhi_remove(struct platform_device *pdev);
 #endif
diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
index f4690cba3443..92ca2124ef44 100644
--- a/drivers/mmc/host/renesas_sdhi_core.c
+++ b/drivers/mmc/host/renesas_sdhi_core.c
@@ -45,7 +45,8 @@
 #define SDHI_VER_GEN3_SD	0xcc10
 #define SDHI_VER_GEN3_SDMMC	0xcd10
 
-#define host_to_priv(host) container_of((host)->pdata, struct renesas_sdhi, mmc_data)
+#define host_to_priv(host) \
+	container_of((host)->pdata, struct renesas_sdhi, mmc_data)
 
 struct renesas_sdhi {
 	struct clk *clk;
@@ -94,6 +95,7 @@ static int renesas_sdhi_clk_enable(struct tmio_mmc_host *host)
 	struct mmc_host *mmc = host->mmc;
 	struct renesas_sdhi *priv = host_to_priv(host);
 	int ret = clk_prepare_enable(priv->clk);
+
 	if (ret < 0)
 		return ret;
 
@@ -125,7 +127,7 @@ static int renesas_sdhi_clk_enable(struct tmio_mmc_host *host)
 }
 
 static unsigned int renesas_sdhi_clk_update(struct tmio_mmc_host *host,
-					      unsigned int new_clock)
+					    unsigned int new_clock)
 {
 	struct renesas_sdhi *priv = host_to_priv(host);
 	unsigned int freq, diff, best_freq = 0, diff_min = ~0;
@@ -175,11 +177,12 @@ static int renesas_sdhi_card_busy(struct mmc_host *mmc)
 {
 	struct tmio_mmc_host *host = mmc_priv(mmc);
 
-	return !(sd_ctrl_read16_and_16_as_32(host, CTL_STATUS) & TMIO_STAT_DAT0);
+	return !(sd_ctrl_read16_and_16_as_32(host, CTL_STATUS) &
+		 TMIO_STAT_DAT0);
 }
 
 static int renesas_sdhi_start_signal_voltage_switch(struct mmc_host *mmc,
-						      struct mmc_ios *ios)
+						    struct mmc_ios *ios)
 {
 	struct tmio_mmc_host *host = mmc_priv(mmc);
 	struct renesas_sdhi *priv = host_to_priv(host);
@@ -285,7 +288,7 @@ static unsigned int renesas_sdhi_init_tuning(struct tmio_mmc_host *host)
 }
 
 static void renesas_sdhi_prepare_tuning(struct tmio_mmc_host *host,
-					 unsigned long tap)
+					unsigned long tap)
 {
 	struct renesas_sdhi *priv = host_to_priv(host);
 
@@ -318,9 +321,9 @@ static int renesas_sdhi_select_tuning(struct tmio_mmc_host *host)
 	tap_start = 0;
 	tap_end = 0;
 	for (i = 0; i < host->tap_num * 2; i++) {
-		if (test_bit(i, host->taps))
+		if (test_bit(i, host->taps)) {
 			ntap++;
-		else {
+		} else {
 			if (ntap > tap_cnt) {
 				tap_start = i - ntap;
 				tap_end = i - 1;
@@ -352,7 +355,6 @@ static int renesas_sdhi_select_tuning(struct tmio_mmc_host *host)
 	return 0;
 }
 
-
 static bool renesas_sdhi_check_scc_error(struct tmio_mmc_host *host)
 {
 	struct renesas_sdhi *priv = host_to_priv(host);
@@ -414,8 +416,7 @@ static int renesas_sdhi_wait_idle(struct tmio_mmc_host *host)
 
 static int renesas_sdhi_write16_hook(struct tmio_mmc_host *host, int addr)
 {
-	switch (addr)
-	{
+	switch (addr) {
 	case CTL_SD_CMD:
 	case CTL_STOP_INTERNAL_ACTION:
 	case CTL_XFER_BLK_COUNT:
@@ -432,7 +433,7 @@ static int renesas_sdhi_write16_hook(struct tmio_mmc_host *host, int addr)
 }
 
 static int renesas_sdhi_multi_io_quirk(struct mmc_card *card,
-					 unsigned int direction, int blk_size)
+				       unsigned int direction, int blk_size)
 {
 	/*
 	 * In Renesas controllers, when performing a
@@ -460,20 +461,23 @@ static void renesas_sdhi_enable_dma(struct tmio_mmc_host *host, bool enable)
 int renesas_sdhi_probe(struct platform_device *pdev,
 		       const struct tmio_mmc_dma_ops *dma_ops)
 {
-	const struct renesas_sdhi_of_data *of_data = of_device_get_match_data( &pdev->dev);
-	struct renesas_sdhi *priv;
-	struct tmio_mmc_data *mmc_data;
 	struct tmio_mmc_data *mmd = pdev->dev.platform_data;
+	const struct renesas_sdhi_of_data *of_data;
+	struct tmio_mmc_data *mmc_data;
+	struct tmio_mmc_dma *dma_priv;
 	struct tmio_mmc_host *host;
+	struct renesas_sdhi *priv;
 	struct resource *res;
 	int irq, ret, i;
-	struct tmio_mmc_dma *dma_priv;
+
+	of_data = of_device_get_match_data(&pdev->dev);
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!res)
 		return -EINVAL;
 
-	priv = devm_kzalloc(&pdev->dev, sizeof(struct renesas_sdhi), GFP_KERNEL);
+	priv = devm_kzalloc(&pdev->dev, sizeof(struct renesas_sdhi),
+			    GFP_KERNEL);
 	if (!priv)
 		return -ENOMEM;
 
@@ -516,7 +520,6 @@ int renesas_sdhi_probe(struct platform_device *pdev,
 		goto eprobe;
 	}
 
-
 	if (of_data) {
 		mmc_data->flags |= of_data->tmio_flags;
 		mmc_data->ocr_mask = of_data->tmio_ocr_mask;
@@ -542,8 +545,11 @@ int renesas_sdhi_probe(struct platform_device *pdev,
 			renesas_sdhi_start_signal_voltage_switch;
 	}
 
-	/* Orginally registers were 16 bit apart, could be 32 or 64 nowadays */
-	if (!host->bus_shift && resource_size(res) > 0x100) /* old way to determine the shift */
+	/*
+	 * Originally registers were 16 bit apart, could be 32 or 64 nowadays.
+	 * Old way to determine the shift:
+	 */
+	if (!host->bus_shift && resource_size(res) > 0x100)
 		host->bus_shift = 1;
 
 	if (mmd)
@@ -567,7 +573,7 @@ int renesas_sdhi_probe(struct platform_device *pdev,
 	mmc_data->flags |= TMIO_MMC_SDIO_IRQ;
 
 	/*
-	 * All SDHI have CMD12 controll bit
+	 * All SDHI have CMD12 control bit
 	 */
 	mmc_data->flags |= TMIO_MMC_HAVE_CMD12_CTRL;
 
@@ -614,7 +620,7 @@ int renesas_sdhi_probe(struct platform_device *pdev,
 			break;
 		i++;
 		ret = devm_request_irq(&pdev->dev, irq, tmio_mmc_irq, 0,
-				  dev_name(&pdev->dev), host);
+				       dev_name(&pdev->dev), host);
 		if (ret)
 			goto eirq;
 	}
diff --git a/drivers/mmc/host/renesas_sdhi_sys_dmac.c b/drivers/mmc/host/renesas_sdhi_sys_dmac.c
index 202cf4346fdf..642a0dcc8c5c 100644
--- a/drivers/mmc/host/renesas_sdhi_sys_dmac.c
+++ b/drivers/mmc/host/renesas_sdhi_sys_dmac.c
@@ -104,7 +104,6 @@ static const struct of_device_id renesas_sdhi_sys_dmac_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, renesas_sdhi_sys_dmac_of_match);
 
-
 static void renesas_sdhi_sys_dmac_enable_dma(struct tmio_mmc_host *host,
 					     bool enable)
 {
@@ -196,8 +195,8 @@ static void renesas_sdhi_sys_dmac_start_dma_rx(struct tmio_mmc_host *host)
 
 	ret = dma_map_sg(chan->device->dev, sg, host->sg_len, DMA_FROM_DEVICE);
 	if (ret > 0)
-		desc = dmaengine_prep_slave_sg(chan, sg, ret,
-			DMA_DEV_TO_MEM, DMA_CTRL_ACK);
+		desc = dmaengine_prep_slave_sg(chan, sg, ret, DMA_DEV_TO_MEM,
+					       DMA_CTRL_ACK);
 
 	if (desc) {
 		reinit_completion(&host->dma_dataend);
@@ -265,6 +264,7 @@ static void renesas_sdhi_sys_dmac_start_dma_tx(struct tmio_mmc_host *host)
 	if (!aligned) {
 		unsigned long flags;
 		void *sg_vaddr = tmio_mmc_kmap_atomic(sg, &flags);
+
 		sg_init_one(&host->bounce_sg, host->bounce_buf, sg->length);
 		memcpy(host->bounce_buf, sg_vaddr, host->bounce_sg.length);
 		tmio_mmc_kunmap_atomic(sg, &flags, sg_vaddr);
@@ -274,8 +274,8 @@ static void renesas_sdhi_sys_dmac_start_dma_tx(struct tmio_mmc_host *host)
 
 	ret = dma_map_sg(chan->device->dev, sg, host->sg_len, DMA_TO_DEVICE);
 	if (ret > 0)
-		desc = dmaengine_prep_slave_sg(chan, sg, ret,
-			DMA_MEM_TO_DEV, DMA_CTRL_ACK);
+		desc = dmaengine_prep_slave_sg(chan, sg, ret, DMA_MEM_TO_DEV,
+					       DMA_CTRL_ACK);
 
 	if (desc) {
 		reinit_completion(&host->dma_dataend);
@@ -308,7 +308,7 @@ static void renesas_sdhi_sys_dmac_start_dma_tx(struct tmio_mmc_host *host)
 }
 
 static void renesas_sdhi_sys_dmac_start_dma(struct tmio_mmc_host *host,
-			       struct mmc_data *data)
+					    struct mmc_data *data)
 {
 	if (data->flags & MMC_DATA_READ) {
 		if (host->chan_rx)
@@ -346,7 +346,7 @@ static void renesas_sdhi_sys_dmac_request_dma(struct tmio_mmc_host *host,
 {
 	/* We can only either use DMA for both Tx and Rx or not use it at all */
 	if (!host->dma || (!host->pdev->dev.of_node &&
-		(!pdata->chan_priv_tx || !pdata->chan_priv_rx)))
+			   (!pdata->chan_priv_tx || !pdata->chan_priv_rx)))
 		return;
 
 	if (!host->chan_tx && !host->chan_rx) {
@@ -372,7 +372,8 @@ static void renesas_sdhi_sys_dmac_request_dma(struct tmio_mmc_host *host,
 			return;
 
 		cfg.direction = DMA_MEM_TO_DEV;
-		cfg.dst_addr = res->start + (CTL_SD_DATA_PORT << host->bus_shift);
+		cfg.dst_addr = res->start +
+			(CTL_SD_DATA_PORT << host->bus_shift);
 		cfg.dst_addr_width = host->dma->dma_buswidth;
 		if (!cfg.dst_addr_width)
 			cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
@@ -428,11 +429,13 @@ static void renesas_sdhi_sys_dmac_release_dma(struct tmio_mmc_host *host)
 {
 	if (host->chan_tx) {
 		struct dma_chan *chan = host->chan_tx;
+
 		host->chan_tx = NULL;
 		dma_release_channel(chan);
 	}
 	if (host->chan_rx) {
 		struct dma_chan *chan = host->chan_rx;
+
 		host->chan_rx = NULL;
 		dma_release_channel(chan);
 	}
@@ -457,10 +460,10 @@ static int renesas_sdhi_sys_dmac_probe(struct platform_device *pdev)
 
 static const struct dev_pm_ops renesas_sdhi_sys_dmac_dev_pm_ops = {
 	SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
-			pm_runtime_force_resume)
+				pm_runtime_force_resume)
 	SET_RUNTIME_PM_OPS(tmio_mmc_host_runtime_suspend,
-			tmio_mmc_host_runtime_resume,
-			NULL)
+			   tmio_mmc_host_runtime_resume,
+			   NULL)
 };
 
 static struct platform_driver renesas_sys_dmac_sdhi_driver = {
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/5] MAINTAINERS: Update files for TMIO/SDHI MMC driver
  2017-05-30 12:50 ` [PATCH 1/5] MAINTAINERS: Update files for TMIO/SDHI MMC driver Simon Horman
@ 2017-05-30 19:31   ` Wolfram Sang
  0 siblings, 0 replies; 14+ messages in thread
From: Wolfram Sang @ 2017-05-30 19:31 UTC (permalink / raw)
  To: Simon Horman
  Cc: Wolfram Sang, Ulf Hansson, Magnus Damm, linux-mmc, linux-renesas-soc

[-- Attachment #1: Type: text/plain, Size: 273 bytes --]

On Tue, May 30, 2017 at 02:50:50PM +0200, Simon Horman wrote:
> Update files for tmio/sdhi MMC driver to reflect recent filename
> changes.
> 
> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>

Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/5] mmc: tmio: use EXPORT_SYMBOL_GPL
  2017-05-30 12:50 ` [PATCH 2/5] mmc: tmio: use EXPORT_SYMBOL_GPL Simon Horman
@ 2017-05-30 19:35   ` Wolfram Sang
  0 siblings, 0 replies; 14+ messages in thread
From: Wolfram Sang @ 2017-05-30 19:35 UTC (permalink / raw)
  To: Simon Horman
  Cc: Wolfram Sang, Ulf Hansson, Magnus Damm, linux-mmc, linux-renesas-soc

[-- Attachment #1: Type: text/plain, Size: 293 bytes --]

On Tue, May 30, 2017 at 02:50:51PM +0200, Simon Horman wrote:
> Use EXPORT_SYMBOL_GPL rather than the non _GPL variant as there seems to be
> no reason not to.
> 
> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>

Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 3/5] mmc: tmio, renesas-sdhi: update Renesas related copyrights
  2017-05-30 12:50 ` [PATCH 3/5] mmc: tmio, renesas-sdhi: update Renesas related copyrights Simon Horman
@ 2017-05-30 19:37   ` Wolfram Sang
  0 siblings, 0 replies; 14+ messages in thread
From: Wolfram Sang @ 2017-05-30 19:37 UTC (permalink / raw)
  To: Simon Horman
  Cc: Wolfram Sang, Ulf Hansson, Magnus Damm, linux-mmc, linux-renesas-soc

[-- Attachment #1: Type: text/plain, Size: 277 bytes --]

On Tue, May 30, 2017 at 02:50:52PM +0200, Simon Horman wrote:
> Update copyrights to reflect work by Wolfram Sang and myself since last
> year.
> 
> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>

Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 5/5] mmc: renesas-sdhi: improve checkpatch cleanness
  2017-05-30 12:50 ` [PATCH 5/5] mmc: renesas-sdhi: " Simon Horman
@ 2017-05-30 19:57   ` Wolfram Sang
  0 siblings, 0 replies; 14+ messages in thread
From: Wolfram Sang @ 2017-05-30 19:57 UTC (permalink / raw)
  To: Simon Horman
  Cc: Wolfram Sang, Ulf Hansson, Magnus Damm, linux-mmc, linux-renesas-soc

[-- Attachment #1: Type: text/plain, Size: 922 bytes --]

On Tue, May 30, 2017 at 02:50:54PM +0200, Simon Horman wrote:
> Trivial updates to improve checkpatch cleanness.
> 
> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>

Two comments here:

> -	/* Orginally registers were 16 bit apart, could be 32 or 64 nowadays */
> -	if (!host->bus_shift && resource_size(res) > 0x100) /* old way to determine the shift */
> +	/*
> +	 * Originally registers were 16 bit apart, could be 32 or 64 nowadays.
> +	 * Old way to determine the shift:
> +	 */
> +	if (!host->bus_shift && resource_size(res) > 0x100)
>  		host->bus_shift = 1;

I liked the old way much better because it makes clearer which comment
belongs to the whole block and which comment belongs to just this one
line.

>  	/*
> -	 * All SDHI have CMD12 controll bit
> +	 * All SDHI have CMD12 control bit
>  	 */

Single line comment?

And hooray for finally fixing the controll bit :D


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 4/5] mmc: tmio: improve checkpatch cleanness
  2017-05-30 12:50 ` [PATCH 4/5] mmc: tmio: improve checkpatch cleanness Simon Horman
@ 2017-05-30 19:58   ` Wolfram Sang
  2017-05-31 19:58     ` Simon Horman
  2017-05-31 20:02   ` Simon Horman
  1 sibling, 1 reply; 14+ messages in thread
From: Wolfram Sang @ 2017-05-30 19:58 UTC (permalink / raw)
  To: Simon Horman
  Cc: Wolfram Sang, Ulf Hansson, Magnus Damm, linux-mmc, linux-renesas-soc

[-- Attachment #1: Type: text/plain, Size: 1331 bytes --]

On Tue, May 30, 2017 at 02:50:53PM +0200, Simon Horman wrote:
> Trivial updates to improve checkpatch cleanness.
> 
> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>

Wow, all of them! When I reviewed your DMA refactoring patches, I meant
to fix only the whitespace issues which were affecting your patches. But
okay, it is a good timing to fix all of those, because of the said DMA
refactoring work, the BSP patches won't fit anymore anyhow, so upporting
them will not become significantly harder.

And while I don't agree with all of checkpatch suggestions, this patch
increases code readability for sure. I guess, what I am saying is:

Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

and

Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

I moved big files around two SD cards attached simultaneously to two
card slots on my Renesas Lager (H2).

> -	if (host->chan_tx && (data->flags & MMC_DATA_WRITE) && !host->force_pio) {
> +	if (host->chan_tx && (data->flags & MMC_DATA_WRITE) &&
> +	    !host->force_pio) {
>  		u32 status = sd_ctrl_read16_and_16_as_32(host, CTL_STATUS);
>  		bool done = false;

Let me give just one example where I think the 80 char limit doesn't
help readability. But no need to fix IMO; as I said, most of the stuff
is really helpful.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 4/5] mmc: tmio: improve checkpatch cleanness
  2017-05-30 19:58   ` Wolfram Sang
@ 2017-05-31 19:58     ` Simon Horman
  0 siblings, 0 replies; 14+ messages in thread
From: Simon Horman @ 2017-05-31 19:58 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Wolfram Sang, Ulf Hansson, Magnus Damm, linux-mmc, linux-renesas-soc

On Tue, May 30, 2017 at 09:58:52PM +0200, Wolfram Sang wrote:
> On Tue, May 30, 2017 at 02:50:53PM +0200, Simon Horman wrote:
> > Trivial updates to improve checkpatch cleanness.
> > 
> > Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
> 
> Wow, all of them! When I reviewed your DMA refactoring patches, I meant
> to fix only the whitespace issues which were affecting your patches. But
> okay, it is a good timing to fix all of those, because of the said DMA
> refactoring work, the BSP patches won't fit anymore anyhow, so upporting
> them will not become significantly harder.
> 
> And while I don't agree with all of checkpatch suggestions, this patch
> increases code readability for sure. I guess, what I am saying is:
> 
> Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> 
> and
> 
> Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> 
> I moved big files around two SD cards attached simultaneously to two
> card slots on my Renesas Lager (H2).
> 
> > -	if (host->chan_tx && (data->flags & MMC_DATA_WRITE) && !host->force_pio) {
> > +	if (host->chan_tx && (data->flags & MMC_DATA_WRITE) &&
> > +	    !host->force_pio) {
> >  		u32 status = sd_ctrl_read16_and_16_as_32(host, CTL_STATUS);
> >  		bool done = false;
> 
> Let me give just one example where I think the 80 char limit doesn't
> help readability. But no need to fix IMO; as I said, most of the stuff
> is really helpful.

Yeah, I'm a bit dubious about some of checkpatch's warnings too.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 4/5] mmc: tmio: improve checkpatch cleanness
  2017-05-30 12:50 ` [PATCH 4/5] mmc: tmio: improve checkpatch cleanness Simon Horman
  2017-05-30 19:58   ` Wolfram Sang
@ 2017-05-31 20:02   ` Simon Horman
  1 sibling, 0 replies; 14+ messages in thread
From: Simon Horman @ 2017-05-31 20:02 UTC (permalink / raw)
  To: Wolfram Sang, Ulf Hansson; +Cc: Magnus Damm, linux-mmc, linux-renesas-soc

On Tue, May 30, 2017 at 02:50:53PM +0200, Simon Horman wrote:
> Trivial updates to improve checkpatch cleanness.
> 
> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>

...

> diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c
> index 70516abd50a1..07905c05f356 100644
> --- a/drivers/mmc/host/tmio_mmc_core.c
> +++ b/drivers/mmc/host/tmio_mmc_core.c
> @@ -127,16 +127,17 @@ static int tmio_mmc_next_sg(struct tmio_mmc_host *host)
>  
>  #define STATUS_TO_TEXT(a, status, i) \
>  	do { \
> -		if (status & TMIO_STAT_##a) { \
> -			if (i++) \
> -				printk(" | "); \
> -			printk(#a); \
> +		if ((status) & TMIO_STAT_##a) { \
> +			if ((i)++) \
> +				printk(KERN_DEBUG, " | "); \
> +			printk(KERN_DEBUG, #a); \

Ooops, 0-day tells me that there should not be a comma after KERN_DEBUG.
I'll fix that in v2.

...

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/5] mmc: tmio, renesas-sdhi: cleanups
  2017-05-30 12:50 [PATCH 0/5] mmc: tmio, renesas-sdhi: cleanups Simon Horman
                   ` (4 preceding siblings ...)
  2017-05-30 12:50 ` [PATCH 5/5] mmc: renesas-sdhi: " Simon Horman
@ 2017-06-08 13:52 ` Ulf Hansson
  5 siblings, 0 replies; 14+ messages in thread
From: Ulf Hansson @ 2017-06-08 13:52 UTC (permalink / raw)
  To: Simon Horman; +Cc: Wolfram Sang, Magnus Damm, linux-mmc, Linux-Renesas

On 30 May 2017 at 14:50, Simon Horman <horms+renesas@verge.net.au> wrote:
> Hi,
>
> this short series provides some cleanups to the tmio and renesas-sdhi
> drivers.
>
> * Update files listed in MAINTAINERS
> * Consistently use EXPORT_SYMBOL_GPL
> * Update Renesas related copyrights
> * Improve checkpatch cleanness
>
> Simon Horman (5):
>   MAINTAINERS: Update files for TMIO/SDHI MMC driver
>   mmc: tmio: use EXPORT_SYMBOL_GPL
>   mmc: tmio, renesas-sdhi: update Renesas related copyrights
>   mmc: tmio: improve checkpatch cleanness
>   mmc: renesas-sdhi: improve checkpatch cleanness
>
>  MAINTAINERS                              |   2 +-
>  drivers/mmc/host/renesas_sdhi.h          |   4 +-
>  drivers/mmc/host/renesas_sdhi_core.c     |  53 +++++++-----
>  drivers/mmc/host/renesas_sdhi_sys_dmac.c |  28 ++++---
>  drivers/mmc/host/tmio_mmc.c              |  10 ++-
>  drivers/mmc/host/tmio_mmc.h              |  22 +++--
>  drivers/mmc/host/tmio_mmc_core.c         | 139 ++++++++++++++++++-------------
>  include/linux/mfd/tmio.h                 |  33 ++++----
>  8 files changed, 167 insertions(+), 124 deletions(-)
>
> --
> 2.1.4
>

Thanks, applied patch 1->3 for next!

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2017-06-08 13:52 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-30 12:50 [PATCH 0/5] mmc: tmio, renesas-sdhi: cleanups Simon Horman
2017-05-30 12:50 ` [PATCH 1/5] MAINTAINERS: Update files for TMIO/SDHI MMC driver Simon Horman
2017-05-30 19:31   ` Wolfram Sang
2017-05-30 12:50 ` [PATCH 2/5] mmc: tmio: use EXPORT_SYMBOL_GPL Simon Horman
2017-05-30 19:35   ` Wolfram Sang
2017-05-30 12:50 ` [PATCH 3/5] mmc: tmio, renesas-sdhi: update Renesas related copyrights Simon Horman
2017-05-30 19:37   ` Wolfram Sang
2017-05-30 12:50 ` [PATCH 4/5] mmc: tmio: improve checkpatch cleanness Simon Horman
2017-05-30 19:58   ` Wolfram Sang
2017-05-31 19:58     ` Simon Horman
2017-05-31 20:02   ` Simon Horman
2017-05-30 12:50 ` [PATCH 5/5] mmc: renesas-sdhi: " Simon Horman
2017-05-30 19:57   ` Wolfram Sang
2017-06-08 13:52 ` [PATCH 0/5] mmc: tmio, renesas-sdhi: cleanups Ulf Hansson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.