From patchwork Thu Feb 16 09:37:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 57943 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp203741wrn; Thu, 16 Feb 2023 01:41:36 -0800 (PST) X-Google-Smtp-Source: AK7set9FDAj6DMc2Nirp9Tm0th/wK7wpzOQdnfoX4EXkrunL5kwn1f6NaipztzeEUrqJaKuToVek X-Received: by 2002:a17:906:3c53:b0:8b1:3813:7b6 with SMTP id i19-20020a1709063c5300b008b1381307b6mr5781279ejg.30.1676540496084; Thu, 16 Feb 2023 01:41:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676540496; cv=none; d=google.com; s=arc-20160816; b=knwwcgsSQnm3t1MkNo9/A+6RAqXGmR82nhTT+IhZM2ITB6k8ahgugixkNX4F/ulNE/ K+M3AEK3LqY2vbJfLrVg4XEbqHiwpuxAuKJrwD1M/Z+/dUa5nlc/rNMLSgUYSxL7O/1N hKOf3fMpwX7k4WatEKm+92eldR90Wo5dRRjlNoPTqjUYFPlhJNF7oGriL8gFvZ+8QQDb ciVV3W7INaSBm10zc7QDkzDJIQz9LLV2L2i7K5AWwfmR75HMDbqQIAc/WwFyFlQAdOkC Tg/IJ2NLEQyLuAUGMdjahd3fpdnb1K0sbXOgL7UYT2x61U9S9+aaTOLaJ2RZ9zZDbWIT HI2w== 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=a8DZXGe1xObRdMsVrQnS0lb6atFLew5i7Tuuw+JmgFw=; b=G+WMsHhXXbL8tX6/uL2zNHxhF0GI/fnzznpoCuzZZjoCDMA5kdZXEGRHMdEJIMhmwX mQdliWbGoVhaWa9YyKNDccX/srLLW231Bc9FTvFGnUwgRb10iC//gicm8UTYmT3dKFKo QavoHaEQ0m12rLEL7Dn+8rfI2aIAf+w1+aKIdyNPbd5CfbtIekyC+DgbEOaA3iHF5Etb +i9cM70cg1FXuZADkR7vI1lAjvUD02z/CXoDpKmkrkDSRH0HnVQeBMZhKUHGvZsYScEO /RwVwXA4zRZ+iO+iPSuEMD6UnZxJ+EQHnfEwyZ/E/+ek2b8rzecYce+CzMeV+GZjleTH 1iUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wToZTfdu; 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 w5-20020aa7da45000000b004a0b622f8fcsi1549631eds.289.2023.02.16.01.41.13; Thu, 16 Feb 2023 01:41:36 -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=wToZTfdu; 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 S230174AbjBPJhw (ORCPT + 99 others); Thu, 16 Feb 2023 04:37:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230111AbjBPJhY (ORCPT ); Thu, 16 Feb 2023 04:37:24 -0500 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 026214DE28 for ; Thu, 16 Feb 2023 01:37:16 -0800 (PST) Received: by mail-lf1-x133.google.com with SMTP id c20so2024461lfv.6 for ; Thu, 16 Feb 2023 01:37:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=a8DZXGe1xObRdMsVrQnS0lb6atFLew5i7Tuuw+JmgFw=; b=wToZTfduTW2q2j/bGKbgja2LztHwIOlTvQClVG+7cNvEpVrBrdTXDxJ3tqPsww+jAU uFKNuUgQk59p9xMCGS4hUu4Fdd6MZKvHWYPIa0qNjOMGCRBdwNtBYOITKDvhHAgElWY7 OsAu34b1GzQnWgTTZ+jNFlF/b4vZxwTmq9EYK74hhDBVZyhirLKzDGeIP66uzG/msCPG EhqEBh4GTOejc0igvcr/8lok1FfaznsI+Jh+fKN4YUo0LSZuLC+VW2yIKfWcdj5AqvLY YIe1/gi0msoyPZ/Ipp8ej0AR/br+SV8hO42S+eX7KVzs9Q1+mTxdIJWASXjIzYE8hR03 wIrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=a8DZXGe1xObRdMsVrQnS0lb6atFLew5i7Tuuw+JmgFw=; b=Rj6nf5EMPbkwLsAaPcA9r+uWyxLvBStHEGz9DiKtQT0CfrnCNJXvfa+qyvjTHXMs6m 3Mvz6UX6kh932uQSEgaE3nbdgqbmloZq+94Wb3142bwp7q8FvZ2/cGgac6c3as+szu3J X0ysTz4h2/iMpWcmi2Csb2msr0OXZVUeC2v4dpJVByRQUTPegWbJfUEnn9AhA/ssOWgL GFrMgBGlKYkYiA6mB5q3L/xvz6gaDDNPfr7fJN5VY7u/aIqt7YaY6wfU+xg0Bos5VVXH XZqL47tkDRstaC9jC2D0EQpAPWP3Mp4sEFytSsRs1XYVWn0KrcqLxfdlzRqY3bYASbho Ev2g== X-Gm-Message-State: AO0yUKXxASOx73JmDxRm33WqKhUlQLkl2ocJ+RLYn+kwCg45ZyHq30Gd jTkiWcABZpPvAmMjrUwu/TGMMQ== X-Received: by 2002:ac2:5088:0:b0:4db:80:fba2 with SMTP id f8-20020ac25088000000b004db0080fba2mr1742040lfm.63.1676540236497; Thu, 16 Feb 2023 01:37:16 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id r3-20020a19ac43000000b004d8758a452asm229069lfc.288.2023.02.16.01.37.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Feb 2023 01:37:15 -0800 (PST) From: Linus Walleij Date: Thu, 16 Feb 2023 10:37:11 +0100 Subject: [PATCH 10/17] gpio: idt3243x: Convert to immutable irq_chip MIME-Version: 1.0 Message-Id: <20230215-immutable-chips-v1-10-51a8f224a5d0@linaro.org> References: <20230215-immutable-chips-v1-0-51a8f224a5d0@linaro.org> In-Reply-To: <20230215-immutable-chips-v1-0-51a8f224a5d0@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 , Grygorii Strashko , 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 autolearn=unavailable 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?1757980127372841013?= X-GMAIL-MSGID: =?utf-8?q?1757980127372841013?= Convert the driver to immutable irq-chip with a bit of intuition. Cc: Marc Zyngier Signed-off-by: Linus Walleij Tested-by: Thomas Bogendoerfer --- drivers/gpio/gpio-idt3243x.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/gpio-idt3243x.c b/drivers/gpio/gpio-idt3243x.c index 1cafdf46f875..00f547d26254 100644 --- a/drivers/gpio/gpio-idt3243x.c +++ b/drivers/gpio/gpio-idt3243x.c @@ -92,6 +92,8 @@ static void idt_gpio_mask(struct irq_data *d) writel(ctrl->mask_cache, ctrl->pic + IDT_PIC_IRQ_MASK); raw_spin_unlock_irqrestore(&gc->bgpio_lock, flags); + + gpiochip_disable_irq(gc, irqd_to_hwirq(d)); } static void idt_gpio_unmask(struct irq_data *d) @@ -100,6 +102,7 @@ static void idt_gpio_unmask(struct irq_data *d) struct idt_gpio_ctrl *ctrl = gpiochip_get_data(gc); unsigned long flags; + gpiochip_enable_irq(gc, irqd_to_hwirq(d)); raw_spin_lock_irqsave(&gc->bgpio_lock, flags); ctrl->mask_cache &= ~BIT(d->hwirq); @@ -119,12 +122,14 @@ static int idt_gpio_irq_init_hw(struct gpio_chip *gc) return 0; } -static struct irq_chip idt_gpio_irqchip = { +static const struct irq_chip idt_gpio_irqchip = { .name = "IDTGPIO", .irq_mask = idt_gpio_mask, .irq_ack = idt_gpio_ack, .irq_unmask = idt_gpio_unmask, - .irq_set_type = idt_gpio_irq_set_type + .irq_set_type = idt_gpio_irq_set_type, + .flags = IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, }; static int idt_gpio_probe(struct platform_device *pdev) @@ -168,7 +173,7 @@ static int idt_gpio_probe(struct platform_device *pdev) return parent_irq; girq = &ctrl->gc.irq; - girq->chip = &idt_gpio_irqchip; + gpio_irq_chip_set_chip(girq, &idt_gpio_irqchip); girq->init_hw = idt_gpio_irq_init_hw; girq->parent_handler = idt_gpio_dispatch; girq->num_parents = 1;