summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKrzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>2025-12-19 15:13:14 +0300
committerBartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>2025-12-22 19:57:36 +0300
commit48befae0d6eee275c3e30d1cd45f39d6ba011e19 (patch)
tree7b87ed2cd244bcfe7befa822ac084ebce18e425c
parentda7c18a457c7a32c4ed1e1e326837d9d7cb4483c (diff)
downloadlinux-48befae0d6eee275c3e30d1cd45f39d6ba011e19.tar.xz
gpio: zynq: Simplify with device_get_match_data()
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(). While changing the error message, switch to dev_err_probe() so error path is a bit simpler. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Link: https://lore.kernel.org/r/20251219-gpio-of-match-v3-3-6b84194a02a8@oss.qualcomm.com Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
-rw-r--r--drivers/gpio/gpio-zynq.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/gpio/gpio-zynq.c b/drivers/gpio/gpio-zynq.c
index 97780c57ab56..571e366624d2 100644
--- a/drivers/gpio/gpio-zynq.c
+++ b/drivers/gpio/gpio-zynq.c
@@ -903,18 +903,16 @@ static int zynq_gpio_probe(struct platform_device *pdev)
struct zynq_gpio *gpio;
struct gpio_chip *chip;
struct gpio_irq_chip *girq;
- const struct of_device_id *match;
gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL);
if (!gpio)
return -ENOMEM;
- match = of_match_node(zynq_gpio_of_match, pdev->dev.of_node);
- if (!match) {
- dev_err(&pdev->dev, "of_match_node() failed\n");
- return -EINVAL;
- }
- gpio->p_data = match->data;
+ gpio->p_data = device_get_match_data(&pdev->dev);
+ if (!gpio->p_data)
+ return dev_err_probe(&pdev->dev, -EINVAL,
+ "device_get_match_data() failed\n");
+
platform_set_drvdata(pdev, gpio);
gpio->base_addr = devm_platform_ioremap_resource(pdev, 0);