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: 65452 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2420261wrd; Tue, 7 Mar 2023 05:12:02 -0800 (PST) X-Google-Smtp-Source: AK7set+379DvIAgO5kQKqpSkEf2bCv/IEcsBU0XnHkxjVr8Z6N3VqxyA/u4N2yWCDn0pTDlVYSef X-Received: by 2002:a17:906:271a:b0:8f0:143d:ee34 with SMTP id z26-20020a170906271a00b008f0143dee34mr11435208ejc.1.1678194722581; Tue, 07 Mar 2023 05:12:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678194722; cv=none; d=google.com; s=arc-20160816; b=ubZ/SjIaGV6+9oVvQ629PotK1raGn2oi9MSy5R3vorAg6u7Nz2FprVYSS35LWaP490 6UUvCReSyOzwPVM08U1lQNQ1N3mQhJocLClV6BlpIt+aC1deBF3+SNwiLXLPo4ufor7y xRZP5XzOVj7BdYLmNw1EgSgRHMV4QTeQtzbI+LBbmUrwhfVawPLfXHpDrc9U8BBmVJ9M OR6MznGcuRFGTB71bGpGQflpegymxzNdIl6t8nfUy+xIHSq20JUyBs13X6kS2UbUGLp4 lBIGb0qZv/kLYs3lvUzyfNugiONP1bpqLAfQeHZoaVJheLun47jFi9skg8yAtGQmGFvi hffw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=BE0hN/evTOxc8pxKXkniQeMiy8yek7h1H53mI21BTS8=; b=LNdSADinBnpwdp5gMUjYWmH76Rv1Qlo+mPP/3xUfODA/quGrBcxukDo03IMTSjKT9A Cj8wm3/u+uuDMzaDDZ6WVl/SOnZyMRdD2rLTcCpOHwgHPN8J1EBAS38GgoOrSQgZGbk+ zrQruLOGxnTzHfEiRzM3dIT4RujcJCY/Ale1VZGBsSJ2W35BrDQrVYb9ygsTq1MTKWKc nGydv+5YpbRRN6T8lYblTHWfTR0duJjhEI1m3dbKIst4qrsD/JJjvZm1AEVTzKhV11W5 XXIxy+m/pfHApYwggipV6G6ER+/75wFLjILWzxL2WltSUT36FooEorwo970bmHPvA6r2 5KSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vZKm0sHQ; 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=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m9-20020a17090607c900b008d9156e6409si1066790ejc.517.2023.03.07.05.11.38; Tue, 07 Mar 2023 05:12:02 -0800 (PST) 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=@linaro.org header.s=google header.b=vZKm0sHQ; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230093AbjCGNFs (ORCPT + 99 others); Tue, 7 Mar 2023 08:05:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230133AbjCGNF3 (ORCPT ); Tue, 7 Mar 2023 08:05:29 -0500 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 632871968C for ; Tue, 7 Mar 2023 05:04:58 -0800 (PST) Received: by mail-lf1-x12b.google.com with SMTP id r27so16942217lfe.10 for ; Tue, 07 Mar 2023 05:04:58 -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=vtPVYWyAPlhKrqNKTQI1q9sqOTFeREKFSwX/KYYoipJJJPekRn89nBXz4EU+9SOrVH x0E1/yQyC00BReG8wrU7hc64PZOnAwEBrJTXy2khfAbNBogx41o4IGBNFNq4AGsM2HZx DvsCJLmreTLRl1E5hZVx6Vx2xM20HX29AlE2KNqXpt3/CoDm1z2vRO/XEccz/jvY3tYC tZkr5PG2fMRkxJ2fPrE9JYWMvSo/qzyH3vkAqhjmtsd7KkYfx6JfqW73ilkkFiTJitxp 5pSfkiSl2tKGnaj0GNwHGjpkF1luVg9Rap43YKSMmFyzAPd/3cot+qun4XCPTdCJJ9kY mxew== X-Gm-Message-State: AO0yUKUBBBrf2vjDkxbJ6A6HXSczQ/zpHmz9/tgiaExb09tQg12PtIxg vGRY9M+pw3by1/HCoR090Foy8Q== 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-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759714709523397101?= X-GMAIL-MSGID: =?utf-8?q?1759714709523397101?= 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;