All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/12] mmc: use sdhci_pltfm_init for private allocation and clean up
@ 2016-01-06  3:55 ` Jisheng Zhang
  0 siblings, 0 replies; 51+ messages in thread
From: Jisheng Zhang @ 2016-01-06  3:55 UTC (permalink / raw)
  To: ulf.hansson, arnd, swarren, lee, eric, michal.simek,
	soren.brinkmann, ludovic.desroches, srinivas.kandagatla,
	maxime.coquelin, patrice.chotard, thierry.reding,
	sebastian.hesselbarth
  Cc: linux-mmc, linux-rpi-kernel, linux-arm-kernel, linux-kernel,
	kernel, linux-tegra, Jisheng Zhang

These patches are to complete the TODOs in Commit 0e748234293f ("mmc:
sdhci: Add size for caller in init+register"), I.E:

- todo: migrate clients to using allocation this way
- todo: remove priv variable once migration is complete

Since v1:
 - add new patch03 to factorise sdhci_msm_pdata outisde of sdhci_msm_host.
   This is to fix drivers/mmc/host/sdhci-msm.c:440:32: warning: 'msm_host'
   is used uninitialized in this function [-Wuninitialized]
 - Add Arnd's Ack for all patches except patch3 which is new in v2

Jisheng Zhang (12):
  mmc: sdhci-bcm2835: use sdhci_pltfm_init for private allocation
  mmc: sdhci-esdhc-imx: use sdhci_pltfm_init for private allocation
  mmc: sdhci-msm: factorise sdhci_msm_pdata outisde of sdhci_msm_host
  mmc: sdhci-msm: use sdhci_pltfm_init for private allocation
  mmc: sdhci-of-arasan: use sdhci_pltfm_init for private allocation
  mmc: sdhci-of-at91: use sdhci_pltfm_init for private allocation
  mmc: sdhci-of-esdhc: use sdhci_pltfm_init for private allocation
  mmc: sdhci-pxav3: use sdhci_pltfm_init for private allocation
  mmc: sdhci-st: use sdhci_pltfm_init for private allocation
  mmc: sdhci-tegra: use sdhci_pltfm_init for private allocation
  mmc: sdhci-pxav2: remove unnecessary assignment of pltfm_host->priv
  mmc: sdhci-pltfm: remove priv variable from sdhci_pltfm_host

 drivers/mmc/host/sdhci-bcm2835.c   | 14 +++-----------
 drivers/mmc/host/sdhci-esdhc-imx.c | 38 +++++++++++++++++---------------------
 drivers/mmc/host/sdhci-msm.c       | 24 +++++++++++-------------
 drivers/mmc/host/sdhci-of-arasan.c | 25 ++++++++++---------------
 drivers/mmc/host/sdhci-of-at91.c   | 21 ++++++++-------------
 drivers/mmc/host/sdhci-of-esdhc.c  | 17 ++++++++---------
 drivers/mmc/host/sdhci-pltfm.h     |  1 -
 drivers/mmc/host/sdhci-pxav2.c     |  1 -
 drivers/mmc/host/sdhci-pxav3.c     | 21 +++++++++------------
 drivers/mmc/host/sdhci-st.c        | 36 ++++++++++++++++++------------------
 drivers/mmc/host/sdhci-tegra.c     | 19 ++++++-------------
 11 files changed, 90 insertions(+), 127 deletions(-)

-- 
2.7.0.rc3


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

* [PATCH v2 00/12] mmc: use sdhci_pltfm_init for private allocation and clean up
@ 2016-01-06  3:55 ` Jisheng Zhang
  0 siblings, 0 replies; 51+ messages in thread
From: Jisheng Zhang @ 2016-01-06  3:55 UTC (permalink / raw)
  To: ulf.hansson, arnd, swarren, lee, eric, michal.simek,
	soren.brinkmann, ludovic.desroches, srinivas.kandagatla,
	maxime.coquelin, patrice.chotard, thierry.reding,
	sebastian.hesselbarth
  Cc: linux-mmc, linux-rpi-kernel, linux-arm-kernel, linux-kernel,
	kernel, linux-tegra, Jisheng Zhang

