]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
gpio: aspeed: Simplify with device_get_match_data()
authorKrzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Fri, 19 Dec 2025 12:13:12 +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-1-6b84194a02a8@oss.qualcomm.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
drivers/gpio/gpio-aspeed.c

index cbdf781994dce48a258cfcc0b6fc1684e2daf9b1..9115e56a1626acb2cc67a5a53b758f004784b2ce 100644 (file)
@@ -1302,7 +1302,6 @@ MODULE_DEVICE_TABLE(of, aspeed_gpio_of_table);
 
 static int aspeed_gpio_probe(struct platform_device *pdev)
 {
-       const struct of_device_id *gpio_id;
        struct gpio_irq_chip *girq;
        struct aspeed_gpio *gpio;
        int rc, irq, i, banks, err;
@@ -1320,8 +1319,8 @@ static int aspeed_gpio_probe(struct platform_device *pdev)
 
        raw_spin_lock_init(&gpio->lock);
 
-       gpio_id = of_match_node(aspeed_gpio_of_table, pdev->dev.of_node);
-       if (!gpio_id)
+       gpio->config = device_get_match_data(&pdev->dev);
+       if (!gpio->config)
                return -EINVAL;
 
        gpio->clk = devm_clk_get_enabled(&pdev->dev, NULL);
@@ -1331,8 +1330,6 @@ static int aspeed_gpio_probe(struct platform_device *pdev)
                gpio->clk = NULL;
        }
 
-       gpio->config = gpio_id->data;
-
        if (!gpio->config->llops->reg_bit_set || !gpio->config->llops->reg_bit_get ||
            !gpio->config->llops->reg_bank_get)
                return -EINVAL;