Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp310816pxb; Wed, 20 Apr 2022 23:33:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyd70hXcQ0yldclQz6jqH8fEthe17eJS872Q0XJyxAvqz/8qOfXcAjOd0yrE1p7d32DC+ez X-Received: by 2002:a17:907:6d17:b0:6ef:f06c:89 with SMTP id sa23-20020a1709076d1700b006eff06c0089mr9626050ejc.649.1650522809099; Wed, 20 Apr 2022 23:33:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650522809; cv=none; d=google.com; s=arc-20160816; b=DxsbmXhwVb0QjJcvfiaOtuLu6NgpzX2gMV3vGeflSZXdIrwroDe3YLa3t0XnaNKTkY Q/yqQtDb0UhUI5K64/1z1eehFxhvBcl2rwC+oXGdlhMeTe338kquOAZOTjiAqrOZRm6Q TInSZuhguEqS4cHQbX5o30lOWGEIx68f96tXYWmOiXZffWscMkd4o6i0LNJsxpnNtDqm jvTRPqPbBZ2QAYg2kYJzkUVi5NW4QnXqxmaM8FYvR/rKsKD5g0Bswt0Xj1/Ey6RkAAjw SVbWIBHqTFDOAjv875TE9X/MGklf1qoOR90eZST0FjfiunIK4uRTmIe16CpD+0p+TssN BTfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=I8LVyMyl69zR1ZKXc9yYCBmiEE6hBFrp1p3Ewpg/sfE=; b=vdPoDrLoZ+WUz1h0Xlq7uSh6oZCT7R0x2w7tXjROMqkf9SvVnWRNINjazA0P152STz /0qIEXdM6dmJgKFWwYztCymQixJj1UBt9F4fM3QfvIAvCmhmrhiaC6YFqUUAV6X8Ml1Z ngfaOBAKsKAD/J6XSN7YHuunmh2RniHOKC4XcB9jqrYLWKVqpArrJ2MGWSBUR7o3KbsZ S6CiMcxvPjtFcnZpjJPObZuynQeFGcKoF4rbKj3PyzUlt8QPHc1yv9kFU1zTXmsvYLAm /NRWdtG6bW/XY+Ona4aniAAoD0R8GcdmMPSTDf5ItJXGk0aqpwXHzVW5xBS/BtggM9I5 FY+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=anRS9Ap2; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w6-20020a056402268600b0041d71bccc73si3594248edd.244.2022.04.20.23.33.05; Wed, 20 Apr 2022 23:33:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=anRS9Ap2; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353416AbiDSOcN (ORCPT + 99 others); Tue, 19 Apr 2022 10:32:13 -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: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 irqchip: Commit-ID: 36b78aae4bfee749bbde73be570796bfd0f56bec Gitweb: https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/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, unsigned int offset); int gpiochip_irq_reqres(struct irq_data *data); void gpiochip_irq_relres(struct irq_data *data); +/* Paste this in your irq_chip structure */ +#define GPIOCHIP_IRQ_RESOURCE_HELPERS \ + .irq_request_resources = gpiochip_irq_reqres, \ + .irq_release_resources = 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 = (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 offset);