linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: Linus Walleij <linus.walleij@linaro.org>,
	 Bartosz Golaszewski <brgl@bgdev.pl>,
	Joel Stanley <joel@jms.id.au>,
	 Andrew Jeffery <andrew@codeconstruct.com.au>,
	 Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>,
	 Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>,
	 Srinivas Neeli <srinivas.neeli@amd.com>,
	 Michal Simek <michal.simek@amd.com>
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	 linux-arm-kernel@lists.infradead.org,
	linux-aspeed@lists.ozlabs.org,
	 Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Subject: [PATCH 2/4] gpio: aspeed: Simplify with of_device_get_match_data()
Date: Thu, 06 Nov 2025 17:16:26 +0100	[thread overview]
Message-ID: <20251106-gpio-of-match-v1-2-50c7115a045e@linaro.org> (raw)
In-Reply-To: <20251106-gpio-of-match-v1-0-50c7115a045e@linaro.org>

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 of_device_get_match_data().

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 drivers/gpio/gpio-aspeed.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c
index 2e0ae953dd99..3d675b63936c 100644
--- a/drivers/gpio/gpio-aspeed.c
+++ b/drivers/gpio/gpio-aspeed.c
@@ -1305,7 +1305,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;
@@ -1323,8 +1322,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 = of_device_get_match_data(&pdev->dev);
+	if (!gpio->config)
 		return -EINVAL;
 
 	gpio->clk = devm_clk_get_enabled(&pdev->dev, NULL);
@@ -1334,8 +1333,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;

-- 
2.48.1


  parent reply	other threads:[~2025-11-06 16:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-06 16:16 [PATCH 0/4] gpio: Simplify with of_device_get_match_data() Krzysztof Kozlowski
2025-11-06 16:16 ` [PATCH 1/4] gpio: tb10x: Drop unused tb10x_set_bits() function Krzysztof Kozlowski
2025-11-06 16:16 ` Krzysztof Kozlowski [this message]
2025-11-06 16:23   ` [PATCH 2/4] gpio: aspeed: Simplify with of_device_get_match_data() Bartosz Golaszewski
2025-11-06 19:13     ` Krzysztof Kozlowski
2025-11-07 10:32       ` Bartosz Golaszewski
2025-11-06 16:16 ` [PATCH 3/4] gpio: creg-snps: " Krzysztof Kozlowski
2025-11-06 16:16 ` [PATCH 4/4] gpio: zynq: " Krzysztof Kozlowski
2025-11-06 17:19 ` (subset) [PATCH 0/4] gpio: " Bartosz Golaszewski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251106-gpio-of-match-v1-2-50c7115a045e@linaro.org \
    --to=krzysztof.kozlowski@linaro.org \
    --cc=Eugeniy.Paltsev@synopsys.com \
    --cc=andrew@codeconstruct.com.au \
    --cc=brgl@bgdev.pl \
    --cc=joel@jms.id.au \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-aspeed@lists.ozlabs.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.simek@amd.com \
    --cc=shubhrajyoti.datta@amd.com \
    --cc=srinivas.neeli@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).