From patchwork Thu Mar 9 07:46:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 1754487 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=112.213.38.117; helo=lists.ozlabs.org; envelope-from=linux-aspeed-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=wJC3zufw; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PXLqY72K6z2469 for ; Thu, 9 Mar 2023 18:47:05 +1100 (AEDT) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4PXLqY5xL9z3cNJ for ; Thu, 9 Mar 2023 18:47:05 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=wJC3zufw; dkim-atps=neutral X-Original-To: linux-aspeed@lists.ozlabs.org Delivered-To: linux-aspeed@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linaro.org (client-ip=2a00:1450:4864:20::12d; helo=mail-lf1-x12d.google.com; envelope-from=linus.walleij@linaro.org; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=wJC3zufw; dkim-atps=neutral Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4PXLpV0GxKz3cM3 for ; Thu, 9 Mar 2023 18:46:10 +1100 (AEDT) Received: by mail-lf1-x12d.google.com with SMTP id n2so1123781lfb.12 for ; Wed, 08 Mar 2023 23:46:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678347969; 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=wJC3zufwPxxsbKw7VfvKKo3TwQtynJvjK4ttQs4bLtNyCksMt/VUnyY2BAbGcZ0wtG Z8D4qs41flPvAArqB5IeScGx0OuJ3Y7b5xrdlVrR8/nx93gcNo2qIhz9ELUvRLrg5G33 SKHUIgTXjHgfbHrlzU0SyIMIcJjeR0/6LJakIm2q2d1xVcsm13ovij7Qr/i7HpJUYDDZ 5/pHCUJA2ejaKXai6/ynckG06C8xwHNzmp0nBIcXKjVMJK1Yl1Jqu49ECcYleQcCO3BM iV4ZI0ur3ifZGcLbEU/77B5APP93JAcyJcKWXx0P+1HMwVuCU8lmquVKY7yB62YJEjmC 0Tcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678347969; 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=m5xuGN/YImKGbYVrSPiL304POS4GNem7FUAUV8Q5Z//LEDyqWOM+BuCSooORcqpEzc yvttGGauLTnxVbdB9CQM7TUbKBTcd8qNAr91Lo624wGpk92MQCkuUj9L0VMwKO6VT5+x jXhPnhqco1A6Mg538Jwz+ltwhOsUsQ0Dz/9k+5f0da5eAVeJfY01CT8kld/3THHRjTzt ACqWF9mkUVbyADoOewlvYFaZWsJPPa5buRHHR6wOwiN3AkthKSsAZalv1t1rxYuVDIOS Xdeb7QGBqKW70zw3RiaK+jwjoyHgqiICkVr0ryyPPZAzv/wLM0gEWbsLsf4z2gVartWs nwLA== X-Gm-Message-State: AO0yUKVt5GF8YtugetJ0T3ReYVmMLaemzsQeTXAb3Jed9Aga3GhPIibT mqlY7D4U/AfyT93Q7ujlZrOh8Q== X-Google-Smtp-Source: AK7set8oIb7klIzQY7BPa8cZvqgfYhhXZT50T/adiRtau3X8Oi4aw7qxIH/e+BQ9EDeRLQ0xkXKhbg== X-Received: by 2002:ac2:50d5:0:b0:4dd:a57e:9960 with SMTP id h21-20020ac250d5000000b004dda57e9960mr5974777lfm.5.1678347969422; Wed, 08 Mar 2023 23:46:09 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id a6-20020a056512020600b004bb766e01a4sm2568972lfo.245.2023.03.08.23.46.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 23:46:09 -0800 (PST) From: Linus Walleij Date: Thu, 09 Mar 2023 08:46:01 +0100 Subject: [PATCH v3 13/17] gpio: max732x: Convert to immutable irq_chip MIME-Version: 1.0 Message-Id: <20230215-immutable-chips-v3-13-972542092a77@linaro.org> References: <20230215-immutable-chips-v3-0-972542092a77@linaro.org> In-Reply-To: <20230215-immutable-chips-v3-0-972542092a77@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 X-Mailer: b4 0.12.1 X-BeenThere: linux-aspeed@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux ASPEED SoC development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-aspeed@lists.ozlabs.org, Marc Zyngier , Linus Walleij , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org Errors-To: linux-aspeed-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Linux-aspeed" 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;