Linux-SPI Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH v1 1/6] mmc: core: Correct descriptions in mmc_of_parse()
@ 2021-04-19 11:24 Andy Shevchenko
  2021-04-19 11:24 ` [PATCH v1 2/6] mmc: core: Convert mmc_of_parse_voltage() to use device property API Andy Shevchenko
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Andy Shevchenko @ 2021-04-19 11:24 UTC (permalink / raw)
  To: Andy Shevchenko, Ulf Hansson, Haibo Chen, Fabio Estevam,
	Yangbo Lu, linux-mmc, devicetree, linux-kernel, linux-arm-kernel,
	linux-spi
  Cc: Rob Herring, Adrian Hunter, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, NXP Linux Team, Mark Brown

Since it has been converted to use device property API, the function
and field descriptions become outdated. Correct them.

Fixes: 73a47a9bb3e2 ("mmc: core: Use device_property_read instead of of_property_read")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/mmc/core/host.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index 9b89a91b6b47..ce030c5aa53c 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -209,8 +209,8 @@ mmc_of_parse_clk_phase(struct mmc_host *host, struct mmc_clk_phase_map *map)
 EXPORT_SYMBOL(mmc_of_parse_clk_phase);
 
 /**
- *	mmc_of_parse() - parse host's device-tree node
- *	@host: host whose node should be parsed.
+ * mmc_of_parse() - parse host's device properties
+ * @host: host whose properties should be parsed.
  *
  * To keep the rest of the MMC subsystem unaware of whether DT has been
  * used to to instantiate and configure this host instance or not, we
-- 
2.30.2


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

* [PATCH v1 2/6] mmc: core: Convert mmc_of_parse_voltage() to use device property API
  2021-04-19 11:24 [PATCH v1 1/6] mmc: core: Correct descriptions in mmc_of_parse() Andy Shevchenko
@ 2021-04-19 11:24 ` Andy Shevchenko
  2021-04-19 11:24 ` [PATCH v1 3/6] mmc: mmc_spi: Set up polling even if voltage-ranges is not present Andy Shevchenko
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2021-04-19 11:24 UTC (permalink / raw)
  To: Andy Shevchenko, Ulf Hansson, Haibo Chen, Fabio Estevam,
	Yangbo Lu, linux-mmc, devicetree, linux-kernel, linux-arm-kernel,
	linux-spi
  Cc: Rob Herring, Adrian Hunter, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, NXP Linux Team, Mark Brown

mmc_of_parse() for a few years has been using device property API.
Convert mmc_of_parse_voltage() as well.

At the same time switch users to new API.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/mmc/core/host.c            | 46 +++++++++++++++++++++---------
 drivers/mmc/host/mmc_spi.c         |  8 +++---
 drivers/mmc/host/of_mmc_spi.c      |  3 +-
 drivers/mmc/host/sdhci-esdhc-imx.c |  2 +-
 drivers/mmc/host/sdhci-of-esdhc.c  |  2 +-
 include/linux/mmc/host.h           |  2 +-
 6 files changed, 41 insertions(+), 22 deletions(-)

diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index ce030c5aa53c..793c7425d0dd 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -379,44 +379,62 @@ EXPORT_SYMBOL(mmc_of_parse);
 
 /**
  * mmc_of_parse_voltage - return mask of supported voltages
- * @np: The device node need to be parsed.
+ * @host: host whose properties should be parsed.
  * @mask: mask of voltages available for MMC/SD/SDIO
  *
- * Parse the "voltage-ranges" DT property, returning zero if it is not
+ * Parse the "voltage-ranges" property, returning zero if it is not
  * found, negative errno if the voltage-range specification is invalid,
  * or one if the voltage-range is specified and successfully parsed.
  */
-int mmc_of_parse_voltage(struct device_node *np, u32 *mask)
+int mmc_of_parse_voltage(struct mmc_host *host, u32 *mask)
 {
-	const u32 *voltage_ranges;
+	const char *prop = "voltage-ranges";
+	struct device *dev = host->parent;
+	u32 *voltage_ranges;
 	int num_ranges, i;
+	int ret;
 
-	voltage_ranges = of_get_property(np, "voltage-ranges", &num_ranges);
-	if (!voltage_ranges) {
-		pr_debug("%pOF: voltage-ranges unspecified\n", np);
+	if (!device_property_present(dev, prop)) {
+		dev_dbg(dev, "%s unspecified\n", prop);
 		return 0;
 	}
-	num_ranges = num_ranges / sizeof(*voltage_ranges) / 2;
+
+	ret = device_property_count_u32(dev, prop);
+	if (ret < 0)
+		return ret;
+
+	num_ranges = ret / 2;
 	if (!num_ranges) {
-		pr_err("%pOF: voltage-ranges empty\n", np);
+		dev_err(dev, "%s empty\n", prop);
 		return -EINVAL;
 	}
 
+	voltage_ranges = kcalloc(2 * num_ranges, sizeof(*voltage_ranges), GFP_KERNEL);
+	if (!voltage_ranges)
+		return -ENOMEM;
+
+	ret = device_property_read_u32_array(dev, prop, voltage_ranges, 2 * num_ranges);
+	if (ret) {
+		kfree(voltage_ranges);
+		return ret;
+	}
+
 	for (i = 0; i < num_ranges; i++) {
 		const int j = i * 2;
 		u32 ocr_mask;
 
-		ocr_mask = mmc_vddrange_to_ocrmask(
-				be32_to_cpu(voltage_ranges[j]),
-				be32_to_cpu(voltage_ranges[j + 1]));
+		ocr_mask = mmc_vddrange_to_ocrmask(voltage_ranges[j + 0],
+						   voltage_ranges[j + 1]);
 		if (!ocr_mask) {
-			pr_err("%pOF: voltage-range #%d is invalid\n",
-				np, i);
+			dev_err(dev, "range #%d in %s is invalid\n", i, prop);
+			kfree(voltage_ranges);
 			return -EINVAL;
 		}
 		*mask |= ocr_mask;
 	}
 
+	kfree(voltage_ranges);
+
 	return 1;
 }
 EXPORT_SYMBOL(mmc_of_parse_voltage);
diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c
index 02f4fd26e76a..9776a03a10f5 100644
--- a/drivers/mmc/host/mmc_spi.c
+++ b/drivers/mmc/host/mmc_spi.c
@@ -1397,6 +1397,8 @@ static int mmc_spi_probe(struct spi_device *spi)
 
 	host->ones = ones;
 
+	dev_set_drvdata(&spi->dev, mmc);
+
 	/* Platform data is used to hook up things like card sensing
 	 * and power switching gpios.
 	 */
@@ -1413,8 +1415,6 @@ static int mmc_spi_probe(struct spi_device *spi)
 			host->powerup_msecs = 250;
 	}
 
-	dev_set_drvdata(&spi->dev, mmc);
-
 	/* preallocate dma buffers */
 	host->data = kmalloc(sizeof(*host->data), GFP_KERNEL);
 	if (!host->data)
@@ -1494,8 +1494,8 @@ static int mmc_spi_probe(struct spi_device *spi)
 fail_dma:
 	kfree(host->data);
 fail_nobuf1:
-	mmc_free_host(mmc);
 	mmc_spi_put_pdata(spi);
+	mmc_free_host(mmc);
 nomem:
 	kfree(ones);
 	return status;
@@ -1518,8 +1518,8 @@ static int mmc_spi_remove(struct spi_device *spi)
 	kfree(host->ones);
 
 	spi->max_speed_hz = mmc->f_max;
-	mmc_free_host(mmc);
 	mmc_spi_put_pdata(spi);
+	mmc_free_host(mmc);
 	return 0;
 }
 
diff --git a/drivers/mmc/host/of_mmc_spi.c b/drivers/mmc/host/of_mmc_spi.c
index 3c4d950a4755..acd96ea399b8 100644
--- a/drivers/mmc/host/of_mmc_spi.c
+++ b/drivers/mmc/host/of_mmc_spi.c
@@ -54,6 +54,7 @@ static void of_mmc_spi_exit(struct device *dev, void *mmc)
 
 struct mmc_spi_platform_data *mmc_spi_get_pdata(struct spi_device *spi)
 {
+	struct mmc_host *mmc = dev_get_drvdata(&spi->dev);
 	struct device *dev = &spi->dev;
 	struct device_node *np = dev->of_node;
 	struct of_mmc_spi *oms;
@@ -65,7 +66,7 @@ struct mmc_spi_platform_data *mmc_spi_get_pdata(struct spi_device *spi)
 	if (!oms)
 		return NULL;
 
-	if (mmc_of_parse_voltage(np, &oms->pdata.ocr_mask) <= 0)
+	if (mmc_of_parse_voltage(mmc, &oms->pdata.ocr_mask) <= 0)
 		goto err_ocr;
 
 	oms->detect_irq = irq_of_parse_and_map(np, 0);
diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index a20459744d21..f39d85e8ea6d 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -1486,7 +1486,7 @@ sdhci_esdhc_imx_probe_dt(struct platform_device *pdev,
 	if (of_property_read_u32(np, "fsl,delay-line", &boarddata->delay_line))
 		boarddata->delay_line = 0;
 
-	mmc_of_parse_voltage(np, &host->ocr_mask);
+	mmc_of_parse_voltage(host->mmc, &host->ocr_mask);
 
 	if (esdhc_is_usdhc(imx_data)) {
 		imx_data->pins_100mhz = pinctrl_lookup_state(imx_data->pinctrl,
diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
index ab5ab969f711..a593b1fbd69e 100644
--- a/drivers/mmc/host/sdhci-of-esdhc.c
+++ b/drivers/mmc/host/sdhci-of-esdhc.c
@@ -1489,7 +1489,7 @@ static int sdhci_esdhc_probe(struct platform_device *pdev)
 	if (ret)
 		goto err;
 
-	mmc_of_parse_voltage(np, &host->ocr_mask);
+	mmc_of_parse_voltage(host->mmc, &host->ocr_mask);
 
 	ret = sdhci_add_host(host);
 	if (ret)
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 26a3c7bc29ae..ecd25a3b37f0 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -514,7 +514,7 @@ void mmc_free_host(struct mmc_host *);
 void mmc_of_parse_clk_phase(struct mmc_host *host,
 			    struct mmc_clk_phase_map *map);
 int mmc_of_parse(struct mmc_host *host);
-int mmc_of_parse_voltage(struct device_node *np, u32 *mask);
+int mmc_of_parse_voltage(struct mmc_host *host, u32 *mask);
 
 static inline void *mmc_priv(struct mmc_host *host)
 {
-- 
2.30.2


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

* [PATCH v1 3/6] mmc: mmc_spi: Set up polling even if voltage-ranges is not present
  2021-04-19 11:24 [PATCH v1 1/6] mmc: core: Correct descriptions in mmc_of_parse() Andy Shevchenko
  2021-04-19 11:24 ` [PATCH v1 2/6] mmc: core: Convert mmc_of_parse_voltage() to use device property API Andy Shevchenko
