From patchwork Tue Mar 7 13:04:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 13163468 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 93BD0C678D5 for ; Tue, 7 Mar 2023 13:11:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=x1xja1x8GXivmKE/anK6hQ0tYtlr2/cWqkyokDNMO+0=; b=wOIapi+EZ+c9t7 F/R13l5LHPg6IuZcheJoSfi70Q0BUGzIbBMGI8tabG/9envMhC7+GXnXy0AI+tSXdH4squXGL4rdd MDz2Tu4IFYhd03QpH4AjifjqR+KOvts/ExwKxidIzmUG4/GDFlb9fSZChaZTrLUyKYpQ0is3MeQn0 Z1XuUlSyPdRHRffZakPGef0pq3QGAdL2d+jbBsHcXVcGT3yYpOfWAhHV0jb4iFFDV0zH+FLW0TMrO 5egoqMhQQcBSvlkkGmuWvprlXmgVAlyrN8dJ7vwldrBkrxXHoXZ48EJoZCKcbINySfzNN0Q5cvsCB Zzxy7urJEFIjloDun4eQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZX4v-000Gd5-DZ; Tue, 07 Mar 2023 13:10:05 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZX06-000Dsr-PW for linux-arm-kernel@bombadil.infradead.org; Tue, 07 Mar 2023 13:05:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Sender:Reply-To:Content-ID:Content-Description; bh=BE0hN/evTOxc8pxKXkniQeMiy8yek7h1H53mI21BTS8=; b=IDUdUAIFDBMP5kVqW7CuVJl00a /pvlAEI530qHndIwUxW5wLe732VsguZtqxXCcKy3IHEMU7+bQPYGpDI2g4pucfXxKtig9jQyb3ynw lEok7YndZwRCqe3zJTO43zz/LL08psGB/nIyB3L/sDN2o+Y8BfK/oK0CCx9AIygwXpG7gEL082xBQ XNIhy5YW/38Szg9k6rxWc5ZAhYyXOxWU0ujrgz9pGa/kv9XDddDwEZ/BvCiKbmoH/Tqj0xgFevg8C bk5SDuFycy6LyHzi21q0E0g9Zb9zLw9kKsBUfY1EIHssvrDSfvF0yJID4jtdSGnAhFTYl2/ZBOfz3 xt2ALL7A==; Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pZX01-00H2yJ-09 for linux-arm-kernel@lists.infradead.org; Tue, 07 Mar 2023 13:05:03 +0000 Received: by mail-lf1-x12f.google.com with SMTP id g17so16984746lfv.4 for ; Tue, 07 Mar 2023 05:04:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678194298; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=BE0hN/evTOxc8pxKXkniQeMiy8yek7h1H53mI21BTS8=; b=vZKm0sHQNOSMMZoNqibcrK3Qe6Lg01/4Fr1aaxO9TGYf/45NkCHHxU/yfX8ZsCGMx/ J9zXwTKz+qF5UBNy0qy4JohKdNJ2XymtlmWrfhlrgGpAO0PHnES4m2FWy9S8RxHJXPUq wzs1CANIN4hrO+6RHsyevTyy1CwkdAbUJYmUtP73VVtm1ucs9J7twojT3oreATjs7YQf UAyT80ziocByhf7ZYiouICdsrHgNauSbu71i+RphcnA7crEl+YsM74LvNV2BN70FI8H5 1rVIfU6qqA2Fa9brCUIIg1nI8ecG+TXZBn84g9c2Jfe8TAFLkKN9LLRBCjHzML+yhZq8 DdXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678194298; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BE0hN/evTOxc8pxKXkniQeMiy8yek7h1H53mI21BTS8=; b=uBatyxVSxyB4tvpm5CaYHrU1KM8XmUQE2MLQxKmEiN7WSY2QHAu31L3dVPKhd0hWKX C8Gygx3Umix5AE7yOhdZsYKGtuSpyrPfeqBJaY0rSLK6SBXfCXrTxR6V1FXbHg+K7xGb nUzMB4Y4ZT326EqY4u0xzHUDnBjApO4tgkWUa7IidAXCfhJWo9mkeA3+lmE1sFm0L7lS 63+LvCvAfAP8x96N72IPt69h64ObUMG2xm/MlTf7zwCDpyhFO0Bp9O2meMMoFvibjP04 MuDWHQ4teyfVIxQrC8SYRLTg2phhGwcCzSh5ZKBeNxqpnzeCMFMRVDS+4Ny9eJaBTpmZ lNgw== X-Gm-Message-State: AO0yUKUc3e4fI18+0oFnGCvDQLZRfWbnDP6bpbols0iBN3E/HDOK7CSV 2TAKsZmVs9DRZZPuzaOyaeOwUQ== X-Google-Smtp-Source: AK7set9wENuA3GfSq1Bk7Dw+Yjl09qsPMHBsyKksazihCREvuGQFHqQ3k0XZPposjOWqIHAg57giKA== X-Received: by 2002:ac2:52bb:0:b0:4d8:5de4:e3b4 with SMTP id r27-20020ac252bb000000b004d85de4e3b4mr4312862lfm.1.1678194297974; Tue, 07 Mar 2023 05:04:57 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id w14-20020ac2598e000000b004caf992bba9sm2030548lfn.268.2023.03.07.05.04.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 05:04:57 -0800 (PST) From: Linus Walleij Date: Tue, 07 Mar 2023 14:04:54 +0100 Subject: [PATCH v2 12/16] gpio: max732x: Convert to immutable irq_chip MIME-Version: 1.0 Message-Id: <20230215-immutable-chips-v2-12-d6b0e3f2d991@linaro.org> References: <20230215-immutable-chips-v2-0-d6b0e3f2d991@linaro.org> In-Reply-To: <20230215-immutable-chips-v2-0-d6b0e3f2d991@linaro.org> To: Mun Yew Tham , Bartosz Golaszewski , Joel Stanley , Andrew Jeffery , Alban Bedel , Orson Zhai , Baolin Wang , Chunyan Zhang , Jay Fang , Daniel Palmer , Romain Perier , Santosh Shilimkar , Kevin Hilman , William Breathitt Gray Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-omap@vger.kernel.org, Linus Walleij , Marc Zyngier X-Mailer: b4 0.12.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230307_130501_553248_AF839628 X-CRM114-Status: GOOD ( 14.58 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Convert the driver to immutable irq-chip with a bit of intuition. Cc: Marc Zyngier Acked-by: Marc Zyngier Signed-off-by: Linus Walleij --- drivers/gpio/gpio-max732x.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpio-max732x.c b/drivers/gpio/gpio-max732x.c index 68e982cdee73..7f2fde191755 100644 --- a/drivers/gpio/gpio-max732x.c +++ b/drivers/gpio/gpio-max732x.c @@ -351,6 +351,7 @@ static void max732x_irq_mask(struct irq_data *d) struct max732x_chip *chip = gpiochip_get_data(gc); chip->irq_mask_cur &= ~(1 << d->hwirq); + gpiochip_disable_irq(gc, irqd_to_hwirq(d)); } static void max732x_irq_unmask(struct irq_data *d) @@ -358,6 +359,7 @@ static void max732x_irq_unmask(struct irq_data *d) struct gpio_chip *gc = irq_data_get_irq_chip_data(d); struct max732x_chip *chip = gpiochip_get_data(gc); + gpiochip_enable_irq(gc, irqd_to_hwirq(d)); chip->irq_mask_cur |= 1 << d->hwirq; } @@ -429,7 +431,7 @@ static int max732x_irq_set_wake(struct irq_data *data, unsigned int on) return 0; } -static struct irq_chip max732x_irq_chip = { +static const struct irq_chip max732x_irq_chip = { .name = "max732x", .irq_mask = max732x_irq_mask, .irq_unmask = max732x_irq_unmask, @@ -437,6 +439,8 @@ static struct irq_chip max732x_irq_chip = { .irq_bus_sync_unlock = max732x_irq_bus_sync_unlock, .irq_set_type = max732x_irq_set_type, .irq_set_wake = max732x_irq_set_wake, + .flags = IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, }; static uint8_t max732x_irq_pending(struct max732x_chip *chip) @@ -517,7 +521,7 @@ static int max732x_irq_setup(struct max732x_chip *chip, } girq = &chip->gpio_chip.irq; - girq->chip = &max732x_irq_chip; + gpio_irq_chip_set_chip(girq, &max732x_irq_chip); /* This will let us handle the parent IRQ in the driver */ girq->parent_handler = NULL; girq->num_parents = 0;