Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpio: 74xx-mmio: Use of_device_get_match_data()

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>

authored by

Thierry Reding and committed by
Linus Walleij
a23ffcf2 058de348

+2 -7
+2 -7
drivers/gpio/gpio-74xx-mmio.c
··· 105 105 106 106 static int mmio_74xx_gpio_probe(struct platform_device *pdev) 107 107 { 108 - const struct of_device_id *of_id; 109 108 struct mmio_74xx_gpio_priv *priv; 110 109 struct resource *res; 111 110 void __iomem *dat; 112 111 int err; 113 112 114 - of_id = of_match_device(mmio_74xx_gpio_ids, &pdev->dev); 115 - if (!of_id) 116 - return -ENODEV; 117 - 118 113 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); 119 114 if (!priv) 120 115 return -ENOMEM; 116 + 117 + priv->flags = (uintptr_t)of_device_get_match_data(&pdev->dev); 121 118 122 119 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 123 120 dat = devm_ioremap_resource(&pdev->dev, res); 124 121 if (IS_ERR(dat)) 125 122 return PTR_ERR(dat); 126 - 127 - priv->flags = (uintptr_t) of_id->data; 128 123 129 124 err = bgpio_init(&priv->gc, &pdev->dev, 130 125 DIV_ROUND_UP(MMIO_74XX_BIT_CNT(priv->flags), 8),