From patchwork Thu Mar 9 07:45:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 66638 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp156871wrd; Wed, 8 Mar 2023 23:56:15 -0800 (PST) X-Google-Smtp-Source: AK7set9WToG8dz4nQR0h1m7L+PWtG1KF+QfOW0UyEmu66nKrrTxK95JelLw1m83yGu8gUeZotmcr X-Received: by 2002:a05:6a20:ba88:b0:cc:b0e0:5534 with SMTP id fb8-20020a056a20ba8800b000ccb0e05534mr20771700pzb.60.1678348575374; Wed, 08 Mar 2023 23:56:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678348575; cv=none; d=google.com; s=arc-20160816; b=S/+Vm5Ke+eaioVe/q+05BeM1CK9mXuniaV+C26K8tKQpOEYWmOAva63rsdueh1hgmL Sj6Rj6XW8IHsR8ctCCMAlqv69Lp/u+kmxsToaZOfkFsTTfJc2JAtHJ46m4PGJGLDj1cd LmlqFtr1XMVb6PLdlQUi5jaH6JaAbbmynZmQvvcE4er7MJXZ0Lz+wSmy9PI835nSh3Xb pW1bRhFbAEcEDIxrGV3RFH6z+MawnzOIKqtK8GPb4tccGX6toqJ2kw+mfqxaIIJnMhO5 DGEzc6FBLVo0IipyuPdQxSo4fx82OebxBpsVt09wx/AwiTzZcIgBRdh9eaWoOMQgo+B6 Ja8g== 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=gpj9iowK+fUp1eAd8JepT37zZC9XqDcnhD9hDARq2kU=; b=LnqAVvLuYvj6X0x8oZfXtOAaRgyVJbwXiCoWTUB/vIDUQrFk2dDuLwCZgzEN0jKq3p JWbx3hAM2jbZ2Pow8Qs6lJhPHyTQlqN6Oe1DMXohfPOBpdOhm0ac/9cNIkOS7qTjKF6y lSJblvhfyQDULaOUPtO9Te4aI3qzIoWqnMcSeQJdQnMkoFXas0tzHGxDFgDRf5OvC6v9 nDAPqHy9LT7uTWtyrL2GruicU+Z909mbmLuE90s431prmNt5UOHGIrLeBXqwQSbd2587 M+2tGEpO+30O7+/MCptM1fS435qgrWfdTVmnsPnQ9KRbL/brQ/FGtRmDZGZdekwgI1U6 C2aQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LVaYC1uH; 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 z3-20020aa79f83000000b005b823de3a41si16751620pfr.197.2023.03.08.23.56.02; Wed, 08 Mar 2023 23:56:15 -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=LVaYC1uH; 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 S230214AbjCIHqT (ORCPT + 99 others); Thu, 9 Mar 2023 02:46:19 -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 S230062AbjCIHqA (ORCPT ); Thu, 9 Mar 2023 02:46:00 -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 2631CDCA70 for ; Wed, 8 Mar 2023 23:45:59 -0800 (PST) Received: by mail-lf1-x129.google.com with SMTP id i9so1157263lfc.6 for ; Wed, 08 Mar 2023 23:45:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678347957; 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=gpj9iowK+fUp1eAd8JepT37zZC9XqDcnhD9hDARq2kU=; b=LVaYC1uHViSwQIwTtsQWwAe1lesXk5XAH+m8tsANxNLm8ZWQySYOnlqMTMrkgBKHra ZoCgaS0jAuZ1G56TqbjxcqO3X25zia57NoBxjobuvRccmpHolykoWf3Uuz/O2AM3orAc R93oTD3v95aaf560IINvCe7rMhHRRfBu1W81pMz1AzIkhqH1834ztCHpnxG05AF2zj3Q 3n5BGjk7AgkSLSfuM7woK+BYozB6up/xzXd5+t684HJB8NNv3jvusxR1F6r4tbggUbxq i7D46OqOvnbcFXjLQ4xHc9ZEigur2mB6ShJazmvrLGp1nFo3OPSnf7e3bBhW8594CZE0 msHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678347957; 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=gpj9iowK+fUp1eAd8JepT37zZC9XqDcnhD9hDARq2kU=; b=HRS3JOUcBiuIDrJ2WscjUZId34+03diCbZry14O6ZXEB61BlqFnWr3f7mBIvk3ASA4 BpJSTFfls4NZNJRXha9KGQW493EWxZSiFhEWZ2fAKSLFpyHSvh85iZLSe2z9dNLFLR0I C8OIs7XcQzrrTCw7P+XScN7QZNaX29xbSmBo5AbxDnAY3nM68q/zB8J4gVfOhpAnoErz f27IaySPIeRZyZBzddjJMpiq58yR6VLtgJhRHZotcOTxMsoerb7iqZy+28jxn4rYnYZ9 1AokvueVL1sQBgccTHAl54tIZxkadYaSR93EPIdVlatatpoC38EllsI9pJrXQyXatslh FWWQ== X-Gm-Message-State: AO0yUKU29i8TNiIcn24ElKO6MZ5Bg/PhBT+H0ERcmwbplVOA/31t4hAl OaR6bH/cEYh/jkK8q3pi9DlnhA== X-Received: by 2002:ac2:55ac:0:b0:4cc:a107:82f4 with SMTP id y12-20020ac255ac000000b004cca10782f4mr5734632lfg.64.1678347957440; Wed, 08 Mar 2023 23:45:57 -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.45.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 23:45:57 -0800 (PST) From: Linus Walleij Date: Thu, 09 Mar 2023 08:45:50 +0100 Subject: [PATCH v3 02/17] gpio: adnp: Convert to immutable irq_chip MIME-Version: 1.0 Message-Id: <20230215-immutable-chips-v3-2-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?1759876035777664435?= X-GMAIL-MSGID: =?utf-8?q?1759876035777664435?= 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-adnp.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpio-adnp.c b/drivers/gpio/gpio-adnp.c index a6439e3daff0..9b01c391efce 100644 --- a/drivers/gpio/gpio-adnp.c +++ b/drivers/gpio/gpio-adnp.c @@ -307,6 +307,7 @@ static void adnp_irq_mask(struct irq_data *d) unsigned int pos = d->hwirq & 7; adnp->irq_enable[reg] &= ~BIT(pos); + gpiochip_disable_irq(gc, irqd_to_hwirq(d)); } static void adnp_irq_unmask(struct irq_data *d) @@ -316,6 +317,7 @@ static void adnp_irq_unmask(struct irq_data *d) unsigned int reg = d->hwirq >> adnp->reg_shift; unsigned int pos = d->hwirq & 7; + gpiochip_enable_irq(gc, irqd_to_hwirq(d)); adnp->irq_enable[reg] |= BIT(pos); } @@ -372,13 +374,15 @@ static void adnp_irq_bus_unlock(struct irq_data *d) mutex_unlock(&adnp->irq_lock); } -static struct irq_chip adnp_irq_chip = { +static const struct irq_chip adnp_irq_chip = { .name = "gpio-adnp", .irq_mask = adnp_irq_mask, .irq_unmask = adnp_irq_unmask, .irq_set_type = adnp_irq_set_type, .irq_bus_lock = adnp_irq_bus_lock, .irq_bus_sync_unlock = adnp_irq_bus_unlock, + .flags = IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, }; static int adnp_irq_setup(struct adnp *adnp) @@ -469,7 +473,8 @@ static int adnp_gpio_setup(struct adnp *adnp, unsigned int num_gpios, return err; girq = &chip->irq; - girq->chip = &adnp_irq_chip; + gpio_irq_chip_set_chip(girq, &adnp_irq_chip); + /* This will let us handle the parent IRQ in the driver */ girq->parent_handler = NULL; girq->num_parents = 0;