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 D9503134B3 for ; Mon, 26 Jun 2023 18:21:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 588B6C433C8; Mon, 26 Jun 2023 18:21:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1687803696; bh=E34G79hfY9gKLRtvfSh+ldeJOR/dny+TKpgI0MKgf+w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zHm6XYm1WKrJva2sHMQdAQtSTVrzdSKT1e8nzvPLq/m279bsY8wYEQ4wO6fNVjfr5 QevxFJFJwzuL8EhH9RJHGGotXjqnPj786+Z7MdBN2p4UEeiuYxuA57bElNZXkiffb7 oMWoXnjs/fzD3D5Gqg1CSBjqhyn2qBDzd3/X0sV0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jiawen Wu , Andy Shevchenko , Linus Walleij , Bartosz Golaszewski , Sasha Levin Subject: [PATCH 6.3 146/199] gpiolib: Fix GPIO chip IRQ initialization restriction Date: Mon, 26 Jun 2023 20:10:52 +0200 Message-ID: <20230626180812.024436215@linuxfoundation.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230626180805.643662628@linuxfoundation.org> References: <20230626180805.643662628@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Jiawen Wu [ Upstream commit 8c00914e5438e3636f26b4f814b3297ae2a1b9ee ] In case of gpio-regmap, IRQ chip is added by regmap-irq and associated with GPIO chip by gpiochip_irqchip_add_domain(). The initialization flag was not added in gpiochip_irqchip_add_domain(), causing gpiochip_to_irq() to return -EPROBE_DEFER. Fixes: 5467801f1fcb ("gpio: Restrict usage of GPIO chip irq members before initialization") Signed-off-by: Jiawen Wu Reviewed-by: Andy Shevchenko Reviewed-by: Linus Walleij Signed-off-by: Bartosz Golaszewski Signed-off-by: Sasha Levin --- drivers/gpio/gpiolib.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 4472214fcd43a..1cfddbb3443d0 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -1763,6 +1763,14 @@ int gpiochip_irqchip_add_domain(struct gpio_chip *gc, gc->to_irq = gpiochip_to_irq; gc->irq.domain = domain; + /* + * Using barrier() here to prevent compiler from reordering + * gc->irq.initialized before adding irqdomain. + */ + barrier(); + + gc->irq.initialized = true; + return 0; } EXPORT_SYMBOL_GPL(gpiochip_irqchip_add_domain); -- 2.39.2