gpio: omap: Use device_get_match_data() helper
authorTian Tao <tiantao6@hisilicon.com>
Wed, 31 Mar 2021 08:19:11 +0000 (16:19 +0800)
committerBartosz Golaszewski <bgolaszewski@baylibre.com>
Wed, 5 May 2021 14:07:40 +0000 (16:07 +0200)
Use the device_get_match_data() helper instead of open coding.

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
drivers/gpio/gpio-omap.c

index 41952bb..f4df555 100644 (file)
@@ -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;