From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7159B35940; Tue, 30 Sep 2025 14:51:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759243907; cv=none; b=qkj5ll6qiU0hMe1Mgqp7dQgd4/zkCeKJsBpPZ/BL44bZQte9lqwpyUqItyImcVZAOUcHYHAuy87I6AGpnScRYDTmhofGUpp8GlYNXaiKmx3h39EUmyMY1AOZYg5L0Mugz13WOLbcdXIEfYgtjwFUCGbdxjIqqUikMIocIiE39IQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759243907; c=relaxed/simple; bh=IQ9spAcNX+t8IzYq3Qt1F+VQGO5pk/1ME4jGbwTyvlM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MUlTY3WTxbffrYW1hj0UQr5xNxR/pbzyzJg2IgtdQDRMPqJVh1mVc5aGj8WjgrsDeicLcwwLlcVhp7SEsKF3rfwkN4mriU8ScU573AZbPOFaE/4oyh6igKhLF2bfOEhnWE58Nh5vg1+bhwy3mbdZDhJ0oklLzhsz/Dt8aKBOfYI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=URFjI9mu; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="URFjI9mu" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1AB2C4CEF0; Tue, 30 Sep 2025 14:51:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1759243907; bh=IQ9spAcNX+t8IzYq3Qt1F+VQGO5pk/1ME4jGbwTyvlM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=URFjI9mu1mp0n7vtz2vSndY6RRBEUEw6g6vkYWJCQAb+dJNYl25v60USP5lPrpsae t4cybw0fUVSbqXtjA6afDIe1RCY0SoyFtv3g02RorRE2dFJq7XCTA3eO+VBLO2pcMJ qSXjK/A6Doh9o8f/5so0tz6qKL8Lt44u7B1x+3Q8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Philipp Zabel , Johannes Berg , Sasha Levin Subject: [PATCH 5.4 52/81] net: rfkill: gpio: add DT support Date: Tue, 30 Sep 2025 16:46:54 +0200 Message-ID: <20250930143821.859750558@linuxfoundation.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250930143819.654157320@linuxfoundation.org> References: <20250930143819.654157320@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Philipp Zabel [ Upstream commit d64c732dfc9edcd57feb693c23162117737e426b ] Allow probing rfkill-gpio via device tree. This hooks up the already existing support that was started in commit 262c91ee5e52 ("net: rfkill: gpio: prepare for DT and ACPI support") via the "rfkill-gpio" compatible, with the "name" and "type" properties renamed to "label" and "radio-type", respectively, in the device tree case. Signed-off-by: Philipp Zabel Link: https://lore.kernel.org/r/20230102-rfkill-gpio-dt-v2-2-d1b83758c16d@pengutronix.de Signed-off-by: Johannes Berg Stable-dep-of: b6f56a44e4c1 ("net: rfkill: gpio: Fix crash due to dereferencering uninitialized pointer") Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- net/rfkill/rfkill-gpio.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) --- a/net/rfkill/rfkill-gpio.c +++ b/net/rfkill/rfkill-gpio.c @@ -79,6 +79,8 @@ static int rfkill_gpio_probe(struct plat { struct rfkill_gpio_data *rfkill; struct gpio_desc *gpio; + const char *name_property; + const char *type_property; const char *type_name; int ret; @@ -86,8 +88,15 @@ static int rfkill_gpio_probe(struct plat if (!rfkill) return -ENOMEM; - device_property_read_string(&pdev->dev, "name", &rfkill->name); - device_property_read_string(&pdev->dev, "type", &type_name); + if (dev_of_node(&pdev->dev)) { + name_property = "label"; + type_property = "radio-type"; + } else { + name_property = "name"; + type_property = "type"; + } + device_property_read_string(&pdev->dev, name_property, &rfkill->name); + device_property_read_string(&pdev->dev, type_property, &type_name); if (!rfkill->name) rfkill->name = dev_name(&pdev->dev); @@ -169,12 +178,19 @@ static const struct acpi_device_id rfkil MODULE_DEVICE_TABLE(acpi, rfkill_acpi_match); #endif +static const struct of_device_id rfkill_of_match[] __maybe_unused = { + { .compatible = "rfkill-gpio", }, + { }, +}; +MODULE_DEVICE_TABLE(of, rfkill_of_match); + static struct platform_driver rfkill_gpio_driver = { .probe = rfkill_gpio_probe, .remove = rfkill_gpio_remove, .driver = { .name = "rfkill_gpio", .acpi_match_table = ACPI_PTR(rfkill_acpi_match), + .of_match_table = of_match_ptr(rfkill_of_match), }, };