linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/3] mmc: sdhci-s3c: simplify getting of_device_id match data
@ 2021-04-15  8:44 Krzysztof Kozlowski
  2021-04-15  8:44 ` [PATCH v2 2/3] mmc: sdhci-s3c: correct kerneldoc of sdhci_s3c_drv_data Krzysztof Kozlowski
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Krzysztof Kozlowski @ 2021-04-15  8:44 UTC (permalink / raw)
  To: Ben Dooks, Jaehoon Chung, Adrian Hunter, Ulf Hansson, linux-mmc,
	linux-kernel
  Cc: Sylwester Nawrocki, Marek Szyprowski, Krzysztof Kozlowski

Use of_device_get_match_data() to make the code slightly smaller and to
remove the of_device_id table forward declaration.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>

---

Changes since v1:
1. Rewrite the commit msg as it is not a NULL pointer dereference.
---
 drivers/mmc/host/sdhci-s3c.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
index f48a788a9d3d..8e1dca625620 100644
--- a/drivers/mmc/host/sdhci-s3c.c
+++ b/drivers/mmc/host/sdhci-s3c.c
@@ -20,6 +20,7 @@
 #include <linux/gpio.h>
 #include <linux/module.h>
 #include <linux/of.h>
+#include <linux/of_device.h>
 #include <linux/of_gpio.h>
 #include <linux/pm.h>
 #include <linux/pm_runtime.h>
@@ -461,19 +462,12 @@ static int sdhci_s3c_parse_dt(struct device *dev,
 }
 #endif
 
-#ifdef CONFIG_OF
-static const struct of_device_id sdhci_s3c_dt_match[];
-#endif
-
 static inline struct sdhci_s3c_drv_data *sdhci_s3c_get_driver_data(
 			struct platform_device *pdev)
 {
 #ifdef CONFIG_OF
-	if (pdev->dev.of_node) {
-		const struct of_device_id *match;
-		match = of_match_node(sdhci_s3c_dt_match, pdev->dev.of_node);
-		return (struct sdhci_s3c_drv_data *)match->data;
-	}
+	if (pdev->dev.of_node)
+		return (struct sdhci_s3c_drv_data *)of_device_get_match_data(&pdev->dev);
 #endif
 	return (struct sdhci_s3c_drv_data *)
 			platform_get_device_id(pdev)->driver_data;
-- 
2.25.1


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

end of thread, other threads:[~2021-04-15 12:03 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-15  8:44 [PATCH v2 1/3] mmc: sdhci-s3c: simplify getting of_device_id match data Krzysztof Kozlowski
2021-04-15  8:44 ` [PATCH v2 2/3] mmc: sdhci-s3c: correct kerneldoc of sdhci_s3c_drv_data Krzysztof Kozlowski
2021-04-15  9:57   ` Sylwester Nawrocki
2021-04-15 12:02   ` Ulf Hansson
2021-04-15  8:44 ` [PATCH v2 3/3] mmc: sdhci-s3c: constify uses of driver/match data Krzysztof Kozlowski
2021-04-15  9:42   ` Sylwester Nawrocki
2021-04-15 12:02   ` Ulf Hansson
2021-04-15  9:39 ` [PATCH v2 1/3] mmc: sdhci-s3c: simplify getting of_device_id match data Sylwester Nawrocki
2021-04-15 12:02 ` Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).