@ 2021-04-19 11:24 ` Andy Shevchenko
  2021-04-19 11:24 ` [PATCH v1 4/6] mmc: mmc_spi: Drop unused NO_IRQ definition Andy Shevchenko
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2021-04-19 11:24 UTC (permalink / raw)
  To: Andy Shevchenko, Ulf Hansson, Haibo Chen, Fabio Estevam,
	Yangbo Lu, linux-mmc, devicetree, linux-kernel, linux-arm-kernel,
	linux-spi
  Cc: Rob Herring, Adrian Hunter, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, NXP Linux Team, Mark Brown

When voltage-ranges property is not present the driver assumes that
it is 3.3v (3.2v..3.4v). But at the same time it disallows polling.

Fix that by dropping the comparison to 0 when no property is provided.

While at it, mark voltage-ranges property optional as it was initially.

Fixes: 9c43df57910b ("mmc_spi: Add support for OpenFirmware bindings")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 Documentation/devicetree/bindings/mmc/mmc-spi-slot.txt | 6 +++---
 drivers/mmc/host/of_mmc_spi.c                          | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/mmc/mmc-spi-slot.txt b/Documentation/devicetree/bindings/mmc/mmc-spi-slot.txt
index 75486cca8054..5e74db69f581 100644
--- a/Documentation/devicetree/bindings/mmc/mmc-spi-slot.txt
+++ b/Documentation/devicetree/bindings/mmc/mmc-spi-slot.txt
@@ -5,11 +5,11 @@ by mmc.txt and the properties used by the mmc_spi driver.
 
 Required properties:
 - spi-max-frequency : maximum frequency for this device (Hz).
