Linux-OMAP Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH v2] gpio: omap: Use device_get_match_data() helper
@ 2021-03-31  8:19 Tian Tao
  2021-03-31 18:38 ` Bartosz Golaszewski
  0 siblings, 1 reply; 2+ messages in thread
From: Tian Tao @ 2021-03-31  8:19 UTC (permalink / raw)
  To: grygorii.strashko, ssantosh, khilman, linus.walleij, bgolaszewski
  Cc: linux-omap, linux-gpio

Use the device_get_match_data() helper instead of open coding.

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
---

v2: drop the space between ? and :.
---
 drivers/gpio/gpio-omap.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index 41952bb..f4df555 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -1364,15 +1364,14 @@ static int omap_gpio_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct device_node *node = dev->of_node;
-	const struct of_device_id *match;
 	const struct omap_gpio_platform_data *pdata;
 	struct gpio_bank *bank;
 	struct irq_chip *irqc;
 	int ret;
 
-	match = of_match_device(of_match_ptr(omap_gpio_match), dev);
+	pdata = device_get_match_data(dev);
 
-	pdata = match ? match->data : dev_get_platdata(dev);
+	pdata = pdata ?: dev_get_platdata(dev);
 	if (!pdata)
 		return -EINVAL;
 
-- 
2.7.4


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

* Re: [PATCH v2] gpio: omap: Use device_get_match_data() helper
  2021-03-31  8:19 [PATCH v2] gpio: omap: Use device_get_match_data() helper Tian Tao
@ 2021-03-31 18:38 ` Bartosz Golaszewski
  0 siblings, 0 replies; 2+ messages in thread
From: Bartosz Golaszewski @ 2021-03-31 18:38 UTC (permalink / raw)
  To: Tian Tao
  Cc: Grygorii Strashko, Santosh Shilimkar, Kevin Hilman,
	Linus Walleij, Linux-OMAP, linux-gpio

On Wed, Mar 31, 2021 at 10:18 AM Tian Tao <tiantao6@hisilicon.com> wrote:
>
> Use the device_get_match_data() helper instead of open coding.
>
> Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
> ---
>
> v2: drop the space between ? and :.
> ---
>  drivers/gpio/gpio-omap.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
> index 41952bb..f4df555 100644
> --- a/drivers/gpio/gpio-omap.c
> +++ b/drivers/gpio/gpio-omap.c
> @@ -1364,15 +1364,14 @@ static int omap_gpio_probe(struct platform_device *pdev)
>  {
>         struct device *dev = &pdev->dev;
>         struct device_node *node = dev->of_node;
> -       const struct of_device_id *match;
>         const struct omap_gpio_platform_data *pdata;
>         struct gpio_bank *bank;
>         struct irq_chip *irqc;
>         int ret;
>
> -       match = of_match_device(of_match_ptr(omap_gpio_match), dev);
> +       pdata = device_get_match_data(dev);
>
> -       pdata = match ? match->data : dev_get_platdata(dev);
> +       pdata = pdata ?: dev_get_platdata(dev);
>         if (!pdata)
>                 return -EINVAL;
>
> --
> 2.7.4
>

Applied, thanks!

Bartosz

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

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-31  8:19 [PATCH v2] gpio: omap: Use device_get_match_data() helper Tian Tao
2021-03-31 18:38 ` Bartosz Golaszewski

Linux-OMAP Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-omap/0 linux-omap/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-omap linux-omap/ https://lore.kernel.org/linux-omap \
		linux-omap@vger.kernel.org
	public-inbox-index linux-omap

Example config snippet for mirrors

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


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