linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pinctrl: single: use of_device_get_match_data() to get soc data
@ 2017-05-20 16:02 Masahiro Yamada
  2017-05-22 16:22 ` Tony Lindgren
  2017-05-29  8:19 ` Linus Walleij
  0 siblings, 2 replies; 3+ messages in thread
From: Masahiro Yamada @ 2017-05-20 16:02 UTC (permalink / raw)
  To: linux-arm-kernel

Use of_device_get_match_data() instead of of_match_device().
It allows us to remove the forward declaration of pcs_of_match.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 drivers/pinctrl/pinctrl-single.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
index 9c267dc..b8b3d93 100644
--- a/drivers/pinctrl/pinctrl-single.c
+++ b/drivers/pinctrl/pinctrl-single.c
@@ -1270,8 +1270,6 @@ static void pcs_free_resources(struct pcs_device *pcs)
 #endif
 }
 
-static const struct of_device_id pcs_of_match[];
-
 static int pcs_add_gpio_func(struct device_node *node, struct pcs_device *pcs)
 {
 	const char *propname = "pinctrl-single,gpio-range";
@@ -1637,15 +1635,14 @@ static int pcs_quirk_missing_pinctrl_cells(struct pcs_device *pcs,
 static int pcs_probe(struct platform_device *pdev)
 {
 	struct device_node *np = pdev->dev.of_node;
-	const struct of_device_id *match;
 	struct pcs_pdata *pdata;
 	struct resource *res;
 	struct pcs_device *pcs;
 	const struct pcs_soc_data *soc;
 	int ret;
 
-	match = of_match_device(pcs_of_match, &pdev->dev);
-	if (!match)
+	soc = of_device_get_match_data(&pdev->dev);
+	if (WARN_ON(!soc))
 		return -EINVAL;
 
 	pcs = devm_kzalloc(&pdev->dev, sizeof(*pcs), GFP_KERNEL);
@@ -1658,7 +1655,6 @@ static int pcs_probe(struct platform_device *pdev)
 	raw_spin_lock_init(&pcs->lock);
 	mutex_init(&pcs->mutex);
 	INIT_LIST_HEAD(&pcs->gpiofuncs);
-	soc = match->data;
 	pcs->flags = soc->flags;
 	memcpy(&pcs->socdata, soc, sizeof(*soc));
 
-- 
2.7.4

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

* [PATCH] pinctrl: single: use of_device_get_match_data() to get soc data
  2017-05-20 16:02 [PATCH] pinctrl: single: use of_device_get_match_data() to get soc data Masahiro Yamada
@ 2017-05-22 16:22 ` Tony Lindgren
  2017-05-29  8:19 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Tony Lindgren @ 2017-05-22 16:22 UTC (permalink / raw)
  To: linux-arm-kernel

* Masahiro Yamada <yamada.masahiro@socionext.com> [170520 09:06]:
> Use of_device_get_match_data() instead of of_match_device().
> It allows us to remove the forward declaration of pcs_of_match.

That's nice:

Acked-by: Tony Lindgren <tony@atomide.com>

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

* [PATCH] pinctrl: single: use of_device_get_match_data() to get soc data
  2017-05-20 16:02 [PATCH] pinctrl: single: use of_device_get_match_data() to get soc data Masahiro Yamada
  2017-05-22 16:22 ` Tony Lindgren
@ 2017-05-29  8:19 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2017-05-29  8:19 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, May 20, 2017 at 6:02 PM, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:

> Use of_device_get_match_data() instead of of_match_device().
> It allows us to remove the forward declaration of pcs_of_match.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

Patch applied with Tony's ACK.

Yours,
Linus Walleij

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

end of thread, other threads:[~2017-05-29  8:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-20 16:02 [PATCH] pinctrl: single: use of_device_get_match_data() to get soc data Masahiro Yamada
2017-05-22 16:22 ` Tony Lindgren
2017-05-29  8:19 ` Linus Walleij

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).