diff mbox series

[v2] gpio: omap: Use device_get_match_data() helper

Message ID 1617178751-18937-1-git-send-email-tiantao6@hisilicon.com (mailing list archive)
State New, archived
Headers show
Series [v2] gpio: omap: Use device_get_match_data() helper | expand

Commit Message

tiantao (H) March 31, 2021, 8:19 a.m. UTC
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(-)

Comments

Bartosz Golaszewski March 31, 2021, 6:38 p.m. UTC | #1
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
diff mbox series

Patch

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;