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

gpio: Use device_get_match_data()

Use preferred device_get_match_data() instead of of_match_device() to
get the driver match data. With this, adjust the includes to explicitly
include the correct headers.

Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

authored by

Rob Herring and committed by
Bartosz Golaszewski
03a975cb 8a58cd57

+8 -15
+3 -6
drivers/gpio/gpio-davinci.c
··· 16 16 #include <linux/irqdomain.h> 17 17 #include <linux/module.h> 18 18 #include <linux/of.h> 19 - #include <linux/of_device.h> 20 19 #include <linux/pinctrl/consumer.h> 21 20 #include <linux/platform_device.h> 22 21 #include <linux/platform_data/gpio-davinci.h> 22 + #include <linux/property.h> 23 23 #include <linux/irqchip/chained_irq.h> 24 24 #include <linux/spinlock.h> 25 25 #include <linux/pm_runtime.h> ··· 486 486 struct davinci_gpio_platform_data *pdata = dev->platform_data; 487 487 struct davinci_gpio_regs __iomem *g; 488 488 struct irq_domain *irq_domain = NULL; 489 - const struct of_device_id *match; 490 489 struct irq_chip *irq_chip; 491 490 struct davinci_gpio_irq_data *irqdata; 492 491 gpio_get_irq_chip_cb_t gpio_get_irq_chip; ··· 494 495 * Use davinci_gpio_get_irq_chip by default to handle non DT cases 495 496 */ 496 497 gpio_get_irq_chip = davinci_gpio_get_irq_chip; 497 - match = of_match_device(of_match_ptr(davinci_gpio_ids), 498 - dev); 499 - if (match) 500 - gpio_get_irq_chip = (gpio_get_irq_chip_cb_t)match->data; 498 + if (dev->of_node) 499 + gpio_get_irq_chip = (gpio_get_irq_chip_cb_t)device_get_match_data(dev); 501 500 502 501 ngpio = pdata->ngpio; 503 502
+2 -2
drivers/gpio/gpio-mmio.c
··· 56 56 #include <linux/slab.h> 57 57 #include <linux/bitops.h> 58 58 #include <linux/platform_device.h> 59 + #include <linux/property.h> 59 60 #include <linux/mod_devicetable.h> 60 61 #include <linux/of.h> 61 - #include <linux/of_device.h> 62 62 63 63 #include "gpiolib.h" 64 64 ··· 702 702 { 703 703 struct bgpio_pdata *pdata; 704 704 705 - if (!of_match_device(bgpio_of_match, &pdev->dev)) 705 + if (!pdev->dev.of_node) 706 706 return NULL; 707 707 708 708 pdata = devm_kzalloc(&pdev->dev, sizeof(struct bgpio_pdata),
+3 -7
drivers/gpio/gpio-mvebu.c
··· 42 42 #include <linux/irqchip/chained_irq.h> 43 43 #include <linux/irqdomain.h> 44 44 #include <linux/mfd/syscon.h> 45 - #include <linux/of_device.h> 45 + #include <linux/of.h> 46 46 #include <linux/pinctrl/consumer.h> 47 47 #include <linux/platform_device.h> 48 + #include <linux/property.h> 48 49 #include <linux/pwm.h> 49 50 #include <linux/regmap.h> 50 51 #include <linux/slab.h> ··· 1123 1122 static int mvebu_gpio_probe(struct platform_device *pdev) 1124 1123 { 1125 1124 struct mvebu_gpio_chip *mvchip; 1126 - const struct of_device_id *match; 1127 1125 struct device_node *np = pdev->dev.of_node; 1128 1126 struct irq_chip_generic *gc; 1129 1127 struct irq_chip_type *ct; ··· 1132 1132 int i, cpu, id; 1133 1133 int err; 1134 1134 1135 - match = of_match_device(mvebu_gpio_of_match, &pdev->dev); 1136 - if (match) 1137 - soc_variant = (unsigned long) match->data; 1138 - else 1139 - soc_variant = MVEBU_GPIO_SOC_VARIANT_ORION; 1135 + soc_variant = (unsigned long)device_get_match_data(&pdev->dev); 1140 1136 1141 1137 /* Some gpio controllers do not provide irq support */ 1142 1138 err = platform_irq_count(pdev);