These patches are to complete the TODOs in Commit 0e748234293f ("mmc:
sdhci: Add size for caller in init+register"), I.E:

- todo: migrate clients to using allocation this way
- todo: remove priv variable once migration is complete

Since v1:
 - add new patch03 to factorise sdhci_msm_pdata outisde of sdhci_msm_host.
   This is to fix drivers/mmc/host/sdhci-msm.c:440:32: warning: 'msm_host'
   is used uninitialized in this function [-Wuninitialized]
 - Add Arnd's Ack for all patches except patch3 which is new in v2

Jisheng Zhang (12):
  mmc: sdhci-bcm2835: use sdhci_pltfm_init for private allocation
  mmc: sdhci-esdhc-imx: use sdhci_pltfm_init for private allocation
  mmc: sdhci-msm: factorise sdhci_msm_pdata outisde of sdhci_msm_host
  mmc: sdhci-msm: use sdhci_pltfm_init for private allocation
  mmc: sdhci-of-arasan: use sdhci_pltfm_init for private allocation
  mmc: sdhci-of-at91: use sdhci_pltfm_init for private allocation
  mmc: sdhci-of-esdhc: use sdhci_pltfm_init for private allocation
  mmc: sdhci-pxav3: use sdhci_pltfm_init for private allocation
  mmc: sdhci-st: use sdhci_pltfm_init for private allocation
  mmc: sdhci-tegra: use sdhci_pltfm_init for private allocation
  mmc: sdhci-pxav2: remove unnecessary assignment of pltfm_host->priv
  mmc: sdhci-pltfm: remove priv variable from sdhci_pltfm_host

 drivers/mmc/host/sdhci-bcm2835.c   | 14 +++-----------
 drivers/mmc/host/sdhci-esdhc-imx.c | 38 +++++++++++++++++---------------------
 drivers/mmc/host/sdhci-msm.c       | 24 +++++++++++-------------
 drivers/mmc/host/sdhci-of-arasan.c | 25 ++++++++++---------------
 drivers/mmc/host/sdhci-of-at91.c   | 21 ++++++++-------------
 drivers/mmc/host/sdhci-of-esdhc.c  | 17 ++++++++---------
 drivers/mmc/host/sdhci-pltfm.h     |  1 -
 drivers/mmc/host/sdhci-pxav2.c     |  1 -
 drivers/mmc/host/sdhci-pxav3.c     | 21 +++++++++------------
 drivers/mmc/host/sdhci-st.c        | 36 ++++++++++++++++++------------------
 drivers/mmc/host/sdhci-tegra.c     | 19 ++++++-------------
 11 files changed, 90 insertions(+), 127 deletions(-)

-- 
2.7.0.rc3


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

* [PATCH v2 00/12] mmc: use sdhci_pltfm_init for private allocation and clean up
@ 2016-01-06  3:55 ` Jisheng Zhang
  0 siblings, 0 replies; 51+ messages in thread
From: Jisheng Zhang @ 2016-01-06  3:55 UTC (permalink / raw)
  To: linux-arm-kernel

These patches are to complete the TODOs in Commit 0e748234293f ("mmc:
sdhci: Add size for caller in init+register"), I.E:

- todo: migrate clients to using allocation this way
- todo: remove priv variable once migration is complete

Since v1:
 - add new patch03 to factorise sdhci_msm_pdata outisde of sdhci_msm_host.
   This is to fix drivers/mmc/host/sdhci-msm.c:440:32: warning: 'msm_host'
   is used uninitialized in this function [-Wuninitialized]
 - Add Arnd's Ack for all patches except patch3 which is new in v2

Jisheng Zhang (12):
  mmc: sdhci-bcm2835: use sdhci_pltfm_init for private allocation
  mmc: sdhci-esdhc-imx: use sdhci_pltfm_init for private allocation
  mmc: sdhci-msm: factorise sdhci_msm_pdata outisde of sdhci_msm_host
  mmc: sdhci-msm: use sdhci_pltfm_init for private allocation
  mmc: sdhci-of-arasan: use sdhci_pltfm_init for private allocation
  mmc: sdhci-of-at91: use sdhci_pltfm_init for private allocation
  mmc: sdhci-of-esdhc: use sdhci_pltfm_init for private allocation
  mmc: sdhci-pxav3: use sdhci_pltfm_init for private allocation
  mmc: sdhci-st: use sdhci_pltfm_init for private allocation
  mmc: sdhci-tegra: use sdhci_pltfm_init for private allocation
  mmc: sdhci-pxav2: remove unnecessary assignment of pltfm_host->priv
  mmc: sdhci-pltfm: remove priv variable from sdhci_pltfm_host

 drivers/mmc/host/sdhci-bcm2835.c   | 14 +++-----------
 drivers/mmc/host/sdhci-esdhc-imx.c | 38 +++++++++++++++++---------------------
 drivers/mmc/host/sdhci-msm.c       | 24 +++++++++++-------------
 drivers/mmc/host/sdhci-of-arasan.c | 25 ++++++++++---------------
 drivers/mmc/host/sdhci-of-at91.c   | 21 ++++++++-------------
 drivers/mmc/host/sdhci-of-esdhc.c  | 17 ++++++++---------
 drivers/mmc/host/sdhci-pltfm.h     |  1 -
 drivers/mmc/host/sdhci-pxav2.c     |  1 -
 drivers/mmc/host/sdhci-pxav3.c     | 21 +++++++++------------
 drivers/mmc/host/sdhci-st.c        | 36 ++++++++++++++++++------------------
 drivers/mmc/host/sdhci-tegra.c     | 19 ++++++-------------
 11 files changed, 90 insertions(+), 127 deletions(-)

-- 
2.7.0.rc3

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

* [PATCH v2 01/12] mmc: sdhci-bcm2835: use sdhci_pltfm_init for private allocation
  2016-01-06  3:55 ` Jisheng Zhang
  (?)
@ 2016-01-06  3:55   ` Jisheng Zhang
  -1 siblings, 0 replies; 51+ messages in thread
From: Jisheng Zhang @ 2016-01-06  3:55 UTC (permalink / raw)
  To: ulf.hansson, arnd, swarren, lee, eric, michal.simek,
	soren.brinkmann, ludovic.desroches, srinivas.kandagatla,
	maxime.coquelin, patrice.chotard, thierry.reding,
	sebastian.hesselbarth
  Cc: linux-mmc, linux-rpi-kernel, linux-arm-kernel, linux-kernel,
	kernel, linux-tegra, Jisheng Zhang

Commit 0e748234293f ("mmc: sdhci: Add size for caller in init+register")
allows users of sdhci_pltfm to allocate private space in calls to
sdhci_pltfm_init+sdhci_pltfm_register. This patch migrates sdhci-bcm2835
to this allocation.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/mmc/host/sdhci-bcm2835.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/drivers/mmc/host/sdhci-bcm2835.c b/drivers/mmc/host/sdhci-bcm2835.c
index 1c65d46..4a6a1d1 100644
--- a/drivers/mmc/host/sdhci-bcm2835.c
+++ b/drivers/mmc/host/sdhci-bcm2835.c
@@ -74,7 +74,7 @@ static inline u32 bcm2835_sdhci_readl(struct sdhci_host *host, int reg)
 static void bcm2835_sdhci_writew(struct sdhci_host *host, u16 val, int reg)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct bcm2835_sdhci *bcm2835_host = pltfm_host->priv;
+	struct bcm2835_sdhci *bcm2835_host = sdhci_pltfm_priv(pltfm_host);
 	u32 oldval = (reg == SDHCI_COMMAND) ? bcm2835_host->shadow :
 		bcm2835_sdhci_readl(host, reg & ~3);
 	u32 word_num = (reg >> 1) & 1;
@@ -152,20 +152,12 @@ static int bcm2835_sdhci_probe(struct platform_device *pdev)
 	struct sdhci_pltfm_host *pltfm_host;
 	int ret;
 
-	host = sdhci_pltfm_init(pdev, &bcm2835_sdhci_pdata, 0);
+	host = sdhci_pltfm_init(pdev, &bcm2835_sdhci_pdata,
+				sizeof(*bcm2835_host));
 	if (IS_ERR(host))
 		return PTR_ERR(host);
 
-	bcm2835_host = devm_kzalloc(&pdev->dev, sizeof(*bcm2835_host),
-					GFP_KERNEL);
-	if (!bcm2835_host) {
-		dev_err(mmc_dev(host->mmc),
-			"failed to allocate bcm2835_sdhci\n");
-		return -ENOMEM;
-	}
-
 	pltfm_host = sdhci_priv(host);
-	pltfm_host->priv = bcm2835_host;
 
 	pltfm_host->clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(pltfm_host->clk)) {
-- 
2.7.0.rc3


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

* [PATCH v2 01/12] mmc: sdhci-bcm2835: use sdhci_pltfm_init for private allocation
@ 2016-01-06  3:55   ` Jisheng Zhang
  0 siblings, 0 replies; 51+ messages in thread
From: Jisheng Zhang @ 2016-01-06  3:55 UTC (permalink / raw)
  To: ulf.hansson, arnd, swarren, lee, eric, michal.simek,
	soren.brinkmann, ludovic.desroches, srinivas.kandagatla,
	maxime.coquelin, patrice.chotard, thierry.reding,
	sebastian.hesselbarth
  Cc: linux-mmc, linux-rpi-kernel, linux-arm-kernel, linux-kernel,
	kernel, linux-tegra, Jisheng Zhang

Commit 0e748234293f ("mmc: sdhci: Add size for caller in init+register")
allows users of sdhci_pltfm to allocate private space in calls to
sdhci_pltfm_init+sdhci_pltfm_register. This patch migrates sdhci-bcm2835
to this allocation.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/mmc/host/sdhci-bcm2835.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/drivers/mmc/host/sdhci-bcm2835.c b/drivers/mmc/host/sdhci-bcm2835.c
index 1c65d46..4a6a1d1 100644
--- a/drivers/mmc/host/sdhci-bcm2835.c
+++ b/drivers/mmc/host/sdhci-bcm2835.c
@@ -74,7 +74,7 @@ static inline u32 bcm2835_sdhci_readl(struct sdhci_host *host, int reg)
 static void bcm2835_sdhci_writew(struct sdhci_host *host, u16 val, int reg)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct bcm2835_sdhci *bcm2835_host = pltfm_host->priv;
+	struct bcm2835_sdhci *bcm2835_host = sdhci_pltfm_priv(pltfm_host);
 	u32 oldval = (reg == SDHCI_COMMAND) ? bcm2835_host->shadow :
 		bcm2835_sdhci_readl(host, reg & ~3);
 	u32 word_num = (reg >> 1) & 1;
@@ -152,20 +152,12 @@ static int bcm2835_sdhci_probe(struct platform_device *pdev)
 	struct sdhci_pltfm_host *pltfm_host;
 	int ret;
 
-	host = sdhci_pltfm_init(pdev, &bcm2835_sdhci_pdata, 0);
+	host = sdhci_pltfm_init(pdev, &bcm2835_sdhci_pdata,
+				sizeof(*bcm2835_host));
 	if (IS_ERR(host))
 		return PTR_ERR(host);
 
-	bcm2835_host = devm_kzalloc(&pdev->dev, sizeof(*bcm2835_host),
-					GFP_KERNEL);
-	if (!bcm2835_host) {
-		dev_err(mmc_dev(host->mmc),
-			"failed to allocate bcm2835_sdhci\n");
-		return -ENOMEM;
-	}
-
 	pltfm_host = sdhci_priv(host);
-	pltfm_host->priv = bcm2835_host;
 
 	pltfm_host->clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(pltfm_host->clk)) {
-- 
2.7.0.rc3


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

* [PATCH v2 01/12] mmc: sdhci-bcm2835: use sdhci_pltfm_init for private allocation
@ 2016-01-06  3:55   ` Jisheng Zhang
  0 siblings, 0 replies; 51+ messages in thread
From: Jisheng Zhang @ 2016-01-06  3:55 UTC (permalink / raw)
  To: linux-arm-kernel

Commit 0e748234293f ("mmc: sdhci: Add size for caller in init+register")
allows users of sdhci_pltfm to allocate private space in calls to
sdhci_pltfm_init+sdhci_pltfm_register. This patch migrates sdhci-bcm2835
to this allocation.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/mmc/host/sdhci-bcm2835.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/drivers/mmc/host/sdhci-bcm2835.c b/drivers/mmc/host/sdhci-bcm2835.c
index 1c65d46..4a6a1d1 100644
--- a/drivers/mmc/host/sdhci-bcm2835.c
+++ b/drivers/mmc/host/sdhci-bcm2835.c
@@ -74,7 +74,7 @@ static inline u32 bcm2835_sdhci_readl(struct sdhci_host *host, int reg)
 static void bcm2835_sdhci_writew(struct sdhci_host *host, u16 val, int reg)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct bcm2835_sdhci *bcm2835_host = pltfm_host->priv;
+	struct bcm2835_sdhci *bcm2835_host = sdhci_pltfm_priv(pltfm_host);
 	u32 oldval = (reg == SDHCI_COMMAND) ? bcm2835_host->shadow :
 		bcm2835_sdhci_readl(host, reg & ~3);
 	u32 word_num = (reg >> 1) & 1;
@@ -152,20 +152,12 @@ static int bcm2835_sdhci_probe(struct platform_device *pdev)
 	struct sdhci_pltfm_host *pltfm_host;
 	int ret;
 
-	host = sdhci_pltfm_init(pdev, &bcm2835_sdhci_pdata, 0);
+	host = sdhci_pltfm_init(pdev, &bcm2835_sdhci_pdata,
+				sizeof(*bcm2835_host));
 	if (IS_ERR(host))
 		return PTR_ERR(host);
 
-	bcm2835_host = devm_kzalloc(&pdev->dev, sizeof(*bcm2835_host),
-					GFP_KERNEL);
-	if (!bcm2835_host) {
-		dev_err(mmc_dev(host->mmc),
-			"failed to allocate bcm2835_sdhci\n");
-		return -ENOMEM;
-	}
-
 	pltfm_host = sdhci_priv(host);
-	pltfm_host->priv = bcm2835_host;
 
 	pltfm_host->clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(pltfm_host->clk)) {
-- 
2.7.0.rc3

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

* [PATCH v2 02/12] mmc: sdhci-esdhc-imx: use sdhci_pltfm_init for private allocation
  2016-01-06  3:55 ` Jisheng Zhang
  (?)
@ 2016-01-06  3:55     ` Jisheng Zhang
  -1 siblings, 0 replies; 51+ messages in thread
From: Jisheng Zhang @ 2016-01-06  3:55 UTC (permalink / raw)
  To: ulf.hansson-QSEj5FYQhm4dnm+yROfE0A, arnd-r2nGTMty4D4,
	swarren-3lzwWm7+Weoh9ZMKESR00Q, lee-DgEjT+Ai2ygdnm+yROfE0A,
	eric-WhKQ6XTQaPysTnJN9+BGXg, michal.simek-gjFFaj9aHVfQT0dZR+AlfA,
	soren.brinkmann-gjFFaj9aHVfQT0dZR+AlfA,
	ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w,
	srinivas.kandagatla-Re5JQEeQqe8AvxtiuMwx3w,
	maxime.coquelin-qxv4g6HH51o, patrice.chotard-qxv4g6HH51o,
	thierry.reding-Re5JQEeQqe8AvxtiuMwx3w,
	sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w
  Cc: linux-mmc-u79uwXL29TY76Z2rM5mHXA,
	linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	kernel-F5mvAk5X5gdBDgjK7y7TUQ,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA, Jisheng Zhang

Commit 0e748234293f ("mmc: sdhci: Add size for caller in init+register")
allows users of sdhci_pltfm to allocate private space in calls to
sdhci_pltfm_init+sdhci_pltfm_register. This patch migrates the sdhci
esdhc-imx driver to this allocation.

Signed-off-by: Jisheng Zhang <jszhang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
Acked-by: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
---
 drivers/mmc/host/sdhci-esdhc-imx.c | 38 +++++++++++++++++---------------------
 1 file changed, 17 insertions(+), 21 deletions(-)

diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index 1f1582f..594a753 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -259,7 +259,7 @@ static inline void esdhc_clrset_le(struct sdhci_host *host, u32 mask, u32 val, i
 static u32 esdhc_readl_le(struct sdhci_host *host, int reg)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct pltfm_imx_data *imx_data = pltfm_host->priv;
+	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
 	u32 val = readl(host->ioaddr + reg);
 
 	if (unlikely(reg == SDHCI_PRESENT_STATE)) {
@@ -337,7 +337,7 @@ static u32 esdhc_readl_le(struct sdhci_host *host, int reg)
 static void esdhc_writel_le(struct sdhci_host *host, u32 val, int reg)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct pltfm_imx_data *imx_data = pltfm_host->priv;
+	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
 	u32 data;
 
 	if (unlikely(reg == SDHCI_INT_ENABLE || reg == SDHCI_SIGNAL_ENABLE)) {
@@ -387,7 +387,7 @@ static void esdhc_writel_le(struct sdhci_host *host, u32 val, int reg)
 static u16 esdhc_readw_le(struct sdhci_host *host, int reg)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct pltfm_imx_data *imx_data = pltfm_host->priv;
+	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
 	u16 ret = 0;
 	u32 val;
 
@@ -447,7 +447,7 @@ static u16 esdhc_readw_le(struct sdhci_host *host, int reg)
 static void esdhc_writew_le(struct sdhci_host *host, u16 val, int reg)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct pltfm_imx_data *imx_data = pltfm_host->priv;
+	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
 	u32 new_val = 0;
 
 	switch (reg) {
@@ -553,7 +553,7 @@ static void esdhc_writew_le(struct sdhci_host *host, u16 val, int reg)
 static void esdhc_writeb_le(struct sdhci_host *host, u8 val, int reg)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct pltfm_imx_data *imx_data = pltfm_host->priv;
+	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
 	u32 new_val;
 	u32 mask;
 
@@ -630,7 +630,7 @@ static inline void esdhc_pltfm_set_clock(struct sdhci_host *host,
 					 unsigned int clock)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct pltfm_imx_data *imx_data = pltfm_host->priv;
+	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
 	unsigned int host_clock = pltfm_host->clock;
 	int pre_div = 2;
 	int div = 1;
@@ -689,7 +689,7 @@ static inline void esdhc_pltfm_set_clock(struct sdhci_host *host,
 static unsigned int esdhc_pltfm_get_ro(struct sdhci_host *host)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct pltfm_imx_data *imx_data = pltfm_host->priv;
+	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
 	struct esdhc_platform_data *boarddata = &imx_data->boarddata;
 
 	switch (boarddata->wp_type) {
@@ -791,7 +791,7 @@ static int esdhc_change_pinstate(struct sdhci_host *host,
 						unsigned int uhs)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct pltfm_imx_data *imx_data = pltfm_host->priv;
+	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
 	struct pinctrl_state *pinctrl;
 
 	dev_dbg(mmc_dev(host->mmc), "change pinctrl state for uhs %d\n", uhs);
@@ -861,7 +861,7 @@ static void esdhc_set_uhs_signaling(struct sdhci_host *host, unsigned timing)
 {
 	u32 m;
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct pltfm_imx_data *imx_data = pltfm_host->priv;
+	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
 	struct esdhc_platform_data *boarddata = &imx_data->boarddata;
 
 	/* disable ddr mode and disable HS400 mode */
@@ -914,7 +914,7 @@ static void esdhc_reset(struct sdhci_host *host, u8 mask)
 static unsigned int esdhc_get_max_timeout_count(struct sdhci_host *host)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct pltfm_imx_data *imx_data = pltfm_host->priv;
+	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
 
 	return esdhc_is_usdhc(imx_data) ? 1 << 28 : 1 << 27;
 }
@@ -922,7 +922,7 @@ static unsigned int esdhc_get_max_timeout_count(struct sdhci_host *host)
 static void esdhc_set_timeout(struct sdhci_host *host, struct mmc_command *cmd)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct pltfm_imx_data *imx_data = pltfm_host->priv;
+	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
 
 	/* use maximum timeout counter */
 	sdhci_writeb(host, esdhc_is_usdhc(imx_data) ? 0xF : 0xE,
@@ -1097,21 +1097,17 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
 	int err;
 	struct pltfm_imx_data *imx_data;
 
-	host = sdhci_pltfm_init(pdev, &sdhci_esdhc_imx_pdata, 0);
+	host = sdhci_pltfm_init(pdev, &sdhci_esdhc_imx_pdata,
+				sizeof(*imx_data));
 	if (IS_ERR(host))
 		return PTR_ERR(host);
 
 	pltfm_host = sdhci_priv(host);
 
-	imx_data = devm_kzalloc(&pdev->dev, sizeof(*imx_data), GFP_KERNEL);
-	if (!imx_data) {
-		err = -ENOMEM;
-		goto free_sdhci;
-	}
+	imx_data = sdhci_pltfm_priv(pltfm_host);
 
 	imx_data->socdata = of_id ? of_id->data : (struct esdhc_soc_data *)
 						  pdev->id_entry->driver_data;
-	pltfm_host->priv = imx_data;
 
 	imx_data->clk_ipg = devm_clk_get(&pdev->dev, "ipg");
 	if (IS_ERR(imx_data->clk_ipg)) {
@@ -1238,7 +1234,7 @@ static int sdhci_esdhc_imx_remove(struct platform_device *pdev)
 {
 	struct sdhci_host *host = platform_get_drvdata(pdev);
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct pltfm_imx_data *imx_data = pltfm_host->priv;
+	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
 	int dead = (readl(host->ioaddr + SDHCI_INT_STATUS) == 0xffffffff);
 
 	pm_runtime_get_sync(&pdev->dev);
@@ -1261,7 +1257,7 @@ static int sdhci_esdhc_runtime_suspend(struct device *dev)
 {
 	struct sdhci_host *host = dev_get_drvdata(dev);
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct pltfm_imx_data *imx_data = pltfm_host->priv;
+	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
 	int ret;
 
 	ret = sdhci_runtime_suspend_host(host);
@@ -1279,7 +1275,7 @@ static int sdhci_esdhc_runtime_resume(struct device *dev)
 {
 	struct sdhci_host *host = dev_get_drvdata(dev);
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct pltfm_imx_data *imx_data = pltfm_host->priv;
+	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
 
 	if (!sdhci_sdio_irq_enabled(host)) {
 		clk_prepare_enable(imx_data->clk_per);
-- 
2.7.0.rc3

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

* [PATCH v2 02/12] mmc: sdhci-esdhc-imx: use sdhci_pltfm_init for private allocation
@ 2016-01-06  3:55     ` Jisheng Zhang
  0 siblings, 0 replies; 51+ messages in thread
From: Jisheng Zhang @ 2016-01-06  3:55 UTC (permalink / raw)
  To: ulf.hansson, arnd, swarren, lee, eric, michal.simek,
	soren.brinkmann, ludovic.desroches, srinivas.kandagatla,
	maxime.coquelin, patrice.chotard, thierry.reding,
	sebastian.hesselbarth
  Cc: linux-mmc, linux-rpi-kernel, linux-arm-kernel, linux-kernel,
	kernel, linux-tegra, Jisheng Zhang

Commit 0e748234293f ("mmc: sdhci: Add size for caller in init+register")
allows users of sdhci_pltfm to allocate private space in calls to
sdhci_pltfm_init+sdhci_pltfm_register. This patch migrates the sdhci
esdhc-imx driver to this allocation.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/mmc/host/sdhci-esdhc-imx.c | 38 +++++++++++++++++---------------------
 1 file changed, 17 insertions(+), 21 deletions(-)

diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index 1f1582f..594a753 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -259,7 +259,7 @@ static inline void esdhc_clrset_le(struct sdhci_host *host, u32 mask, u32 val, i
 static u32 esdhc_readl_le(struct sdhci_host *host, int reg)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct pltfm_imx_data *imx_data = pltfm_host->priv;
+	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
 	u32 val = readl(host->ioaddr + reg);
 
 	if (unlikely(reg == SDHCI_PRESENT_STATE)) {
@@ -337,7 +337,7 @@ static u32 esdhc_readl_le(struct sdhci_host *host, int reg)
 static void esdhc_writel_le(struct sdhci_host *host, u32 val, int reg)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct pltfm_imx_data *imx_data = pltfm_host->priv;
+	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
 	u32 data;
 
 	if (unlikely(reg == SDHCI_INT_ENABLE || reg == SDHCI_SIGNAL_ENABLE)) {
@@ -387,7 +387,7 @@ static void esdhc_writel_le(struct sdhci_host *host, u32 val, int reg)
 static u16 esdhc_readw_le(struct sdhci_host *host, int reg)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct pltfm_imx_data *imx_data = pltfm_host->priv;
+	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
 	u16 ret = 0;
 	u32 val;
 
@@ -447,7 +447,7 @@ static u16 esdhc_readw_le(struct sdhci_host *host, int reg)
 static void esdhc_writew_le(struct sdhci_host *host, u16 val, int reg)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct pltfm_imx_data *imx_data = pltfm_host->priv;
+	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
 	u32 new_val = 0;
 
 	switch (reg) {
@@ -553,7 +553,7 @@ static void esdhc_writew_le(struct sdhci_host *host, u16 val, int reg)
 static void esdhc_writeb_le(struct sdhci_host *host, u8 val, int reg)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct pltfm_imx_data *imx_data = pltfm_host->priv;
+	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
 	u32 new_val;
 	u32 mask;
 
@@ -630,7 +630,7 @@ static inline void esdhc_pltfm_set_clock(struct sdhci_host *host,
 					 unsigned int clock)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct pltfm_imx_data *imx_data = pltfm_host->priv;
+	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
 	unsigned int host_clock = pltfm_host->clock;
 	int pre_div = 2;
 	int div = 1;
@@ -689,7 +689,7 @@ static inline void esdhc_pltfm_set_clock(struct sdhci_host *host,
 static unsigned int esdhc_pltfm_get_ro(struct sdhci_host *host)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct pltfm_imx_data *imx_data = pltfm_host->priv;
+	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
 	struct esdhc_platform_data *boarddata = &imx_data->boarddata;
 
 	switch (boarddata->wp_type) {
@@ -791,7 +791,7 @@ static int esdhc_change_pinstate(struct sdhci_host *host,
 						unsigned int uhs)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct pltfm_imx_data *imx_data = pltfm_host->priv;
+	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
 	struct pinctrl_state *pinctrl;
 
 	dev_dbg(mmc_dev(host->mmc), "change pinctrl state for uhs %d\n", uhs);
@@ -861,7 +861,7 @@ static void esdhc_set_uhs_signaling(struct sdhci_host *host, unsigned timing)
 {
 	u32 m;
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct pltfm_imx_data *imx_data = pltfm_host->priv;
+	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
 	struct esdhc_platform_data *boarddata = &imx_data->boarddata;
 
 	/* disable ddr mode and disable HS400 mode */
@@ -914,7 +914,7 @@ static void esdhc_reset(struct sdhci_host *host, u8 mask)
 static unsigned int esdhc_get_max_timeout_count(struct sdhci_host *host)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct pltfm_imx_data *imx_data = pltfm_host->priv;
+	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
 
 	return esdhc_is_usdhc(imx_data) ? 1 << 28 : 1 << 27;
 }
@@ -922,7 +922,7 @@ static unsigned int esdhc_get_max_timeout_count(struct sdhci_host *host)
 static void esdhc_set_timeout(struct sdhci_host *host, struct mmc_command *cmd)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct pltfm_imx_data *imx_data = pltfm_host->priv;
+	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
 
 	/* use maximum timeout counter */
 	sdhci_writeb(host, esdhc_is_usdhc(imx_data) ? 0xF : 0xE,
@@ -1097,21 +1097,17 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
 	int err;
 	struct pltfm_imx_data *imx_data;
 
-	host = sdhci_pltfm_init(pdev, &sdhci_esdhc_imx_pdata, 0);
+	host = sdhci_pltfm_init(pdev, &sdhci_esdhc_imx_pdata,
+				sizeof(*imx_data));
 	if (IS_ERR(host))
 		return PTR_ERR(host);
 
 	pltfm_host = sdhci_priv(host);
 
-	imx_data = devm_kzalloc(&pdev->dev, sizeof(*imx_data), GFP_KERNEL);
-	if (!imx_data) {
-		err = -ENOMEM;
-		goto free_sdhci;
-	}
+	imx_data = sdhci_pltfm_priv(pltfm_host);
 
 	imx_data->socdata = of_id ? of_id->data : (struct esdhc_soc_data *)
 						  pdev->id_entry->driver_data;
-	pltfm_host->priv = imx_data;
 
 	imx_data->clk_ipg = devm_clk_get(&pdev->dev, "ipg");
 	if (IS_ERR(imx_data->clk_ipg)) {
@@ -1238,7 +1234,7 @@ static int sdhci_esdhc_imx_remove(struct platform_device *pdev)
 {
 	struct sdhci_host *host = platform_get_drvdata(pdev);
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct pltfm_imx_data *imx_data = pltfm_host->priv;
+	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
 	int dead = (readl(host->ioaddr + SDHCI_INT_STATUS) == 0xffffffff);
 
 	pm_runtime_get_sync(&pdev->dev);
@@ -1261,7 +1257,7 @@ static int sdhci_esdhc_runtime_suspend(struct device *dev)
 {
 	struct sdhci_host *host = dev_get_drvdata(dev);
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct pltfm_imx_data *imx_data = pltfm_host->priv;
+	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
 	int ret;
 
 	ret = sdhci_runtime_suspend_host(host);
@@ -1279,7 +1275,7 @@ static int sdhci_esdhc_runtime_resume(struct device *dev)
 {
 	struct sdhci_host *host = dev_get_drvdata(dev);
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct pltfm_imx_data *imx_data = pltfm_host->priv;
+	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
 
 	if (!sdhci_sdio_irq_enabled(host)) {
 		clk_prepare_enable(imx_data->clk_per);
-- 
2.7.0.rc3


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

* [PATCH v2 02/12] mmc: sdhci-esdhc-imx: use sdhci_pltfm_init for private allocation
@ 2016-01-06  3:55     ` Jisheng Zhang
  0 siblings, 0 replies; 51+ messages in thread
From: Jisheng Zhang @ 2016-01-06  3:55 UTC (permalink / raw)
  To: linux-arm-kernel

Commit 0e748234293f ("mmc: sdhci: Add size for caller in init+register")
allows users of sdhci_pltfm to allocate private space in calls to
sdhci_pltfm_init+sdhci_pltfm_register. This patch migrates the sdhci
esdhc-imx driver to this allocation.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/mmc/host/sdhci-esdhc-imx.c | 38 +++++++++++++++++---------------------
 1 file changed, 17 insertions(+), 21 deletions(-)

diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index 1f1582f..594a753 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -259,7 +259,7 @@ static inline void esdhc_clrset_le(struct sdhci_host *host, u32 mask, u32 val, i
 static u32 esdhc_readl_le(struct sdhci_host *host, int reg)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct pltfm_imx_data *imx_data = pltfm_host->priv;
+	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
 	u32 val = readl(host->ioaddr + reg);
 
 	if (unlikely(reg == SDHCI_PRESENT_STATE)) {
@@ -337,7 +337,7 @@ static u32 esdhc_readl_le(struct sdhci_host *host, int reg)
 static void esdhc_writel_le(struct sdhci_host *host, u32 val, int reg)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct pltfm_imx_data *imx_data = pltfm_host->priv;
+	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
 	u32 data;
 
 	if (unlikely(reg == SDHCI_INT_ENABLE || reg == SDHCI_SIGNAL_ENABLE)) {
@@ -387,7 +387,7 @@ static void esdhc_writel_le(struct sdhci_host *host, u32 val, int reg)
 static u16 esdhc_readw_le(struct sdhci_host *host, int reg)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct pltfm_imx_data *imx_data = pltfm_host->priv;
+	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
 	u16 ret = 0;
 	u32 val;
 
@@ -447,7 +447,7 @@ static u16 esdhc_readw_le(struct sdhci_host *host, int reg)
 static void esdhc_writew_le(struct sdhci_host *host, u16 val, int reg)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct pltfm_imx_data *imx_data = pltfm_host->priv;
+	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
 	u32 new_val = 0;
 
 	switch (reg) {
@@ -553,7 +553,7 @@ static void esdhc_writew_le(struct sdhci_host *host, u16 val, int reg)
 static void esdhc_writeb_le(struct sdhci_host *host, u8 val, int reg)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct pltfm_imx_data *imx_data = pltfm_host->priv;
+	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
 	u32 new_val;
 	u32 mask;
 
@@ -630,7 +630,7 @@ static inline void esdhc_pltfm_set_clock(struct sdhci_host *host,
 					 unsigned int clock)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct pltfm_imx_data *imx_data = pltfm_host->priv;
+	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
 	unsigned int host_clock = pltfm_host->clock;
 	int pre_div = 2;
 	int div = 1;
@@ -689,7 +689,7 @@ static inline void esdhc_pltfm_set_clock(struct sdhci_host *host,
 static unsigned int esdhc_pltfm_get_ro(struct sdhci_host *host)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct pltfm_imx_data *imx_data = pltfm_host->priv;
+	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
 	struct esdhc_platform_data *boarddata = &imx_data->boarddata;
 
 	switch (boarddata->wp_type) {
@@ -791,7 +791,7 @@ static int esdhc_change_pinstate(struct sdhci_host *host,
 						unsigned int uhs)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct pltfm_imx_data *imx_data = pltfm_host->priv;
+	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
 	struct pinctrl_state *pinctrl;
 
 	dev_dbg(mmc_dev(host->mmc), "change pinctrl state for uhs %d\n", uhs);
@@ -861,7 +861,7 @@ static void esdhc_set_uhs_signaling(struct sdhci_host *host, unsigned timing)
 {
 	u32 m;
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct pltfm_imx_data *imx_data = pltfm_host->priv;
+	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
 	struct esdhc_platform_data *boarddata = &imx_data->boarddata;
 
 	/* disable ddr mode and disable HS400 mode */
@@ -914,7 +914,7 @@ static void esdhc_reset(struct sdhci_host *host, u8 mask)
 static unsigned int esdhc_get_max_timeout_count(struct sdhci_host *host)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct pltfm_imx_data *imx_data = pltfm_host->priv;
+	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
 
 	return esdhc_is_usdhc(imx_data) ? 1 << 28 : 1 << 27;
 }
@@ -922,7 +922,7 @@ static unsigned int esdhc_get_max_timeout_count(struct sdhci_host *host)
 static void esdhc_set_timeout(struct sdhci_host *host, struct mmc_command *cmd)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct pltfm_imx_data *imx_data = pltfm_host->priv;
+	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
 
 	/* use maximum timeout counter */
 	sdhci_writeb(host, esdhc_is_usdhc(imx_data) ? 0xF : 0xE,
@@ -1097,21 +1097,17 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
 	int err;
 	struct pltfm_imx_data *imx_data;
 
-	host = sdhci_pltfm_init(pdev, &sdhci_esdhc_imx_pdata, 0);
+	host = sdhci_pltfm_init(pdev, &sdhci_esdhc_imx_pdata,
+				sizeof(*imx_data));
 	if (IS_ERR(host))
 		return PTR_ERR(host);
 
 	pltfm_host = sdhci_priv(host);
 
-	imx_data = devm_kzalloc(&pdev->dev, sizeof(*imx_data), GFP_KERNEL);
-	if (!imx_data) {
-		err = -ENOMEM;
-		goto free_sdhci;
-	}
+	imx_data = sdhci_pltfm_priv(pltfm_host);
 
 	imx_data->socdata = of_id ? of_id->data : (struct esdhc_soc_data *)
 						  pdev->id_entry->driver_data;
-	pltfm_host->priv = imx_data;
 
 	imx_data->clk_ipg = devm_clk_get(&pdev->dev, "ipg");
 	if (IS_ERR(imx_data->clk_ipg)) {
@@ -1238,7 +1234,7 @@ static int sdhci_esdhc_imx_remove(struct platform_device *pdev)
 {
 	struct sdhci_host *host = platform_get_drvdata(pdev);
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct pltfm_imx_data *imx_data = pltfm_host->priv;
+	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
 	int dead = (readl(host->ioaddr + SDHCI_INT_STATUS) == 0xffffffff);
 
 	pm_runtime_get_sync(&pdev->dev);
@@ -1261,7 +1257,7 @@ static int sdhci_esdhc_runtime_suspend(struct device *dev)
 {
 	struct sdhci_host *host = dev_get_drvdata(dev);
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct pltfm_imx_data *imx_data = pltfm_host->priv;
+	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
 	int ret;
 
 	ret = sdhci_runtime_suspend_host(host);
@@ -1279,7 +1275,7 @@ static int sdhci_esdhc_runtime_resume(struct device *dev)
 {
 	struct sdhci_host *host = dev_get_drvdata(dev);
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct pltfm_imx_data *imx_data = pltfm_host->priv;
+	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
 
 	if (!sdhci_sdio_irq_enabled(host)) {
 		clk_prepare_enable(imx_data->clk_per);
-- 
2.7.0.rc3

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

* [PATCH v2 03/12] mmc: sdhci-msm: factorise sdhci_msm_pdata outisde of sdhci_msm_host
  2016-01-06  3:55 ` Jisheng Zhang
  (?)
@ 2016-01-06  3:55   ` Jisheng Zhang
  -1 siblings, 0 replies; 51+ messages in thread
From: Jisheng Zhang @ 2016-01-06  3:55 UTC (permalink / raw)
  To: ulf.hansson, arnd, swarren, lee, eric, michal.simek,
	soren.brinkmann, ludovic.desroches, srinivas.kandagatla,
	maxime.coquelin, patrice.chotard, thierry.reding,
	sebastian.hesselbarth
  Cc: Jisheng Zhang, kernel, linux-mmc, linux-kernel, linux-rpi-kernel,
	linux-tegra, linux-arm-kernel

There's no need to allocate one sdhci_msm_pdata for each sdhci_msm_host.
This patch removes the sdhci_msm_pdata member from sdhci_msm_host and
uses one static global sdhci_msm_pdata for all sdhci msm hosts. It also
marks sdhci_msm_ops as const.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
---
 drivers/mmc/host/sdhci-msm.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
index 4695bee..ffac9b4 100644
--- a/drivers/mmc/host/sdhci-msm.c
+++ b/drivers/mmc/host/sdhci-msm.c
@@ -60,7 +60,6 @@ struct sdhci_msm_host {
 	struct clk *pclk;	/* SDHC peripheral bus clock */
 	struct clk *bus_clk;	/* SDHC bus voter clock */
 	struct mmc_host *mmc;
-	struct sdhci_pltfm_data sdhci_msm_pdata;
 };
 
 /* Platform specific tuning */
@@ -418,7 +417,7 @@ static const struct of_device_id sdhci_msm_dt_match[] = {
 
 MODULE_DEVICE_TABLE(of, sdhci_msm_dt_match);
 
-static struct sdhci_ops sdhci_msm_ops = {
+static const struct sdhci_ops sdhci_msm_ops = {
 	.platform_execute_tuning = sdhci_msm_execute_tuning,
 	.reset = sdhci_reset,
 	.set_clock = sdhci_set_clock,
@@ -426,6 +425,12 @@ static struct sdhci_ops sdhci_msm_ops = {
 	.set_uhs_signaling = sdhci_set_uhs_signaling,
 };
 
+static const struct sdhci_pltfm_data sdhci_msm_pdata = {
+	.quirks = SDHCI_QUIRK_BROKEN_CARD_DETECTION |
+		  SDHCI_QUIRK_SINGLE_POWER_WRITE,
+	.ops = &sdhci_msm_ops,
+};
+
 static int sdhci_msm_probe(struct platform_device *pdev)
 {
 	struct sdhci_host *host;
@@ -441,8 +446,7 @@ static int sdhci_msm_probe(struct platform_device *pdev)
 	if (!msm_host)
 		return -ENOMEM;
 
-	msm_host->sdhci_msm_pdata.ops = &sdhci_msm_ops;
-	host = sdhci_pltfm_init(pdev, &msm_host->sdhci_msm_pdata, 0);
+	host = sdhci_pltfm_init(pdev, &sdhci_msm_pdata, 0);
 	if (IS_ERR(host))
 		return PTR_ERR(host);
 
@@ -522,9 +526,6 @@ static int sdhci_msm_probe(struct platform_device *pdev)
 	/* Set HC_MODE_EN bit in HC_MODE register */
 	writel_relaxed(HC_MODE_EN, (msm_host->core_mem + CORE_HC_MODE));
 
-	host->quirks |= SDHCI_QUIRK_BROKEN_CARD_DETECTION;
-	host->quirks |= SDHCI_QUIRK_SINGLE_POWER_WRITE;
-
 	host_version = readw_relaxed((host->ioaddr + SDHCI_HOST_VERSION));
 	dev_dbg(&pdev->dev, "Host Version: 0x%x Vendor Version 0x%x\n",
 		host_version, ((host_version & SDHCI_VENDOR_VER_MASK) >>
-- 
2.7.0.rc3

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

* [PATCH v2 03/12] mmc: sdhci-msm: factorise sdhci_msm_pdata outisde of sdhci_msm_host
@ 2016-01-06  3:55   ` Jisheng Zhang
  0 siblings, 0 replies; 51+ messages in thread
From: Jisheng Zhang @ 2016-01-06  3:55 UTC (permalink / raw)
  To: ulf.hansson, arnd, swarren, lee, eric, michal.simek,
	soren.brinkmann, ludovic.desroches, srinivas.kandagatla,
	maxime.coquelin, patrice.chotard, thierry.reding,
	sebastian.hesselbarth
  Cc: linux-mmc, linux-rpi-kernel, linux-arm-kernel, linux-kernel,
	kernel, linux-tegra, Jisheng Zhang

There's no need to allocate one sdhci_msm_pdata for each sdhci_msm_host.
This patch removes the sdhci_msm_pdata member from sdhci_msm_host and
uses one static global sdhci_msm_pdata for all sdhci msm hosts. It also
marks sdhci_msm_ops as const.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
---
 drivers/mmc/host/sdhci-msm.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
index 4695bee..ffac9b4 100644
--- a/drivers/mmc/host/sdhci-msm.c
+++ b/drivers/mmc/host/sdhci-msm.c
@@ -60,7 +60,6 @@ struct sdhci_msm_host {
 	struct clk *pclk;	/* SDHC peripheral bus clock */
 	struct clk *bus_clk;	/* SDHC bus voter clock */
 	struct mmc_host *mmc;
-	struct sdhci_pltfm_data sdhci_msm_pdata;
 };
 
 /* Platform specific tuning */
@@ -418,7 +417,7 @@ static const struct of_device_id sdhci_msm_dt_match[] = {
 
 MODULE_DEVICE_TABLE(of, sdhci_msm_dt_match);
 
-static struct sdhci_ops sdhci_msm_ops = {
+static const struct sdhci_ops sdhci_msm_ops = {
 	.platform_execute_tuning = sdhci_msm_execute_tuning,
 	.reset = sdhci_reset,
 	.set_clock = sdhci_set_clock,
@@ -426,6 +425,12 @@ static struct sdhci_ops sdhci_msm_ops = {
 	.set_uhs_signaling = sdhci_set_uhs_signaling,
 };
 
+static const struct sdhci_pltfm_data sdhci_msm_pdata = {
+	.quirks = SDHCI_QUIRK_BROKEN_CARD_DETECTION |
+		  SDHCI_QUIRK_SINGLE_POWER_WRITE,
+	.ops = &sdhci_msm_ops,
+};
+
 static int sdhci_msm_probe(struct platform_device *pdev)
 {
 	struct sdhci_host *host;
@@ -441,8 +446,7 @@ static int sdhci_msm_probe(struct platform_device *pdev)
 	if (!msm_host)
 		return -ENOMEM;
 
-	msm_host->sdhci_msm_pdata.ops = &sdhci_msm_ops;
-	host = sdhci_pltfm_init(pdev, &msm_host->sdhci_msm_pdata, 0);
+	host = sdhci_pltfm_init(pdev, &sdhci_msm_pdata, 0);
 	if (IS_ERR(host))
 		return PTR_ERR(host);
 
@@ -522,9 +526,6 @@ static int sdhci_msm_probe(struct platform_device *pdev)
 	/* Set HC_MODE_EN bit in HC_MODE register */
 	writel_relaxed(HC_MODE_EN, (msm_host->core_mem + CORE_HC_MODE));
 
-	host->quirks |= SDHCI_QUIRK_BROKEN_CARD_DETECTION;
-	host->quirks |= SDHCI_QUIRK_SINGLE_POWER_WRITE;
-
 	host_version = readw_relaxed((host->ioaddr + SDHCI_HOST_VERSION));
 	dev_dbg(&pdev->dev, "Host Version: 0x%x Vendor Version 0x%x\n",
 		host_version, ((host_version & SDHCI_VENDOR_VER_MASK) >>
-- 
2.7.0.rc3


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

* [PATCH v2 03/12] mmc: sdhci-msm: factorise sdhci_msm_pdata outisde of sdhci_msm_host
@ 2016-01-06  3:55   ` Jisheng Zhang
  0 siblings, 0 replies; 51+ messages in thread
From: Jisheng Zhang @ 2016-01-06  3:55 UTC (permalink / raw)
  To: linux-arm-kernel

There's no need to allocate one sdhci_msm_pdata for each sdhci_msm_host.
This patch removes the sdhci_msm_pdata member from sdhci_msm_host and
uses one static global sdhci_msm_pdata for all sdhci msm hosts. It also
marks sdhci_msm_ops as const.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
---
 drivers/mmc/host/sdhci-msm.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
index 4695bee..ffac9b4 100644
--- a/drivers/mmc/host/sdhci-msm.c
+++ b/drivers/mmc/host/sdhci-msm.c
@@ -60,7 +60,6 @@ struct sdhci_msm_host {
 	struct clk *pclk;	/* SDHC peripheral bus clock */
 	struct clk *bus_clk;	/* SDHC bus voter clock */
 	struct mmc_host *mmc;
-	struct sdhci_pltfm_data sdhci_msm_pdata;
 };
 
 /* Platform specific tuning */
@@ -418,7 +417,7 @@ static const struct of_device_id sdhci_msm_dt_match[] = {
 
 MODULE_DEVICE_TABLE(of, sdhci_msm_dt_match);
 
-static struct sdhci_ops sdhci_msm_ops = {
+static const struct sdhci_ops sdhci_msm_ops = {
 	.platform_execute_tuning = sdhci_msm_execute_tuning,
 	.reset = sdhci_reset,
 	.set_clock = sdhci_set_clock,
@@ -426,6 +425,12 @@ static struct sdhci_ops sdhci_msm_ops = {
 	.set_uhs_signaling = sdhci_set_uhs_signaling,
 };
 
+static const struct sdhci_pltfm_data sdhci_msm_pdata = {
+	.quirks = SDHCI_QUIRK_BROKEN_CARD_DETECTION |
+		  SDHCI_QUIRK_SINGLE_POWER_WRITE,
+	.ops = &sdhci_msm_ops,
+};
+
 static int sdhci_msm_probe(struct platform_device *pdev)
 {
 	struct sdhci_host *host;
@@ -441,8 +446,7 @@ static int sdhci_msm_probe(struct platform_device *pdev)
 	if (!msm_host)
 		return -ENOMEM;
 
-	msm_host->sdhci_msm_pdata.ops = &sdhci_msm_ops;
-	host = sdhci_pltfm_init(pdev, &msm_host->sdhci_msm_pdata, 0);
+	host = sdhci_pltfm_init(pdev, &sdhci_msm_pdata, 0);
 	if (IS_ERR(host))
 		return PTR_ERR(host);
 
@@ -522,9 +526,6 @@ static int sdhci_msm_probe(struct platform_device *pdev)
 	/* Set HC_MODE_EN bit in HC_MODE register */
 	writel_relaxed(HC_MODE_EN, (msm_host->core_mem + CORE_HC_MODE));
 
-	host->quirks |= SDHCI_QUIRK_BROKEN_CARD_DETECTION;
-	host->quirks |= SDHCI_QUIRK_SINGLE_POWER_WRITE;
-
 	host_version = readw_relaxed((host->ioaddr + SDHCI_HOST_VERSION));
 	dev_dbg(&pdev->dev, "Host Version: 0x%x Vendor Version 0x%x\n",
 		host_version, ((host_version & SDHCI_VENDOR_VER_MASK) >>
-- 
2.7.0.rc3

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

* [PATCH v2 04/12] mmc: sdhci-msm: use sdhci_pltfm_init for private allocation
  2016-01-06  3:55 ` Jisheng Zhang
  (?)
@ 2016-01-06  3:55   ` Jisheng Zhang
  -1 siblings, 0 replies; 51+ messages in thread
From: Jisheng Zhang @ 2016-01-06  3:55 UTC (permalink / raw)
  To: ulf.hansson, arnd, swarren, lee, eric, michal.simek,
	soren.brinkmann, ludovic.desroches, srinivas.kandagatla,
	maxime.coquelin, patrice.chotard, thierry.reding,
	sebastian.hesselbarth
  Cc: Jisheng Zhang, kernel, linux-mmc, linux-kernel, linux-rpi-kernel,
	linux-tegra, linux-arm-kernel

Commit 0e748234293f ("mmc: sdhci: Add size for caller in init+register")
allows users of sdhci_pltfm to allocate private space in calls to
sdhci_pltfm_init+sdhci_pltfm_register. This patch migrates sdhci-msm
to this allocation.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/mmc/host/sdhci-msm.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
index ffac9b4..548ae58 100644
--- a/drivers/mmc/host/sdhci-msm.c
+++ b/drivers/mmc/host/sdhci-msm.c
@@ -442,16 +442,13 @@ static int sdhci_msm_probe(struct platform_device *pdev)
 	u32 core_version, caps;
 	u8 core_major;
 
-	msm_host = devm_kzalloc(&pdev->dev, sizeof(*msm_host), GFP_KERNEL);
-	if (!msm_host)
-		return -ENOMEM;
-
-	host = sdhci_pltfm_init(pdev, &sdhci_msm_pdata, 0);
+	host = sdhci_pltfm_init(pdev, &sdhci_msm_pdata,
+				sizeof(*msm_host));
 	if (IS_ERR(host))
 		return PTR_ERR(host);
 
 	pltfm_host = sdhci_priv(host);
-	pltfm_host->priv = msm_host;
+	msm_host = sdhci_pltfm_priv(pltfm_host);
 	msm_host->mmc = host->mmc;
 	msm_host->pdev = pdev;
 
@@ -571,7 +568,7 @@ static int sdhci_msm_remove(struct platform_device *pdev)
 {
 	struct sdhci_host *host = platform_get_drvdata(pdev);
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_msm_host *msm_host = pltfm_host->priv;
+	struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host);
 	int dead = (readl_relaxed(host->ioaddr + SDHCI_INT_STATUS) ==
 		    0xffffffff);
 
-- 
2.7.0.rc3

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

* [PATCH v2 04/12] mmc: sdhci-msm: use sdhci_pltfm_init for private allocation
@ 2016-01-06  3:55   ` Jisheng Zhang
  0 siblings, 0 replies; 51+ messages in thread
From: Jisheng Zhang @ 2016-01-06  3:55 UTC (permalink / raw)
  To: ulf.hansson, arnd, swarren, lee, eric, michal.simek,
	soren.brinkmann, ludovic.desroches, srinivas.kandagatla,
	maxime.coquelin, patrice.chotard, thierry.reding,
	sebastian.hesselbarth
  Cc: linux-mmc, linux-rpi-kernel, linux-arm-kernel, linux-kernel,
	kernel, linux-tegra, Jisheng Zhang

Commit 0e748234293f ("mmc: sdhci: Add size for caller in init+register")
allows users of sdhci_pltfm to allocate private space in calls to
sdhci_pltfm_init+sdhci_pltfm_register. This patch migrates sdhci-msm
to this allocation.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/mmc/host/sdhci-msm.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
index ffac9b4..548ae58 100644
--- a/drivers/mmc/host/sdhci-msm.c
+++ b/drivers/mmc/host/sdhci-msm.c
@@ -442,16 +442,13 @@ static int sdhci_msm_probe(struct platform_device *pdev)
 	u32 core_version, caps;
 	u8 core_major;
 
-	msm_host = devm_kzalloc(&pdev->dev, sizeof(*msm_host), GFP_KERNEL);
-	if (!msm_host)
-		return -ENOMEM;
-
-	host = sdhci_pltfm_init(pdev, &sdhci_msm_pdata, 0);
+	host = sdhci_pltfm_init(pdev, &sdhci_msm_pdata,
+				sizeof(*msm_host));
 	if (IS_ERR(host))
 		return PTR_ERR(host);
 
 	pltfm_host = sdhci_priv(host);
-	pltfm_host->priv = msm_host;
+	msm_host = sdhci_pltfm_priv(pltfm_host);
 	msm_host->mmc = host->mmc;
 	msm_host->pdev = pdev;
 
@@ -571,7 +568,7 @@ static int sdhci_msm_remove(struct platform_device *pdev)
 {
 	struct sdhci_host *host = platform_get_drvdata(pdev);
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_msm_host *msm_host = pltfm_host->priv;
+	struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host);
 	int dead = (readl_relaxed(host->ioaddr + SDHCI_INT_STATUS) ==
 		    0xffffffff);
 
-- 
2.7.0.rc3


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

* [PATCH v2 04/12] mmc: sdhci-msm: use sdhci_pltfm_init for private allocation
@ 2016-01-06  3:55   ` Jisheng Zhang
  0 siblings, 0 replies; 51+ messages in thread
From: Jisheng Zhang @ 2016-01-06  3:55 UTC (permalink / raw)
  To: linux-arm-kernel

Commit 0e748234293f ("mmc: sdhci: Add size for caller in init+register")
allows users of sdhci_pltfm to allocate private space in calls to
sdhci_pltfm_init+sdhci_pltfm_register. This patch migrates sdhci-msm
to this allocation.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/mmc/host/sdhci-msm.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
index ffac9b4..548ae58 100644
--- a/drivers/mmc/host/sdhci-msm.c
+++ b/drivers/mmc/host/sdhci-msm.c
@@ -442,16 +442,13 @@ static int sdhci_msm_probe(struct platform_device *pdev)
 	u32 core_version, caps;
 	u8 core_major;
 
-	msm_host = devm_kzalloc(&pdev->dev, sizeof(*msm_host), GFP_KERNEL);
-	if (!msm_host)
-		return -ENOMEM;
-
-	host = sdhci_pltfm_init(pdev, &sdhci_msm_pdata, 0);
+	host = sdhci_pltfm_init(pdev, &sdhci_msm_pdata,
+				sizeof(*msm_host));
 	if (IS_ERR(host))
 		return PTR_ERR(host);
 
 	pltfm_host = sdhci_priv(host);
-	pltfm_host->priv = msm_host;
+	msm_host = sdhci_pltfm_priv(pltfm_host);
 	msm_host->mmc = host->mmc;
 	msm_host->pdev = pdev;
 
@@ -571,7 +568,7 @@ static int sdhci_msm_remove(struct platform_device *pdev)
 {
 	struct sdhci_host *host = platform_get_drvdata(pdev);
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_msm_host *msm_host = pltfm_host->priv;
+	struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host);
 	int dead = (readl_relaxed(host->ioaddr + SDHCI_INT_STATUS) ==
 		    0xffffffff);
 
-- 
2.7.0.rc3

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

* [PATCH v2 05/12] mmc: sdhci-of-arasan: use sdhci_pltfm_init for private allocation
  2016-01-06  3:55 ` Jisheng Zhang
  (?)
@ 2016-01-06  3:55   ` Jisheng Zhang
  -1 siblings, 0 replies; 51+ messages in thread
From: Jisheng Zhang @ 2016-01-06  3:55 UTC (permalink / raw)
  To: ulf.hansson, arnd, swarren, lee, eric, michal.simek,
	soren.brinkmann, ludovic.desroches, srinivas.kandagatla,
	maxime.coquelin, patrice.chotard, thierry.reding,
	sebastian.hesselbarth
  Cc: linux-mmc, linux-rpi-kernel, linux-arm-kernel, linux-kernel,
	kernel, linux-tegra, Jisheng Zhang

Commit 0e748234293f ("mmc: sdhci: Add size for caller in init+register")
allows users of sdhci_pltfm to allocate private space in calls to
sdhci_pltfm_init+sdhci_pltfm_register. This patch migrates the
sdhci-of-arasan driver to this allocation.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/mmc/host/sdhci-of-arasan.c | 25 ++++++++++---------------
 1 file changed, 10 insertions(+), 15 deletions(-)

diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
index 75379cb..53c8d36 100644
--- a/drivers/mmc/host/sdhci-of-arasan.c
+++ b/drivers/mmc/host/sdhci-of-arasan.c
@@ -81,7 +81,7 @@ static int sdhci_arasan_suspend(struct device *dev)
 	struct platform_device *pdev = to_platform_device(dev);
 	struct sdhci_host *host = platform_get_drvdata(pdev);
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_arasan_data *sdhci_arasan = pltfm_host->priv;
+	struct sdhci_arasan_data *sdhci_arasan = sdhci_pltfm_priv(pltfm_host);
 	int ret;
 
 	ret = sdhci_suspend_host(host);
@@ -106,7 +106,7 @@ static int sdhci_arasan_resume(struct device *dev)
 	struct platform_device *pdev = to_platform_device(dev);
 	struct sdhci_host *host = platform_get_drvdata(pdev);
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_arasan_data *sdhci_arasan = pltfm_host->priv;
+	struct sdhci_arasan_data *sdhci_arasan = sdhci_pltfm_priv(pltfm_host);
 	int ret;
 
 	ret = clk_enable(sdhci_arasan->clk_ahb);
@@ -137,10 +137,13 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
 	struct sdhci_pltfm_host *pltfm_host;
 	struct sdhci_arasan_data *sdhci_arasan;
 
-	sdhci_arasan = devm_kzalloc(&pdev->dev, sizeof(*sdhci_arasan),
-			GFP_KERNEL);
-	if (!sdhci_arasan)
-		return -ENOMEM;
+	host = sdhci_pltfm_init(pdev, &sdhci_arasan_pdata,
+				sizeof(*sdhci_arasan));
+	if (IS_ERR(host))
+		return PTR_ERR(host);
+
+	pltfm_host = sdhci_priv(host);
+	sdhci_arasan = sdhci_pltfm_priv(pltfm_host);
 
 	sdhci_arasan->clk_ahb = devm_clk_get(&pdev->dev, "clk_ahb");
 	if (IS_ERR(sdhci_arasan->clk_ahb)) {
@@ -166,20 +169,12 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
 		goto clk_dis_ahb;
 	}
 
-	host = sdhci_pltfm_init(pdev, &sdhci_arasan_pdata, 0);
-	if (IS_ERR(host)) {
-		ret = PTR_ERR(host);
-		goto clk_disable_all;
-	}
-
 	if (of_device_is_compatible(pdev->dev.of_node, "arasan,sdhci-4.9a")) {
 		host->quirks |= SDHCI_QUIRK_NO_HISPD_BIT;
 		host->quirks2 |= SDHCI_QUIRK2_HOST_NO_CMD23;
 	}
 
 	sdhci_get_of_property(pdev);
-	pltfm_host = sdhci_priv(host);
-	pltfm_host->priv = sdhci_arasan;
 	pltfm_host->clk = clk_xin;
 
 	ret = mmc_of_parse(host->mmc);
@@ -208,7 +203,7 @@ static int sdhci_arasan_remove(struct platform_device *pdev)
 {
 	struct sdhci_host *host = platform_get_drvdata(pdev);
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_arasan_data *sdhci_arasan = pltfm_host->priv;
+	struct sdhci_arasan_data *sdhci_arasan = sdhci_pltfm_priv(pltfm_host);
 
 	clk_disable_unprepare(sdhci_arasan->clk_ahb);
 
-- 
2.7.0.rc3

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

* [PATCH v2 05/12] mmc: sdhci-of-arasan: use sdhci_pltfm_init for private allocation
@ 2016-01-06  3:55   ` Jisheng Zhang
  0 siblings, 0 replies; 51+ messages in thread
From: Jisheng Zhang @ 2016-01-06  3:55 UTC (permalink / raw)
  To: ulf.hansson, arnd, swarren, lee, eric, michal.simek,
	soren.brinkmann, ludovic.desroches, srinivas.kandagatla,
	maxime.coquelin, patrice.chotard, thierry.reding,
	sebastian.hesselbarth
  Cc: linux-mmc, linux-rpi-kernel, linux-arm-kernel, linux-kernel,
	kernel, linux-tegra, Jisheng Zhang

Commit 0e748234293f ("mmc: sdhci: Add size for caller in init+register")
allows users of sdhci_pltfm to allocate private space in calls to
sdhci_pltfm_init+sdhci_pltfm_register. This patch migrates the
sdhci-of-arasan driver to this allocation.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/mmc/host/sdhci-of-arasan.c | 25 ++++++++++---------------
 1 file changed, 10 insertions(+), 15 deletions(-)

diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
index 75379cb..53c8d36 100644
--- a/drivers/mmc/host/sdhci-of-arasan.c
+++ b/drivers/mmc/host/sdhci-of-arasan.c
@@ -81,7 +81,7 @@ static int sdhci_arasan_suspend(struct device *dev)
 	struct platform_device *pdev = to_platform_device(dev);
 	struct sdhci_host *host = platform_get_drvdata(pdev);
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_arasan_data *sdhci_arasan = pltfm_host->priv;
+	struct sdhci_arasan_data *sdhci_arasan = sdhci_pltfm_priv(pltfm_host);
 	int ret;
 
 	ret = sdhci_suspend_host(host);
@@ -106,7 +106,7 @@ static int sdhci_arasan_resume(struct device *dev)
 	struct platform_device *pdev = to_platform_device(dev);
 	struct sdhci_host *host = platform_get_drvdata(pdev);
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_arasan_data *sdhci_arasan = pltfm_host->priv;
+	struct sdhci_arasan_data *sdhci_arasan = sdhci_pltfm_priv(pltfm_host);
 	int ret;
 
 	ret = clk_enable(sdhci_arasan->clk_ahb);
@@ -137,10 +137,13 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
 	struct sdhci_pltfm_host *pltfm_host;
 	struct sdhci_arasan_data *sdhci_arasan;
 
-	sdhci_arasan = devm_kzalloc(&pdev->dev, sizeof(*sdhci_arasan),
-			GFP_KERNEL);
-	if (!sdhci_arasan)
-		return -ENOMEM;
+	host = sdhci_pltfm_init(pdev, &sdhci_arasan_pdata,
+				sizeof(*sdhci_arasan));
+	if (IS_ERR(host))
+		return PTR_ERR(host);
+
+	pltfm_host = sdhci_priv(host);
+	sdhci_arasan = sdhci_pltfm_priv(pltfm_host);
 
 	sdhci_arasan->clk_ahb = devm_clk_get(&pdev->dev, "clk_ahb");
 	if (IS_ERR(sdhci_arasan->clk_ahb)) {
@@ -166,20 +169,12 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
 		goto clk_dis_ahb;
 	}
 
-	host = sdhci_pltfm_init(pdev, &sdhci_arasan_pdata, 0);
-	if (IS_ERR(host)) {
-		ret = PTR_ERR(host);
-		goto clk_disable_all;
-	}
-
 	if (of_device_is_compatible(pdev->dev.of_node, "arasan,sdhci-4.9a")) {
 		host->quirks |= SDHCI_QUIRK_NO_HISPD_BIT;
 		host->quirks2 |= SDHCI_QUIRK2_HOST_NO_CMD23;
 	}
 
 	sdhci_get_of_property(pdev);
-	pltfm_host = sdhci_priv(host);
-	pltfm_host->priv = sdhci_arasan;
 	pltfm_host->clk = clk_xin;
 
 	ret = mmc_of_parse(host->mmc);
@@ -208,7 +203,7 @@ static int sdhci_arasan_remove(struct platform_device *pdev)
 {
 	struct sdhci_host *host = platform_get_drvdata(pdev);
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_arasan_data *sdhci_arasan = pltfm_host->priv;
+	struct sdhci_arasan_data *sdhci_arasan = sdhci_pltfm_priv(pltfm_host);
 
 	clk_disable_unprepare(sdhci_arasan->clk_ahb);
 
-- 
2.7.0.rc3


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

* [PATCH v2 05/12] mmc: sdhci-of-arasan: use sdhci_pltfm_init for private allocation
@ 2016-01-06  3:55   ` Jisheng Zhang
  0 siblings, 0 replies; 51+ messages in thread
From: Jisheng Zhang @ 2016-01-06  3:55 UTC (permalink / raw)
  To: linux-arm-kernel

Commit 0e748234293f ("mmc: sdhci: Add size for caller in init+register")
allows users of sdhci_pltfm to allocate private space in calls to
sdhci_pltfm_init+sdhci_pltfm_register. This patch migrates the
sdhci-of-arasan driver to this allocation.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/mmc/host/sdhci-of-arasan.c | 25 ++++++++++---------------
 1 file changed, 10 insertions(+), 15 deletions(-)

diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
index 75379cb..53c8d36 100644
--- a/drivers/mmc/host/sdhci-of-arasan.c
+++ b/drivers/mmc/host/sdhci-of-arasan.c
@@ -81,7 +81,7 @@ static int sdhci_arasan_suspend(struct device *dev)
 	struct platform_device *pdev = to_platform_device(dev);
 	struct sdhci_host *host = platform_get_drvdata(pdev);
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_arasan_data *sdhci_arasan = pltfm_host->priv;
+	struct sdhci_arasan_data *sdhci_arasan = sdhci_pltfm_priv(pltfm_host);
 	int ret;
 
 	ret = sdhci_suspend_host(host);
@@ -106,7 +106,7 @@ static int sdhci_arasan_resume(struct device *dev)
 	struct platform_device *pdev = to_platform_device(dev);
 	struct sdhci_host *host = platform_get_drvdata(pdev);
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_arasan_data *sdhci_arasan = pltfm_host->priv;
+	struct sdhci_arasan_data *sdhci_arasan = sdhci_pltfm_priv(pltfm_host);
 	int ret;
 
 	ret = clk_enable(sdhci_arasan->clk_ahb);
@@ -137,10 +137,13 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
 	struct sdhci_pltfm_host *pltfm_host;
 	struct sdhci_arasan_data *sdhci_arasan;
 
-	sdhci_arasan = devm_kzalloc(&pdev->dev, sizeof(*sdhci_arasan),
-			GFP_KERNEL);
-	if (!sdhci_arasan)
-		return -ENOMEM;
+	host = sdhci_pltfm_init(pdev, &sdhci_arasan_pdata,
+				sizeof(*sdhci_arasan));
+	if (IS_ERR(host))
+		return PTR_ERR(host);
+
+	pltfm_host = sdhci_priv(host);
+	sdhci_arasan = sdhci_pltfm_priv(pltfm_host);
 
 	sdhci_arasan->clk_ahb = devm_clk_get(&pdev->dev, "clk_ahb");
 	if (IS_ERR(sdhci_arasan->clk_ahb)) {
@@ -166,20 +169,12 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
 		goto clk_dis_ahb;
 	}
 
-	host = sdhci_pltfm_init(pdev, &sdhci_arasan_pdata, 0);
-	if (IS_ERR(host)) {
-		ret = PTR_ERR(host);
-		goto clk_disable_all;
-	}
-
 	if (of_device_is_compatible(pdev->dev.of_node, "arasan,sdhci-4.9a")) {
 		host->quirks |= SDHCI_QUIRK_NO_HISPD_BIT;
 		host->quirks2 |= SDHCI_QUIRK2_HOST_NO_CMD23;
 	}
 
 	sdhci_get_of_property(pdev);
-	pltfm_host = sdhci_priv(host);
-	pltfm_host->priv = sdhci_arasan;
 	pltfm_host->clk = clk_xin;
 
 	ret = mmc_of_parse(host->mmc);
@@ -208,7 +203,7 @@ static int sdhci_arasan_remove(struct platform_device *pdev)
 {
 	struct sdhci_host *host = platform_get_drvdata(pdev);
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_arasan_data *sdhci_arasan = pltfm_host->priv;
+	struct sdhci_arasan_data *sdhci_arasan = sdhci_pltfm_priv(pltfm_host);
 
 	clk_disable_unprepare(sdhci_arasan->clk_ahb);
 
-- 
2.7.0.rc3

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

* [PATCH v2 06/12] mmc: sdhci-of-at91: use sdhci_pltfm_init for private allocation
  2016-01-06  3:55 ` Jisheng Zhang
  (?)
@ 2016-01-06  3:55   ` Jisheng Zhang
  -1 siblings, 0 replies; 51+ messages in thread
From: Jisheng Zhang @ 2016-01-06  3:55 UTC (permalink / raw)
  To: ulf.hansson, arnd, swarren, lee, eric, michal.simek,
	soren.brinkmann, ludovic.desroches, srinivas.kandagatla,
	maxime.coquelin, patrice.chotard, thierry.reding,
	sebastian.hesselbarth
  Cc: linux-mmc, linux-rpi-kernel, linux-arm-kernel, linux-kernel,
	kernel, linux-tegra, Jisheng Zhang

Commit 0e748234293f ("mmc: sdhci: Add size for caller in init+register")
allows users of sdhci_pltfm to allocate private space in calls to
sdhci_pltfm_init+sdhci_pltfm_register. This patch migrates the
sdhci-of-at91 driver to this allocation.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/mmc/host/sdhci-of-at91.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
index 06d0b50..765eb09 100644
--- a/drivers/mmc/host/sdhci-of-at91.c
+++ b/drivers/mmc/host/sdhci-of-at91.c
@@ -68,11 +68,13 @@ static int sdhci_at91_probe(struct platform_device *pdev)
 		return -EINVAL;
 	soc_data = match->data;
 
-	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
-	if (!priv) {
-		dev_err(&pdev->dev, "unable to allocate private data\n");
-		return -ENOMEM;
-	}
+	host = sdhci_pltfm_init(pdev, soc_data,
+				sizeof(*priv));
+	if (IS_ERR(host))
+		return PTR_ERR(host);
+
+	pltfm_host = sdhci_priv(host);
+	priv = sdhci_pltfm_priv(pltfm_host);
 
 	priv->mainck = devm_clk_get(&pdev->dev, "baseclk");
 	if (IS_ERR(priv->mainck)) {
@@ -92,10 +94,6 @@ static int sdhci_at91_probe(struct platform_device *pdev)
 		return PTR_ERR(priv->gck);
 	}
 
-	host = sdhci_pltfm_init(pdev, soc_data, 0);
-	if (IS_ERR(host))
-		return PTR_ERR(host);
-
 	/*
 	 * The mult clock is provided by as a generated clock by the PMC
 	 * controller. In order to set the rate of gck, we have to get the
@@ -135,9 +133,6 @@ static int sdhci_at91_probe(struct platform_device *pdev)
 	clk_prepare_enable(priv->mainck);
 	clk_prepare_enable(priv->gck);
 
-	pltfm_host = sdhci_priv(host);
-	pltfm_host->priv = priv;
-
 	ret = mmc_of_parse(host->mmc);
 	if (ret)
 		goto clocks_disable_unprepare;
@@ -163,7 +158,7 @@ static int sdhci_at91_remove(struct platform_device *pdev)
 {
 	struct sdhci_host	*host = platform_get_drvdata(pdev);
 	struct sdhci_pltfm_host	*pltfm_host = sdhci_priv(host);
-	struct sdhci_at91_priv	*priv = pltfm_host->priv;
+	struct sdhci_at91_priv	*priv = sdhci_pltfm_priv(pltfm_host);
 
 	sdhci_pltfm_unregister(pdev);
 
-- 
2.7.0.rc3

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

* [PATCH v2 06/12] mmc: sdhci-of-at91: use sdhci_pltfm_init for private allocation
@ 2016-01-06  3:55   ` Jisheng Zhang
  0 siblings, 0 replies; 51+ messages in thread
From: Jisheng Zhang @ 2016-01-06  3:55 UTC (permalink / raw)
  To: ulf.hansson, arnd, swarren, lee, eric, michal.simek,
	soren.brinkmann, ludovic.desroches, srinivas.kandagatla,
	maxime.coquelin, patrice.chotard, thierry.reding,
	sebastian.hesselbarth
  Cc: linux-mmc, linux-rpi-kernel, linux-arm-kernel, linux-kernel,
	kernel, linux-tegra, Jisheng Zhang

Commit 0e748234293f ("mmc: sdhci: Add size for caller in init+register")
allows users of sdhci_pltfm to allocate private space in calls to
sdhci_pltfm_init+sdhci_pltfm_register. This patch migrates the
sdhci-of-at91 driver to this allocation.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/mmc/host/sdhci-of-at91.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
index 06d0b50..765eb09 100644
--- a/drivers/mmc/host/sdhci-of-at91.c
+++ b/drivers/mmc/host/sdhci-of-at91.c
@@ -68,11 +68,13 @@ static int sdhci_at91_probe(struct platform_device *pdev)
 		return -EINVAL;
 	soc_data = match->data;
 
-	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
-	if (!priv) {
-		dev_err(&pdev->dev, "unable to allocate private data\n");
-		return -ENOMEM;
-	}
+	host = sdhci_pltfm_init(pdev, soc_data,
+				sizeof(*priv));
+	if (IS_ERR(host))
+		return PTR_ERR(host);
+
+	pltfm_host = sdhci_priv(host);
+	priv = sdhci_pltfm_priv(pltfm_host);
 
 	priv->mainck = devm_clk_get(&pdev->dev, "baseclk");
 	if (IS_ERR(priv->mainck)) {
@@ -92,10 +94,6 @@ static int sdhci_at91_probe(struct platform_device *pdev)
 		return PTR_ERR(priv->gck);
 	}
 
-	host = sdhci_pltfm_init(pdev, soc_data, 0);
-	if (IS_ERR(host))
-		return PTR_ERR(host);
-
 	/*
 	 * The mult clock is provided by as a generated clock by the PMC
 	 * controller. In order to set the rate of gck, we have to get the
@@ -135,9 +133,6 @@ static int sdhci_at91_probe(struct platform_device *pdev)
 	clk_prepare_enable(priv->mainck);
 	clk_prepare_enable(priv->gck);
 
-	pltfm_host = sdhci_priv(host);
-	pltfm_host->priv = priv;
-
 	ret = mmc_of_parse(host->mmc);
 	if (ret)
 		goto clocks_disable_unprepare;
@@ -163,7 +158,7 @@ static int sdhci_at91_remove(struct platform_device *pdev)
 {
 	struct sdhci_host	*host = platform_get_drvdata(pdev);
 	struct sdhci_pltfm_host	*pltfm_host = sdhci_priv(host);
-	struct sdhci_at91_priv	*priv = pltfm_host->priv;
+	struct sdhci_at91_priv	*priv = sdhci_pltfm_priv(pltfm_host);
 
 	sdhci_pltfm_unregister(pdev);
 
-- 
2.7.0.rc3


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

* [PATCH v2 06/12] mmc: sdhci-of-at91: use sdhci_pltfm_init for private allocation
@ 2016-01-06  3:55   ` Jisheng Zhang
  0 siblings, 0 replies; 51+ messages in thread
From: Jisheng Zhang @ 2016-01-06  3:55 UTC (permalink / raw)
  To: linux-arm-kernel

Commit 0e748234293f ("mmc: sdhci: Add size for caller in init+register")
allows users of sdhci_pltfm to allocate private space in calls to
sdhci_pltfm_init+sdhci_pltfm_register. This patch migrates the
sdhci-of-at91 driver to this allocation.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/mmc/host/sdhci-of-at91.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
index 06d0b50..765eb09 100644
--- a/drivers/mmc/host/sdhci-of-at91.c
+++ b/drivers/mmc/host/sdhci-of-at91.c
@@ -68,11 +68,13 @@ static int sdhci_at91_probe(struct platform_device *pdev)
 		return -EINVAL;
 	soc_data = match->data;
 
-	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
-	if (!priv) {
-		dev_err(&pdev->dev, "unable to allocate private data\n");
-		return -ENOMEM;
-	}
+	host = sdhci_pltfm_init(pdev, soc_data,
+				sizeof(*priv));
+	if (IS_ERR(host))
+		return PTR_ERR(host);
+
+	pltfm_host = sdhci_priv(host);
+	priv = sdhci_pltfm_priv(pltfm_host);
 
 	priv->mainck = devm_clk_get(&pdev->dev, "baseclk");
 	if (IS_ERR(priv->mainck)) {
@@ -92,10 +94,6 @@ static int sdhci_at91_probe(struct platform_device *pdev)
 		return PTR_ERR(priv->gck);
 	}
 
-	host = sdhci_pltfm_init(pdev, soc_data, 0);
-	if (IS_ERR(host))
-		return PTR_ERR(host);
-
 	/*
 	 * The mult clock is provided by as a generated clock by the PMC
 	 * controller. In order to set the rate of gck, we have to get the
@@ -135,9 +133,6 @@ static int sdhci_at91_probe(struct platform_device *pdev)
 	clk_prepare_enable(priv->mainck);
 	clk_prepare_enable(priv->gck);
 
-	pltfm_host = sdhci_priv(host);
-	pltfm_host->priv = priv;
-
 	ret = mmc_of_parse(host->mmc);
 	if (ret)
 		goto clocks_disable_unprepare;
@@ -163,7 +158,7 @@ static int sdhci_at91_remove(struct platform_device *pdev)
 {
 	struct sdhci_host	*host = platform_get_drvdata(pdev);
 	struct sdhci_pltfm_host	*pltfm_host = sdhci_priv(host);
-	struct sdhci_at91_priv	*priv = pltfm_host->priv;
+	struct sdhci_at91_priv	*priv = sdhci_pltfm_priv(pltfm_host);
 
 	sdhci_pltfm_unregister(pdev);
 
-- 
2.7.0.rc3

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

* [PATCH v2 07/12] mmc: sdhci-of-esdhc: use sdhci_pltfm_init for private allocation
  2016-01-06  3:55 ` Jisheng Zhang
  (?)
@ 2016-01-06  3:56     ` Jisheng Zhang
  -1 siblings, 0 replies; 51+ messages in thread
From: Jisheng Zhang @ 2016-01-06  3:56 UTC (permalink / raw)
  To: ulf.hansson-QSEj5FYQhm4dnm+yROfE0A, arnd-r2nGTMty4D4,
	swarren-3lzwWm7+Weoh9ZMKESR00Q, lee-DgEjT+Ai2ygdnm+yROfE0A,
	eric-WhKQ6XTQaPysTnJN9+BGXg, michal.simek-gjFFaj9aHVfQT0dZR+AlfA,
	soren.brinkmann-gjFFaj9aHVfQT0dZR+AlfA,
	ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w,
	srinivas.kandagatla-Re5JQEeQqe8AvxtiuMwx3w,
	maxime.coquelin-qxv4g6HH51o, patrice.chotard-qxv4g6HH51o,
	thierry.reding-Re5JQEeQqe8AvxtiuMwx3w,
	sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w
  Cc: linux-mmc-u79uwXL29TY76Z2rM5mHXA,
	linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	kernel-F5mvAk5X5gdBDgjK7y7TUQ,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA, Jisheng Zhang

Commit 0e748234293f ("mmc: sdhci: Add size for caller in init+register")
allows users of sdhci_pltfm to allocate private space in calls to
sdhci_pltfm_init+sdhci_pltfm_register. This patch migrates the
sdhci-of-esdhc driver to this allocation.

Signed-off-by: Jisheng Zhang <jszhang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
Acked-by: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
---
 drivers/mmc/host/sdhci-of-esdhc.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
index 90e94a0..2fb8314 100644
--- a/drivers/mmc/host/sdhci-of-esdhc.c
+++ b/drivers/mmc/host/sdhci-of-esdhc.c
@@ -49,7 +49,7 @@ static u32 esdhc_readl_fixup(struct sdhci_host *host,
 				     int spec_reg, u32 value)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_esdhc *esdhc = pltfm_host->priv;
+	struct sdhci_esdhc *esdhc = sdhci_pltfm_priv(pltfm_host);
 	u32 ret;
 
 	/*
@@ -354,7 +354,7 @@ static void esdhc_le_writeb(struct sdhci_host *host, u8 val, int reg)
 static void esdhc_of_adma_workaround(struct sdhci_host *host, u32 intmask)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_esdhc *esdhc = pltfm_host->priv;
+	struct sdhci_esdhc *esdhc = sdhci_pltfm_priv(pltfm_host);
 	bool applicable;
 	dma_addr_t dmastart;
 	dma_addr_t dmanow;
@@ -404,7 +404,7 @@ static unsigned int esdhc_of_get_min_clock(struct sdhci_host *host)
 static void esdhc_of_set_clock(struct sdhci_host *host, unsigned int clock)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_esdhc *esdhc = pltfm_host->priv;
+	struct sdhci_esdhc *esdhc = sdhci_pltfm_priv(pltfm_host);
 	int pre_div = 1;
 	int div = 1;
 	u32 temp;
@@ -569,15 +569,12 @@ static void esdhc_init(struct platform_device *pdev, struct sdhci_host *host)
 	u16 host_ver;
 
 	pltfm_host = sdhci_priv(host);
-	esdhc = devm_kzalloc(&pdev->dev, sizeof(struct sdhci_esdhc),
-			     GFP_KERNEL);
+	esdhc = sdhci_pltfm_priv(pltfm_host);
 
 	host_ver = sdhci_readw(host, SDHCI_HOST_VERSION);
 	esdhc->vendor_ver = (host_ver & SDHCI_VENDOR_VER_MASK) >>
 			     SDHCI_VENDOR_VER_SHIFT;
 	esdhc->spec_ver = host_ver & SDHCI_SPEC_VER_MASK;
-
-	pltfm_host->priv = esdhc;
 }
 
 static int sdhci_esdhc_probe(struct platform_device *pdev)
@@ -589,9 +586,11 @@ static int sdhci_esdhc_probe(struct platform_device *pdev)
 	np = pdev->dev.of_node;
 
 	if (of_get_property(np, "little-endian", NULL))
-		host = sdhci_pltfm_init(pdev, &sdhci_esdhc_le_pdata, 0);
+		host = sdhci_pltfm_init(pdev, &sdhci_esdhc_le_pdata,
+					sizeof(struct sdhci_esdhc));
 	else
-		host = sdhci_pltfm_init(pdev, &sdhci_esdhc_be_pdata, 0);
+		host = sdhci_pltfm_init(pdev, &sdhci_esdhc_be_pdata,
+					sizeof(struct sdhci_esdhc));
 
 	if (IS_ERR(host))
 		return PTR_ERR(host);
-- 
2.7.0.rc3

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

* [PATCH v2 07/12] mmc: sdhci-of-esdhc: use sdhci_pltfm_init for private allocation
@ 2016-01-06  3:56     ` Jisheng Zhang
  0 siblings, 0 replies; 51+ messages in thread
From: Jisheng Zhang @ 2016-01-06  3:56 UTC (permalink / raw)
  To: ulf.hansson, arnd, swarren, lee, eric, michal.simek,
	soren.brinkmann, ludovic.desroches, srinivas.kandagatla,
	maxime.coquelin, patrice.chotard, thierry.reding,
	sebastian.hesselbarth
  Cc: linux-mmc, linux-rpi-kernel, linux-arm-kernel, linux-kernel,
	kernel, linux-tegra, Jisheng Zhang

Commit 0e748234293f ("mmc: sdhci: Add size for caller in init+register")
allows users of sdhci_pltfm to allocate private space in calls to
sdhci_pltfm_init+sdhci_pltfm_register. This patch migrates the
sdhci-of-esdhc driver to this allocation.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/mmc/host/sdhci-of-esdhc.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
index 90e94a0..2fb8314 100644
--- a/drivers/mmc/host/sdhci-of-esdhc.c
+++ b/drivers/mmc/host/sdhci-of-esdhc.c
@@ -49,7 +49,7 @@ static u32 esdhc_readl_fixup(struct sdhci_host *host,
 				     int spec_reg, u32 value)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_esdhc *esdhc = pltfm_host->priv;
+	struct sdhci_esdhc *esdhc = sdhci_pltfm_priv(pltfm_host);
 	u32 ret;
 
 	/*
@@ -354,7 +354,7 @@ static void esdhc_le_writeb(struct sdhci_host *host, u8 val, int reg)
 static void esdhc_of_adma_workaround(struct sdhci_host *host, u32 intmask)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_esdhc *esdhc = pltfm_host->priv;
+	struct sdhci_esdhc *esdhc = sdhci_pltfm_priv(pltfm_host);
 	bool applicable;
 	dma_addr_t dmastart;
 	dma_addr_t dmanow;
@@ -404,7 +404,7 @@ static unsigned int esdhc_of_get_min_clock(struct sdhci_host *host)
 static void esdhc_of_set_clock(struct sdhci_host *host, unsigned int clock)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_esdhc *esdhc = pltfm_host->priv;
+	struct sdhci_esdhc *esdhc = sdhci_pltfm_priv(pltfm_host);
 	int pre_div = 1;
 	int div = 1;
 	u32 temp;
@@ -569,15 +569,12 @@ static void esdhc_init(struct platform_device *pdev, struct sdhci_host *host)
 	u16 host_ver;
 
 	pltfm_host = sdhci_priv(host);
-	esdhc = devm_kzalloc(&pdev->dev, sizeof(struct sdhci_esdhc),
-			     GFP_KERNEL);
+	esdhc = sdhci_pltfm_priv(pltfm_host);
 
 	host_ver = sdhci_readw(host, SDHCI_HOST_VERSION);
 	esdhc->vendor_ver = (host_ver & SDHCI_VENDOR_VER_MASK) >>
 			     SDHCI_VENDOR_VER_SHIFT;
 	esdhc->spec_ver = host_ver & SDHCI_SPEC_VER_MASK;
-
-	pltfm_host->priv = esdhc;
 }
 
 static int sdhci_esdhc_probe(struct platform_device *pdev)
@@ -589,9 +586,11 @@ static int sdhci_esdhc_probe(struct platform_device *pdev)
 	np = pdev->dev.of_node;
 
 	if (of_get_property(np, "little-endian", NULL))
-		host = sdhci_pltfm_init(pdev, &sdhci_esdhc_le_pdata, 0);
+		host = sdhci_pltfm_init(pdev, &sdhci_esdhc_le_pdata,
+					sizeof(struct sdhci_esdhc));
 	else
-		host = sdhci_pltfm_init(pdev, &sdhci_esdhc_be_pdata, 0);
+		host = sdhci_pltfm_init(pdev, &sdhci_esdhc_be_pdata,
+					sizeof(struct sdhci_esdhc));
 
 	if (IS_ERR(host))
 		return PTR_ERR(host);
-- 
2.7.0.rc3


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

* [PATCH v2 07/12] mmc: sdhci-of-esdhc: use sdhci_pltfm_init for private allocation
@ 2016-01-06  3:56     ` Jisheng Zhang
  0 siblings, 0 replies; 51+ messages in thread
From: Jisheng Zhang @ 2016-01-06  3:56 UTC (permalink / raw)
  To: linux-arm-kernel

Commit 0e748234293f ("mmc: sdhci: Add size for caller in init+register")
allows users of sdhci_pltfm to allocate private space in calls to
sdhci_pltfm_init+sdhci_pltfm_register. This patch migrates the
sdhci-of-esdhc driver to this allocation.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/mmc/host/sdhci-of-esdhc.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
index 90e94a0..2fb8314 100644
--- a/drivers/mmc/host/sdhci-of-esdhc.c
+++ b/drivers/mmc/host/sdhci-of-esdhc.c
@@ -49,7 +49,7 @@ static u32 esdhc_readl_fixup(struct sdhci_host *host,
 				     int spec_reg, u32 value)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_esdhc *esdhc = pltfm_host->priv;
+	struct sdhci_esdhc *esdhc = sdhci_pltfm_priv(pltfm_host);
 	u32 ret;
 
 	/*
@@ -354,7 +354,7 @@ static void esdhc_le_writeb(struct sdhci_host *host, u8 val, int reg)
 static void esdhc_of_adma_workaround(struct sdhci_host *host, u32 intmask)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_esdhc *esdhc = pltfm_host->priv;
+	struct sdhci_esdhc *esdhc = sdhci_pltfm_priv(pltfm_host);
 	bool applicable;
 	dma_addr_t dmastart;
 	dma_addr_t dmanow;
@@ -404,7 +404,7 @@ static unsigned int esdhc_of_get_min_clock(struct sdhci_host *host)
 static void esdhc_of_set_clock(struct sdhci_host *host, unsigned int clock)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_esdhc *esdhc = pltfm_host->priv;
+	struct sdhci_esdhc *esdhc = sdhci_pltfm_priv(pltfm_host);
 	int pre_div = 1;
 	int div = 1;
 	u32 temp;
@@ -569,15 +569,12 @@ static void esdhc_init(struct platform_device *pdev, struct sdhci_host *host)
 	u16 host_ver;
 
 	pltfm_host = sdhci_priv(host);
-	esdhc = devm_kzalloc(&pdev->dev, sizeof(struct sdhci_esdhc),
-			     GFP_KERNEL);
+	esdhc = sdhci_pltfm_priv(pltfm_host);
 
 	host_ver = sdhci_readw(host, SDHCI_HOST_VERSION);
 	esdhc->vendor_ver = (host_ver & SDHCI_VENDOR_VER_MASK) >>
 			     SDHCI_VENDOR_VER_SHIFT;
 	esdhc->spec_ver = host_ver & SDHCI_SPEC_VER_MASK;
-
-	pltfm_host->priv = esdhc;
 }
 
 static int sdhci_esdhc_probe(struct platform_device *pdev)
@@ -589,9 +586,11 @@ static int sdhci_esdhc_probe(struct platform_device *pdev)
 	np = pdev->dev.of_node;
 
 	if (of_get_property(np, "little-endian", NULL))
-		host = sdhci_pltfm_init(pdev, &sdhci_esdhc_le_pdata, 0);
+		host = sdhci_pltfm_init(pdev, &sdhci_esdhc_le_pdata,
+					sizeof(struct sdhci_esdhc));
 	else
-		host = sdhci_pltfm_init(pdev, &sdhci_esdhc_be_pdata, 0);
+		host = sdhci_pltfm_init(pdev, &sdhci_esdhc_be_pdata,
+					sizeof(struct sdhci_esdhc));
 
 	if (IS_ERR(host))
 		return PTR_ERR(host);
-- 
2.7.0.rc3

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

* [PATCH v2 08/12] mmc: sdhci-pxav3: use sdhci_pltfm_init for private allocation
  2016-01-06  3:55 ` Jisheng Zhang
  (?)
@ 2016-01-06  3:56   ` Jisheng Zhang
  -1 siblings, 0 replies; 51+ messages in thread
From: Jisheng Zhang @ 2016-01-06  3:56 UTC (permalink / raw)
  To: ulf.hansson, arnd, swarren, lee, eric, michal.simek,
	soren.brinkmann, ludovic.desroches, srinivas.kandagatla,
	maxime.coquelin, patrice.chotard, thierry.reding,
	sebastian.hesselbarth
  Cc: linux-mmc, linux-rpi-kernel, linux-arm-kernel, linux-kernel,
	kernel, linux-tegra, Jisheng Zhang

Commit 0e748234293f ("mmc: sdhci: Add size for caller in init+register")
allows users of sdhci_pltfm to allocate private space in calls to
sdhci_pltfm_init+sdhci_pltfm_register. This patch migrates sdhci-pxav3
to this allocation.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/mmc/host/sdhci-pxav3.c | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c
index f5edf9d..3d6df57 100644
--- a/drivers/mmc/host/sdhci-pxav3.c
+++ b/drivers/mmc/host/sdhci-pxav3.c
@@ -132,7 +132,7 @@ static int armada_38x_quirks(struct platform_device *pdev,
 {
 	struct device_node *np = pdev->dev.of_node;
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_pxa *pxa = pltfm_host->priv;
+	struct sdhci_pxa *pxa = sdhci_pltfm_priv(pltfm_host);
 	struct resource *res;
 
 	host->quirks &= ~SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN;
@@ -201,7 +201,7 @@ static void pxav3_reset(struct sdhci_host *host, u8 mask)
 static void pxav3_gen_init_74_clocks(struct sdhci_host *host, u8 power_mode)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_pxa *pxa = pltfm_host->priv;
+	struct sdhci_pxa *pxa = sdhci_pltfm_priv(pltfm_host);
 	u16 tmp;
 	int count;
 
@@ -250,7 +250,7 @@ static void pxav3_gen_init_74_clocks(struct sdhci_host *host, u8 power_mode)
 static void pxav3_set_uhs_signaling(struct sdhci_host *host, unsigned int uhs)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_pxa *pxa = pltfm_host->priv;
+	struct sdhci_pxa *pxa = sdhci_pltfm_priv(pltfm_host);
 	u16 ctrl_2;
 
 	/*
@@ -370,16 +370,13 @@ static int sdhci_pxav3_probe(struct platform_device *pdev)
 	const struct of_device_id *match;
 	int ret;
 
-	pxa = devm_kzalloc(&pdev->dev, sizeof(struct sdhci_pxa), GFP_KERNEL);
-	if (!pxa)
-		return -ENOMEM;
-
-	host = sdhci_pltfm_init(pdev, &sdhci_pxav3_pdata, 0);
+	host = sdhci_pltfm_init(pdev, &sdhci_pxav3_pdata,
+				sizeof(*pxa));
 	if (IS_ERR(host))
 		return PTR_ERR(host);
 
 	pltfm_host = sdhci_priv(host);
-	pltfm_host->priv = pxa;
+	pxa = sdhci_pltfm_priv(pltfm_host);
 
 	pxa->clk_io = devm_clk_get(dev, "io");
 	if (IS_ERR(pxa->clk_io))
@@ -486,7 +483,7 @@ static int sdhci_pxav3_remove(struct platform_device *pdev)
 {
 	struct sdhci_host *host = platform_get_drvdata(pdev);
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_pxa *pxa = pltfm_host->priv;
+	struct sdhci_pxa *pxa = sdhci_pltfm_priv(pltfm_host);
 
 	pm_runtime_get_sync(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
@@ -535,7 +532,7 @@ static int sdhci_pxav3_runtime_suspend(struct device *dev)
 {
 	struct sdhci_host *host = dev_get_drvdata(dev);
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_pxa *pxa = pltfm_host->priv;
+	struct sdhci_pxa *pxa = sdhci_pltfm_priv(pltfm_host);
 	int ret;
 
 	ret = sdhci_runtime_suspend_host(host);
@@ -553,7 +550,7 @@ static int sdhci_pxav3_runtime_resume(struct device *dev)
 {
 	struct sdhci_host *host = dev_get_drvdata(dev);
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_pxa *pxa = pltfm_host->priv;
+	struct sdhci_pxa *pxa = sdhci_pltfm_priv(pltfm_host);
 
 	clk_prepare_enable(pxa->clk_io);
 	if (!IS_ERR(pxa->clk_core))
-- 
2.7.0.rc3

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

* [PATCH v2 08/12] mmc: sdhci-pxav3: use sdhci_pltfm_init for private allocation
@ 2016-01-06  3:56   ` Jisheng Zhang
  0 siblings, 0 replies; 51+ messages in thread
From: Jisheng Zhang @ 2016-01-06  3:56 UTC (permalink / raw)
  To: ulf.hansson, arnd, swarren, lee, eric, michal.simek,
	soren.brinkmann, ludovic.desroches, srinivas.kandagatla,
	maxime.coquelin, patrice.chotard, thierry.reding,
	sebastian.hesselbarth
  Cc: linux-mmc, linux-rpi-kernel, linux-arm-kernel, linux-kernel,
	kernel, linux-tegra, Jisheng Zhang

Commit 0e748234293f ("mmc: sdhci: Add size for caller in init+register")
allows users of sdhci_pltfm to allocate private space in calls to
sdhci_pltfm_init+sdhci_pltfm_register. This patch migrates sdhci-pxav3
to this allocation.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/mmc/host/sdhci-pxav3.c | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c
index f5edf9d..3d6df57 100644
--- a/drivers/mmc/host/sdhci-pxav3.c
+++ b/drivers/mmc/host/sdhci-pxav3.c
@@ -132,7 +132,7 @@ static int armada_38x_quirks(struct platform_device *pdev,
 {
 	struct device_node *np = pdev->dev.of_node;
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_pxa *pxa = pltfm_host->priv;
+	struct sdhci_pxa *pxa = sdhci_pltfm_priv(pltfm_host);
 	struct resource *res;
 
 	host->quirks &= ~SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN;
@@ -201,7 +201,7 @@ static void pxav3_reset(struct sdhci_host *host, u8 mask)
 static void pxav3_gen_init_74_clocks(struct sdhci_host *host, u8 power_mode)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_pxa *pxa = pltfm_host->priv;
+	struct sdhci_pxa *pxa = sdhci_pltfm_priv(pltfm_host);
 	u16 tmp;
 	int count;
 
@@ -250,7 +250,7 @@ static void pxav3_gen_init_74_clocks(struct sdhci_host *host, u8 power_mode)
 static void pxav3_set_uhs_signaling(struct sdhci_host *host, unsigned int uhs)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_pxa *pxa = pltfm_host->priv;
+	struct sdhci_pxa *pxa = sdhci_pltfm_priv(pltfm_host);
 	u16 ctrl_2;
 
 	/*
@@ -370,16 +370,13 @@ static int sdhci_pxav3_probe(struct platform_device *pdev)
 	const struct of_device_id *match;
 	int ret;
 
-	pxa = devm_kzalloc(&pdev->dev, sizeof(struct sdhci_pxa), GFP_KERNEL);
-	if (!pxa)
-		return -ENOMEM;
-
-	host = sdhci_pltfm_init(pdev, &sdhci_pxav3_pdata, 0);
+	host = sdhci_pltfm_init(pdev, &sdhci_pxav3_pdata,
+				sizeof(*pxa));
 	if (IS_ERR(host))
 		return PTR_ERR(host);
 
 	pltfm_host = sdhci_priv(host);
-	pltfm_host->priv = pxa;
+	pxa = sdhci_pltfm_priv(pltfm_host);
 
 	pxa->clk_io = devm_clk_get(dev, "io");
 	if (IS_ERR(pxa->clk_io))
@@ -486,7 +483,7 @@ static int sdhci_pxav3_remove(struct platform_device *pdev)
 {
 	struct sdhci_host *host = platform_get_drvdata(pdev);
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_pxa *pxa = pltfm_host->priv;
+	struct sdhci_pxa *pxa = sdhci_pltfm_priv(pltfm_host);
 
 	pm_runtime_get_sync(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
@@ -535,7 +532,7 @@ static int sdhci_pxav3_runtime_suspend(struct device *dev)
 {
 	struct sdhci_host *host = dev_get_drvdata(dev);
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_pxa *pxa = pltfm_host->priv;
+	struct sdhci_pxa *pxa = sdhci_pltfm_priv(pltfm_host);
 	int ret;
 
 	ret = sdhci_runtime_suspend_host(host);
@@ -553,7 +550,7 @@ static int sdhci_pxav3_runtime_resume(struct device *dev)
 {
 	struct sdhci_host *host = dev_get_drvdata(dev);
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_pxa *pxa = pltfm_host->priv;
+	struct sdhci_pxa *pxa = sdhci_pltfm_priv(pltfm_host);
 
 	clk_prepare_enable(pxa->clk_io);
 	if (!IS_ERR(pxa->clk_core))
-- 
2.7.0.rc3


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

* [PATCH v2 08/12] mmc: sdhci-pxav3: use sdhci_pltfm_init for private allocation
@ 2016-01-06  3:56   ` Jisheng Zhang
  0 siblings, 0 replies; 51+ messages in thread
From: Jisheng Zhang @ 2016-01-06  3:56 UTC (permalink / raw)
  To: linux-arm-kernel

Commit 0e748234293f ("mmc: sdhci: Add size for caller in init+register")
allows users of sdhci_pltfm to allocate private space in calls to
sdhci_pltfm_init+sdhci_pltfm_register. This patch migrates sdhci-pxav3
to this allocation.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/mmc/host/sdhci-pxav3.c | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c
index f5edf9d..3d6df57 100644
--- a/drivers/mmc/host/sdhci-pxav3.c
+++ b/drivers/mmc/host/sdhci-pxav3.c
@@ -132,7 +132,7 @@ static int armada_38x_quirks(struct platform_device *pdev,
 {
 	struct device_node *np = pdev->dev.of_node;
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_pxa *pxa = pltfm_host->priv;
+	struct sdhci_pxa *pxa = sdhci_pltfm_priv(pltfm_host);
 	struct resource *res;
 
 	host->quirks &= ~SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN;
@@ -201,7 +201,7 @@ static void pxav3_reset(struct sdhci_host *host, u8 mask)
 static void pxav3_gen_init_74_clocks(struct sdhci_host *host, u8 power_mode)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_pxa *pxa = pltfm_host->priv;
+	struct sdhci_pxa *pxa = sdhci_pltfm_priv(pltfm_host);
 	u16 tmp;
 	int count;
 
@@ -250,7 +250,7 @@ static void pxav3_gen_init_74_clocks(struct sdhci_host *host, u8 power_mode)
 static void pxav3_set_uhs_signaling(struct sdhci_host *host, unsigned int uhs)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_pxa *pxa = pltfm_host->priv;
+	struct sdhci_pxa *pxa = sdhci_pltfm_priv(pltfm_host);
 	u16 ctrl_2;
 
 	/*
@@ -370,16 +370,13 @@ static int sdhci_pxav3_probe(struct platform_device *pdev)
 	const struct of_device_id *match;
 	int ret;
 
-	pxa = devm_kzalloc(&pdev->dev, sizeof(struct sdhci_pxa), GFP_KERNEL);
-	if (!pxa)
-		return -ENOMEM;
-
-	host = sdhci_pltfm_init(pdev, &sdhci_pxav3_pdata, 0);
+	host = sdhci_pltfm_init(pdev, &sdhci_pxav3_pdata,
+				sizeof(*pxa));
 	if (IS_ERR(host))
 		return PTR_ERR(host);
 
 	pltfm_host = sdhci_priv(host);
-	pltfm_host->priv = pxa;
+	pxa = sdhci_pltfm_priv(pltfm_host);
 
 	pxa->clk_io = devm_clk_get(dev, "io");
 	if (IS_ERR(pxa->clk_io))
@@ -486,7 +483,7 @@ static int sdhci_pxav3_remove(struct platform_device *pdev)
 {
 	struct sdhci_host *host = platform_get_drvdata(pdev);
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_pxa *pxa = pltfm_host->priv;
+	struct sdhci_pxa *pxa = sdhci_pltfm_priv(pltfm_host);
 
 	pm_runtime_get_sync(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
@@ -535,7 +532,7 @@ static int sdhci_pxav3_runtime_suspend(struct device *dev)
 {
 	struct sdhci_host *host = dev_get_drvdata(dev);
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_pxa *pxa = pltfm_host->priv;
+	struct sdhci_pxa *pxa = sdhci_pltfm_priv(pltfm_host);
 	int ret;
 
 	ret = sdhci_runtime_suspend_host(host);
@@ -553,7 +550,7 @@ static int sdhci_pxav3_runtime_resume(struct device *dev)
 {
 	struct sdhci_host *host = dev_get_drvdata(dev);
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_pxa *pxa = pltfm_host->priv;
+	struct sdhci_pxa *pxa = sdhci_pltfm_priv(pltfm_host);
 
 	clk_prepare_enable(pxa->clk_io);
 	if (!IS_ERR(pxa->clk_core))
-- 
2.7.0.rc3

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

* [PATCH v2 09/12] mmc: sdhci-st: use sdhci_pltfm_init for private allocation
  2016-01-06  3:55 ` Jisheng Zhang
  (?)
@ 2016-01-06  3:56     ` Jisheng Zhang
  -1 siblings, 0 replies; 51+ messages in thread
From: Jisheng Zhang @ 2016-01-06  3:56 UTC (permalink / raw)
  To: ulf.hansson-QSEj5FYQhm4dnm+yROfE0A, arnd-r2nGTMty4D4,
	swarren-3lzwWm7+Weoh9ZMKESR00Q, lee-DgEjT+Ai2ygdnm+yROfE0A,
	eric-WhKQ6XTQaPysTnJN9+BGXg, michal.simek-gjFFaj9aHVfQT0dZR+AlfA,
	soren.brinkmann-gjFFaj9aHVfQT0dZR+AlfA,
	ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w,
	srinivas.kandagatla-Re5JQEeQqe8AvxtiuMwx3w,
	maxime.coquelin-qxv4g6HH51o, patrice.chotard-qxv4g6HH51o,
	thierry.reding-Re5JQEeQqe8AvxtiuMwx3w,
	sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w
  Cc: linux-mmc-u79uwXL29TY76Z2rM5mHXA,
	linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	kernel-F5mvAk5X5gdBDgjK7y7TUQ,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA, Jisheng Zhang

Commit 0e748234293f ("mmc: sdhci: Add size for caller in init+register")
allows users of sdhci_pltfm to allocate private space in calls to
sdhci_pltfm_init+sdhci_pltfm_register. This patch migrates sdhci-st
to this allocation.

Signed-off-by: Jisheng Zhang <jszhang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
Acked-by: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
---
 drivers/mmc/host/sdhci-st.c | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/drivers/mmc/host/sdhci-st.c b/drivers/mmc/host/sdhci-st.c
index 969c2b0..4604376 100644
--- a/drivers/mmc/host/sdhci-st.c
+++ b/drivers/mmc/host/sdhci-st.c
@@ -251,7 +251,7 @@ static int sdhci_st_set_dll_for_clock(struct sdhci_host *host)
 {
 	int ret = 0;
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct st_mmc_platform_data *pdata = pltfm_host->priv;
+	struct st_mmc_platform_data *pdata = sdhci_pltfm_priv(pltfm_host);
 
 	if (host->clock > CLK_TO_CHECK_DLL_LOCK) {
 		st_mmcss_set_dll(pdata->top_ioaddr);
@@ -265,7 +265,7 @@ static void sdhci_st_set_uhs_signaling(struct sdhci_host *host,
 					unsigned int uhs)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct st_mmc_platform_data *pdata = pltfm_host->priv;
+	struct st_mmc_platform_data *pdata = sdhci_pltfm_priv(pltfm_host);
 	u16 ctrl_2 = sdhci_readw(host, SDHCI_HOST_CONTROL2);
 	int ret = 0;
 
@@ -357,10 +357,7 @@ static int sdhci_st_probe(struct platform_device *pdev)
 	int ret = 0;
 	u16 host_version;
 	struct resource *res;
-
-	pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
-	if (!pdata)
-		return -ENOMEM;
+	struct reset_control *rstc;
 
 	clk =  devm_clk_get(&pdev->dev, "mmc");
 	if (IS_ERR(clk)) {
@@ -368,19 +365,24 @@ static int sdhci_st_probe(struct platform_device *pdev)
 		return PTR_ERR(clk);
 	}
 
-	pdata->rstc = devm_reset_control_get(&pdev->dev, NULL);
-	if (IS_ERR(pdata->rstc))
-		pdata->rstc = NULL;
+	rstc = devm_reset_control_get(&pdev->dev, NULL);
+	if (IS_ERR(rstc))
+		rstc = NULL;
 	else
-		reset_control_deassert(pdata->rstc);
+		reset_control_deassert(rstc);
 
-	host = sdhci_pltfm_init(pdev, &sdhci_st_pdata, 0);
+	host = sdhci_pltfm_init(pdev, &sdhci_st_pdata,
+				sizeof(*pdata));
 	if (IS_ERR(host)) {
 		dev_err(&pdev->dev, "Failed sdhci_pltfm_init\n");
 		ret = PTR_ERR(host);
 		goto err_pltfm_init;
 	}
 
+	pltfm_host = sdhci_priv(host);
+	pdata = sdhci_pltfm_priv(pltfm_host);
+	pdata->rstc = rstc;
+
 	ret = mmc_of_parse(host->mmc);
 	if (ret) {
 		dev_err(&pdev->dev, "Failed mmc_of_parse\n");
@@ -398,8 +400,6 @@ static int sdhci_st_probe(struct platform_device *pdev)
 		pdata->top_ioaddr = NULL;
 	}
 
-	pltfm_host = sdhci_priv(host);
-	pltfm_host->priv = pdata;
 	pltfm_host->clk = clk;
 
 	/* Configure the Arasan HC inside the flashSS */
@@ -427,8 +427,8 @@ err_out:
 err_of:
 	sdhci_pltfm_free(pdev);
 err_pltfm_init:
-	if (pdata->rstc)
-		reset_control_assert(pdata->rstc);
+	if (rstc)
+		reset_control_assert(rstc);
 
 	return ret;
 }
@@ -437,7 +437,7 @@ static int sdhci_st_remove(struct platform_device *pdev)
 {
 	struct sdhci_host *host = platform_get_drvdata(pdev);
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct st_mmc_platform_data *pdata = pltfm_host->priv;
+	struct st_mmc_platform_data *pdata = sdhci_pltfm_priv(pltfm_host);
 	int ret;
 
 	ret = sdhci_pltfm_unregister(pdev);
@@ -453,7 +453,7 @@ static int sdhci_st_suspend(struct device *dev)
 {
 	struct sdhci_host *host = dev_get_drvdata(dev);
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct st_mmc_platform_data *pdata = pltfm_host->priv;
+	struct st_mmc_platform_data *pdata = sdhci_pltfm_priv(pltfm_host);
 	int ret = sdhci_suspend_host(host);
 
 	if (ret)
@@ -471,7 +471,7 @@ static int sdhci_st_resume(struct device *dev)
 {
 	struct sdhci_host *host = dev_get_drvdata(dev);
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct st_mmc_platform_data *pdata = pltfm_host->priv;
+	struct st_mmc_platform_data *pdata = sdhci_pltfm_priv(pltfm_host);
 	struct device_node *np = dev->of_node;
 
 	clk_prepare_enable(pltfm_host->clk);
-- 
2.7.0.rc3

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

* [PATCH v2 09/12] mmc: sdhci-st: use sdhci_pltfm_init for private allocation
@ 2016-01-06  3:56     ` Jisheng Zhang
  0 siblings, 0 replies; 51+ messages in thread
From: Jisheng Zhang @ 2016-01-06  3:56 UTC (permalink / raw)
  To: ulf.hansson, arnd, swarren, lee, eric, michal.simek,
	soren.brinkmann, ludovic.desroches, srinivas.kandagatla,
	maxime.coquelin, patrice.chotard, thierry.reding,
	sebastian.hesselbarth
  Cc: linux-mmc, linux-rpi-kernel, linux-arm-kernel, linux-kernel,
	kernel, linux-tegra, Jisheng Zhang

Commit 0e748234293f ("mmc: sdhci: Add size for caller in init+register")
allows users of sdhci_pltfm to allocate private space in calls to
sdhci_pltfm_init+sdhci_pltfm_register. This patch migrates sdhci-st
to this allocation.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/mmc/host/sdhci-st.c | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/drivers/mmc/host/sdhci-st.c b/drivers/mmc/host/sdhci-st.c
index 969c2b0..4604376 100644
--- a/drivers/mmc/host/sdhci-st.c
+++ b/drivers/mmc/host/sdhci-st.c
@@ -251,7 +251,7 @@ static int sdhci_st_set_dll_for_clock(struct sdhci_host *host)
 {
 	int ret = 0;
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct st_mmc_platform_data *pdata = pltfm_host->priv;
+	struct st_mmc_platform_data *pdata = sdhci_pltfm_priv(pltfm_host);
 
 	if (host->clock > CLK_TO_CHECK_DLL_LOCK) {
 		st_mmcss_set_dll(pdata->top_ioaddr);
@@ -265,7 +265,7 @@ static void sdhci_st_set_uhs_signaling(struct sdhci_host *host,
 					unsigned int uhs)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct st_mmc_platform_data *pdata = pltfm_host->priv;
+	struct st_mmc_platform_data *pdata = sdhci_pltfm_priv(pltfm_host);
 	u16 ctrl_2 = sdhci_readw(host, SDHCI_HOST_CONTROL2);
 	int ret = 0;
 
@@ -357,10 +357,7 @@ static int sdhci_st_probe(struct platform_device *pdev)
 	int ret = 0;
 	u16 host_version;
 	struct resource *res;
-
-	pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
-	if (!pdata)
-		return -ENOMEM;
+	struct reset_control *rstc;
 
 	clk =  devm_clk_get(&pdev->dev, "mmc");
 	if (IS_ERR(clk)) {
@@ -368,19 +365,24 @@ static int sdhci_st_probe(struct platform_device *pdev)
 		return PTR_ERR(clk);
 	}
 
-	pdata->rstc = devm_reset_control_get(&pdev->dev, NULL);
-	if (IS_ERR(pdata->rstc))
-		pdata->rstc = NULL;
+	rstc = devm_reset_control_get(&pdev->dev, NULL);
+	if (IS_ERR(rstc))
+		rstc = NULL;
 	else
-		reset_control_deassert(pdata->rstc);
+		reset_control_deassert(rstc);
 
-	host = sdhci_pltfm_init(pdev, &sdhci_st_pdata, 0);
+	host = sdhci_pltfm_init(pdev, &sdhci_st_pdata,
+				sizeof(*pdata));
 	if (IS_ERR(host)) {
 		dev_err(&pdev->dev, "Failed sdhci_pltfm_init\n");
 		ret = PTR_ERR(host);
 		goto err_pltfm_init;
 	}
 
+	pltfm_host = sdhci_priv(host);
+	pdata = sdhci_pltfm_priv(pltfm_host);
+	pdata->rstc = rstc;
+
 	ret = mmc_of_parse(host->mmc);
 	if (ret) {
 		dev_err(&pdev->dev, "Failed mmc_of_parse\n");
@@ -398,8 +400,6 @@ static int sdhci_st_probe(struct platform_device *pdev)
 		pdata->top_ioaddr = NULL;
 	}
 
-	pltfm_host = sdhci_priv(host);
-	pltfm_host->priv = pdata;
 	pltfm_host->clk = clk;
 
 	/* Configure the Arasan HC inside the flashSS */
@@ -427,8 +427,8 @@ err_out:
 err_of:
 	sdhci_pltfm_free(pdev);
 err_pltfm_init:
-	if (pdata->rstc)
-		reset_control_assert(pdata->rstc);
+	if (rstc)
+		reset_control_assert(rstc);
 
 	return ret;
 }
@@ -437,7 +437,7 @@ static int sdhci_st_remove(struct platform_device *pdev)
 {
 	struct sdhci_host *host = platform_get_drvdata(pdev);
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct st_mmc_platform_data *pdata = pltfm_host->priv;
+	struct st_mmc_platform_data *pdata = sdhci_pltfm_priv(pltfm_host);
 	int ret;
 
 	ret = sdhci_pltfm_unregister(pdev);
@@ -453,7 +453,7 @@ static int sdhci_st_suspend(struct device *dev)
 {
 	struct sdhci_host *host = dev_get_drvdata(dev);
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct st_mmc_platform_data *pdata = pltfm_host->priv;
+	struct st_mmc_platform_data *pdata = sdhci_pltfm_priv(pltfm_host);
 	int ret = sdhci_suspend_host(host);
 
 	if (ret)
@@ -471,7 +471,7 @@ static int sdhci_st_resume(struct device *dev)
 {
 	struct sdhci_host *host = dev_get_drvdata(dev);
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct st_mmc_platform_data *pdata = pltfm_host->priv;
+	struct st_mmc_platform_data *pdata = sdhci_pltfm_priv(pltfm_host);
 	struct device_node *np = dev->of_node;
 
 	clk_prepare_enable(pltfm_host->clk);
-- 
2.7.0.rc3


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

* [PATCH v2 09/12] mmc: sdhci-st: use sdhci_pltfm_init for private allocation
@ 2016-01-06  3:56     ` Jisheng Zhang
  0 siblings, 0 replies; 51+ messages in thread
From: Jisheng Zhang @ 2016-01-06  3:56 UTC (permalink / raw)
  To: linux-arm-kernel

Commit 0e748234293f ("mmc: sdhci: Add size for caller in init+register")
allows users of sdhci_pltfm to allocate private space in calls to
sdhci_pltfm_init+sdhci_pltfm_register. This patch migrates sdhci-st
to this allocation.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/mmc/host/sdhci-st.c | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/drivers/mmc/host/sdhci-st.c b/drivers/mmc/host/sdhci-st.c
index 969c2b0..4604376 100644
--- a/drivers/mmc/host/sdhci-st.c
+++ b/drivers/mmc/host/sdhci-st.c
@@ -251,7 +251,7 @@ static int sdhci_st_set_dll_for_clock(struct sdhci_host *host)
 {
 	int ret = 0;
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct st_mmc_platform_data *pdata = pltfm_host->priv;
+	struct st_mmc_platform_data *pdata = sdhci_pltfm_priv(pltfm_host);
 
 	if (host->clock > CLK_TO_CHECK_DLL_LOCK) {
 		st_mmcss_set_dll(pdata->top_ioaddr);
@@ -265,7 +265,7 @@ static void sdhci_st_set_uhs_signaling(struct sdhci_host *host,
 					unsigned int uhs)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct st_mmc_platform_data *pdata = pltfm_host->priv;
+	struct st_mmc_platform_data *pdata = sdhci_pltfm_priv(pltfm_host);
 	u16 ctrl_2 = sdhci_readw(host, SDHCI_HOST_CONTROL2);
 	int ret = 0;
 
@@ -357,10 +357,7 @@ static int sdhci_st_probe(struct platform_device *pdev)
 	int ret = 0;
 	u16 host_version;
 	struct resource *res;
-
-	pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
-	if (!pdata)
-		return -ENOMEM;
+	struct reset_control *rstc;
 
 	clk =  devm_clk_get(&pdev->dev, "mmc");
 	if (IS_ERR(clk)) {
@@ -368,19 +365,24 @@ static int sdhci_st_probe(struct platform_device *pdev)
 		return PTR_ERR(clk);
 	}
 
-	pdata->rstc = devm_reset_control_get(&pdev->dev, NULL);
-	if (IS_ERR(pdata->rstc))
-		pdata->rstc = NULL;
+	rstc = devm_reset_control_get(&pdev->dev, NULL);
+	if (IS_ERR(rstc))
+		rstc = NULL;
 	else
-		reset_control_deassert(pdata->rstc);
+		reset_control_deassert(rstc);
 
-	host = sdhci_pltfm_init(pdev, &sdhci_st_pdata, 0);
+	host = sdhci_pltfm_init(pdev, &sdhci_st_pdata,
+				sizeof(*pdata));
 	if (IS_ERR(host)) {
 		dev_err(&pdev->dev, "Failed sdhci_pltfm_init\n");
 		ret = PTR_ERR(host);
 		goto err_pltfm_init;
 	}
 
+	pltfm_host = sdhci_priv(host);
+	pdata = sdhci_pltfm_priv(pltfm_host);
+	pdata->rstc = rstc;
+
 	ret = mmc_of_parse(host->mmc);
 	if (ret) {
 		dev_err(&pdev->dev, "Failed mmc_of_parse\n");
@@ -398,8 +400,6 @@ static int sdhci_st_probe(struct platform_device *pdev)
 		pdata->top_ioaddr = NULL;
 	}
 
-	pltfm_host = sdhci_priv(host);
-	pltfm_host->priv = pdata;
 	pltfm_host->clk = clk;
 
 	/* Configure the Arasan HC inside the flashSS */
@@ -427,8 +427,8 @@ err_out:
 err_of:
 	sdhci_pltfm_free(pdev);
 err_pltfm_init:
-	if (pdata->rstc)
-		reset_control_assert(pdata->rstc);
+	if (rstc)
+		reset_control_assert(rstc);
 
 	return ret;
 }
@@ -437,7 +437,7 @@ static int sdhci_st_remove(struct platform_device *pdev)
 {
 	struct sdhci_host *host = platform_get_drvdata(pdev);
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct st_mmc_platform_data *pdata = pltfm_host->priv;
+	struct st_mmc_platform_data *pdata = sdhci_pltfm_priv(pltfm_host);
 	int ret;
 
 	ret = sdhci_pltfm_unregister(pdev);
@@ -453,7 +453,7 @@ static int sdhci_st_suspend(struct device *dev)
 {
 	struct sdhci_host *host = dev_get_drvdata(dev);
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct st_mmc_platform_data *pdata = pltfm_host->priv;
+	struct st_mmc_platform_data *pdata = sdhci_pltfm_priv(pltfm_host);
 	int ret = sdhci_suspend_host(host);
 
 	if (ret)
@@ -471,7 +471,7 @@ static int sdhci_st_resume(struct device *dev)
 {
 	struct sdhci_host *host = dev_get_drvdata(dev);
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct st_mmc_platform_data *pdata = pltfm_host->priv;
+	struct st_mmc_platform_data *pdata = sdhci_pltfm_priv(pltfm_host);
 	struct device_node *np = dev->of_node;
 
 	clk_prepare_enable(pltfm_host->clk);
-- 
2.7.0.rc3

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

* [PATCH v2 10/12] mmc: sdhci-tegra: use sdhci_pltfm_init for private allocation
  2016-01-06  3:55 ` Jisheng Zhang
  (?)
@ 2016-01-06  3:56   ` Jisheng Zhang
  -1 siblings, 0 replies; 51+ messages in thread
From: Jisheng Zhang @ 2016-01-06  3:56 UTC (permalink / raw)
  To: ulf.hansson, arnd, swarren, lee, eric, michal.simek,
	soren.brinkmann, ludovic.desroches, srinivas.kandagatla,
	maxime.coquelin, patrice.chotard, thierry.reding,
	sebastian.hesselbarth
  Cc: linux-mmc, linux-rpi-kernel, linux-arm-kernel, linux-kernel,
	kernel, linux-tegra, Jisheng Zhang

Commit 0e748234293f ("mmc: sdhci: Add size for caller in init+register")
allows users of sdhci_pltfm to allocate private space in calls to
sdhci_pltfm_init+sdhci_pltfm_register. This patch migrates sdhci-tegra
to this allocation.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/mmc/host/sdhci-tegra.c | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c
index ad28b49..25d0c08 100644
--- a/drivers/mmc/host/sdhci-tegra.c
+++ b/drivers/mmc/host/sdhci-tegra.c
@@ -54,7 +54,7 @@ struct sdhci_tegra {
 static u16 tegra_sdhci_readw(struct sdhci_host *host, int reg)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_tegra *tegra_host = pltfm_host->priv;
+	struct sdhci_tegra *tegra_host = sdhci_pltfm_priv(pltfm_host);
 	const struct sdhci_tegra_soc_data *soc_data = tegra_host->soc_data;
 
 	if (unlikely((soc_data->nvquirks & NVQUIRK_FORCE_SDHCI_SPEC_200) &&
@@ -90,7 +90,7 @@ static void tegra_sdhci_writew(struct sdhci_host *host, u16 val, int reg)
 static void tegra_sdhci_writel(struct sdhci_host *host, u32 val, int reg)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_tegra *tegra_host = pltfm_host->priv;
+	struct sdhci_tegra *tegra_host = sdhci_pltfm_priv(pltfm_host);
 	const struct sdhci_tegra_soc_data *soc_data = tegra_host->soc_data;
 
 	/* Seems like we're getting spurious timeout and crc errors, so
@@ -122,7 +122,7 @@ static unsigned int tegra_sdhci_get_ro(struct sdhci_host *host)
 static void tegra_sdhci_reset(struct sdhci_host *host, u8 mask)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_tegra *tegra_host = pltfm_host->priv;
+	struct sdhci_tegra *tegra_host = sdhci_pltfm_priv(pltfm_host);
 	const struct sdhci_tegra_soc_data *soc_data = tegra_host->soc_data;
 	u32 misc_ctrl;
 
@@ -260,19 +260,13 @@ static int sdhci_tegra_probe(struct platform_device *pdev)
 		return -EINVAL;
 	soc_data = match->data;
 
-	host = sdhci_pltfm_init(pdev, soc_data->pdata, 0);
+	host = sdhci_pltfm_init(pdev, soc_data->pdata,
+				sizeof(*tegra_host));
 	if (IS_ERR(host))
 		return PTR_ERR(host);
 	pltfm_host = sdhci_priv(host);
-
-	tegra_host = devm_kzalloc(&pdev->dev, sizeof(*tegra_host), GFP_KERNEL);
-	if (!tegra_host) {
-		dev_err(mmc_dev(host->mmc), "failed to allocate tegra_host\n");
-		rc = -ENOMEM;
-		goto err_alloc_tegra_host;
-	}
+	tegra_host = sdhci_pltfm_priv(pltfm_host);
 	tegra_host->soc_data = soc_data;
-	pltfm_host->priv = tegra_host;
 
 	rc = mmc_of_parse(host->mmc);
 	if (rc)
@@ -305,7 +299,6 @@ err_add_host:
 err_clk_get:
 err_power_req:
 err_parse_dt:
-err_alloc_tegra_host:
 	sdhci_pltfm_free(pdev);
 	return rc;
 }
-- 
2.7.0.rc3

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

* [PATCH v2 10/12] mmc: sdhci-tegra: use sdhci_pltfm_init for private allocation
@ 2016-01-06  3:56   ` Jisheng Zhang
  0 siblings, 0 replies; 51+ messages in thread
From: Jisheng Zhang @ 2016-01-06  3:56 UTC (permalink / raw)
  To: ulf.hansson, arnd, swarren, lee, eric, michal.simek,
	soren.brinkmann, ludovic.desroches, srinivas.kandagatla,
	maxime.coquelin, patrice.chotard, thierry.reding,
	sebastian.hesselbarth
  Cc: linux-mmc, linux-rpi-kernel, linux-arm-kernel, linux-kernel,
	kernel, linux-tegra, Jisheng Zhang

Commit 0e748234293f ("mmc: sdhci: Add size for caller in init+register")
allows users of sdhci_pltfm to allocate private space in calls to
sdhci_pltfm_init+sdhci_pltfm_register. This patch migrates sdhci-tegra
to this allocation.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/mmc/host/sdhci-tegra.c | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c
index ad28b49..25d0c08 100644
--- a/drivers/mmc/host/sdhci-tegra.c
+++ b/drivers/mmc/host/sdhci-tegra.c
@@ -54,7 +54,7 @@ struct sdhci_tegra {
 static u16 tegra_sdhci_readw(struct sdhci_host *host, int reg)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_tegra *tegra_host = pltfm_host->priv;
+	struct sdhci_tegra *tegra_host = sdhci_pltfm_priv(pltfm_host);
 	const struct sdhci_tegra_soc_data *soc_data = tegra_host->soc_data;
 
 	if (unlikely((soc_data->nvquirks & NVQUIRK_FORCE_SDHCI_SPEC_200) &&
@@ -90,7 +90,7 @@ static void tegra_sdhci_writew(struct sdhci_host *host, u16 val, int reg)
 static void tegra_sdhci_writel(struct sdhci_host *host, u32 val, int reg)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_tegra *tegra_host = pltfm_host->priv;
+	struct sdhci_tegra *tegra_host = sdhci_pltfm_priv(pltfm_host);
 	const struct sdhci_tegra_soc_data *soc_data = tegra_host->soc_data;
 
 	/* Seems like we're getting spurious timeout and crc errors, so
@@ -122,7 +122,7 @@ static unsigned int tegra_sdhci_get_ro(struct sdhci_host *host)
 static void tegra_sdhci_reset(struct sdhci_host *host, u8 mask)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_tegra *tegra_host = pltfm_host->priv;
+	struct sdhci_tegra *tegra_host = sdhci_pltfm_priv(pltfm_host);
 	const struct sdhci_tegra_soc_data *soc_data = tegra_host->soc_data;
 	u32 misc_ctrl;
 
@@ -260,19 +260,13 @@ static int sdhci_tegra_probe(struct platform_device *pdev)
 		return -EINVAL;
 	soc_data = match->data;
 
-	host = sdhci_pltfm_init(pdev, soc_data->pdata, 0);
+	host = sdhci_pltfm_init(pdev, soc_data->pdata,
+				sizeof(*tegra_host));
 	if (IS_ERR(host))
 		return PTR_ERR(host);
 	pltfm_host = sdhci_priv(host);
-
-	tegra_host = devm_kzalloc(&pdev->dev, sizeof(*tegra_host), GFP_KERNEL);
-	if (!tegra_host) {
-		dev_err(mmc_dev(host->mmc), "failed to allocate tegra_host\n");
-		rc = -ENOMEM;
-		goto err_alloc_tegra_host;
-	}
+	tegra_host = sdhci_pltfm_priv(pltfm_host);
 	tegra_host->soc_data = soc_data;
-	pltfm_host->priv = tegra_host;
 
 	rc = mmc_of_parse(host->mmc);
 	if (rc)
@@ -305,7 +299,6 @@ err_add_host:
 err_clk_get:
 err_power_req:
 err_parse_dt:
-err_alloc_tegra_host:
 	sdhci_pltfm_free(pdev);
 	return rc;
 }
-- 
2.7.0.rc3


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

* [PATCH v2 10/12] mmc: sdhci-tegra: use sdhci_pltfm_init for private allocation
@ 2016-01-06  3:56   ` Jisheng Zhang
  0 siblings, 0 replies; 51+ messages in thread
From: Jisheng Zhang @ 2016-01-06  3:56 UTC (permalink / raw)
  To: linux-arm-kernel

Commit 0e748234293f ("mmc: sdhci: Add size for caller in init+register")
allows users of sdhci_pltfm to allocate private space in calls to
sdhci_pltfm_init+sdhci_pltfm_register. This patch migrates sdhci-tegra
to this allocation.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/mmc/host/sdhci-tegra.c | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c
index ad28b49..25d0c08 100644
--- a/drivers/mmc/host/sdhci-tegra.c
+++ b/drivers/mmc/host/sdhci-tegra.c
@@ -54,7 +54,7 @@ struct sdhci_tegra {
 static u16 tegra_sdhci_readw(struct sdhci_host *host, int reg)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_tegra *tegra_host = pltfm_host->priv;
+	struct sdhci_tegra *tegra_host = sdhci_pltfm_priv(pltfm_host);
 	const struct sdhci_tegra_soc_data *soc_data = tegra_host->soc_data;
 
 	if (unlikely((soc_data->nvquirks & NVQUIRK_FORCE_SDHCI_SPEC_200) &&
@@ -90,7 +90,7 @@ static void tegra_sdhci_writew(struct sdhci_host *host, u16 val, int reg)
 static void tegra_sdhci_writel(struct sdhci_host *host, u32 val, int reg)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_tegra *tegra_host = pltfm_host->priv;
+	struct sdhci_tegra *tegra_host = sdhci_pltfm_priv(pltfm_host);
 	const struct sdhci_tegra_soc_data *soc_data = tegra_host->soc_data;
 
 	/* Seems like we're getting spurious timeout and crc errors, so
@@ -122,7 +122,7 @@ static unsigned int tegra_sdhci_get_ro(struct sdhci_host *host)
 static void tegra_sdhci_reset(struct sdhci_host *host, u8 mask)
 {
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	struct sdhci_tegra *tegra_host = pltfm_host->priv;
+	struct sdhci_tegra *tegra_host = sdhci_pltfm_priv(pltfm_host);
 	const struct sdhci_tegra_soc_data *soc_data = tegra_host->soc_data;
 	u32 misc_ctrl;
 
@@ -260,19 +260,13 @@ static int sdhci_tegra_probe(struct platform_device *pdev)
 		return -EINVAL;
 	soc_data = match->data;
 
-	host = sdhci_pltfm_init(pdev, soc_data->pdata, 0);
+	host = sdhci_pltfm_init(pdev, soc_data->pdata,
+				sizeof(*tegra_host));
 	if (IS_ERR(host))
 		return PTR_ERR(host);
 	pltfm_host = sdhci_priv(host);
-
-	tegra_host = devm_kzalloc(&pdev->dev, sizeof(*tegra_host), GFP_KERNEL);
-	if (!tegra_host) {
-		dev_err(mmc_dev(host->mmc), "failed to allocate tegra_host\n");
-		rc = -ENOMEM;
-		goto err_alloc_tegra_host;
-	}
+	tegra_host = sdhci_pltfm_priv(pltfm_host);
 	tegra_host->soc_data = soc_data;
-	pltfm_host->priv = tegra_host;
 
 	rc = mmc_of_parse(host->mmc);
 	if (rc)
@@ -305,7 +299,6 @@ err_add_host:
 err_clk_get:
 err_power_req:
 err_parse_dt:
-err_alloc_tegra_host:
 	sdhci_pltfm_free(pdev);
 	return rc;
 }
-- 
2.7.0.rc3

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

* [PATCH v2 11/12] mmc: sdhci-pxav2: remove unnecessary assignment of pltfm_host->priv
  2016-01-06  3:55 ` Jisheng Zhang
  (?)
@ 2016-01-06  3:56   ` Jisheng Zhang
  -1 siblings, 0 replies; 51+ messages in thread
From: Jisheng Zhang @ 2016-01-06  3:56 UTC (permalink / raw)
  To: ulf.hansson, arnd, swarren, lee, eric, michal.simek,
	soren.brinkmann, ludovic.desroches, srinivas.kandagatla,
	maxime.coquelin, patrice.chotard, thierry.reding,
	sebastian.hesselbarth
  Cc: linux-mmc, linux-rpi-kernel, linux-arm-kernel, linux-kernel,
	kernel, linux-tegra, Jisheng Zhang

The sdhci_pltfm_init() function has initialized the priv member as
NULL, so there's no need to do it again.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/mmc/host/sdhci-pxav2.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/mmc/host/sdhci-pxav2.c b/drivers/mmc/host/sdhci-pxav2.c
index beffd86..1d8dd35 100644
--- a/drivers/mmc/host/sdhci-pxav2.c
+++ b/drivers/mmc/host/sdhci-pxav2.c
@@ -177,7 +177,6 @@ static int sdhci_pxav2_probe(struct platform_device *pdev)
 		return PTR_ERR(host);
 
 	pltfm_host = sdhci_priv(host);
-	pltfm_host->priv = NULL;
 
 	clk = clk_get(dev, "PXA-SDHCLK");
 	if (IS_ERR(clk)) {
-- 
2.7.0.rc3

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

* [PATCH v2 11/12] mmc: sdhci-pxav2: remove unnecessary assignment of pltfm_host->priv
@ 2016-01-06  3:56   ` Jisheng Zhang
  0 siblings, 0 replies; 51+ messages in thread
From: Jisheng Zhang @ 2016-01-06  3:56 UTC (permalink / raw)
  To: ulf.hansson, arnd, swarren, lee, eric, michal.simek,
	soren.brinkmann, ludovic.desroches, srinivas.kandagatla,
	maxime.coquelin, patrice.chotard, thierry.reding,
	sebastian.hesselbarth
  Cc: linux-mmc, linux-rpi-kernel, linux-arm-kernel, linux-kernel,
	kernel, linux-tegra, Jisheng Zhang

The sdhci_pltfm_init() function has initialized the priv member as
NULL, so there's no need to do it again.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/mmc/host/sdhci-pxav2.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/mmc/host/sdhci-pxav2.c b/drivers/mmc/host/sdhci-pxav2.c
index beffd86..1d8dd35 100644
--- a/drivers/mmc/host/sdhci-pxav2.c
+++ b/drivers/mmc/host/sdhci-pxav2.c
@@ -177,7 +177,6 @@ static int sdhci_pxav2_probe(struct platform_device *pdev)
 		return PTR_ERR(host);
 
 	pltfm_host = sdhci_priv(host);
-	pltfm_host->priv = NULL;
 
 	clk = clk_get(dev, "PXA-SDHCLK");
 	if (IS_ERR(clk)) {
-- 
2.7.0.rc3


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

* [PATCH v2 11/12] mmc: sdhci-pxav2: remove unnecessary assignment of pltfm_host->priv
@ 2016-01-06  3:56   ` Jisheng Zhang
  0 siblings, 0 replies; 51+ messages in thread
From: Jisheng Zhang @ 2016-01-06  3:56 UTC (permalink / raw)
  To: linux-arm-kernel

The sdhci_pltfm_init() function has initialized the priv member as
NULL, so there's no need to do it again.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/mmc/host/sdhci-pxav2.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/mmc/host/sdhci-pxav2.c b/drivers/mmc/host/sdhci-pxav2.c
index beffd86..1d8dd35 100644
--- a/drivers/mmc/host/sdhci-pxav2.c
+++ b/drivers/mmc/host/sdhci-pxav2.c
@@ -177,7 +177,6 @@ static int sdhci_pxav2_probe(struct platform_device *pdev)
 		return PTR_ERR(host);
 
 	pltfm_host = sdhci_priv(host);
-	pltfm_host->priv = NULL;
 
 	clk = clk_get(dev, "PXA-SDHCLK");
 	if (IS_ERR(clk)) {
-- 
2.7.0.rc3

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

* [PATCH v2 12/12] mmc: sdhci-pltfm: remove priv variable from sdhci_pltfm_host
  2016-01-06  3:55 ` Jisheng Zhang
  (?)
@ 2016-01-06  3:56   ` Jisheng Zhang
  -1 siblings, 0 replies; 51+ messages in thread
From: Jisheng Zhang @ 2016-01-06  3:56 UTC (permalink / raw)
  To: ulf.hansson, arnd, swarren, lee, eric, michal.simek,
	soren.brinkmann, ludovic.desroches, srinivas.kandagatla,
	maxime.coquelin, patrice.chotard, thierry.reding,
	sebastian.hesselbarth
  Cc: linux-mmc, linux-rpi-kernel, linux-arm-kernel, linux-kernel,
	kernel, linux-tegra, Jisheng Zhang

Now all clients migration to use sdhci_pltfm_init for private
allocation is done and there's no users of the priv variable, so we can
remove it from the sdhci_pltfm_host structure.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/mmc/host/sdhci-pltfm.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/mmc/host/sdhci-pltfm.h b/drivers/mmc/host/sdhci-pltfm.h
index 04bc248..d38053b 100644
--- a/drivers/mmc/host/sdhci-pltfm.h
+++ b/drivers/mmc/host/sdhci-pltfm.h
@@ -23,7 +23,6 @@ struct sdhci_pltfm_data {
 
 struct sdhci_pltfm_host {
 	struct clk *clk;
-	void *priv; /* to handle quirks across io-accessor calls */
 
 	/* migrate from sdhci_of_host */
 	unsigned int clock;
-- 
2.7.0.rc3

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

* [PATCH v2 12/12] mmc: sdhci-pltfm: remove priv variable from sdhci_pltfm_host
@ 2016-01-06  3:56   ` Jisheng Zhang
  0 siblings, 0 replies; 51+ messages in thread
From: Jisheng Zhang @ 2016-01-06  3:56 UTC (permalink / raw)
  To: ulf.hansson, arnd, swarren, lee, eric, michal.simek,
	soren.brinkmann, ludovic.desroches, srinivas.kandagatla,
	maxime.coquelin, patrice.chotard, thierry.reding,
	sebastian.hesselbarth
  Cc: linux-mmc, linux-rpi-kernel, linux-arm-kernel, linux-kernel,
	kernel, linux-tegra, Jisheng Zhang

Now all clients migration to use sdhci_pltfm_init for private
allocation is done and there's no users of the priv variable, so we can
remove it from the sdhci_pltfm_host structure.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/mmc/host/sdhci-pltfm.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/mmc/host/sdhci-pltfm.h b/drivers/mmc/host/sdhci-pltfm.h
index 04bc248..d38053b 100644
--- a/drivers/mmc/host/sdhci-pltfm.h
+++ b/drivers/mmc/host/sdhci-pltfm.h
@@ -23,7 +23,6 @@ struct sdhci_pltfm_data {
 
 struct sdhci_pltfm_host {
 	struct clk *clk;
-	void *priv; /* to handle quirks across io-accessor calls */
 
 	/* migrate from sdhci_of_host */
 	unsigned int clock;
-- 
2.7.0.rc3


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

* [PATCH v2 12/12] mmc: sdhci-pltfm: remove priv variable from sdhci_pltfm_host
@ 2016-01-06  3:56   ` Jisheng Zhang
  0 siblings, 0 replies; 51+ messages in thread
From: Jisheng Zhang @ 2016-01-06  3:56 UTC (permalink / raw)
  To: linux-arm-kernel

Now all clients migration to use sdhci_pltfm_init for private
allocation is done and there's no users of the priv variable, so we can
remove it from the sdhci_pltfm_host structure.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/mmc/host/sdhci-pltfm.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/mmc/host/sdhci-pltfm.h b/drivers/mmc/host/sdhci-pltfm.h
index 04bc248..d38053b 100644
--- a/drivers/mmc/host/sdhci-pltfm.h
+++ b/drivers/mmc/host/sdhci-pltfm.h
@@ -23,7 +23,6 @@ struct sdhci_pltfm_data {
 
 struct sdhci_pltfm_host {
 	struct clk *clk;
-	void *priv; /* to handle quirks across io-accessor calls */
 
 	/* migrate from sdhci_of_host */
 	unsigned int clock;
-- 
2.7.0.rc3

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

* Re: [PATCH v2 06/12] mmc: sdhci-of-at91: use sdhci_pltfm_init for private allocation
  2016-01-06  3:55   ` Jisheng Zhang
  (?)
@ 2016-01-06  9:02       ` Ludovic Desroches
  -1 siblings, 0 replies; 51+ messages in thread
From: Ludovic Desroches @ 2016-01-06  9:02 UTC (permalink / raw)
  To: Jisheng Zhang
  Cc: ulf.hansson-QSEj5FYQhm4dnm+yROfE0A, arnd-r2nGTMty4D4,
	swarren-3lzwWm7+Weoh9ZMKESR00Q, lee-DgEjT+Ai2ygdnm+yROfE0A,
	eric-WhKQ6XTQaPysTnJN9+BGXg, michal.simek-gjFFaj9aHVfQT0dZR+AlfA,
	soren.brinkmann-gjFFaj9aHVfQT0dZR+AlfA,
	ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w,
	srinivas.kandagatla-Re5JQEeQqe8AvxtiuMwx3w,
	maxime.coquelin-qxv4g6HH51o, patrice.chotard-qxv4g6HH51o,
	thierry.reding-Re5JQEeQqe8AvxtiuMwx3w,
	sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w,
	linux-mmc-u79uwXL29TY76Z2rM5mHXA,
	linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	kernel-F5mvAk5X5gdBDgjK7y7TUQ,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA

Hi Jisheng,

Thanks for your patch but it needs to be updated since it breaks this
driver.

-       struct sdhci_at91_priv  *priv = pltfm_host->priv;
+       struct sdhci_at91_priv  *priv = sdhci_pltfm_priv(pltfm_host);

is missing in sdhci_at91_runtime_suspend and sdhci_at91_runtime_resume
causing a NULL pointer dereference.

On Wed, Jan 06, 2016 at 11:55:59AM +0800, Jisheng Zhang wrote:
> Commit 0e748234293f ("mmc: sdhci: Add size for caller in init+register")
> allows users of sdhci_pltfm to allocate private space in calls to
> sdhci_pltfm_init+sdhci_pltfm_register. This patch migrates the
> sdhci-of-at91 driver to this allocation.
> 
> Signed-off-by: Jisheng Zhang <jszhang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
> Acked-by: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
> ---
>  drivers/mmc/host/sdhci-of-at91.c | 21 ++++++++-------------
>  1 file changed, 8 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
> index 06d0b50..765eb09 100644
> --- a/drivers/mmc/host/sdhci-of-at91.c
> +++ b/drivers/mmc/host/sdhci-of-at91.c
> @@ -68,11 +68,13 @@ static int sdhci_at91_probe(struct platform_device *pdev)
>  		return -EINVAL;
>  	soc_data = match->data;
>  
> -	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
> -	if (!priv) {
> -		dev_err(&pdev->dev, "unable to allocate private data\n");
> -		return -ENOMEM;
> -	}
> +	host = sdhci_pltfm_init(pdev, soc_data,
> +				sizeof(*priv));

Can be on the same line.

Regards

Ludovic

> +	if (IS_ERR(host))
> +		return PTR_ERR(host);
> +
> +	pltfm_host = sdhci_priv(host);
> +	priv = sdhci_pltfm_priv(pltfm_host);
>  
>  	priv->mainck = devm_clk_get(&pdev->dev, "baseclk");
>  	if (IS_ERR(priv->mainck)) {
> @@ -92,10 +94,6 @@ static int sdhci_at91_probe(struct platform_device *pdev)
>  		return PTR_ERR(priv->gck);
>  	}
>  
> -	host = sdhci_pltfm_init(pdev, soc_data, 0);
> -	if (IS_ERR(host))
> -		return PTR_ERR(host);
> -
>  	/*
>  	 * The mult clock is provided by as a generated clock by the PMC
>  	 * controller. In order to set the rate of gck, we have to get the
> @@ -135,9 +133,6 @@ static int sdhci_at91_probe(struct platform_device *pdev)
>  	clk_prepare_enable(priv->mainck);
>  	clk_prepare_enable(priv->gck);
>  
> -	pltfm_host = sdhci_priv(host);
> -	pltfm_host->priv = priv;
> -
>  	ret = mmc_of_parse(host->mmc);
>  	if (ret)
>  		goto clocks_disable_unprepare;
> @@ -163,7 +158,7 @@ static int sdhci_at91_remove(struct platform_device *pdev)
>  {
>  	struct sdhci_host	*host = platform_get_drvdata(pdev);
>  	struct sdhci_pltfm_host	*pltfm_host = sdhci_priv(host);
> -	struct sdhci_at91_priv	*priv = pltfm_host->priv;
> +	struct sdhci_at91_priv	*priv = sdhci_pltfm_priv(pltfm_host);
>  
>  	sdhci_pltfm_unregister(pdev);
>  
> -- 
> 2.7.0.rc3
> 

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

* Re: [PATCH v2 06/12] mmc: sdhci-of-at91: use sdhci_pltfm_init for private allocation
@ 2016-01-06  9:02       ` Ludovic Desroches
  0 siblings, 0 replies; 51+ messages in thread
From: Ludovic Desroches @ 2016-01-06  9:02 UTC (permalink / raw)
  To: Jisheng Zhang
  Cc: ulf.hansson, arnd, swarren, lee, eric, michal.simek,
	soren.brinkmann, ludovic.desroches, srinivas.kandagatla,
	maxime.coquelin, patrice.chotard, thierry.reding,
	sebastian.hesselbarth, linux-mmc, linux-rpi-kernel,
	linux-arm-kernel, linux-kernel, kernel, linux-tegra

Hi Jisheng,

Thanks for your patch but it needs to be updated since it breaks this
driver.

-       struct sdhci_at91_priv  *priv = pltfm_host->priv;
+       struct sdhci_at91_priv  *priv = sdhci_pltfm_priv(pltfm_host);

is missing in sdhci_at91_runtime_suspend and sdhci_at91_runtime_resume
causing a NULL pointer dereference.

On Wed, Jan 06, 2016 at 11:55:59AM +0800, Jisheng Zhang wrote:
> Commit 0e748234293f ("mmc: sdhci: Add size for caller in init+register")
> allows users of sdhci_pltfm to allocate private space in calls to
> sdhci_pltfm_init+sdhci_pltfm_register. This patch migrates the
> sdhci-of-at91 driver to this allocation.
> 
> Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
> Acked-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/mmc/host/sdhci-of-at91.c | 21 ++++++++-------------
>  1 file changed, 8 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
> index 06d0b50..765eb09 100644
> --- a/drivers/mmc/host/sdhci-of-at91.c
> +++ b/drivers/mmc/host/sdhci-of-at91.c
> @@ -68,11 +68,13 @@ static int sdhci_at91_probe(struct platform_device *pdev)
>  		return -EINVAL;
>  	soc_data = match->data;
>  
> -	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
> -	if (!priv) {
> -		dev_err(&pdev->dev, "unable to allocate private data\n");
> -		return -ENOMEM;
> -	}
> +	host = sdhci_pltfm_init(pdev, soc_data,
> +				sizeof(*priv));

Can be on the same line.

Regards

Ludovic

> +	if (IS_ERR(host))
> +		return PTR_ERR(host);
> +
> +	pltfm_host = sdhci_priv(host);
> +	priv = sdhci_pltfm_priv(pltfm_host);
>  
>  	priv->mainck = devm_clk_get(&pdev->dev, "baseclk");
>  	if (IS_ERR(priv->mainck)) {
> @@ -92,10 +94,6 @@ static int sdhci_at91_probe(struct platform_device *pdev)
>  		return PTR_ERR(priv->gck);
>  	}
>  
> -	host = sdhci_pltfm_init(pdev, soc_data, 0);
> -	if (IS_ERR(host))
> -		return PTR_ERR(host);
> -
>  	/*
>  	 * The mult clock is provided by as a generated clock by the PMC
>  	 * controller. In order to set the rate of gck, we have to get the
> @@ -135,9 +133,6 @@ static int sdhci_at91_probe(struct platform_device *pdev)
>  	clk_prepare_enable(priv->mainck);
>  	clk_prepare_enable(priv->gck);
>  
> -	pltfm_host = sdhci_priv(host);
> -	pltfm_host->priv = priv;
> -
>  	ret = mmc_of_parse(host->mmc);
>  	if (ret)
>  		goto clocks_disable_unprepare;
> @@ -163,7 +158,7 @@ static int sdhci_at91_remove(struct platform_device *pdev)
>  {
>  	struct sdhci_host	*host = platform_get_drvdata(pdev);
>  	struct sdhci_pltfm_host	*pltfm_host = sdhci_priv(host);
> -	struct sdhci_at91_priv	*priv = pltfm_host->priv;
> +	struct sdhci_at91_priv	*priv = sdhci_pltfm_priv(pltfm_host);
>  
>  	sdhci_pltfm_unregister(pdev);
>  
> -- 
> 2.7.0.rc3
> 

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

* [PATCH v2 06/12] mmc: sdhci-of-at91: use sdhci_pltfm_init for private allocation
@ 2016-01-06  9:02       ` Ludovic Desroches
  0 siblings, 0 replies; 51+ messages in thread
From: Ludovic Desroches @ 2016-01-06  9:02 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Jisheng,

Thanks for your patch but it needs to be updated since it breaks this
driver.

-       struct sdhci_at91_priv  *priv = pltfm_host->priv;
+       struct sdhci_at91_priv  *priv = sdhci_pltfm_priv(pltfm_host);

is missing in sdhci_at91_runtime_suspend and sdhci_at91_runtime_resume
causing a NULL pointer dereference.

On Wed, Jan 06, 2016 at 11:55:59AM +0800, Jisheng Zhang wrote:
> Commit 0e748234293f ("mmc: sdhci: Add size for caller in init+register")
> allows users of sdhci_pltfm to allocate private space in calls to
> sdhci_pltfm_init+sdhci_pltfm_register. This patch migrates the
> sdhci-of-at91 driver to this allocation.
> 
> Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
> Acked-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/mmc/host/sdhci-of-at91.c | 21 ++++++++-------------
>  1 file changed, 8 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
> index 06d0b50..765eb09 100644
> --- a/drivers/mmc/host/sdhci-of-at91.c
> +++ b/drivers/mmc/host/sdhci-of-at91.c
> @@ -68,11 +68,13 @@ static int sdhci_at91_probe(struct platform_device *pdev)
>  		return -EINVAL;
>  	soc_data = match->data;
>  
> -	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
> -	if (!priv) {
> -		dev_err(&pdev->dev, "unable to allocate private data\n");
> -		return -ENOMEM;
> -	}
> +	host = sdhci_pltfm_init(pdev, soc_data,
> +				sizeof(*priv));

Can be on the same line.

Regards

Ludovic

> +	if (IS_ERR(host))
> +		return PTR_ERR(host);
> +
> +	pltfm_host = sdhci_priv(host);
> +	priv = sdhci_pltfm_priv(pltfm_host);
>  
>  	priv->mainck = devm_clk_get(&pdev->dev, "baseclk");
>  	if (IS_ERR(priv->mainck)) {
> @@ -92,10 +94,6 @@ static int sdhci_at91_probe(struct platform_device *pdev)
>  		return PTR_ERR(priv->gck);
>  	}
>  
> -	host = sdhci_pltfm_init(pdev, soc_data, 0);
> -	if (IS_ERR(host))
> -		return PTR_ERR(host);
> -
>  	/*
>  	 * The mult clock is provided by as a generated clock by the PMC
>  	 * controller. In order to set the rate of gck, we have to get the
> @@ -135,9 +133,6 @@ static int sdhci_at91_probe(struct platform_device *pdev)
>  	clk_prepare_enable(priv->mainck);
>  	clk_prepare_enable(priv->gck);
>  
> -	pltfm_host = sdhci_priv(host);
> -	pltfm_host->priv = priv;
> -
>  	ret = mmc_of_parse(host->mmc);
>  	if (ret)
>  		goto clocks_disable_unprepare;
> @@ -163,7 +158,7 @@ static int sdhci_at91_remove(struct platform_device *pdev)
>  {
>  	struct sdhci_host	*host = platform_get_drvdata(pdev);
>  	struct sdhci_pltfm_host	*pltfm_host = sdhci_priv(host);
> -	struct sdhci_at91_priv	*priv = pltfm_host->priv;
> +	struct sdhci_at91_priv	*priv = sdhci_pltfm_priv(pltfm_host);
>  
>  	sdhci_pltfm_unregister(pdev);
>  
> -- 
> 2.7.0.rc3
> 

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

* Re: [PATCH v2 06/12] mmc: sdhci-of-at91: use sdhci_pltfm_init for private allocation
  2016-01-06  9:02       ` Ludovic Desroches
  (?)
@ 2016-01-06  9:22         ` Jisheng Zhang
  -1 siblings, 0 replies; 51+ messages in thread
From: Jisheng Zhang @ 2016-01-06  9:22 UTC (permalink / raw)
  To: Ludovic Desroches
  Cc: ulf.hansson, arnd, swarren, lee, eric, michal.simek,
	soren.brinkmann, srinivas.kandagatla, maxime.coquelin,
	patrice.chotard, thierry.reding, sebastian.hesselbarth,
	linux-mmc, linux-rpi-kernel, linux-arm-kernel, linux-kernel,
	kernel, linux-tegra

Dear Ludovic,

On Wed, 6 Jan 2016 10:02:15 +0100 Ludovic Desroches wrote:

> Hi Jisheng,
> 
> Thanks for your patch but it needs to be updated since it breaks this
> driver.
> 
> -       struct sdhci_at91_priv  *priv = pltfm_host->priv;
> +       struct sdhci_at91_priv  *priv = sdhci_pltfm_priv(pltfm_host);
> 
> is missing in sdhci_at91_runtime_suspend and sdhci_at91_runtime_resume
> causing a NULL pointer dereference.

My code base is 4.4-rc8.
I didn't see sdhci_at91_runtime_suspend and sdhci_at91_runtime_resume
functions in the sdhci-of-at91.c. Seems the at91 runtime pm support
is newly added and intends for 4.5.

So the question is which code base should I use? 

Hi Ulf,

could you please give some suggestions?

Thanks in advance,
Jisheng

> 
> On Wed, Jan 06, 2016 at 11:55:59AM +0800, Jisheng Zhang wrote:
> > Commit 0e748234293f ("mmc: sdhci: Add size for caller in init+register")
> > allows users of sdhci_pltfm to allocate private space in calls to
> > sdhci_pltfm_init+sdhci_pltfm_register. This patch migrates the
> > sdhci-of-at91 driver to this allocation.
> > 
> > Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
> > Acked-by: Arnd Bergmann <arnd@arndb.de>
> > ---
> >  drivers/mmc/host/sdhci-of-at91.c | 21 ++++++++-------------
> >  1 file changed, 8 insertions(+), 13 deletions(-)
> > 
> > diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
> > index 06d0b50..765eb09 100644
> > --- a/drivers/mmc/host/sdhci-of-at91.c
> > +++ b/drivers/mmc/host/sdhci-of-at91.c
> > @@ -68,11 +68,13 @@ static int sdhci_at91_probe(struct platform_device *pdev)
> >  		return -EINVAL;
> >  	soc_data = match->data;
> >  
> > -	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
> > -	if (!priv) {
> > -		dev_err(&pdev->dev, "unable to allocate private data\n");
> > -		return -ENOMEM;
> > -	}
> > +	host = sdhci_pltfm_init(pdev, soc_data,
> > +				sizeof(*priv));  
> 
> Can be on the same line.

Great! will do in v3.

> 
> Regards
> 
> Ludovic
> 
> > +	if (IS_ERR(host))
> > +		return PTR_ERR(host);
> > +
> > +	pltfm_host = sdhci_priv(host);
> > +	priv = sdhci_pltfm_priv(pltfm_host);
> >  
> >  	priv->mainck = devm_clk_get(&pdev->dev, "baseclk");
> >  	if (IS_ERR(priv->mainck)) {
> > @@ -92,10 +94,6 @@ static int sdhci_at91_probe(struct platform_device *pdev)
> >  		return PTR_ERR(priv->gck);
> >  	}
> >  
> > -	host = sdhci_pltfm_init(pdev, soc_data, 0);
> > -	if (IS_ERR(host))
> > -		return PTR_ERR(host);
> > -
> >  	/*
> >  	 * The mult clock is provided by as a generated clock by the PMC
> >  	 * controller. In order to set the rate of gck, we have to get the
> > @@ -135,9 +133,6 @@ static int sdhci_at91_probe(struct platform_device *pdev)
> >  	clk_prepare_enable(priv->mainck);
> >  	clk_prepare_enable(priv->gck);
> >  
> > -	pltfm_host = sdhci_priv(host);
> > -	pltfm_host->priv = priv;
> > -
> >  	ret = mmc_of_parse(host->mmc);
> >  	if (ret)
> >  		goto clocks_disable_unprepare;
> > @@ -163,7 +158,7 @@ static int sdhci_at91_remove(struct platform_device *pdev)
> >  {
> >  	struct sdhci_host	*host = platform_get_drvdata(pdev);
> >  	struct sdhci_pltfm_host	*pltfm_host = sdhci_priv(host);
> > -	struct sdhci_at91_priv	*priv = pltfm_host->priv;
> > +	struct sdhci_at91_priv	*priv = sdhci_pltfm_priv(pltfm_host);
> >  
> >  	sdhci_pltfm_unregister(pdev);
> >  
> > -- 
> > 2.7.0.rc3
> >   

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

* Re: [PATCH v2 06/12] mmc: sdhci-of-at91: use sdhci_pltfm_init for private allocation
@ 2016-01-06  9:22         ` Jisheng Zhang
  0 siblings, 0 replies; 51+ messages in thread
From: Jisheng Zhang @ 2016-01-06  9:22 UTC (permalink / raw)
  To: Ludovic Desroches
  Cc: ulf.hansson, arnd, swarren, lee, eric, michal.simek,
	soren.brinkmann, srinivas.kandagatla, maxime.coquelin,
	patrice.chotard, thierry.reding, sebastian.hesselbarth,
	linux-mmc, linux-rpi-kernel, linux-arm-kernel, linux-kernel,
	kernel, linux-tegra

Dear Ludovic,

On Wed, 6 Jan 2016 10:02:15 +0100 Ludovic Desroches wrote:

> Hi Jisheng,
> 
> Thanks for your patch but it needs to be updated since it breaks this
> driver.
> 
> -       struct sdhci_at91_priv  *priv = pltfm_host->priv;
> +       struct sdhci_at91_priv  *priv = sdhci_pltfm_priv(pltfm_host);
> 
> is missing in sdhci_at91_runtime_suspend and sdhci_at91_runtime_resume
> causing a NULL pointer dereference.

My code base is 4.4-rc8.
I didn't see sdhci_at91_runtime_suspend and sdhci_at91_runtime_resume
functions in the sdhci-of-at91.c. Seems the at91 runtime pm support
is newly added and intends for 4.5.

So the question is which code base should I use? 

Hi Ulf,

could you please give some suggestions?

Thanks in advance,
Jisheng

> 
> On Wed, Jan 06, 2016 at 11:55:59AM +0800, Jisheng Zhang wrote:
> > Commit 0e748234293f ("mmc: sdhci: Add size for caller in init+register")
> > allows users of sdhci_pltfm to allocate private space in calls to
> > sdhci_pltfm_init+sdhci_pltfm_register. This patch migrates the
> > sdhci-of-at91 driver to this allocation.
> > 
> > Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
> > Acked-by: Arnd Bergmann <arnd@arndb.de>
> > ---
> >  drivers/mmc/host/sdhci-of-at91.c | 21 ++++++++-------------
> >  1 file changed, 8 insertions(+), 13 deletions(-)
> > 
> > diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
> > index 06d0b50..765eb09 100644
> > --- a/drivers/mmc/host/sdhci-of-at91.c
> > +++ b/drivers/mmc/host/sdhci-of-at91.c
> > @@ -68,11 +68,13 @@ static int sdhci_at91_probe(struct platform_device *pdev)
> >  		return -EINVAL;
> >  	soc_data = match->data;
> >  
> > -	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
> > -	if (!priv) {
> > -		dev_err(&pdev->dev, "unable to allocate private data\n");
> > -		return -ENOMEM;
> > -	}
> > +	host = sdhci_pltfm_init(pdev, soc_data,
> > +				sizeof(*priv));  
> 
> Can be on the same line.

Great! will do in v3.

> 
> Regards
> 
> Ludovic
> 
> > +	if (IS_ERR(host))
> > +		return PTR_ERR(host);
> > +
> > +	pltfm_host = sdhci_priv(host);
> > +	priv = sdhci_pltfm_priv(pltfm_host);
> >  
> >  	priv->mainck = devm_clk_get(&pdev->dev, "baseclk");
> >  	if (IS_ERR(priv->mainck)) {
> > @@ -92,10 +94,6 @@ static int sdhci_at91_probe(struct platform_device *pdev)
> >  		return PTR_ERR(priv->gck);
> >  	}
> >  
> > -	host = sdhci_pltfm_init(pdev, soc_data, 0);
> > -	if (IS_ERR(host))
> > -		return PTR_ERR(host);
> > -
> >  	/*
> >  	 * The mult clock is provided by as a generated clock by the PMC
> >  	 * controller. In order to set the rate of gck, we have to get the
> > @@ -135,9 +133,6 @@ static int sdhci_at91_probe(struct platform_device *pdev)
> >  	clk_prepare_enable(priv->mainck);
> >  	clk_prepare_enable(priv->gck);
> >  
> > -	pltfm_host = sdhci_priv(host);
> > -	pltfm_host->priv = priv;
> > -
> >  	ret = mmc_of_parse(host->mmc);
> >  	if (ret)
> >  		goto clocks_disable_unprepare;
> > @@ -163,7 +158,7 @@ static int sdhci_at91_remove(struct platform_device *pdev)
> >  {
> >  	struct sdhci_host	*host = platform_get_drvdata(pdev);
> >  	struct sdhci_pltfm_host	*pltfm_host = sdhci_priv(host);
> > -	struct sdhci_at91_priv	*priv = pltfm_host->priv;
> > +	struct sdhci_at91_priv	*priv = sdhci_pltfm_priv(pltfm_host);
> >  
> >  	sdhci_pltfm_unregister(pdev);
> >  
> > -- 
> > 2.7.0.rc3
> >   


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

* [PATCH v2 06/12] mmc: sdhci-of-at91: use sdhci_pltfm_init for private allocation
@ 2016-01-06  9:22         ` Jisheng Zhang
  0 siblings, 0 replies; 51+ messages in thread
From: Jisheng Zhang @ 2016-01-06  9:22 UTC (permalink / raw)
  To: linux-arm-kernel

Dear Ludovic,

On Wed, 6 Jan 2016 10:02:15 +0100 Ludovic Desroches wrote:

> Hi Jisheng,
> 
> Thanks for your patch but it needs to be updated since it breaks this
> driver.
> 
> -       struct sdhci_at91_priv  *priv = pltfm_host->priv;
> +       struct sdhci_at91_priv  *priv = sdhci_pltfm_priv(pltfm_host);
> 
> is missing in sdhci_at91_runtime_suspend and sdhci_at91_runtime_resume
> causing a NULL pointer dereference.

My code base is 4.4-rc8.
I didn't see sdhci_at91_runtime_suspend and sdhci_at91_runtime_resume
functions in the sdhci-of-at91.c. Seems the at91 runtime pm support
is newly added and intends for 4.5.

So the question is which code base should I use? 

Hi Ulf,

could you please give some suggestions?

Thanks in advance,
Jisheng

> 
> On Wed, Jan 06, 2016 at 11:55:59AM +0800, Jisheng Zhang wrote:
> > Commit 0e748234293f ("mmc: sdhci: Add size for caller in init+register")
> > allows users of sdhci_pltfm to allocate private space in calls to
> > sdhci_pltfm_init+sdhci_pltfm_register. This patch migrates the
> > sdhci-of-at91 driver to this allocation.
> > 
> > Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
> > Acked-by: Arnd Bergmann <arnd@arndb.de>
> > ---
> >  drivers/mmc/host/sdhci-of-at91.c | 21 ++++++++-------------
> >  1 file changed, 8 insertions(+), 13 deletions(-)
> > 
> > diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
> > index 06d0b50..765eb09 100644
> > --- a/drivers/mmc/host/sdhci-of-at91.c
> > +++ b/drivers/mmc/host/sdhci-of-at91.c
> > @@ -68,11 +68,13 @@ static int sdhci_at91_probe(struct platform_device *pdev)
> >  		return -EINVAL;
> >  	soc_data = match->data;
> >  
> > -	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
> > -	if (!priv) {
> > -		dev_err(&pdev->dev, "unable to allocate private data\n");
> > -		return -ENOMEM;
> > -	}
> > +	host = sdhci_pltfm_init(pdev, soc_data,
> > +				sizeof(*priv));  
> 
> Can be on the same line.

Great! will do in v3.

> 
> Regards
> 
> Ludovic
> 
> > +	if (IS_ERR(host))
> > +		return PTR_ERR(host);
> > +
> > +	pltfm_host = sdhci_priv(host);
> > +	priv = sdhci_pltfm_priv(pltfm_host);
> >  
> >  	priv->mainck = devm_clk_get(&pdev->dev, "baseclk");
> >  	if (IS_ERR(priv->mainck)) {
> > @@ -92,10 +94,6 @@ static int sdhci_at91_probe(struct platform_device *pdev)
> >  		return PTR_ERR(priv->gck);
> >  	}
> >  
> > -	host = sdhci_pltfm_init(pdev, soc_data, 0);
> > -	if (IS_ERR(host))
> > -		return PTR_ERR(host);
> > -
> >  	/*
> >  	 * The mult clock is provided by as a generated clock by the PMC
> >  	 * controller. In order to set the rate of gck, we have to get the
> > @@ -135,9 +133,6 @@ static int sdhci_at91_probe(struct platform_device *pdev)
> >  	clk_prepare_enable(priv->mainck);
> >  	clk_prepare_enable(priv->gck);
> >  
> > -	pltfm_host = sdhci_priv(host);
> > -	pltfm_host->priv = priv;
> > -
> >  	ret = mmc_of_parse(host->mmc);
> >  	if (ret)
> >  		goto clocks_disable_unprepare;
> > @@ -163,7 +158,7 @@ static int sdhci_at91_remove(struct platform_device *pdev)
> >  {
> >  	struct sdhci_host	*host = platform_get_drvdata(pdev);
> >  	struct sdhci_pltfm_host	*pltfm_host = sdhci_priv(host);
> > -	struct sdhci_at91_priv	*priv = pltfm_host->priv;
> > +	struct sdhci_at91_priv	*priv = sdhci_pltfm_priv(pltfm_host);
> >  
> >  	sdhci_pltfm_unregister(pdev);
> >  
> > -- 
> > 2.7.0.rc3
> >   

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

* Re: [PATCH v2 06/12] mmc: sdhci-of-at91: use sdhci_pltfm_init for private allocation
  2016-01-06  9:22         ` Jisheng Zhang
  (?)
@ 2016-01-06  9:34           ` Jisheng Zhang
  -1 siblings, 0 replies; 51+ messages in thread
From: Jisheng Zhang @ 2016-01-06  9:34 UTC (permalink / raw)
  To: Ludovic Desroches
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	ulf.hansson-QSEj5FYQhm4dnm+yROfE0A,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	kernel-F5mvAk5X5gdBDgjK7y7TUQ, arnd-r2nGTMty4D4,
	swarren-3lzwWm7+Weoh9ZMKESR00Q,
	srinivas.kandagatla-Re5JQEeQqe8AvxtiuMwx3w,
	lee-DgEjT+Ai2ygdnm+yROfE0A, linux-mmc-u79uwXL29TY76Z2rM5mHXA,
	michal.simek-gjFFaj9aHVfQT0dZR+AlfA, patrice.chotard-qxv4g6HH51o,
	eric-WhKQ6XTQaPysTnJN9+BGXg,
	thierry.reding-Re5JQEeQqe8AvxtiuMwx3w,
	linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w,
	soren.brinkmann-gjFFaj9aHVfQT0dZR+AlfA,
	maxime.coquelin-qxv4g6HH51o

Dear Ulf,

On Wed, 6 Jan 2016 17:22:48 +0800 Jisheng Zhang wrote:

> Dear Ludovic,
> 
> On Wed, 6 Jan 2016 10:02:15 +0100 Ludovic Desroches wrote:
> 
> > Hi Jisheng,
> > 
> > Thanks for your patch but it needs to be updated since it breaks this
> > driver.
> > 
> > -       struct sdhci_at91_priv  *priv = pltfm_host->priv;
> > +       struct sdhci_at91_priv  *priv = sdhci_pltfm_priv(pltfm_host);
> > 
> > is missing in sdhci_at91_runtime_suspend and sdhci_at91_runtime_resume
> > causing a NULL pointer dereference.  
> 
> My code base is 4.4-rc8.
> I didn't see sdhci_at91_runtime_suspend and sdhci_at91_runtime_resume
> functions in the sdhci-of-at91.c. Seems the at91 runtime pm support
> is newly added and intends for 4.5.
> 
> So the question is which code base should I use? 

To smooth the patch progress,
I'll post v3 based on git://git.linaro.org/people/ulf.hansson/mmc next branch

Thanks,
Jisheng

> 
> Hi Ulf,
> 
> could you please give some suggestions?
> 
> Thanks in advance,
> Jisheng
> 
> > 
> > On Wed, Jan 06, 2016 at 11:55:59AM +0800, Jisheng Zhang wrote:  
> > > Commit 0e748234293f ("mmc: sdhci: Add size for caller in init+register")
> > > allows users of sdhci_pltfm to allocate private space in calls to
> > > sdhci_pltfm_init+sdhci_pltfm_register. This patch migrates the
> > > sdhci-of-at91 driver to this allocation.
> > > 
> > > Signed-off-by: Jisheng Zhang <jszhang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
> > > Acked-by: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
> > > ---
> > >  drivers/mmc/host/sdhci-of-at91.c | 21 ++++++++-------------
> > >  1 file changed, 8 insertions(+), 13 deletions(-)
> > > 
> > > diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
> > > index 06d0b50..765eb09 100644
> > > --- a/drivers/mmc/host/sdhci-of-at91.c
> > > +++ b/drivers/mmc/host/sdhci-of-at91.c
> > > @@ -68,11 +68,13 @@ static int sdhci_at91_probe(struct platform_device *pdev)
> > >  		return -EINVAL;
> > >  	soc_data = match->data;
> > >  
> > > -	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
> > > -	if (!priv) {
> > > -		dev_err(&pdev->dev, "unable to allocate private data\n");
> > > -		return -ENOMEM;
> > > -	}
> > > +	host = sdhci_pltfm_init(pdev, soc_data,
> > > +				sizeof(*priv));    
> > 
> > Can be on the same line.  
> 
> Great! will do in v3.
> 
> > 
> > Regards
> > 
> > Ludovic
> >   
> > > +	if (IS_ERR(host))
> > > +		return PTR_ERR(host);
> > > +
> > > +	pltfm_host = sdhci_priv(host);
> > > +	priv = sdhci_pltfm_priv(pltfm_host);
> > >  
> > >  	priv->mainck = devm_clk_get(&pdev->dev, "baseclk");
> > >  	if (IS_ERR(priv->mainck)) {
> > > @@ -92,10 +94,6 @@ static int sdhci_at91_probe(struct platform_device *pdev)
> > >  		return PTR_ERR(priv->gck);
> > >  	}
> > >  
> > > -	host = sdhci_pltfm_init(pdev, soc_data, 0);
> > > -	if (IS_ERR(host))
> > > -		return PTR_ERR(host);
> > > -
> > >  	/*
> > >  	 * The mult clock is provided by as a generated clock by the PMC
> > >  	 * controller. In order to set the rate of gck, we have to get the
> > > @@ -135,9 +133,6 @@ static int sdhci_at91_probe(struct platform_device *pdev)
> > >  	clk_prepare_enable(priv->mainck);
> > >  	clk_prepare_enable(priv->gck);
> > >  
> > > -	pltfm_host = sdhci_priv(host);
> > > -	pltfm_host->priv = priv;
> > > -
> > >  	ret = mmc_of_parse(host->mmc);
> > >  	if (ret)
> > >  		goto clocks_disable_unprepare;
> > > @@ -163,7 +158,7 @@ static int sdhci_at91_remove(struct platform_device *pdev)
> > >  {
> > >  	struct sdhci_host	*host = platform_get_drvdata(pdev);
> > >  	struct sdhci_pltfm_host	*pltfm_host = sdhci_priv(host);
> > > -	struct sdhci_at91_priv	*priv = pltfm_host->priv;
> > > +	struct sdhci_at91_priv	*priv = sdhci_pltfm_priv(pltfm_host);
> > >  
> > >  	sdhci_pltfm_unregister(pdev);
> > >  
> > > -- 
> > > 2.7.0.rc3
> > >     
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 06/12] mmc: sdhci-of-at91: use sdhci_pltfm_init for private allocation
@ 2016-01-06  9:34           ` Jisheng Zhang
  0 siblings, 0 replies; 51+ messages in thread
From: Jisheng Zhang @ 2016-01-06  9:34 UTC (permalink / raw)
  To: Ludovic Desroches
  Cc: linux-arm-kernel, ulf.hansson, linux-kernel, kernel, arnd,
	swarren, srinivas.kandagatla, lee, linux-mmc, michal.simek,
	patrice.chotard, eric, thierry.reding, linux-rpi-kernel,
	linux-tegra, sebastian.hesselbarth, soren.brinkmann,
	maxime.coquelin

Dear Ulf,

On Wed, 6 Jan 2016 17:22:48 +0800 Jisheng Zhang wrote:

> Dear Ludovic,
> 
> On Wed, 6 Jan 2016 10:02:15 +0100 Ludovic Desroches wrote:
> 
> > Hi Jisheng,
> > 
> > Thanks for your patch but it needs to be updated since it breaks this
> > driver.
> > 
> > -       struct sdhci_at91_priv  *priv = pltfm_host->priv;
> > +       struct sdhci_at91_priv  *priv = sdhci_pltfm_priv(pltfm_host);
> > 
> > is missing in sdhci_at91_runtime_suspend and sdhci_at91_runtime_resume
> > causing a NULL pointer dereference.  
> 
> My code base is 4.4-rc8.
> I didn't see sdhci_at91_runtime_suspend and sdhci_at91_runtime_resume
> functions in the sdhci-of-at91.c. Seems the at91 runtime pm support
> is newly added and intends for 4.5.
> 
> So the question is which code base should I use? 

To smooth the patch progress,
I'll post v3 based on git://git.linaro.org/people/ulf.hansson/mmc next branch

Thanks,
Jisheng

> 
> Hi Ulf,
> 
> could you please give some suggestions?
> 
> Thanks in advance,
> Jisheng
> 
> > 
> > On Wed, Jan 06, 2016 at 11:55:59AM +0800, Jisheng Zhang wrote:  
> > > Commit 0e748234293f ("mmc: sdhci: Add size for caller in init+register")
> > > allows users of sdhci_pltfm to allocate private space in calls to
> > > sdhci_pltfm_init+sdhci_pltfm_register. This patch migrates the
> > > sdhci-of-at91 driver to this allocation.
> > > 
> > > Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
> > > Acked-by: Arnd Bergmann <arnd@arndb.de>
> > > ---
> > >  drivers/mmc/host/sdhci-of-at91.c | 21 ++++++++-------------
> > >  1 file changed, 8 insertions(+), 13 deletions(-)
> > > 
> > > diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
> > > index 06d0b50..765eb09 100644
> > > --- a/drivers/mmc/host/sdhci-of-at91.c
> > > +++ b/drivers/mmc/host/sdhci-of-at91.c
> > > @@ -68,11 +68,13 @@ static int sdhci_at91_probe(struct platform_device *pdev)
> > >  		return -EINVAL;
> > >  	soc_data = match->data;
> > >  
> > > -	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
> > > -	if (!priv) {
> > > -		dev_err(&pdev->dev, "unable to allocate private data\n");
> > > -		return -ENOMEM;
> > > -	}
> > > +	host = sdhci_pltfm_init(pdev, soc_data,
> > > +				sizeof(*priv));    
> > 
> > Can be on the same line.  
> 
> Great! will do in v3.
> 
> > 
> > Regards
> > 
> > Ludovic
> >   
> > > +	if (IS_ERR(host))
> > > +		return PTR_ERR(host);
> > > +
> > > +	pltfm_host = sdhci_priv(host);
> > > +	priv = sdhci_pltfm_priv(pltfm_host);
> > >  
> > >  	priv->mainck = devm_clk_get(&pdev->dev, "baseclk");
> > >  	if (IS_ERR(priv->mainck)) {
> > > @@ -92,10 +94,6 @@ static int sdhci_at91_probe(struct platform_device *pdev)
> > >  		return PTR_ERR(priv->gck);
> > >  	}
> > >  
> > > -	host = sdhci_pltfm_init(pdev, soc_data, 0);
> > > -	if (IS_ERR(host))
> > > -		return PTR_ERR(host);
> > > -
> > >  	/*
> > >  	 * The mult clock is provided by as a generated clock by the PMC
> > >  	 * controller. In order to set the rate of gck, we have to get the
> > > @@ -135,9 +133,6 @@ static int sdhci_at91_probe(struct platform_device *pdev)
> > >  	clk_prepare_enable(priv->mainck);
> > >  	clk_prepare_enable(priv->gck);
> > >  
> > > -	pltfm_host = sdhci_priv(host);
> > > -	pltfm_host->priv = priv;
> > > -
> > >  	ret = mmc_of_parse(host->mmc);
> > >  	if (ret)
> > >  		goto clocks_disable_unprepare;
> > > @@ -163,7 +158,7 @@ static int sdhci_at91_remove(struct platform_device *pdev)
> > >  {
> > >  	struct sdhci_host	*host = platform_get_drvdata(pdev);
> > >  	struct sdhci_pltfm_host	*pltfm_host = sdhci_priv(host);
> > > -	struct sdhci_at91_priv	*priv = pltfm_host->priv;
> > > +	struct sdhci_at91_priv	*priv = sdhci_pltfm_priv(pltfm_host);
> > >  
> > >  	sdhci_pltfm_unregister(pdev);
> > >  
> > > -- 
> > > 2.7.0.rc3
> > >     
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel


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

* [PATCH v2 06/12] mmc: sdhci-of-at91: use sdhci_pltfm_init for private allocation
@ 2016-01-06  9:34           ` Jisheng Zhang
  0 siblings, 0 replies; 51+ messages in thread
From: Jisheng Zhang @ 2016-01-06  9:34 UTC (permalink / raw)
  To: linux-arm-kernel

Dear Ulf,

On Wed, 6 Jan 2016 17:22:48 +0800 Jisheng Zhang wrote:

> Dear Ludovic,
> 
> On Wed, 6 Jan 2016 10:02:15 +0100 Ludovic Desroches wrote:
> 
> > Hi Jisheng,
> > 
> > Thanks for your patch but it needs to be updated since it breaks this
> > driver.
> > 
> > -       struct sdhci_at91_priv  *priv = pltfm_host->priv;
> > +       struct sdhci_at91_priv  *priv = sdhci_pltfm_priv(pltfm_host);
> > 
> > is missing in sdhci_at91_runtime_suspend and sdhci_at91_runtime_resume
> > causing a NULL pointer dereference.  
> 
> My code base is 4.4-rc8.
> I didn't see sdhci_at91_runtime_suspend and sdhci_at91_runtime_resume
> functions in the sdhci-of-at91.c. Seems the at91 runtime pm support
> is newly added and intends for 4.5.
> 
> So the question is which code base should I use? 

To smooth the patch progress,
I'll post v3 based on git://git.linaro.org/people/ulf.hansson/mmc next branch

Thanks,
Jisheng

> 
> Hi Ulf,
> 
> could you please give some suggestions?
> 
> Thanks in advance,
> Jisheng
> 
> > 
> > On Wed, Jan 06, 2016 at 11:55:59AM +0800, Jisheng Zhang wrote:  
> > > Commit 0e748234293f ("mmc: sdhci: Add size for caller in init+register")
> > > allows users of sdhci_pltfm to allocate private space in calls to
> > > sdhci_pltfm_init+sdhci_pltfm_register. This patch migrates the
> > > sdhci-of-at91 driver to this allocation.
> > > 
> > > Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
> > > Acked-by: Arnd Bergmann <arnd@arndb.de>
> > > ---
> > >  drivers/mmc/host/sdhci-of-at91.c | 21 ++++++++-------------
> > >  1 file changed, 8 insertions(+), 13 deletions(-)
> > > 
> > > diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
> > > index 06d0b50..765eb09 100644
> > > --- a/drivers/mmc/host/sdhci-of-at91.c
> > > +++ b/drivers/mmc/host/sdhci-of-at91.c
> > > @@ -68,11 +68,13 @@ static int sdhci_at91_probe(struct platform_device *pdev)
> > >  		return -EINVAL;
> > >  	soc_data = match->data;
> > >  
> > > -	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
> > > -	if (!priv) {
> > > -		dev_err(&pdev->dev, "unable to allocate private data\n");
> > > -		return -ENOMEM;
> > > -	}
> > > +	host = sdhci_pltfm_init(pdev, soc_data,
> > > +				sizeof(*priv));    
> > 
> > Can be on the same line.  
> 
> Great! will do in v3.
> 
> > 
> > Regards
> > 
> > Ludovic
> >   
> > > +	if (IS_ERR(host))
> > > +		return PTR_ERR(host);
> > > +
> > > +	pltfm_host = sdhci_priv(host);
> > > +	priv = sdhci_pltfm_priv(pltfm_host);
> > >  
> > >  	priv->mainck = devm_clk_get(&pdev->dev, "baseclk");
> > >  	if (IS_ERR(priv->mainck)) {
> > > @@ -92,10 +94,6 @@ static int sdhci_at91_probe(struct platform_device *pdev)
> > >  		return PTR_ERR(priv->gck);
> > >  	}
> > >  
> > > -	host = sdhci_pltfm_init(pdev, soc_data, 0);
> > > -	if (IS_ERR(host))
> > > -		return PTR_ERR(host);
> > > -
> > >  	/*
> > >  	 * The mult clock is provided by as a generated clock by the PMC
> > >  	 * controller. In order to set the rate of gck, we have to get the
> > > @@ -135,9 +133,6 @@ static int sdhci_at91_probe(struct platform_device *pdev)
> > >  	clk_prepare_enable(priv->mainck);
> > >  	clk_prepare_enable(priv->gck);
> > >  
> > > -	pltfm_host = sdhci_priv(host);
> > > -	pltfm_host->priv = priv;
> > > -
> > >  	ret = mmc_of_parse(host->mmc);
> > >  	if (ret)
> > >  		goto clocks_disable_unprepare;
> > > @@ -163,7 +158,7 @@ static int sdhci_at91_remove(struct platform_device *pdev)
> > >  {
> > >  	struct sdhci_host	*host = platform_get_drvdata(pdev);
> > >  	struct sdhci_pltfm_host	*pltfm_host = sdhci_priv(host);
> > > -	struct sdhci_at91_priv	*priv = pltfm_host->priv;
> > > +	struct sdhci_at91_priv	*priv = sdhci_pltfm_priv(pltfm_host);
> > >  
> > >  	sdhci_pltfm_unregister(pdev);
> > >  
> > > -- 
> > > 2.7.0.rc3
> > >     
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 06/12] mmc: sdhci-of-at91: use sdhci_pltfm_init for private allocation
  2016-01-06  9:22         ` Jisheng Zhang
  (?)
@ 2016-01-06 10:11           ` Ludovic Desroches
  -1 siblings, 0 replies; 51+ messages in thread
From: Ludovic Desroches @ 2016-01-06 10:11 UTC (permalink / raw)
  To: Jisheng Zhang
  Cc: Ludovic Desroches, ulf.hansson, arnd, swarren, lee, eric,
	michal.simek, soren.brinkmann, srinivas.kandagatla,
	maxime.coquelin, patrice.chotard, thierry.reding,
	sebastian.hesselbarth, linux-mmc, linux-rpi-kernel,
	linux-arm-kernel, linux-kernel, kernel, linux-tegra

On Wed, Jan 06, 2016 at 05:22:48PM +0800, Jisheng Zhang wrote:
> Dear Ludovic,
> 
> On Wed, 6 Jan 2016 10:02:15 +0100 Ludovic Desroches wrote:
> 
> > Hi Jisheng,
> > 
> > Thanks for your patch but it needs to be updated since it breaks this
> > driver.
> > 
> > -       struct sdhci_at91_priv  *priv = pltfm_host->priv;
> > +       struct sdhci_at91_priv  *priv = sdhci_pltfm_priv(pltfm_host);
> > 
> > is missing in sdhci_at91_runtime_suspend and sdhci_at91_runtime_resume
> > causing a NULL pointer dereference.
> 
> My code base is 4.4-rc8.
> I didn't see sdhci_at91_runtime_suspend and sdhci_at91_runtime_resume
> functions in the sdhci-of-at91.c. Seems the at91 runtime pm support
> is newly added and intends for 4.5.
> 
> So the question is which code base should I use? 

I did the test on next-20151222 since next-20160104 is broken for many
ARM SoC.

> 
> Hi Ulf,
> 
> could you please give some suggestions?
> 
> Thanks in advance,
> Jisheng
> 
> > 
> > On Wed, Jan 06, 2016 at 11:55:59AM +0800, Jisheng Zhang wrote:
> > > Commit 0e748234293f ("mmc: sdhci: Add size for caller in init+register")
> > > allows users of sdhci_pltfm to allocate private space in calls to
> > > sdhci_pltfm_init+sdhci_pltfm_register. This patch migrates the
> > > sdhci-of-at91 driver to this allocation.
> > > 
> > > Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
> > > Acked-by: Arnd Bergmann <arnd@arndb.de>
> > > ---
> > >  drivers/mmc/host/sdhci-of-at91.c | 21 ++++++++-------------
> > >  1 file changed, 8 insertions(+), 13 deletions(-)
> > > 
> > > diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
> > > index 06d0b50..765eb09 100644
> > > --- a/drivers/mmc/host/sdhci-of-at91.c
> > > +++ b/drivers/mmc/host/sdhci-of-at91.c
> > > @@ -68,11 +68,13 @@ static int sdhci_at91_probe(struct platform_device *pdev)
> > >  		return -EINVAL;
> > >  	soc_data = match->data;
> > >  
> > > -	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
> > > -	if (!priv) {
> > > -		dev_err(&pdev->dev, "unable to allocate private data\n");
> > > -		return -ENOMEM;
> > > -	}
> > > +	host = sdhci_pltfm_init(pdev, soc_data,
> > > +				sizeof(*priv));  
> > 
> > Can be on the same line.
> 
> Great! will do in v3.
> 
> > 
> > Regards
> > 
> > Ludovic
> > 
> > > +	if (IS_ERR(host))
> > > +		return PTR_ERR(host);
> > > +
> > > +	pltfm_host = sdhci_priv(host);
> > > +	priv = sdhci_pltfm_priv(pltfm_host);
> > >  
> > >  	priv->mainck = devm_clk_get(&pdev->dev, "baseclk");
> > >  	if (IS_ERR(priv->mainck)) {
> > > @@ -92,10 +94,6 @@ static int sdhci_at91_probe(struct platform_device *pdev)
> > >  		return PTR_ERR(priv->gck);
> > >  	}
> > >  
> > > -	host = sdhci_pltfm_init(pdev, soc_data, 0);
> > > -	if (IS_ERR(host))
> > > -		return PTR_ERR(host);
> > > -
> > >  	/*
> > >  	 * The mult clock is provided by as a generated clock by the PMC
> > >  	 * controller. In order to set the rate of gck, we have to get the
> > > @@ -135,9 +133,6 @@ static int sdhci_at91_probe(struct platform_device *pdev)
> > >  	clk_prepare_enable(priv->mainck);
> > >  	clk_prepare_enable(priv->gck);
> > >  
> > > -	pltfm_host = sdhci_priv(host);
> > > -	pltfm_host->priv = priv;
> > > -
> > >  	ret = mmc_of_parse(host->mmc);
> > >  	if (ret)
> > >  		goto clocks_disable_unprepare;
> > > @@ -163,7 +158,7 @@ static int sdhci_at91_remove(struct platform_device *pdev)
> > >  {
> > >  	struct sdhci_host	*host = platform_get_drvdata(pdev);
> > >  	struct sdhci_pltfm_host	*pltfm_host = sdhci_priv(host);
> > > -	struct sdhci_at91_priv	*priv = pltfm_host->priv;
> > > +	struct sdhci_at91_priv	*priv = sdhci_pltfm_priv(pltfm_host);
> > >  
> > >  	sdhci_pltfm_unregister(pdev);
> > >  
> > > -- 
> > > 2.7.0.rc3
> > >   
> 

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

* Re: [PATCH v2 06/12] mmc: sdhci-of-at91: use sdhci_pltfm_init for private allocation
@ 2016-01-06 10:11           ` Ludovic Desroches
  0 siblings, 0 replies; 51+ messages in thread
From: Ludovic Desroches @ 2016-01-06 10:11 UTC (permalink / raw)
  To: Jisheng Zhang
  Cc: Ludovic Desroches, ulf.hansson, arnd, swarren, lee, eric,
	michal.simek, soren.brinkmann, srinivas.kandagatla,
	maxime.coquelin, patrice.chotard, thierry.reding,
	sebastian.hesselbarth, linux-mmc, linux-rpi-kernel,
	linux-arm-kernel, linux-kernel, kernel, linux-tegra

On Wed, Jan 06, 2016 at 05:22:48PM +0800, Jisheng Zhang wrote:
> Dear Ludovic,
> 
> On Wed, 6 Jan 2016 10:02:15 +0100 Ludovic Desroches wrote:
> 
> > Hi Jisheng,
> > 
> > Thanks for your patch but it needs to be updated since it breaks this
> > driver.
> > 
> > -       struct sdhci_at91_priv  *priv = pltfm_host->priv;
> > +       struct sdhci_at91_priv  *priv = sdhci_pltfm_priv(pltfm_host);
> > 
> > is missing in sdhci_at91_runtime_suspend and sdhci_at91_runtime_resume
> > causing a NULL pointer dereference.
> 
> My code base is 4.4-rc8.
> I didn't see sdhci_at91_runtime_suspend and sdhci_at91_runtime_resume
> functions in the sdhci-of-at91.c. Seems the at91 runtime pm support
> is newly added and intends for 4.5.
> 
> So the question is which code base should I use? 

I did the test on next-20151222 since next-20160104 is broken for many
ARM SoC.

> 
> Hi Ulf,
> 
> could you please give some suggestions?
> 
> Thanks in advance,
> Jisheng
> 
> > 
> > On Wed, Jan 06, 2016 at 11:55:59AM +0800, Jisheng Zhang wrote:
> > > Commit 0e748234293f ("mmc: sdhci: Add size for caller in init+register")
> > > allows users of sdhci_pltfm to allocate private space in calls to
> > > sdhci_pltfm_init+sdhci_pltfm_register. This patch migrates the
> > > sdhci-of-at91 driver to this allocation.
> > > 
> > > Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
> > > Acked-by: Arnd Bergmann <arnd@arndb.de>
> > > ---
> > >  drivers/mmc/host/sdhci-of-at91.c | 21 ++++++++-------------
> > >  1 file changed, 8 insertions(+), 13 deletions(-)
> > > 
> > > diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
> > > index 06d0b50..765eb09 100644
> > > --- a/drivers/mmc/host/sdhci-of-at91.c
> > > +++ b/drivers/mmc/host/sdhci-of-at91.c
> > > @@ -68,11 +68,13 @@ static int sdhci_at91_probe(struct platform_device *pdev)
> > >  		return -EINVAL;
> > >  	soc_data = match->data;
> > >  
> > > -	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
> > > -	if (!priv) {
> > > -		dev_err(&pdev->dev, "unable to allocate private data\n");
> > > -		return -ENOMEM;
> > > -	}
> > > +	host = sdhci_pltfm_init(pdev, soc_data,
> > > +				sizeof(*priv));  
> > 
> > Can be on the same line.
> 
> Great! will do in v3.
> 
> > 
> > Regards
> > 
> > Ludovic
> > 
> > > +	if (IS_ERR(host))
> > > +		return PTR_ERR(host);
> > > +
> > > +	pltfm_host = sdhci_priv(host);
> > > +	priv = sdhci_pltfm_priv(pltfm_host);
> > >  
> > >  	priv->mainck = devm_clk_get(&pdev->dev, "baseclk");
> > >  	if (IS_ERR(priv->mainck)) {
> > > @@ -92,10 +94,6 @@ static int sdhci_at91_probe(struct platform_device *pdev)
> > >  		return PTR_ERR(priv->gck);
> > >  	}
> > >  
> > > -	host = sdhci_pltfm_init(pdev, soc_data, 0);
> > > -	if (IS_ERR(host))
> > > -		return PTR_ERR(host);
> > > -
> > >  	/*
> > >  	 * The mult clock is provided by as a generated clock by the PMC
> > >  	 * controller. In order to set the rate of gck, we have to get the
> > > @@ -135,9 +133,6 @@ static int sdhci_at91_probe(struct platform_device *pdev)
> > >  	clk_prepare_enable(priv->mainck);
> > >  	clk_prepare_enable(priv->gck);
> > >  
> > > -	pltfm_host = sdhci_priv(host);
> > > -	pltfm_host->priv = priv;
> > > -
> > >  	ret = mmc_of_parse(host->mmc);
> > >  	if (ret)
> > >  		goto clocks_disable_unprepare;
> > > @@ -163,7 +158,7 @@ static int sdhci_at91_remove(struct platform_device *pdev)
> > >  {
> > >  	struct sdhci_host	*host = platform_get_drvdata(pdev);
> > >  	struct sdhci_pltfm_host	*pltfm_host = sdhci_priv(host);
> > > -	struct sdhci_at91_priv	*priv = pltfm_host->priv;
> > > +	struct sdhci_at91_priv	*priv = sdhci_pltfm_priv(pltfm_host);
> > >  
> > >  	sdhci_pltfm_unregister(pdev);
> > >  
> > > -- 
> > > 2.7.0.rc3
> > >   
> 

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

* [PATCH v2 06/12] mmc: sdhci-of-at91: use sdhci_pltfm_init for private allocation
@ 2016-01-06 10:11           ` Ludovic Desroches
  0 siblings, 0 replies; 51+ messages in thread
From: Ludovic Desroches @ 2016-01-06 10:11 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jan 06, 2016 at 05:22:48PM +0800, Jisheng Zhang wrote:
> Dear Ludovic,
> 
> On Wed, 6 Jan 2016 10:02:15 +0100 Ludovic Desroches wrote:
> 
> > Hi Jisheng,
> > 
> > Thanks for your patch but it needs to be updated since it breaks this
> > driver.
> > 
> > -       struct sdhci_at91_priv  *priv = pltfm_host->priv;
> > +       struct sdhci_at91_priv  *priv = sdhci_pltfm_priv(pltfm_host);
> > 
> > is missing in sdhci_at91_runtime_suspend and sdhci_at91_runtime_resume
> > causing a NULL pointer dereference.
> 
> My code base is 4.4-rc8.
> I didn't see sdhci_at91_runtime_suspend and sdhci_at91_runtime_resume
> functions in the sdhci-of-at91.c. Seems the at91 runtime pm support
> is newly added and intends for 4.5.
> 
> So the question is which code base should I use? 

I did the test on next-20151222 since next-20160104 is broken for many
ARM SoC.

> 
> Hi Ulf,
> 
> could you please give some suggestions?
> 
> Thanks in advance,
> Jisheng
> 
> > 
> > On Wed, Jan 06, 2016 at 11:55:59AM +0800, Jisheng Zhang wrote:
> > > Commit 0e748234293f ("mmc: sdhci: Add size for caller in init+register")
> > > allows users of sdhci_pltfm to allocate private space in calls to
> > > sdhci_pltfm_init+sdhci_pltfm_register. This patch migrates the
> > > sdhci-of-at91 driver to this allocation.
> > > 
> > > Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
> > > Acked-by: Arnd Bergmann <arnd@arndb.de>
> > > ---
> > >  drivers/mmc/host/sdhci-of-at91.c | 21 ++++++++-------------
> > >  1 file changed, 8 insertions(+), 13 deletions(-)
> > > 
> > > diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
> > > index 06d0b50..765eb09 100644
> > > --- a/drivers/mmc/host/sdhci-of-at91.c
> > > +++ b/drivers/mmc/host/sdhci-of-at91.c
> > > @@ -68,11 +68,13 @@ static int sdhci_at91_probe(struct platform_device *pdev)
> > >  		return -EINVAL;
> > >  	soc_data = match->data;
> > >  
> > > -	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
> > > -	if (!priv) {
> > > -		dev_err(&pdev->dev, "unable to allocate private data\n");
> > > -		return -ENOMEM;
> > > -	}
> > > +	host = sdhci_pltfm_init(pdev, soc_data,
> > > +				sizeof(*priv));  
> > 
> > Can be on the same line.
> 
> Great! will do in v3.
> 
> > 
> > Regards
> > 
> > Ludovic
> > 
> > > +	if (IS_ERR(host))
> > > +		return PTR_ERR(host);
> > > +
> > > +	pltfm_host = sdhci_priv(host);
> > > +	priv = sdhci_pltfm_priv(pltfm_host);
> > >  
> > >  	priv->mainck = devm_clk_get(&pdev->dev, "baseclk");
> > >  	if (IS_ERR(priv->mainck)) {
> > > @@ -92,10 +94,6 @@ static int sdhci_at91_probe(struct platform_device *pdev)
> > >  		return PTR_ERR(priv->gck);
> > >  	}
> > >  
> > > -	host = sdhci_pltfm_init(pdev, soc_data, 0);
> > > -	if (IS_ERR(host))
> > > -		return PTR_ERR(host);
> > > -
> > >  	/*
> > >  	 * The mult clock is provided by as a generated clock by the PMC
> > >  	 * controller. In order to set the rate of gck, we have to get the
> > > @@ -135,9 +133,6 @@ static int sdhci_at91_probe(struct platform_device *pdev)
> > >  	clk_prepare_enable(priv->mainck);
> > >  	clk_prepare_enable(priv->gck);
> > >  
> > > -	pltfm_host = sdhci_priv(host);
> > > -	pltfm_host->priv = priv;
> > > -
> > >  	ret = mmc_of_parse(host->mmc);
> > >  	if (ret)
> > >  		goto clocks_disable_unprepare;
> > > @@ -163,7 +158,7 @@ static int sdhci_at91_remove(struct platform_device *pdev)
> > >  {
> > >  	struct sdhci_host	*host = platform_get_drvdata(pdev);
> > >  	struct sdhci_pltfm_host	*pltfm_host = sdhci_priv(host);
> > > -	struct sdhci_at91_priv	*priv = pltfm_host->priv;
> > > +	struct sdhci_at91_priv	*priv = sdhci_pltfm_priv(pltfm_host);
> > >  
> > >  	sdhci_pltfm_unregister(pdev);
> > >  
> > > -- 
> > > 2.7.0.rc3
> > >   
> 

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

end of thread, other threads:[~2016-01-06 10:11 UTC | newest]

Thread overview: 51+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-06  3:55 [PATCH v2 00/12] mmc: use sdhci_pltfm_init for private allocation and clean up Jisheng Zhang
2016-01-06  3:55 ` Jisheng Zhang
2016-01-06  3:55 ` Jisheng Zhang
2016-01-06  3:55 ` [PATCH v2 01/12] mmc: sdhci-bcm2835: use sdhci_pltfm_init for private allocation Jisheng Zhang
2016-01-06  3:55   ` Jisheng Zhang
2016-01-06  3:55   ` Jisheng Zhang
2016-01-06  3:55 ` [PATCH v2 03/12] mmc: sdhci-msm: factorise sdhci_msm_pdata outisde of sdhci_msm_host Jisheng Zhang
2016-01-06  3:55   ` Jisheng Zhang
2016-01-06  3:55   ` Jisheng Zhang
2016-01-06  3:55 ` [PATCH v2 04/12] mmc: sdhci-msm: use sdhci_pltfm_init for private allocation Jisheng Zhang
2016-01-06  3:55   ` Jisheng Zhang
2016-01-06  3:55   ` Jisheng Zhang
2016-01-06  3:55 ` [PATCH v2 05/12] mmc: sdhci-of-arasan: " Jisheng Zhang
2016-01-06  3:55   ` Jisheng Zhang
2016-01-06  3:55   ` Jisheng Zhang
2016-01-06  3:55 ` [PATCH v2 06/12] mmc: sdhci-of-at91: " Jisheng Zhang
2016-01-06  3:55   ` Jisheng Zhang
2016-01-06  3:55   ` Jisheng Zhang
     [not found]   ` <1452052565-4232-7-git-send-email-jszhang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2016-01-06  9:02     ` Ludovic Desroches
2016-01-06  9:02       ` Ludovic Desroches
2016-01-06  9:02       ` Ludovic Desroches
2016-01-06  9:22       ` Jisheng Zhang
2016-01-06  9:22         ` Jisheng Zhang
2016-01-06  9:22         ` Jisheng Zhang
2016-01-06  9:34         ` Jisheng Zhang
2016-01-06  9:34           ` Jisheng Zhang
2016-01-06  9:34           ` Jisheng Zhang
2016-01-06 10:11         ` Ludovic Desroches
2016-01-06 10:11           ` Ludovic Desroches
2016-01-06 10:11           ` Ludovic Desroches
     [not found] ` <1452052565-4232-1-git-send-email-jszhang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2016-01-06  3:55   ` [PATCH v2 02/12] mmc: sdhci-esdhc-imx: " Jisheng Zhang
2016-01-06  3:55     ` Jisheng Zhang
2016-01-06  3:55     ` Jisheng Zhang
2016-01-06  3:56   ` [PATCH v2 07/12] mmc: sdhci-of-esdhc: " Jisheng Zhang
2016-01-06  3:56     ` Jisheng Zhang
2016-01-06  3:56     ` Jisheng Zhang
2016-01-06  3:56   ` [PATCH v2 09/12] mmc: sdhci-st: " Jisheng Zhang
2016-01-06  3:56     ` Jisheng Zhang
2016-01-06  3:56     ` Jisheng Zhang
2016-01-06  3:56 ` [PATCH v2 08/12] mmc: sdhci-pxav3: " Jisheng Zhang
2016-01-06  3:56   ` Jisheng Zhang
2016-01-06  3:56   ` Jisheng Zhang
2016-01-06  3:56 ` [PATCH v2 10/12] mmc: sdhci-tegra: " Jisheng Zhang
2016-01-06  3:56   ` Jisheng Zhang
2016-01-06  3:56   ` Jisheng Zhang
2016-01-06  3:56 ` [PATCH v2 11/12] mmc: sdhci-pxav2: remove unnecessary assignment of pltfm_host->priv Jisheng Zhang
2016-01-06  3:56   ` Jisheng Zhang
2016-01-06  3:56   ` Jisheng Zhang
2016-01-06  3:56 ` [PATCH v2 12/12] mmc: sdhci-pltfm: remove priv variable from sdhci_pltfm_host Jisheng Zhang
2016-01-06  3:56   ` Jisheng Zhang
2016-01-06  3:56   ` Jisheng Zhang

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.