-- voltage-ranges : two cells are required, first cell specifies minimum
-  slot voltage (mV), second cell specifies maximum slot voltage (mV).
-  Several ranges could be specified.
 
 Optional properties:
+- voltage-ranges : two cells are required, first cell specifies minimum
+  slot voltage (mV), second cell specifies maximum slot voltage (mV).
+  Several ranges could be specified. If not provided, 3.2v..3.4v is assumed.
 - gpios : may specify GPIOs in this order: Card-Detect GPIO,
   Write-Protect GPIO. Note that this does not follow the
   binding from mmc.txt, for historical reasons.
diff --git a/drivers/mmc/host/of_mmc_spi.c b/drivers/mmc/host/of_mmc_spi.c
index acd96ea399b8..843ec3db891b 100644
--- a/drivers/mmc/host/of_mmc_spi.c
+++ b/drivers/mmc/host/of_mmc_spi.c
@@ -66,7 +66,7 @@ struct mmc_spi_platform_data *mmc_spi_get_pdata(struct spi_device *spi)
 	if (!oms)
 		return NULL;
 
-	if (mmc_of_parse_voltage(mmc, &oms->pdata.ocr_mask) <= 0)
+	if (mmc_of_parse_voltage(mmc, &oms->pdata.ocr_mask) < 0)
 		goto err_ocr;
 
 	oms->detect_irq = irq_of_parse_and_map(np, 0);
