From patchwork Mon Jun 3 18:19:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 13684033 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0FCE4C25B75 for ; Mon, 3 Jun 2024 18:20:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BusTMnBGUnGezfK3qabf3/psTvHTr7wuRVTOrxjxmAo=; b=mQGBUP5hpKPcN8 LquXFBQiLXwiL4Pvsn4IJ/td6u1s9viUfSvEryNl20j+BEZu++n2s7w96bdkgS16BU3WQH1Vtw6sg yceb+P4a391cnsMz0K1RIXcNJkA9L+QrGGG32pfxuZnggU6vF450hPHX3QRnepFz5jb+ZM9hVTBjl RcBpQZlaHd3dntEbuBeyNiIBFFmXiE9XLjwIOD4wETdO73wD1YhwEl1dl8Dl3WuItpbnrfZwASuYT eCg1UMfeFN+rp3oeK+f5dGheO7qzm2AKI+4P8Qt9iSjTEWzrR1OWBfywaiWDq/cwvv3RPtxGflEi5 E9dIbJmZ1Ao4jWrN70jQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sECIB-000000000R0-0Lx5; Mon, 03 Jun 2024 18:20:23 +0000 Received: from mout.gmx.net ([212.227.15.18]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sECI6-000000000PI-1WVT for linux-arm-kernel@lists.infradead.org; Mon, 03 Jun 2024 18:20:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1717438809; x=1718043609; i=wahrenst@gmx.net; bh=6bUdGXU2A6onMeytnb3GO73q7Ar8QShjy7dwB5dI9sQ=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:Message-Id:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=Sr+KVKPtdIg5/TA9Xht3YbJDTYP+ri6PMEdkK9N+4ICk8sJEy9AzA/0Uld9ce9/t xWY8H6OcfWzKBxRHodJ2zZlEGtxKP9wqkNzywOibrvs5vWsF9Mi/gBzkvUnQNU6hy sJM/Xe+We+18dIXP3aUwF8iNWN3ZfXh29Z6pHoNExukUEAFK0pb0oK+QVIY6Rxj6q VcWnqXT5Iy5IIoXOqCHPgzOpVIL+zkU5rlHiA+jOYMz7kOBYBJN5pFRyQxG45NZPl DCqlIbPSI0zhaymEPr/IsSim2tdQP2Gwfdr+vbcArHPP5t74GNhtA27CxvRvdN1EW ZGh+54JJ0pPKHCdTjg== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from stefanw-SCHENKER ([37.4.248.43]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MjjCL-1stsu21qrD-00kBK8; Mon, 03 Jun 2024 20:20:09 +0200 From: Stefan Wahren To: Linus Walleij , Florian Fainelli Cc: bcm-kernel-feedback-list@broadcom.com, Ray Jui , Scott Branden , linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Bartosz Golaszewski , Phil Elwell , Kent Gibson , Andy Shevchenko , Stefan Wahren Subject: [PATCH 1/2] pinctrl: bcm2835: Fix permissions of persist_gpio_outputs Date: Mon, 3 Jun 2024 20:19:37 +0200 Message-Id: <20240603181938.76047-2-wahrenst@gmx.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240603181938.76047-1-wahrenst@gmx.net> References: <20240603181938.76047-1-wahrenst@gmx.net> MIME-Version: 1.0 X-Provags-ID: V03:K1:kSJyPk7F/4DwdX9PvDTr/PmZ6Qa/w7uaaHLq9hcbz6gkB4wmbr/ vDOSDCGdatKPxpmW1taxJJK7UWU14ImSGtqK7LcoIozqxqXRaRIia03hPoGL8GVz797M0qy BBjQo7azAe5yafxzME7RGUwBBYMFEFqZVyLIAFrlyZlIzF7HrhFX/HLk0e7Zt2HiZek5ks+ kc7yl/vPxe043lHTaRhqg== UI-OutboundReport: notjunk:1;M01:P0:6riRGvs0ng8=;02FUQSx1yhxhC5w7bcubTvWBIPe Fp9lRPLspi64sKc6G/25kmiwDuKMoRhbOSuD2bCYhwl8gGo11ZPmA33NKLGOdpkgauiPzmF24 gw5oqOyC/c/zajapqWelFlGIWRoUJGcJGxapTcHOeqNFB2D4sYbU1hnmXpNFbIj3O72S/tatm Hg2UVIoNzuj9veXkP5oMgUuRq18DWYITs4JXVINsda/sTUnAu/Gvd0Jw3eUF496eQPEka3Abo BpPbAkefDUkQzbfNsHGXCpLqHyGVovCSQI7rY2NL2mO2wjFM1tvUudeC3f6msTXhVPsQO+HYU FrN4J3trw4GWcbM8TLldDhKk63XiyZJmL8fpp5CBgUthDwMpS/79suShhccR98fIWkIRCspR6 FwG2LkH7LMIL/QhCq0ysxE6ziLe20ynUJums42ji/MpsTjmzz/cgWH4BHBfK7eVFaK1bDr0Pv ffBT8In739q8AEWr3I3OKYIKSWa0vcTdKLdNNNtX4FORAKRptK8ec5AUWrUvsEIyUGvn1Z87p K590xOB4zpcGyFjUarqORHUqcRRSJrEflbQIeKrX609feXnQ+kT84DbWvpy83cqEdZxilAtOH IZ4YpullkQFjyQ+IdIQOUoJu971DZwP3ENDawqfbxOLk6e5ZQg+9PcZJ2ZAXIabIlg2tLSdO1 LVmWABFiSZ+/kUAI+FO1hKfNTpcmBbZjhJ0L+3tFotQ5/dMt11yvP6Hd4vSV+YasyE6K8iti2 r9S2dv3kIj09Xx/ybpCSRCAZf4zQt5G/+YGi9gV99ksBOWvKfPqHIiGnDJb+O55C5mLBWNqR7 muH9bNvYCDww2NpchH8KVe9r4ZnEg2+ZunKE+JukQTSXc= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240603_112018_784433_2AEFB2C3 X-CRM114-Status: GOOD ( 11.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The commit 8ff05989b44e ("pinctrl: bcm2835: Make pin freeing behavior configurable") unintentionally made the module parameter persist_gpio_outputs changeable at runtime. So drop the write permission in order to make the freeing behavior predictable for user applications. Fixes: 8ff05989b44e ("pinctrl: bcm2835: Make pin freeing behavior configurable") Reported-by: Andy Shevchenko Closes: https://lore.kernel.org/linux-gpio/Zjk-C0nLmlynqLAE@surfacebook.localdomain/ Signed-off-by: Stefan Wahren Acked-by: Florian Fainelli --- drivers/pinctrl/bcm/pinctrl-bcm2835.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.34.1 diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c index 7178a38475cc..27fd54795791 100644 --- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c +++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c @@ -245,7 +245,7 @@ static const char * const irq_type_names[] = { }; static bool persist_gpio_outputs; -module_param(persist_gpio_outputs, bool, 0644); +module_param(persist_gpio_outputs, bool, 0444); MODULE_PARM_DESC(persist_gpio_outputs, "Enable GPIO_OUT persistence when pin is freed"); static inline u32 bcm2835_gpio_rd(struct bcm2835_pinctrl *pc, unsigned reg) From patchwork Mon Jun 3 18:19:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 13684035 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 67C0FC27C50 for ; Mon, 3 Jun 2024 18:20:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ViYdXTxzvE9P5xs3s/48h4tnVsg6FnqhWQVX2XFubq0=; b=ixIxylUJh+pId8 XZg5fQKQeiVNNcJY3jempGZXyyCtHq0DbvffZ+DVc6svLAXXqozgpd2mzotdDf5RH6w1sTlfEsS0b 8cdzUqQgBG6evo8cvnjEh9PIHUCBLoY39b5nhc/O+iPjPuHNbeFzK72oq0a10haqmo3Yj6Z/hUNwu FFJx29+j8TN2FnyJeirJ7gZjYUTGbUa8quP2+9inMvhV+d29lUfU3H6is2ghsgadjmyf4hK4/qSNt dIul+DSwuG58jX26RxUsq1HLe4Q6d8rXY7KXDloYftfObpUMhHMABAg8PPUaheKem22U2evoam4KF 4Q2CcADvCyg/HJv7qFrQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sECIA-000000000Qw-22GV; Mon, 03 Jun 2024 18:20:22 +0000 Received: from mout.gmx.net ([212.227.15.18]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sECI6-000000000Po-1S8h for linux-arm-kernel@lists.infradead.org; Mon, 03 Jun 2024 18:20:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1717438810; x=1718043610; i=wahrenst@gmx.net; bh=hhK6Is3cDAiDl4ndjZfZ42wPw5HnZ06D3SDVvba8LHQ=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:Message-Id:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=OU1e1pZUVbXIIPXGwQsdMLDKc4z/1rEGlSVGt2cgJsdOOfyV/TDMhuMmKc7jGjy5 Xwi26iSV4tnJQZilbUy9BY7pOrJ5q4NEU2BpvGozIkubK6DjDlAioETesycX61BOO SmsxZnQIQtNwX6r7wYqx/XW+PMvqT64Ux2T9nBK6Lc8c6FbJXc78+tMic9/Il4zqV evfitpRZNCGUWBYqzpmAeQa+p4r7YI1MwSWrjhxoBuoCbNA3nL6n3QwIBQM+6pBNy 4GUKGcUiYQqnQMv4K/TvR0DacGLaI2RepFnGHVnYUDHEdsP8pENFYSv6t2d0jO8Qo lxfPqgTNWApON76S5A== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from stefanw-SCHENKER ([37.4.248.43]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MCsPy-1sN1zd3r5k-00CEDP; Mon, 03 Jun 2024 20:20:10 +0200 From: Stefan Wahren To: Linus Walleij , Florian Fainelli Cc: bcm-kernel-feedback-list@broadcom.com, Ray Jui , Scott Branden , linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Bartosz Golaszewski , Phil Elwell , Kent Gibson , Andy Shevchenko , Stefan Wahren Subject: [PATCH 2/2] pinctrl: bcm2835: Use string_choices API instead of ternary operator Date: Mon, 3 Jun 2024 20:19:38 +0200 Message-Id: <20240603181938.76047-3-wahrenst@gmx.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240603181938.76047-1-wahrenst@gmx.net> References: <20240603181938.76047-1-wahrenst@gmx.net> MIME-Version: 1.0 X-Provags-ID: V03:K1:HDl2Ih3YeCwkBD/w1c8HQ/NTCcphaAxOv086EBo71k6RNdpDxns b//+NXHLxh85/NxzXu2i7+vooAf25IOVRIitJXx3hqwuoNYURPZad76lrlZlX1irt7xv2ux f0v1MUKrSZEU9v1oufpV3OmqoY9Gf+h8l1lQSPD2Yol4MFOEJCqLVPaBaDd/LhP2x8FWovQ Axc0tRTbkN8RWyeb3NpdQ== UI-OutboundReport: notjunk:1;M01:P0:SfMnocnIi48=;Xe6eCxEVPHu6wbf8r/kjTuWcNqK yZLs/iHFnEn/isxLFZ7HySmAhWY620ZWYF+bBwAE2WiMt4hw306Py11aMiq5awIeovx9Vm51S hSjWZM+g+LdV89bBIJJe1xMUGm5TB29OwsmYo2wY5mAAV8kP7p2MD5F068bsPIaZz0nt/xnev 87QgfxyL5aF3TcfUWekwb1j6DvnoaMY1h8tN9hZsrgeIo43RBo4p+hENCzE3ieSY1sDtrxj0+ LWT3ZqO88ZHSJqMtCmBvKb1qILN5kI6729KRzbdENBtmYgdM3QJewe4c2yk3cnvqj9A5JkxUT XtBfDOz/gxt9Gj1LA6QqEtCvt53VoQ3dHm/MOoX3DXah+GC4NGNeoCp/3Iu0mo9P0GgzW/Soy IyV2yZUaCY1KhIwicRiasZ6QTHL+k9Vqwr8fKcjN08zv2AzjARG4N8PqclFI75Wur9frYUJKC iZyYxSeuB4r/NxqwT/1k7WMxfCs838ifrDMmIRmWDRvUmCUg404k5Y62JFbqmggvmBXPbY9PS ob+0WweDYzOvWkEtDA7gd8xldc73a5LpeGL8AHxLcDPId4nNkQd8xMq9dR74qM/9a0vxDFiZh UWICf1DTQMCgm+iwVd8VnqknQ2hgLnLBpX8KqqodoOWur16o77DISNZpwCz2VGMSqXhHAX78q ZSwxlvuY7oLU9ww4vAtRYgev16qoNzW0l6ylg/nhIhtxHb89xfZwwGa9IuhpDHzBT+05CcJY3 BZ6KGtFSPWlvGYOjHjPjJqi66Dos9AYeju8wX46VqhPcHRjdTAHC3d+wnOeJEWYyFKpmCKSZJ AM6NVxgnC3o9P+5ijQUA0ZuZeCY2UNVPtM4kRtarTZzwk= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240603_112018_781767_1DA61B6B X-CRM114-Status: GOOD ( 11.54 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use modern string_choices API instead of manually determining the output using ternary operator. Suggested-by: Andy Shevchenko Signed-off-by: Stefan Wahren Acked-by: Florian Fainelli --- drivers/pinctrl/bcm/pinctrl-bcm2835.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- 2.34.1 diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c index 27fd54795791..184641e221d4 100644 --- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c +++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -752,7 +753,7 @@ static void bcm2835_pctl_pin_dbg_show(struct pinctrl_dev *pctldev, int irq = irq_find_mapping(chip->irq.domain, offset); seq_printf(s, "function %s in %s; irq %d (%s)", - fname, value ? "hi" : "lo", + fname, str_hi_lo(value), irq, irq_type_names[pc->irq_type[offset]]); } @@ -1428,7 +1429,7 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev) } dev_info(dev, "GPIO_OUT persistence: %s\n", - persist_gpio_outputs ? "yes" : "no"); + str_yes_no(persist_gpio_outputs)); return 0;