]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
gpio: creg-snps: Simplify with device_get_match_data()
authorKrzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Fri, 19 Dec 2025 12:13:13 +0000 (13:13 +0100)
committerBartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Mon, 22 Dec 2025 16:57:35 +0000 (17:57 +0100)
Driver's probe function matches against driver's of_device_id table,
where each entry has non-NULL match data, so of_match_node() can be
simplified with device_get_match_data().

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20251219-gpio-of-match-v3-2-6b84194a02a8@oss.qualcomm.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
drivers/gpio/gpio-creg-snps.c

index f8ea961fa1de619f02f7763879bfd0d6780f3daa..157ab90f5ba8aa61326f754283128437ca593cef 100644 (file)
@@ -134,7 +134,6 @@ static const struct of_device_id creg_gpio_ids[] = {
 
 static int creg_gpio_probe(struct platform_device *pdev)
 {
-       const struct of_device_id *match;
        struct device *dev = &pdev->dev;
        struct creg_gpio *hcg;
        u32 ngpios;
@@ -148,8 +147,7 @@ static int creg_gpio_probe(struct platform_device *pdev)
        if (IS_ERR(hcg->regs))
                return PTR_ERR(hcg->regs);
 
-       match = of_match_node(creg_gpio_ids, pdev->dev.of_node);
-       hcg->layout = match->data;
+       hcg->layout = device_get_match_data(dev);
        if (!hcg->layout)
                return -EINVAL;