-- 
2.30.2


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

* [PATCH v1 4/6] mmc: mmc_spi: Drop unused NO_IRQ definition
  2021-04-19 11:24 [PATCH v1 1/6] mmc: core: Correct descriptions in mmc_of_parse() Andy Shevchenko
  2021-04-19 11:24 ` [PATCH v1 2/6] mmc: core: Convert mmc_of_parse_voltage() to use device property API Andy Shevchenko
  2021-04-19 11:24 ` [PATCH v1 3/6] mmc: mmc_spi: Set up polling even if voltage-ranges is not present Andy Shevchenko
@ 2021-04-19 11:24 ` Andy Shevchenko
  2021-04-19 11:24 ` [PATCH v1 5/6] mmc: mmc_spi: Use already parsed IRQ Andy Shevchenko
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2021-04-19 11:24 UTC (permalink / raw)
  To: Andy Shevchenko, Ulf Hansson, Haibo Chen, Fabio Estevam,
	Yangbo Lu, linux-mmc, devicetree, linux-kernel, linux-arm-kernel,
	linux-spi
  Cc: Rob Herring, Adrian Hunter, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, NXP Linux Team, Mark Brown

After the commit 073350f7b562 ("mmc: mmc_spi: Fix return value evaluation of
irq_of_parse_and_map()") the NO_IRQ is not used anymore, drop it for good.

Fixes: 073350f7b562 ("mmc: mmc_spi: Fix return value evaluation of irq_of_parse_and_map()")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/mmc/host/of_mmc_spi.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/mmc/host/of_mmc_spi.c b/drivers/mmc/host/of_mmc_spi.c
index 843ec3db891b..0b038f5c392a 100644
--- a/drivers/mmc/host/of_mmc_spi.c
+++ b/drivers/mmc/host/of_mmc_spi.c
@@ -19,11 +19,6 @@
 #include <linux/mmc/core.h>
 #include <linux/mmc/host.h>
 
-/* For archs that don't support NO_IRQ (such as mips), provide a dummy value */
-#ifndef NO_IRQ
-#define NO_IRQ 0
-#endif
-
 MODULE_LICENSE("GPL");
 
 struct of_mmc_spi {
-- 
2.30.2


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

* [PATCH v1 5/6] mmc: mmc_spi: Use already parsed IRQ
  2021-04-19 11:24 [PATCH v1 1/6] mmc: core: Correct descriptions in mmc_of_parse() Andy Shevchenko
                   ` (2 preceding siblings ...)
  2021-04-19 11:24 ` [PATCH v1 4/6] mmc: mmc_spi: Drop unused NO_IRQ definition Andy Shevchenko
@ 2021-04-19 11:24 ` Andy Shevchenko
  2021-04-19 11:24 ` [PATCH v1 6/6] mmc: mmc_spi: Make of_mmc_spi.c resource provider agnostic Andy Shevchenko
  2021-04-19 12:59 ` [PATCH v1 1/6] mmc: core: Correct descriptions in mmc_of_parse() Ulf Hansson
  5 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2021-04-19 11:24 UTC (permalink / raw)
  To: Andy Shevchenko, Ulf Hansson, Haibo Chen, Fabio Estevam,
	Yangbo Lu, linux-mmc, devicetree, linux-kernel, linux-arm-kernel,
	linux-spi
  Cc: Rob Herring, Adrian Hunter, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, NXP Linux Team, Mark Brown

SPI core already parses and maps IRQ for us if provided.
Use it instead of double parsing in mmc_spi_get_pdata().

Due to above, change condition, since SPI core can hold
an error pointer as invalid IRQ.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/mmc/host/of_mmc_spi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/of_mmc_spi.c b/drivers/mmc/host/of_mmc_spi.c
index 0b038f5c392a..009c3885f6ba 100644
--- a/drivers/mmc/host/of_mmc_spi.c
+++ b/drivers/mmc/host/of_mmc_spi.c
@@ -64,8 +64,8 @@ struct mmc_spi_platform_data *mmc_spi_get_pdata(struct spi_device *spi)
 	if (mmc_of_parse_voltage(mmc, &oms->pdata.ocr_mask) < 0)
 		goto err_ocr;
 
-	oms->detect_irq = irq_of_parse_and_map(np, 0);
-	if (oms->detect_irq != 0) {
+	oms->detect_irq = spi->irq;
+	if (oms->detect_irq > 0) {
 		oms->pdata.init = of_mmc_spi_init;
 		oms->pdata.exit = of_mmc_spi_exit;
 	} else {
-- 
2.30.2


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

* [PATCH v1 6/6] mmc: mmc_spi: Make of_mmc_spi.c resource provider agnostic
  2021-04-19 11:24 [PATCH v1 1/6] mmc: core: Correct descriptions in mmc_of_parse() Andy Shevchenko
                   ` (3 preceding siblings ...)
  2021-04-19 11:24 ` [PATCH v1 5/6] mmc: mmc_spi: Use already parsed IRQ Andy Shevchenko
@ 2021-04-19 11:24 ` Andy Shevchenko
  2021-04-19 12:59 ` [PATCH v1 1/6] mmc: core: Correct descriptions in mmc_of_parse() Ulf Hansson
  5 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2021-04-19 11:24 UTC (permalink / raw)
  To: Andy Shevchenko, Ulf Hansson, Haibo Chen, Fabio Estevam,
	Yangbo Lu, linux-mmc, devicetree, linux-kernel, linux-arm-kernel,
	linux-spi
  Cc: Rob Herring, Adrian Hunter, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, NXP Linux Team, Mark Brown

In order to use the same driver on non-OF platforms, make
of_mmc_spi.c resource provider agnostic.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/mmc/host/Makefile     | 2 --
 drivers/mmc/host/of_mmc_spi.c | 6 ++----
 include/linux/spi/mmc_spi.h   | 9 ---------
 3 files changed, 2 insertions(+), 15 deletions(-)

diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
index 6df5c4774260..14004cc09aaa 100644
--- a/drivers/mmc/host/Makefile
+++ b/drivers/mmc/host/Makefile
@@ -34,9 +34,7 @@ obj-$(CONFIG_MMC_TIFM_SD)	+= tifm_sd.o
 obj-$(CONFIG_MMC_MVSDIO)	+= mvsdio.o
 obj-$(CONFIG_MMC_DAVINCI)       += davinci_mmc.o
 obj-$(CONFIG_MMC_SPI)		+= mmc_spi.o
-ifeq ($(CONFIG_OF),y)
 obj-$(CONFIG_MMC_SPI)		+= of_mmc_spi.o
-endif
 obj-$(CONFIG_MMC_S3C)   	+= s3cmci.o
 obj-$(CONFIG_MMC_SDRICOH_CS)	+= sdricoh_cs.o
 obj-$(CONFIG_MMC_TMIO)		+= tmio_mmc.o
diff --git a/drivers/mmc/host/of_mmc_spi.c b/drivers/mmc/host/of_mmc_spi.c
index 009c3885f6ba..9d480a05f655 100644
--- a/drivers/mmc/host/of_mmc_spi.c
+++ b/drivers/mmc/host/of_mmc_spi.c
@@ -51,10 +51,9 @@ struct mmc_spi_platform_data *mmc_spi_get_pdata(struct spi_device *spi)
 {
 	struct mmc_host *mmc = dev_get_drvdata(&spi->dev);
 	struct device *dev = &spi->dev;
-	struct device_node *np = dev->of_node;
 	struct of_mmc_spi *oms;
 
-	if (dev->platform_data || !np)
+	if (dev->platform_data || !dev_fwnode(dev))
 		return dev->platform_data;
 
 	oms = kzalloc(sizeof(*oms), GFP_KERNEL);
@@ -83,10 +82,9 @@ EXPORT_SYMBOL(mmc_spi_get_pdata);
 void mmc_spi_put_pdata(struct spi_device *spi)
 {
 	struct device *dev = &spi->dev;
-	struct device_node *np = dev->of_node;
 	struct of_mmc_spi *oms = to_of_mmc_spi(dev);
 
-	if (!dev->platform_data || !np)
+	if (!dev->platform_data || !dev_fwnode(dev))
 		return;
 
 	kfree(oms);
diff --git a/include/linux/spi/mmc_spi.h b/include/linux/spi/mmc_spi.h
index 778ae8eb1f3e..9ad9a06e488d 100644
--- a/include/linux/spi/mmc_spi.h
+++ b/include/linux/spi/mmc_spi.h
@@ -35,16 +35,7 @@ struct mmc_spi_platform_data {
 	void (*setpower)(struct device *, unsigned int maskval);
 };
 
-#ifdef CONFIG_OF
 extern struct mmc_spi_platform_data *mmc_spi_get_pdata(struct spi_device *spi);
 extern void mmc_spi_put_pdata(struct spi_device *spi);
-#else
-static inline struct mmc_spi_platform_data *
-mmc_spi_get_pdata(struct spi_device *spi)
-{
-	return spi->dev.platform_data;
-}
-static inline void mmc_spi_put_pdata(struct spi_device *spi) {}
-#endif /* CONFIG_OF */
 
 #endif /* __LINUX_SPI_MMC_SPI_H */
-- 
2.30.2


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

* Re: [PATCH v1 1/6] mmc: core: Correct descriptions in mmc_of_parse()
  2021-04-19 11:24 [PATCH v1 1/6] mmc: core: Correct descriptions in mmc_of_parse() Andy Shevchenko
                   ` (4 preceding siblings ...)
  2021-04-19 11:24 ` [PATCH v1 6/6] mmc: mmc_spi: Make of_mmc_spi.c resource provider agnostic Andy Shevchenko
@ 2021-04-19 12:59 ` Ulf Hansson
  5 siblings, 0 replies; 7+ messages in thread
From: Ulf Hansson @ 2021-04-19 12:59 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Haibo Chen, Fabio Estevam, Yangbo Lu, linux-mmc, DTML,
	Linux Kernel Mailing List, Linux ARM, linux-spi, Rob Herring,
	Adrian Hunter, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
	NXP Linux Team, Mark Brown

On Mon, 19 Apr 2021 at 13:24, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> Since it has been converted to use device property API, the function
> and field descriptions become outdated. Correct them.
>
> Fixes: 73a47a9bb3e2 ("mmc: core: Use device_property_read instead of of_property_read")
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Series applied for next, thanks!

Kind regards
Uffe

> ---
>  drivers/mmc/core/host.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
> index 9b89a91b6b47..ce030c5aa53c 100644
> --- a/drivers/mmc/core/host.c
> +++ b/drivers/mmc/core/host.c
> @@ -209,8 +209,8 @@ mmc_of_parse_clk_phase(struct mmc_host *host, struct mmc_clk_phase_map *map)
>  EXPORT_SYMBOL(mmc_of_parse_clk_phase);
>
>  /**
> - *     mmc_of_parse() - parse host's device-tree node
> - *     @host: host whose node should be parsed.
> + * mmc_of_parse() - parse host's device properties
> + * @host: host whose properties should be parsed.
>   *
>   * To keep the rest of the MMC subsystem unaware of whether DT has been
>   * used to to instantiate and configure this host instance or not, we
> --
> 2.30.2
>

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

end of thread, back to index

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-19 11:24 [PATCH v1 1/6] mmc: core: Correct descriptions in mmc_of_parse() Andy Shevchenko
2021-04-19 11:24 ` [PATCH v1 2/6] mmc: core: Convert mmc_of_parse_voltage() to use device property API Andy Shevchenko
2021-04-19 11:24 ` [PATCH v1 3/6] mmc: mmc_spi: Set up polling even if voltage-ranges is not present Andy Shevchenko
2021-04-19 11:24 ` [PATCH v1 4/6] mmc: mmc_spi: Drop unused NO_IRQ definition Andy Shevchenko
2021-04-19 11:24 ` [PATCH v1 5/6] mmc: mmc_spi: Use already parsed IRQ Andy Shevchenko
2021-04-19 11:24 ` [PATCH v1 6/6] mmc: mmc_spi: Make of_mmc_spi.c resource provider agnostic Andy Shevchenko
2021-04-19 12:59 ` [PATCH v1 1/6] mmc: core: Correct descriptions in mmc_of_parse() Ulf Hansson

Linux-SPI Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-spi/0 linux-spi/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-spi linux-spi/ https://lore.kernel.org/linux-spi \
		linux-spi@vger.kernel.org
	public-inbox-index linux-spi

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-spi


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git