From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=115.124.28.76 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796116064; b=5ombiF7DTOcGee+OdckNdJWVj8hKtR1StuvTo9X127XYhVGaoQpHkvuDNaSTlkCo7nbf g9cHW4zbi2K7dtGwgewCbnMdZ3/MoRYTSyErd4jKes0NEZlyx+dCfAxkqDZLj/FA1WTw0 xyELmcvKiOZbYsoFH8wqbCY/If4vO7bMGgc9MnROMGp7dg6bXmCTfZ41nukK6UGFcY9j0 4ji/OYHdyzw1jK5dePbwDSGOqRht94yjaNbSJ4++TOyrCnRSW/lOzIgB+zMkR1bvgyEmJ aVapNw66HVXkRcmmE8AmSf/+TkCZnLoHouFx/u3rEdOwG9nLEBAaPPHNc0jetJFgU+w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796116064; h=DMARC-Filter:X-Alimail-AntiSpam:Received:From:To:Cc:Subject:Date: Message-Id:X-Mailer:MIME-Version:Content-Transfer-Encoding; bh=03JvWk9p8MaxvvfMABVvE2lQ2OR39LPrcW1JgTqG3WA=; b=r0I6KN27SrJ7faXM32Rw00oZv6+IK8IK3EB/ALPDHDrvF7eEl+UR0SA4sroIK1aRf61T uP9gUpZHZcuSuOYHAaFgU1Oi+VEinDqH/smP7Ffgm54ohqPbi0lS8r3Sp1wV/9P7G3uO3 odpNCYl1ApxdrT/CmYmpaxqd3WVPG5jcG8W65SlZ0zCrSxrrm1N40bMlKNq4w7j7m1AUm LLSQgIcA9EPp5SO2Ix6Y1jSJGinMh0ISUVRGulZ6LxamzeO9/NMCkvdNv9VOsKxGzfrp9 nbWnN9dM2CGhexlKxgWoKyfLOyhPXAC/7UYGbS9dBgTr0QkOV1hnjfr9USTV/dtxv/g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=kaihong.com; spf=pass smtp.mailfrom=kaihong.com; arc=none smtp.remote-ip=115.124.28.76 Received: from out28-76.mail.aliyun.com (out28-76.mail.aliyun.com [115.124.28.76]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 452B2606A31A; Tue, 1 Dec 2026 09:07:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 452B2606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kaihong.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kaihong.com X-Alimail-AntiSpam:AC=CONTINUE;BC=0.08837032|-1;CH=green;DM=|CONTINUE|false|;DS=CONTINUE|ham_system_inform|0.00189074-0.000178695-0.997931;FP=17094488526114743777|0|0|0|0|-1|-1|-1;HT=maildocker-contentspam033037034017;MF=wangxiaolei01@kaihong.com;NM=1;PH=DS;RN=12;RT=12;SR=0;TI=SMTPD_---.kE5VdfP_1796116056; Received: from nj-vm-261.pxvirt.local(mailfrom:wangxiaolei01@kaihong.com fp:SMTPD_---.kE5VdfP_1796116056 cluster:ay29) by smtp.aliyun-inc.com; Tue, 01 Dec 2026 17:07:37 +0800 From: Xiaolei Wang To: linusw@kernel.org, florian.fainelli@broadcom.com, bcm-kernel-feedback-list@broadcom.com, daniel@dragonzap.com, wangxiaolei01@kaihong.com, iivanov@suse.de, andrea.porta@suse.com, phil@raspberrypi.com Cc: linux-gpio@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 0/2] pinctrl: rp1: fix RT sleep and clean up map freeing Date: Tue, 1 Dec 2026 09:07:15 +0000 Message-Id: <20261201090717.2470936-1-wangxiaolei01@kaihong.com> X-Mailer: git-send-email 2.34.1 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This series contains two independent changes to the RP1 pinctrl driver: a fix for a real PREEMPT_RT bug, and a cleanup that removes duplicated code and a small leak. They do not depend on each other. Patch 1 makes the gpio regmap use a raw spinlock. The gpio irq_chip callbacks run in atomic context -- irq_set_type() is called with the irq descriptor's raw spinlock held, and the driver itself disables preemption and interrupts while touching the registers. On PREEMPT_RT the gpio regmap uses the default spinlock_t, which becomes a sleepable rt_spin_lock, so writing a register field from that context sleeps and triggers "sleeping function called from invalid context". This is reachable from ordinary userspace: requesting a GPIO line with an edge trigger through the GPIO cdev ioctl ends up in irq_set_type(), so any application using edge-detected GPIO lines hits it. Other pinctrl drivers have already adopted the same fix, e.g. armada-37xx. Patch 2 replaces the open-coded dt_free_map callback with the core pinctrl_utils_free_map() helper. The local copy only frees config arrays of CONFIGS_PIN maps, but the driver may also produce CONFIGS_GROUP maps through the generic pinconf DT parser; their config arrays would be leaked. The core helper handles both types and removes the duplicate code. The RT bug was reproduced on a Raspberry Pi 5 with a PREEMPT_RT kernel by requesting an edge-triggered GPIO line from userspace. A full read of the pinctrl debugfs "pins" file (all 54 pins) produces no warnings. This patch was initially drafted with AI assistance and has been reviewed and modified by me. Signed-off-by: Xiaolei Wang --- Changes in v2: - Patch 1: unchanged since v1. - Patch 2: add the missing Fixes tag, which the automated Sashiko review flagged as a low severity issue: https://sashiko.dev/#/patchset/20261126035420.1836760-1-wangxiaolei01@kaihong.com?part=2 The CONFIGS_GROUP config arrays are allocated by the generic pinconf DT parser, so the leak dates back to the commit that introduced this driver's open-coded dt_free_map callback. No other change. Link to v1: https://lore.kernel.org/all/20261126035420.1836760-1-wangxiaolei01@kaihong.com/ Xiaolei Wang (2): pinctrl: rp1: use raw spinlock for gpio regmap pinctrl: rp1: use pinctrl_utils_free_map() for map cleanup drivers/pinctrl/pinctrl-rp1.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) -- 2.34.1