gpio: 74xx-mmio: Use of_device_get_match_data()
authorThierry Reding <treding@nvidia.com>
Mon, 30 Apr 2018 07:38:08 +0000 (09:38 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 16 May 2018 12:35:24 +0000 (14:35 +0200)
Use of_device_get_match_data() instead of open-coding it.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpio-74xx-mmio.c

index 0475e8ec96d0170ff2c6de7c543596bc773104d9..49616ec815ee351b0d807d69b49e990b235f9de4 100644 (file)
@@ -105,27 +105,22 @@ static int mmio_74xx_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
 
 static int mmio_74xx_gpio_probe(struct platform_device *pdev)
 {
-       const struct of_device_id *of_id;
        struct mmio_74xx_gpio_priv *priv;
        struct resource *res;
        void __iomem *dat;
        int err;
 
-       of_id = of_match_device(mmio_74xx_gpio_ids, &pdev->dev);
-       if (!of_id)
-               return -ENODEV;
-
        priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
        if (!priv)
                return -ENOMEM;
 
+       priv->flags = (uintptr_t)of_device_get_match_data(&pdev->dev);
+
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        dat = devm_ioremap_resource(&pdev->dev, res);
        if (IS_ERR(dat))
                return PTR_ERR(dat);
 
-       priv->flags = (uintptr_t) of_id->data;
-
        err = bgpio_init(&priv->gc, &pdev->dev,
                         DIV_ROUND_UP(MMIO_74XX_BIT_CNT(priv->flags), 8),
                         dat, NULL, NULL, NULL, NULL, 0);