From patchwork Thu Mar 9 07:45:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 66632 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp156497wrd; Wed, 8 Mar 2023 23:55:01 -0800 (PST) X-Google-Smtp-Source: AK7set+BXzIAtSVdpnbswoFO67X1Z6SBG9DrUDgCaQZd/7386W7M27xWSxU0S52rfUAJ8c7GcH6z X-Received: by 2002:a62:4ecb:0:b0:5dc:fa22:1bdd with SMTP id c194-20020a624ecb000000b005dcfa221bddmr17485463pfb.8.1678348501007; Wed, 08 Mar 2023 23:55:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678348500; cv=none; d=google.com; s=arc-20160816; b=drFHlYijh+UU1ejtKkFtlL8mkkf7veXDQHq45/uTluplFo5DmpCRm6OYOmd0ZZFZUQ ETc6f51M6ZCVFGmqp5Bo8E/XJu/05nl8ypI4Qhj/PU8PLvZPc4dhHmWOy/imihANnML9 gQ8Cq7qWAMdmAHwo2gV977YET+VdjduLw5b3KE+qA+4iSMVJFfQAibQRUDldz+uyNgMV ciy3gFnqYqpZ4KEPZNvs3PYePxVVwdQgJlOBwR3JjVZhWwjsbBWNx8HQZ/vPXQ3N0Hfj Ugs0le5aSm9tmsiNfDL2VpI0QQTZ5kQ4BaeDySqoCEBFRFLP9dBBUu66gvro3rzvE1Ah dLvQ== 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=YxZa+3MhOrXUUjhkc+LrGW+xXurv1Litsrz7qLnZ7aI=; b=mU8Q0b+mUx43CimgYBMkrFqQsWzvshBF1xJE5urzgC5OmId5Fi1AMKa9lIkdBtQGJM u5atO6CIyvckNP1qQe3B71XxEDF6R1RT/a4dLlQfudmhMmA8BFoYRuTAo+qNwhEWlUM4 Tjgm9Z0GmzNMmY0RB8SZxCq6qauknm3cEyuCoYaWmvFZvAsDq0pR7WPQhmGOGVeWpvvR O5B1C3/u9GjNeN+1/N16aO6KPmXfwnTfWNus/zu2BkpiGhPwlr6Nfux4eKQIkky7D3Ma E7shK2iEZ6MxN9svzLAXR+2t9cpC3vDWM4nK6eWObIQcMKFRIu5MOWOBOrgIiCho/fxI 2oHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=t8rkah65; 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 q125-20020a634383000000b004fba2d220f1si16068505pga.680.2023.03.08.23.54.45; Wed, 08 Mar 2023 23:55:00 -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=t8rkah65; 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 S229453AbjCIHqq (ORCPT + 99 others); Thu, 9 Mar 2023 02:46:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230032AbjCIHqH (ORCPT ); Thu, 9 Mar 2023 02:46:07 -0500 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91F5DDD37E for ; Wed, 8 Mar 2023 23:46:04 -0800 (PST) Received: by mail-lf1-x136.google.com with SMTP id i28so1206250lfv.0 for ; Wed, 08 Mar 2023 23:46:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678347963; 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=YxZa+3MhOrXUUjhkc+LrGW+xXurv1Litsrz7qLnZ7aI=; b=t8rkah655HCn9cL1h3Am/2+vV9AgN0P4gZ9nz2b0HxputsAayTbj821PqUa7otUYtR 4rT352da4OCJCfzzGkx9v813htRdIT96XMYNv1//VWUxakgKq165OFenRYcp5/5kdn30 Ag75I+gOCogp/+q0kzxvJtJZogUvIVcQ6yVAT6f0Y/qOf2S88dCiQqa5kz0UCIj+C6e6 1m4ygY3ig91t87dlglPlwRBVeCJWVMX0RsTwJN65yun6okbknftwuSQ0DyUnVS6P73If 0ODs59J99Vwr19HNTlOec8uCB7RYpPoN87qHQYs/v3qQNAJdhj0QMK29Zyylffu6ehsm KNbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678347963; 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=YxZa+3MhOrXUUjhkc+LrGW+xXurv1Litsrz7qLnZ7aI=; b=zQ1MCXy6nyapOSmCkDSe3wlvhPb1UGdHQWXm480+r7rhRtTZz0p4EKfT5/vNuMecCq YuWCNr97aI2x+SkbMABsQKTtNxjmueQtXY+Zi5Ml8q1UWCRzBOi63eYuEnU1ugXaZ1gT xx1Sfu8ZUIef8+cEgO/W8RNXed5W6jIOoxkazIMf2tOg2EBUy8w0n42s2uVHg2ukMCo8 HP3zTG8Es2awcfUqz6bJ5NZCZn1rvtgcIx2HqIWt9lyH3MK7YMTcbd6usgsOGSI6J3Sz tJgS/s5uPs8B1byHuBXDmAQvynlRYHkLsQspRePQZED6YPezAJHqPWCwibh2kZyg5p2u pvww== X-Gm-Message-State: AO0yUKVensugYkHflnqhgnxBLLzORmbjtfbsrLYeB0YvZ9MuD6twFwmg CFROQHuDW+XTnmY4tOoVIXJ2zw== X-Received: by 2002:ac2:4475:0:b0:4b0:1305:6e02 with SMTP id y21-20020ac24475000000b004b013056e02mr6031006lfl.8.1678347962992; Wed, 08 Mar 2023 23:46:02 -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.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 23:46:02 -0800 (PST) From: Linus Walleij Date: Thu, 09 Mar 2023 08:45:55 +0100 Subject: [PATCH v3 07/17] gpio: cadence: Convert to immutable irq_chip MIME-Version: 1.0 Message-Id: <20230215-immutable-chips-v3-7-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?1759875957361024438?= X-GMAIL-MSGID: =?utf-8?q?1759875957361024438?= 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-cadence.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/gpio-cadence.c b/drivers/gpio/gpio-cadence.c index 137aea49ba02..3720b90cad10 100644 --- a/drivers/gpio/gpio-cadence.c +++ b/drivers/gpio/gpio-cadence.c @@ -70,6 +70,7 @@ static void cdns_gpio_irq_mask(struct irq_data *d) struct cdns_gpio_chip *cgpio = gpiochip_get_data(chip); iowrite32(BIT(d->hwirq), cgpio->regs + CDNS_GPIO_IRQ_DIS); + gpiochip_disable_irq(chip, irqd_to_hwirq(d)); } static void cdns_gpio_irq_unmask(struct irq_data *d) @@ -77,6 +78,7 @@ static void cdns_gpio_irq_unmask(struct irq_data *d) struct gpio_chip *chip = irq_data_get_irq_chip_data(d); struct cdns_gpio_chip *cgpio = gpiochip_get_data(chip); + gpiochip_enable_irq(chip, irqd_to_hwirq(d)); iowrite32(BIT(d->hwirq), cgpio->regs + CDNS_GPIO_IRQ_EN); } @@ -138,11 +140,13 @@ static void cdns_gpio_irq_handler(struct irq_desc *desc) chained_irq_exit(irqchip, desc); } -static struct irq_chip cdns_gpio_irqchip = { +static const struct irq_chip cdns_gpio_irqchip = { .name = "cdns-gpio", .irq_mask = cdns_gpio_irq_mask, .irq_unmask = cdns_gpio_irq_unmask, - .irq_set_type = cdns_gpio_irq_set_type + .irq_set_type = cdns_gpio_irq_set_type, + .flags = IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, }; static int cdns_gpio_probe(struct platform_device *pdev) @@ -222,7 +226,7 @@ static int cdns_gpio_probe(struct platform_device *pdev) struct gpio_irq_chip *girq; girq = &cgpio->gc.irq; - girq->chip = &cdns_gpio_irqchip; + gpio_irq_chip_set_chip(girq, &cdns_gpio_irqchip); girq->parent_handler = cdns_gpio_irq_handler; girq->num_parents = 1; girq->parents = devm_kcalloc(&pdev->dev, 1,