From nobody Thu May 14 08:17:34 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB9DDC433F5 for ; Tue, 19 Apr 2022 14:29:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353425AbiDSOcP (ORCPT ); Tue, 19 Apr 2022 10:32:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353341AbiDSObt (ORCPT ); Tue, 19 Apr 2022 10:31:49 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB96632ED7 for ; Tue, 19 Apr 2022 07:29:06 -0700 (PDT) Date: Tue, 19 Apr 2022 14:29:04 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1650378545; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=I8LVyMyl69zR1ZKXc9yYCBmiEE6hBFrp1p3Ewpg/sfE=; b=anRS9Ap2byBwjYJ0L8oWWwXxEGHlZZe8K5yNHEnSrTfhmN4MZFffGb5ow1BbuV5bmx2H23 V/LziwgkYM3EjUkPot+NUmI/P6jrYVvO+0Ja9gcmU+kVgH3Lm7IOaHIb935VF0M8yat3mV E/6hWM4wXkaX+u0yZ0X+mN/jKlfNE7iPsTqlGI4dtFNpsv73xYOMC1hWlD1o741xJLG9iE c0bDDSip7dsCNjy5s0KkSVEcyRVC3SI3454r3kTmFz+5K7Rwsxv7r/8SUq7FzGTSmiRv3/ ADnib2K4zvvWFat+tsPU+5rHK/xxJK59KLh1u3pSEaw1JL3EbYrk1Cl0bP016A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1650378545; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=I8LVyMyl69zR1ZKXc9yYCBmiEE6hBFrp1p3Ewpg/sfE=; b=DhlXr4QBqM2co3Akk//KLYEpSOid893zUYBD4vT2xBDUaCnWWMhfeWSeGvQIl8XhliIlSy LC67LH7kOF6Vi0Dw== From: "irqchip-bot for Marc Zyngier" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-kernel@vger.kernel.org Subject: [irqchip: irq/irqchip-next] gpio: Add helpers to ease the transition towards immutable irq_chip Cc: Andy Shevchenko , Bartosz Golaszewski , Marc Zyngier , tglx@linutronix.de In-Reply-To: <20220419141846.598305-4-maz@kernel.org> References: <20220419141846.598305-4-maz@kernel.org> MIME-Version: 1.0 Message-ID: <165037854449.4207.5465768707727542198.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the irq/irqchip-next branch of ir= qchip: Commit-ID: 36b78aae4bfee749bbde73be570796bfd0f56bec Gitweb: https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-plat= forms/36b78aae4bfee749bbde73be570796bfd0f56bec Author: Marc Zyngier AuthorDate: Tue, 19 Apr 2022 15:18:39 +01:00 Committer: Marc Zyngier CommitterDate: Tue, 19 Apr 2022 15:22:25 +01:00 gpio: Add helpers to ease the transition towards immutable irq_chip Add a couple of new helpers to make it slightly simpler to convert drivers to immutable irq_chip structures: - GPIOCHIP_IRQ_RESOURCE_HELPERS populates the irq_chip structure with the resource management callbacks - gpio_irq_chip_set_chip() populates the gpio_irq_chip.chip structure, avoiding the proliferation of ugly casts Reviewed-by: Andy Shevchenko Reviewed-by: Bartosz Golaszewski Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/20220419141846.598305-4-maz@kernel.org --- include/linux/gpio/driver.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h index 066bcfd..8329900 100644 --- a/include/linux/gpio/driver.h +++ b/include/linux/gpio/driver.h @@ -583,6 +583,18 @@ void gpiochip_enable_irq(struct gpio_chip *gc, unsigne= d int offset); int gpiochip_irq_reqres(struct irq_data *data); void gpiochip_irq_relres(struct irq_data *data); =20 +/* Paste this in your irq_chip structure */ +#define GPIOCHIP_IRQ_RESOURCE_HELPERS \ + .irq_request_resources =3D gpiochip_irq_reqres, \ + .irq_release_resources =3D gpiochip_irq_relres + +static inline void gpio_irq_chip_set_chip(struct gpio_irq_chip *girq, + const struct irq_chip *chip) +{ + /* Yes, dropping const is ugly, but it isn't like we have a choice */ + girq->chip =3D (struct irq_chip *)chip; +} + /* Line status inquiry for drivers */ bool gpiochip_line_is_open_drain(struct gpio_chip *gc, unsigned int offset= ); bool gpiochip_line_is_open_source(struct gpio_chip *gc, unsigned int offse= t);