When default-blocked is present, rfkill_gpio_probe() initializes the software state to blocked but configures the GPIOs to the unblocked level. rfkill_init_sw_state() does not invoke the set_block callback and marks the state as persistent, so registration does not normally synchronize the GPIOs. The radio can therefore remain enabled while rfkill reports it as blocked, until userspace toggles the state. Initialize both GPIOs using !blocked, matching the existing set_block callback and the initial software state. Preserve the existing behavior when default-blocked is absent. Fixes: 2882bf7dd4f5 ("net: rfkill: gpio: allow booting in blocked state") Signed-off-by: Jie Gu --- Changes in v2: - Use the author's full name. - Add the Fixes tag. - Add testing details. No code changes. Tested on our product board running 6.16.12: - With default-blocked, verified that the radio remains disabled after boot and rfkill reports it as soft-blocked. - Verified that unblocking and blocking toggles the radio correctly. - Without default-blocked, verified unchanged boot behavior. v1: https://lore.kernel.org/all/20261117032059.3946777-1-jie.gu@leica-geosystems.com/ net/rfkill/rfkill-gpio.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c index 20cb432dfb85..0951554046df 100644 --- a/net/rfkill/rfkill-gpio.c +++ b/net/rfkill/rfkill-gpio.c @@ -97,6 +97,7 @@ static int rfkill_gpio_probe(struct platform_device *pdev) const char *name_property; const char *type_property; struct gpio_desc *gpio; + bool blocked; int ret; if (dmi_check_system(rfkill_gpio_deny_table)) @@ -147,11 +148,13 @@ static int rfkill_gpio_probe(struct platform_device *pdev) return -EINVAL; } - ret = gpiod_direction_output(rfkill->reset_gpio, true); + blocked = device_property_present(&pdev->dev, "default-blocked"); + + ret = gpiod_direction_output(rfkill->reset_gpio, !blocked); if (ret) return ret; - ret = gpiod_direction_output(rfkill->shutdown_gpio, true); + ret = gpiod_direction_output(rfkill->shutdown_gpio, !blocked); if (ret) return ret; @@ -161,7 +164,7 @@ static int rfkill_gpio_probe(struct platform_device *pdev) if (!rfkill->rfkill_dev) return -ENOMEM; - if (device_property_present(&pdev->dev, "default-blocked")) + if (blocked) rfkill_init_sw_state(rfkill->rfkill_dev, true); ret = rfkill_register(rfkill->rfkill_dev); -- 2.43.0