From 56c5ab49fea965ad7577a76ea4be60a84c98c088 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sun, 5 Jul 2026 16:48:20 -0700 Subject: [PATCH] ramips: gpio: use fwnode instead of of Upstream nowadays prefers fwnode instead of of. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/24095 Signed-off-by: Jonas Jelonek --- .../ramips/files/drivers/gpio/gpio-ralink.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/target/linux/ramips/files/drivers/gpio/gpio-ralink.c b/target/linux/ramips/files/drivers/gpio/gpio-ralink.c index c0f4a87ddcb..6d6428b7d7c 100644 --- a/target/linux/ramips/files/drivers/gpio/gpio-ralink.c +++ b/target/linux/ramips/files/drivers/gpio/gpio-ralink.c @@ -206,9 +206,9 @@ static int ralink_get_multiple(struct gpio_chip *gc, unsigned long *mask, static int ralink_gpio_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; - struct device_node *np = dev->of_node; + struct fwnode_handle *fw = dev_fwnode(dev); struct ralink_gpio_chip *rg; - struct of_phandle_args args; + struct fwnode_reference_args args; u32 ngpios = 0; int ret; @@ -220,20 +220,20 @@ static int ralink_gpio_probe(struct platform_device *pdev) if (IS_ERR(rg->membase)) return PTR_ERR(rg->membase); - if (of_property_read_u8_array(np, "ralink,register-map", + if (device_property_read_u8_array(dev, "ralink,register-map", rg->regs, GPIO_REG_MAX)) { dev_err(dev, "failed to read register definition\n"); return -EINVAL; } - if (of_property_read_u32(np, "ngpios", &ngpios) < 0) + if (device_property_read_u32(dev, "ngpios", &ngpios) < 0) ngpios = 0; if (ngpios == 0) { - if (of_parse_phandle_with_args(np, "gpio-ranges", "#gpio-cells", 0, &args) == 0) { - if (args.args_count > 0) - ngpios = args.args[args.args_count - 1]; - of_node_put(args.np); + if (!fwnode_property_get_reference_args(fw, "gpio-ranges", "#gpio-cells", 0, 0, &args)) { + if (args.nargs > 0) + ngpios = args.args[args.nargs - 1]; + fwnode_handle_put(args.fwnode); } } -- 2.47.3