From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 54A8D47D949 for ; Wed, 15 Jul 2026 12:29:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784118588; cv=none; b=DcWkxM1AO7K55NC2+NrhPfqY05azXEYDR+KUAz6FKCj/MkRZOh9J93Js3Xal/Vc7zcgclVEo0Gvyl1jbdqYW+hABl1lhuemiwgJ89J7LTJnLGCWYT9GeMVpxHmIco7CgtrpFB6mbk+suBZHEikUqMcxrhrh/otadZEMJQJ78TuA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784118588; c=relaxed/simple; bh=RPnGMYwpuu4Q9PjKZXlMk8TL7x4tqKXbmEB39sWYnXQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=X8SN7oUaAcmK7dVSYGgoHNyvdRYkC5W0+XL/9S7FtwHrJMUetX/CNyc8U5dsx4hHCaG222+TI9g6P/fXzPjolvurJz8WaqCo0eQJwrcI+mZ8g91U3epO17f9iIFxLCvbboUt22Xiz0UjYcbdhXhJXfgSlNOtGzIIosvquCz1398= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=DC0hei1N; arc=none smtp.client-ip=209.85.221.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DC0hei1N" Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-47d70879764so3660465f8f.2 for ; Wed, 15 Jul 2026 05:29:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784118584; x=1784723384; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Xg6K9BOVyTm0sW/3T39sG2O2ploAdMhQq+0sGRnM+RE=; b=DC0hei1N/Q/5G1HVgokD5cVUaDDnRvyaWAyTOXbBAigTkQBbVuULiTog2pTH1twZgg 6SR2IEo6g7GuwRsgSpwxEdCpTPdRkm7oQA5mKBUgmcgzocaouVNjuo53hAxyR4D7OHtP rTYrzgkwphABpml9yEWohY3+Q6wa6RsOCd35z70saxBxlnrL8OkrtDku65s9CxqvdPWC lWVub9j0mwA85rZ88SWbF2bWtSAGV8bSvxBZ7ireeKD2GGzsqADMEqy7+M5SfDyZYTqS jI8t+WSobzCRNRwBd/NxCQJTAoC9liimy//Th+oQvbEeba60lR8J56iqzZ9wXuy0wkQf 7xFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784118584; x=1784723384; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=Xg6K9BOVyTm0sW/3T39sG2O2ploAdMhQq+0sGRnM+RE=; b=JaGSToS9k2StRWu3A+eUJKXZOoRjoKxCrbrdZI4kscIiyAyYHB90sX9/FZZbWCfP5p d8e1hh5UG2C0RGqBkXoZzBo7ElWkEM5WmEu53Vupt9i2FhnsLeGSDPO248xaEc3Twojn KBxeG5ClyvzW0sNriQI+Kx59ZE9Nbx5JVYrQt6pbgw97xNBTIKt5uv7p0hXWTproc6wB I+Mwr8KguCzbDQeHaX6kT6aRHe83DRwaueaobnSdrZjHB8BXAnxCh7gOAZ9UL0PvLtay ODj/02GTlSGBrNglgvptgunJzez32tZiEqlW7sewf3JY010RsuxKwTMOASspmZsVDs3V B3Sw== X-Forwarded-Encrypted: i=1; AHgh+RqAHYcOTvZr/0B+XT0dZTA6RNzL8A9kT5yJ1pG6uCni+036XF6L09QSFm1NFkPcD0vy5DqcY+DVdelEzL4=@vger.kernel.org X-Gm-Message-State: AOJu0YywasCmGV7167Zon113mesYctJm8bMWhuWwXtFrykWt1AS3pkKy JtA5zG1Ti3Wwu6djNDcNAxZG8KfwZy0e90KEpwzLWTc9sKiQNEYGypmr X-Gm-Gg: AfdE7clmdykWsNOA36Qdx3PVsxXHm0nYcHEi8mJZaewWi3BkIaQInoqaigf0yYvdaaY 8PyVZJ2l7OfIpt2Aly1cdGOrdtITHOnMjISPluNtD9OPiPjvPUCLAKVTcXI3ie0bPVpVtWdkQI4 O6TOhqMp6g3X4k2nuRkbetUNjPi/W7YRMQP+svqvBPbJWNDl301Lpvmp7FZlZ7DduKNZZx+Gg7s jjW3PLyeYINp98rTh4kf3dnB+IzWF5muAVwoqd3JxAHh+RxAg3KnBcT6ubYIf6LPiOJVdQB1WQN LxESodjuUsgwVpyMU3BDQGUa+GgaXRhxgIC3lyfttItial1N5VakBc3eX+8l/FwqcMc8j7YjfED uJs/LDEy+LznDV6PIjqiq1BtwzPeAgnaVCIcsMZ/YIDv66R2yyLFeABBKs4/hTBmI8vAhOpa3ln aQu1pn/RcIxr5at9207w1e98z5AnZ0HIU9QQ== X-Received: by 2002:a05:600c:3487:b0:493:bacb:1341 with SMTP id 5b1f17b1804b1-4953c144adamr29207275e9.4.1784118584084; Wed, 15 Jul 2026 05:29:44 -0700 (PDT) Received: from taln60.nuvoton.co.il ([212.199.177.18]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4950a32a2casm216770715e9.12.2026.07.15.05.29.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jul 2026 05:29:43 -0700 (PDT) From: Tomer Maimon To: andrew@codeconstruct.com.au, linusw@kernel.org, brgl@kernel.org Cc: openbmc@lists.ozlabs.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, avifishman70@gmail.com, tmaimon77@gmail.com, tali.perry1@gmail.com, venture@google.com, yuenn@google.com, benjaminfair@google.com Subject: [PATCH v1 6/8] pinctrl: npcm8xx: move GPIO IRQ setup into request_resources Date: Wed, 15 Jul 2026 15:29:21 +0300 Message-Id: <20260715122923.1938327-7-tmaimon77@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260715122923.1938327-1-tmaimon77@gmail.com> References: <20260715122923.1938327-1-tmaimon77@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit npcmgpio_irq_startup() calls pinctrl_gpio_direction_input(), which may sleep while taking the pinctrl core mutex. That makes IRQ startup trip lockdep when CONFIG_PROVE_LOCKING is enabled. Move the direction change into irq_request_resources() and keep startup limited to the ack and unmask operations that are safe in atomic context. Signed-off-by: Tomer Maimon --- drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c | 29 ++++++++++++++++++----- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c b/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c index 1c95d7cbd..e21ccdb5d 100644 --- a/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c +++ b/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c @@ -297,17 +297,33 @@ static void npcmgpio_irq_unmask(struct irq_data *d) static unsigned int npcmgpio_irq_startup(struct irq_data *d) { - struct gpio_chip *gc = irq_data_get_irq_chip_data(d); - unsigned int gpio = irqd_to_hwirq(d); - - /* active-high, input, clear interrupt, enable interrupt */ - npcmgpio_direction_input(gc, gpio); npcmgpio_irq_ack(d); npcmgpio_irq_unmask(d); return 0; } +static int npcmgpio_irq_request_resources(struct irq_data *d) +{ + struct gpio_chip *gc = irq_data_get_irq_chip_data(d); + unsigned int gpio = irqd_to_hwirq(d); + int ret; + + ret = npcmgpio_direction_input(gc, gpio); + if (ret) + return ret; + + return gpiochip_reqres_irq(gc, gpio); +} + +static void npcmgpio_irq_release_resources(struct irq_data *d) +{ + struct gpio_chip *gc = irq_data_get_irq_chip_data(d); + unsigned int gpio = irqd_to_hwirq(d); + + gpiochip_relres_irq(gc, gpio); +} + static struct irq_chip npcmgpio_irqchip = { .name = "NPCM8XX-GPIO-IRQ", .irq_ack = npcmgpio_irq_ack, @@ -315,8 +331,9 @@ static struct irq_chip npcmgpio_irqchip = { .irq_mask = npcmgpio_irq_mask, .irq_set_type = npcmgpio_set_irq_type, .irq_startup = npcmgpio_irq_startup, + .irq_request_resources = npcmgpio_irq_request_resources, + .irq_release_resources = npcmgpio_irq_release_resources, .flags = IRQCHIP_MASK_ON_SUSPEND | IRQCHIP_IMMUTABLE, - GPIOCHIP_IRQ_RESOURCE_HELPERS, }; static const int gpi36_pins[] = { 36 }; -- 2.34.1