From patchwork Thu Mar 9 07:45:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 66637 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp156850wrd; Wed, 8 Mar 2023 23:56:11 -0800 (PST) X-Google-Smtp-Source: AK7set/ZyyQaAaFlvoqGIAR3R5KBDkiioGtMvqkHLoIputDgrEYjnCfdlhUqO84AfW9QOlbiuYGJ X-Received: by 2002:a17:90a:e7ca:b0:234:f77:d6d2 with SMTP id kb10-20020a17090ae7ca00b002340f77d6d2mr21868036pjb.45.1678348571580; Wed, 08 Mar 2023 23:56:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678348571; cv=none; d=google.com; s=arc-20160816; b=PcmmgyKNIDEiNO9Hk+0b6qQ/V0wmWxbG8B37KMl3+GBqaVTq9Ap6t+cRCLk9nHhDFJ YbA8opu6Uj7Vhe1jy164M+/l4LF3y2m+xO8fyDrvcUSMSY3Hyeo31xq4Alxs6KKeA+js El/IJTj6GjW6eiog+TyJlVMvWoNJ+gDnySLxz2NXpsFK0B6sCv5q6CkEe4RaZEk1bwbV o8qm/+TGhmSgNog1vUlZNg7l4rV3CIPHMJsoNbXIBxJI5Q00cLqc6+ppLVVD649JN6Jn TVOULChDySFcD9cTWtkGlLaXutWqov7B6fLkZ9I8fqSAB9IG64R4u4/7xda0mlY34Aej eizg== 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=Nj6jio3cM/arnjJ3w8Z7XTVvD/CZOiBuUJssoRypJa0=; b=XTQLQEMsrTvgQPRS6OavWeCY7ANiU4rQi+OVYrduCNd3K1zDX/5TWF2s1q98oGbqHI KtimXCsNQ0MiSjVSYVvgWOFjuVEUOExbdhdmm6ONpsIaOQStBbKOuJbiCnFVoeLey1iV PL4tZtoU/gmqm+JlB/rvP88BJdIDu+q0xWsmZGSfJAsf+tsYX8G6yc/jEGXHgJ1GywQd 2f1Qw1Kd/73mak6D844LW9ikHummIJnNQEaSpvj0H1QK5D9F+SPhcEKGWHGjzyidRqpX qVHIeZ6KOM8OVRjSHQvpeJViujIRLe0Wp3Ptc3Mmu2ko7ylJO4E9k3L948duScXJ3iQr xl9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xwf8KALZ; 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 26-20020a17090a01da00b0023490e77182si1523913pjd.104.2023.03.08.23.55.58; Wed, 08 Mar 2023 23:56:11 -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=xwf8KALZ; 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 S230201AbjCIHrA (ORCPT + 99 others); Thu, 9 Mar 2023 02:47:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230253AbjCIHqa (ORCPT ); Thu, 9 Mar 2023 02:46:30 -0500 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C22EEDF720 for ; Wed, 8 Mar 2023 23:46:07 -0800 (PST) Received: by mail-lf1-x129.google.com with SMTP id i9so1157712lfc.6 for ; Wed, 08 Mar 2023 23:46:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678347967; 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=Nj6jio3cM/arnjJ3w8Z7XTVvD/CZOiBuUJssoRypJa0=; b=xwf8KALZLR0nIYkuFjQZGVcY2mmqSH9Bfzggzf2PNDHJUzO3FLSp55bkFvwwJSjugU bySHixGlQTucE5mALVhMAqd0U+SRxp4YOp92wG1995YoeXHMhdFR3yToSBGokblA+vvP memzY3k/ZT9CqUyFJw0X9S2BjjUsf9rzmVL+yqMBnchOcpNOFJ1qUcxjGEm8hYv+nACV BjEEZ/dQQF5gc2Is9vQYGVC+P6zD65aux1fObZAcWAyhb9Uw2cwVjkKt23QS8an5bAgg zOP52WaV4fGwrWmCuf1qkEqT69qCzTzLIdQrXVCadt6QYxOuR83ew8G9YRq2lNEF30VF DUKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678347967; 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=Nj6jio3cM/arnjJ3w8Z7XTVvD/CZOiBuUJssoRypJa0=; b=1TjoxJXyfkqk2ldbwqxupruXXReTzO4QBXEm+3txVs/GZyeKso6WDnP81RIdeFZfpL rSbu1zz4VMa6JmBn2ELugk/6Cyx8CEEuFg8CkyM5xX6gizjKkbvpgO3ID7wSGaI5OKAF 66unQFNNypZKbh9dr3DTnxILpPmkAklBRDt95UKGqpiIVSEFYqTPhgR6p4zCIlhZsT7o 2XIQGA5QC7hqGi33bSf+1McE+bYwV6leiCWiXzriVv8HamQh4oRnIQ0iA8doxczFRxc8 ysY1ModVHZDDkJtLK1qkrEtu592HC53CugmKxNUch9amgfHfSCEJCUXwaW2KrRSUilyI BOcw== X-Gm-Message-State: AO0yUKX/i5AQMcvmOf/Y807LM7/UIxrECp9vnQfF48gDYTQGicSwGh+V y7AbsI6VTEy3sqoEviE48L/ELA== X-Received: by 2002:a19:a416:0:b0:4dd:a025:d8e with SMTP id q22-20020a19a416000000b004dda0250d8emr6336857lfc.47.1678347967362; Wed, 08 Mar 2023 23:46:07 -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.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 23:46:07 -0800 (PST) From: Linus Walleij Date: Thu, 09 Mar 2023 08:45:59 +0100 Subject: [PATCH v3 11/17] gpio: msc313: Convert to immutable irq_chip MIME-Version: 1.0 Message-Id: <20230215-immutable-chips-v3-11-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 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?1759876031630703824?= X-GMAIL-MSGID: =?utf-8?q?1759876031630703824?= Convert the driver to immutable irq-chip with a bit of intuition. This conversion follows the pattern of the gpio-ixp4xx hierarchical GPIO interrupt driver. Cc: Marc Zyngier Acked-by: Marc Zyngier Signed-off-by: Linus Walleij Reviewed-by: Romain Perier --- drivers/gpio/gpio-msc313.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/drivers/gpio/gpio-msc313.c b/drivers/gpio/gpio-msc313.c index b0773e5652fa..036ad2324892 100644 --- a/drivers/gpio/gpio-msc313.c +++ b/drivers/gpio/gpio-msc313.c @@ -532,17 +532,35 @@ static int msc313_gpio_direction_output(struct gpio_chip *chip, unsigned int off return 0; } +static void msc313_gpio_irq_mask(struct irq_data *d) +{ + struct gpio_chip *gc = irq_data_get_irq_chip_data(d); + + irq_chip_mask_parent(d); + gpiochip_disable_irq(gc, d->hwirq); +} + +static void msc313_gpio_irq_unmask(struct irq_data *d) +{ + struct gpio_chip *gc = irq_data_get_irq_chip_data(d); + + gpiochip_enable_irq(gc, d->hwirq); + irq_chip_unmask_parent(d); +} + /* * The interrupt handling happens in the parent interrupt controller, * we don't do anything here. */ -static struct irq_chip msc313_gpio_irqchip = { +static const struct irq_chip msc313_gpio_irqchip = { .name = "GPIO", .irq_eoi = irq_chip_eoi_parent, - .irq_mask = irq_chip_mask_parent, - .irq_unmask = irq_chip_unmask_parent, + .irq_mask = msc313_gpio_irq_mask, + .irq_unmask = msc313_gpio_irq_unmask, .irq_set_type = irq_chip_set_type_parent, .irq_set_affinity = irq_chip_set_affinity_parent, + .flags = IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, }; /* @@ -644,7 +662,7 @@ static int msc313_gpio_probe(struct platform_device *pdev) gpiochip->names = gpio->gpio_data->names; gpioirqchip = &gpiochip->irq; - gpioirqchip->chip = &msc313_gpio_irqchip; + gpio_irq_chip_set_chip(gpioirqchip, &msc313_gpio_irqchip); gpioirqchip->fwnode = of_node_to_fwnode(dev->of_node); gpioirqchip->parent_domain = parent_domain; gpioirqchip->child_to_parent_hwirq = msc313e_gpio_child_to_parent_hwirq;