From patchwork Thu Mar 9 07:45:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 66623 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp154224wrd; Wed, 8 Mar 2023 23:48:02 -0800 (PST) X-Google-Smtp-Source: AK7set+5JuJhyuRuIc5Xx1pgwGWaUNZttojlptLrVxYvDco1S0F5+Aygju//ecQAnNYpqGy6AZcf X-Received: by 2002:a17:903:2341:b0:19c:d5c7:e3df with SMTP id c1-20020a170903234100b0019cd5c7e3dfmr24943448plh.8.1678348082450; Wed, 08 Mar 2023 23:48:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678348082; cv=none; d=google.com; s=arc-20160816; b=XN7CYq+7xQSCt7gRUUvv6uAczhjf+sl0J1gLPQfWYt30+4bv2c7p6lCqS7uSoFiziT aCVbMdV6/etLkIyNjwMU3nOVM2H6n0bvJ4Eueevd8j28alNwdW/NFXLvma+Pl4zSYLbl 252rruZQoG8Kv/SyWhcRQUQcZxj8eajWVXX+FObHK+7w+IOaiI794Qmfv+Yd6sIV1H9n OOFwOjTpEhtC/SA6iafRsasnN2qNcMEvUrIpGGFBtHBNRivfavgxm+wUI6AHOeRtvHPS WdmW/zQag4wXhrAGLjxZoyawfrwhEziQK7Rcml3wlxH8OyxuNi0/WDeU85YhldGkV6Pw nsig== 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=t+KEmI8whzjEUAizVJPshJjrICLTLWn62dQQiYVD1jA=; b=erhag7QjEaq7OYkGDpTXvUQNVXSAmV4LH4stvhsPynd2fi/urfDx22LS5PrSlGU08d RtdFzy0tIzI6KRHVWqFXIhhI7B0PZJThK/RjHpKhSZlAZev3Im2i5Uv44lOGcRoPtXOX S/0A1vldXiRmQJ8EteFBXXMBUk/u0TASfU5LdzE5lF2y5BOriZZFhM7WZxvk6S+n/1yj A8qJEoy8A7xyfWgoHnqTHQY2UxTtgBRcaJjz5ovNvdFUwsYfS7GMXRV0RtZg1WTP86+/ q/lkPScodjHB6pB1y/sGDD8KCWiPAX0uZp6hAPl4LsepW4rC7xZMW2Wy+wLvPNu3tQok +ybg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IzVpcZj9; 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 e8-20020a170902cf4800b0019aba74abcdsi15749999plg.314.2023.03.08.23.47.50; Wed, 08 Mar 2023 23:48: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=IzVpcZj9; 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 S230140AbjCIHqO (ORCPT + 99 others); Thu, 9 Mar 2023 02:46:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230050AbjCIHp7 (ORCPT ); Thu, 9 Mar 2023 02:45:59 -0500 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FF3EDD352 for ; Wed, 8 Mar 2023 23:45:58 -0800 (PST) Received: by mail-lf1-x12d.google.com with SMTP id s20so1127930lfb.11 for ; Wed, 08 Mar 2023 23:45:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678347956; 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=t+KEmI8whzjEUAizVJPshJjrICLTLWn62dQQiYVD1jA=; b=IzVpcZj96fumWwiZ9ce8p3OR00lwH2NSwIo6JgwE3eUrUbaCenSVg9A2IfJ0T5yKrF SkQWIosnVkJASnorq0HjSVujiLGhuf+H/CU3+yYMQDsjvDUskV5emKdM0lVSezIrvkss FdSBrCi4CbAaiEwps34Uui98JaatpeK5ak6yYuz8f0AyWyYZGKxp09rbxX+XT2uue5iD y0EBrkyqDVoaygONBXCc3okeqz57bWs1/PtSZqIlcbl24A1He/CyjbG+PL8ikEmDC83G bojse/lcmBP4bVFZ6FWWkICZkNA3MUkOtFnZcL3KeJuhzjI5+iXI9EZUHsr5eguGZ3l2 MDkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678347956; 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=t+KEmI8whzjEUAizVJPshJjrICLTLWn62dQQiYVD1jA=; b=PDYrTYUUDwwAFbik6oSKNUrl7RGb/xz5cWevciQSjent4BQP7MXHCnfYvQyUzKY1KQ QVsL3OzkzWUnUxnrbvqu3usIFauvFacs/eq6CUef5y9ZfTvvcNTz4N65is1Oub0TKCom XP1HakWi1LgBi0HuRO/8Wtd4zjyJH5rYMOzl4eyM3eM2kDt/gGvtx+k9/4T6w/3+XYLb osV5zeMn602Y3lDIDSXZJPksC8wTXXDiH3zqXe616ns8mZcPnBiwpZqUp3EA7r63Mo+y 2JNTen5R8QqxEbskQJPmPH/EpRCTIe06Ym1ajoGP9P/fD1q1cwRcPruMZk/lCO5oceYG +dQw== X-Gm-Message-State: AO0yUKVYcSBC7Po6TyUDqDQBbUZDW4237WfGiA17/mcjwbqRqv2WhTNZ UwkQBeVgUrFjzd7fLQcysJmI7Q== X-Received: by 2002:ac2:4c0d:0:b0:4e2:3453:40eb with SMTP id t13-20020ac24c0d000000b004e2345340ebmr5437312lfq.34.1678347956342; Wed, 08 Mar 2023 23:45:56 -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.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 23:45:55 -0800 (PST) From: Linus Walleij Date: Thu, 09 Mar 2023 08:45:49 +0100 Subject: [PATCH v3 01/17] gpio: altera: Convert to immutable irq_chip MIME-Version: 1.0 Message-Id: <20230215-immutable-chips-v3-1-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=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?1759875519092482173?= X-GMAIL-MSGID: =?utf-8?q?1759875519092482173?= 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-altera.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/gpio/gpio-altera.c b/drivers/gpio/gpio-altera.c index b59fae993626..c1599edb3453 100644 --- a/drivers/gpio/gpio-altera.c +++ b/drivers/gpio/gpio-altera.c @@ -24,14 +24,12 @@ * @interrupt_trigger : specifies the hardware configured IRQ trigger type * (rising, falling, both, high) * @mapped_irq : kernel mapped irq number. -* @irq_chip : IRQ chip configuration */ struct altera_gpio_chip { struct of_mm_gpio_chip mmchip; raw_spinlock_t gpio_lock; int interrupt_trigger; int mapped_irq; - struct irq_chip irq_chip; }; static void altera_gpio_irq_unmask(struct irq_data *d) @@ -43,6 +41,7 @@ static void altera_gpio_irq_unmask(struct irq_data *d) altera_gc = gpiochip_get_data(irq_data_get_irq_chip_data(d)); mm_gc = &altera_gc->mmchip; + gpiochip_enable_irq(&mm_gc->gc, irqd_to_hwirq(d)); raw_spin_lock_irqsave(&altera_gc->gpio_lock, flags); intmask = readl(mm_gc->regs + ALTERA_GPIO_IRQ_MASK); @@ -68,6 +67,7 @@ static void altera_gpio_irq_mask(struct irq_data *d) intmask &= ~BIT(irqd_to_hwirq(d)); writel(intmask, mm_gc->regs + ALTERA_GPIO_IRQ_MASK); raw_spin_unlock_irqrestore(&altera_gc->gpio_lock, flags); + gpiochip_disable_irq(&mm_gc->gc, irqd_to_hwirq(d)); } /* @@ -233,6 +233,17 @@ static void altera_gpio_irq_leveL_high_handler(struct irq_desc *desc) chained_irq_exit(chip, desc); } +static const struct irq_chip altera_gpio_irq_chip = { + .name = "altera-gpio", + .irq_mask = altera_gpio_irq_mask, + .irq_unmask = altera_gpio_irq_unmask, + .irq_set_type = altera_gpio_irq_set_type, + .irq_startup = altera_gpio_irq_startup, + .irq_shutdown = altera_gpio_irq_mask, + .flags = IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, +}; + static int altera_gpio_probe(struct platform_device *pdev) { struct device_node *node = pdev->dev.of_node; @@ -278,15 +289,9 @@ static int altera_gpio_probe(struct platform_device *pdev) } altera_gc->interrupt_trigger = reg; - altera_gc->irq_chip.name = "altera-gpio"; - altera_gc->irq_chip.irq_mask = altera_gpio_irq_mask; - altera_gc->irq_chip.irq_unmask = altera_gpio_irq_unmask; - altera_gc->irq_chip.irq_set_type = altera_gpio_irq_set_type; - altera_gc->irq_chip.irq_startup = altera_gpio_irq_startup; - altera_gc->irq_chip.irq_shutdown = altera_gpio_irq_mask; - girq = &altera_gc->mmchip.gc.irq; - girq->chip = &altera_gc->irq_chip; + gpio_irq_chip_set_chip(girq, &altera_gpio_irq_chip); + if (altera_gc->interrupt_trigger == IRQ_TYPE_LEVEL_HIGH) girq->parent_handler = altera_gpio_irq_leveL_high_handler; else 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; From patchwork Thu Mar 9 07:45:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 66633 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp156570wrd; Wed, 8 Mar 2023 23:55:13 -0800 (PST) X-Google-Smtp-Source: AK7set+uP4zYHFq3AWYPM8+juN8y+/nePID8oN6WbAOpo0xhVooyBGiEhOZfe48zU/s++iCnC9Ez X-Received: by 2002:a17:902:f693:b0:19d:e11:32de with SMTP id l19-20020a170902f69300b0019d0e1132demr25630171plg.34.1678348513675; Wed, 08 Mar 2023 23:55:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678348513; cv=none; d=google.com; s=arc-20160816; b=K+dh/2fud4PkLhSLjSChAH80Y0KpohJXFulrEeZt4dNkvHVT5N6itNMGxqHG98rr5f YBzN4xGMQowM3CB6sv1t9kNmsLN8iDZBWParE94IywvpnvbwpGwn9qsh5NMgST6Ks2WA wls8YLyqNzE9Fx8a9he4EoBLzRWTlrJHmeIy/KGmIGdTuseOq7p/jIvbutsxmliRLrNj CYp/9/zZ8OS55r83qjUL1XuqlmG62KXsnmwxUUR/GugelnIN7f1lhneSaaDAw+us2N1R ZdJMeNil4dekqFp8+VWLgPmeCdjxIWXbxcMlSm1QxWROLgwLY722ArSGxNd6qfv6yHvG fZsQ== 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=3J7dPBvISDsm7K/tqEkOGjTGzAkWKpmXKqK/yWwAM9o=; b=K93JV7xeIDOxdRn7OHWRbyENIgCuXkkQ2y6fLnTNXaBcitaIK9dHf4TvSi3gYCs19W Vn2P8mw7/AzhiG69+iMJ2kqAJR61KZPcjsrCRdBRbPWdRgzv4HWEp74EPc/9+3mQHbZr e+/cfGtNqS8CjXKuxT08mEHumB5kbrfXYyhbcZd7E/gXgiJQPhCmLCdQqmPsb9KwWUG3 nNj9UvdK4ptgl3XW8BM8R++XL7DzVfnMjSLCMEkut+jehbCBrHeHxnrxOxjpfQT2+zB8 n7kAn5L5N3yVHLBvoltBO05oXTKWN8YK8dQ12d6dGJDl4rcG158OXCjcv/LMFJVOTCNN xqpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iY+SY1LI; 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 a6-20020a170902ecc600b00195f4f578fasi19797165plh.564.2023.03.08.23.55.01; Wed, 08 Mar 2023 23:55:13 -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=iY+SY1LI; 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 S230236AbjCIHqW (ORCPT + 99 others); Thu, 9 Mar 2023 02:46:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230107AbjCIHqB (ORCPT ); Thu, 9 Mar 2023 02:46:01 -0500 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52F56DCA4F for ; Wed, 8 Mar 2023 23:46:00 -0800 (PST) Received: by mail-lf1-x12e.google.com with SMTP id bi9so1173757lfb.2 for ; Wed, 08 Mar 2023 23:46:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678347958; 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=3J7dPBvISDsm7K/tqEkOGjTGzAkWKpmXKqK/yWwAM9o=; b=iY+SY1LIdoAVm51tddLFKx/+2eccgntYfbsSyXmvTPoMU5aYr959/qgD7O/lVfLfLi blBw+4ykSBG4AdAZjSdISmzV8Q/QCmAzVPc5eNX2t08XQy+cg4Utx8RQYNxa+LzbW7s/ ZqytsDEDtkx14JCpgzL/Kh27HWDByrN9L3SUZm0Deh6evvb5ZhgzkUNOdSIuxGifl37T 4GtKAcZedqLb41hyQRRLmoIwZp9h0Cieh8oX1ugkzM4LZQTISn46c9D5o3q9jazJ038+ hFeRiJjhW2ovjw/64Do94VXB56FfLUrjY4L1zgG0aX0jXI2i/HBTj5MizFebD3sJcJIO Q89g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678347958; 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=3J7dPBvISDsm7K/tqEkOGjTGzAkWKpmXKqK/yWwAM9o=; b=GKQlxb3uveShjxGqKUqvj/rDu+nVSkKS9Kk3UIXSmtS8UaGPQtAKiPV8b7T4mUAMX6 GgY1mIpwg+cX7DrRnux7mPTuV4Zl/stuOvY2FX9ZKrSlgNEgKJxIDepHL50T59SyG1uO xk82Xvg/etVexZCHi2XyjZfJofmw0O5+5YESctrIy0J54z5/cJODTe7aB/pidz5sZuDH Ra/5mYElVaopSWpofupJTrmhQOS39vPYxnrcMsuZ/XQOOZ5z+sZnf5Qes2Ri5AdbORcl cani+wwxkR34hFoF/8K7WPijMKzrlLeJzUZEVGr6SmwYcjtzPSPKVTIsMPgIk0tpY3cd BOZA== X-Gm-Message-State: AO0yUKWbSDS3ztyY7Vx2rHWizNtQJFff5WwtV9u7Anz0jgYLo+N8QzQ/ 4/JacbIk5g6hQkpSX0HHgSVsxQ== X-Received: by 2002:a19:ae01:0:b0:4b4:9068:2c0b with SMTP id f1-20020a19ae01000000b004b490682c0bmr6917425lfc.2.1678347958739; Wed, 08 Mar 2023 23:45:58 -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.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 23:45:58 -0800 (PST) From: Linus Walleij Date: Thu, 09 Mar 2023 08:45:51 +0100 Subject: [PATCH v3 03/17] gpio: aspeed: Always register the irqchip MIME-Version: 1.0 Message-Id: <20230215-immutable-chips-v3-3-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 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?1759875970997079238?= X-GMAIL-MSGID: =?utf-8?q?1759875970997079238?= From: Joel Stanley The driver was implemented in a way that made the irqchip optional, if a irq was not present in the device tree. However, all of the device trees have always had an irq, so the optional-ness has never been used. Signed-off-by: Joel Stanley Signed-off-by: Linus Walleij --- drivers/gpio/gpio-aspeed.c | 49 ++++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 26 deletions(-) diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c index a94da80d3a95..129f6a6b4d1d 100644 --- a/drivers/gpio/gpio-aspeed.c +++ b/drivers/gpio/gpio-aspeed.c @@ -1137,8 +1137,9 @@ MODULE_DEVICE_TABLE(of, aspeed_gpio_of_table); static int __init aspeed_gpio_probe(struct platform_device *pdev) { const struct of_device_id *gpio_id; + struct gpio_irq_chip *girq; struct aspeed_gpio *gpio; - int rc, i, banks, err; + int rc, irq, i, banks, err; u32 ngpio; gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL); @@ -1201,31 +1202,27 @@ static int __init aspeed_gpio_probe(struct platform_device *pdev) aspeed_gpio_change_cmd_source(gpio, bank, 3, GPIO_CMDSRC_ARM); } - /* Optionally set up an irqchip if there is an IRQ */ - rc = platform_get_irq(pdev, 0); - if (rc > 0) { - struct gpio_irq_chip *girq; - - gpio->irq = rc; - girq = &gpio->chip.irq; - girq->chip = &gpio->irqc; - girq->chip->name = dev_name(&pdev->dev); - girq->chip->irq_ack = aspeed_gpio_irq_ack; - girq->chip->irq_mask = aspeed_gpio_irq_mask; - girq->chip->irq_unmask = aspeed_gpio_irq_unmask; - girq->chip->irq_set_type = aspeed_gpio_set_type; - girq->parent_handler = aspeed_gpio_irq_handler; - girq->num_parents = 1; - girq->parents = devm_kcalloc(&pdev->dev, 1, - sizeof(*girq->parents), - GFP_KERNEL); - if (!girq->parents) - return -ENOMEM; - girq->parents[0] = gpio->irq; - girq->default_type = IRQ_TYPE_NONE; - girq->handler = handle_bad_irq; - girq->init_valid_mask = aspeed_init_irq_valid_mask; - } + /* Set up an irqchip */ + irq = platform_get_irq(pdev, 0); + if (irq < 0) + return irq; + gpio->irq = irq; + girq = &gpio->chip.irq; + girq->chip = &gpio->irqc; + girq->chip->name = dev_name(&pdev->dev); + girq->chip->irq_ack = aspeed_gpio_irq_ack; + girq->chip->irq_mask = aspeed_gpio_irq_mask; + girq->chip->irq_unmask = aspeed_gpio_irq_unmask; + girq->chip->irq_set_type = aspeed_gpio_set_type; + girq->parent_handler = aspeed_gpio_irq_handler; + girq->num_parents = 1; + girq->parents = devm_kcalloc(&pdev->dev, 1, sizeof(*girq->parents), GFP_KERNEL); + if (!girq->parents) + return -ENOMEM; + girq->parents[0] = gpio->irq; + girq->default_type = IRQ_TYPE_NONE; + girq->handler = handle_bad_irq; + girq->init_valid_mask = aspeed_init_irq_valid_mask; gpio->offset_timer = devm_kzalloc(&pdev->dev, gpio->chip.ngpio, GFP_KERNEL); From patchwork Thu Mar 9 07:45:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 66640 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp156934wrd; Wed, 8 Mar 2023 23:56:27 -0800 (PST) X-Google-Smtp-Source: AK7set9zgo9Iv2ms4WETUq19PMeMpwb4mPzmfiKHrUJ2Mpj5lXJfu405/+WyjaG/ccCjxfS1pt6o X-Received: by 2002:a17:902:d38c:b0:19c:d6d0:7887 with SMTP id e12-20020a170902d38c00b0019cd6d07887mr19689173pld.30.1678348587025; Wed, 08 Mar 2023 23:56:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678348587; cv=none; d=google.com; s=arc-20160816; b=E0/LmAKUOGBx7i8Rm9D+Mo15aUVUxBY8s70VXTOt74j8/PlnvcW/oxC/VGhhLaqQb9 fp/BkRNT1B9fcZwFLypGXWX2eKBHKVEjBHi5rNAgmZUHVanZ/Pkj6/NgxgiNd/4ckVvd 30j0tIcfxxVLAPHNfCgpR47Fgsal/jkBA0DixqpYEVTYOfz4yVW9QTgN3ac7hKitng3w /tbM0z8wVIm2muqDwGxl07ATxKPuDJMhKQAKHL6x/pUcnvaioHWVXzbAhA5nei+b/oL3 J5rGHaMR5IkMT6CSOexDHwk+yq2cMi95JHRARzzK4VGyodUkwyw4fymoPJF2/Q/PfnZZ GoRw== 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=zEW74q7+LMSUY62mVTwdBMLjddbljPzOZryQLptVoYY=; b=qk9k9OX+QBR2aHjPrkWz9oHy5HG5Yniy6pur6KpvTT1sNZwr8C9IUhYrxgyH062AQE ldWUL+Xfgv1R+chCQOS88HniMk7SxZpBajFKV6WzE/8XnN5Fm6FVMHrxHbalSrF64IC4 8WbwpsvENc+Lnl4HhFYDGGqD65RvsKOMOjvXrfCNXjOvbDGcgqoZqm4X7I+kcL4QxOE9 yph/5S9x4dP88Yjxp62x9x4tE51/NKpWEmRgk0yHhVE0xwyikQAGtgE/JvcJc0dMbm9C 0QY7QFks+OAm3Q95AWmzzSqcaTU9AVmgXToLVWnFEPc7J4N7gAuvlFX6OcG3e5dfRrto 8Dsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XMbLbd3t; 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 e1-20020a170902744100b0019a66cb2194si16466800plt.101.2023.03.08.23.56.14; Wed, 08 Mar 2023 23:56:27 -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=XMbLbd3t; 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 S229952AbjCIHq1 (ORCPT + 99 others); Thu, 9 Mar 2023 02:46:27 -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 S230131AbjCIHqC (ORCPT ); Thu, 9 Mar 2023 02:46:02 -0500 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59262DD370 for ; Wed, 8 Mar 2023 23:46:01 -0800 (PST) Received: by mail-lf1-x130.google.com with SMTP id bi9so1173808lfb.2 for ; Wed, 08 Mar 2023 23:46:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678347959; 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=zEW74q7+LMSUY62mVTwdBMLjddbljPzOZryQLptVoYY=; b=XMbLbd3t48QtZLIZdDhf0HUbvwbrN57LRxCsnWYwD95sSoH2C9ydCK9Ou4efqV4wBf fPho61KoVh/4YrAezawtOyTjD3HO3JWICfKNAme4sdUkVQiyuINnrmd0FI5wYdsJv3K3 EBch5GcMrv+1Jw6aPqiNtQool9SLVRIoZh+7fUKiAAJMA/e7/ch/BIxYVP7nksuk4aSL rPTs1Z688sR4BgDAUVMyh74s85bPjuMjJCoJVJ0L75uXA1Todzi5Oy9fS+BobwrqTWfJ azL/5VqCzWQFL8KilTI4GpkGuXTGbgnzloDwIRNt47hTvhJYDWiyLx5b/cS+eWRbSjZb gFBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678347959; 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=zEW74q7+LMSUY62mVTwdBMLjddbljPzOZryQLptVoYY=; b=HThFdYLfaV2a6jGrHtZmwus5NTQejT/MEqghItHYeBuyCputqPg67bVdCVv5yTVV8g KY6yaDlAb06Yxe8lg7tOKB+mURPw8jrZ0AevPe4vDlOBqwor2A/mQCxX/joT96Sy+3ER 4/YzlB8u4HQpsf8HI3XBZhZYNc1BIQ8ZUEWD4dJufJyA2zrFVoD6nBowV003hWIGT/xt tIe27htQY8op/F4w1IL+gkK6gC0ryCwnXclCPIlHaZjuvoIqVnaFL6r2AxjjF1a9dOQV m/9DD+Bi/BdLGqmMqIogp+qAE6OZg4IHpZEOT1IEwnEppZKMmQX9y/tbwl4X3TDhwIaH f7fg== X-Gm-Message-State: AO0yUKXHDfsxsGyHUO9vdwQPp4DNNIQumpBZ1QaUBlDMFsxXtI+EAc3r LkJzUWKv5x3aBa1X+LyUAm5PQA== X-Received: by 2002:ac2:51c2:0:b0:4e2:40ba:af44 with SMTP id u2-20020ac251c2000000b004e240baaf44mr6215672lfm.7.1678347959770; Wed, 08 Mar 2023 23:45:59 -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.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 23:45:59 -0800 (PST) From: Linus Walleij Date: Thu, 09 Mar 2023 08:45:52 +0100 Subject: [PATCH v3 04/17] gpio: aspeed: Convert to immutable irq_chip MIME-Version: 1.0 Message-Id: <20230215-immutable-chips-v3-4-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?1759876048052514422?= X-GMAIL-MSGID: =?utf-8?q?1759876048052514422?= Convert the driver to immutable irq-chip with a bit of intuition. Cc: Marc Zyngier Tested-by: Joel Stanley Acked-by: Marc Zyngier Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Rebase on v6.3-rc1 - Collect ACKs ChangeLog v2->v3: - Drop chip->name = dev_name() assignment. - Rebase on top of Joels patch to make irqchip compulsory --- drivers/gpio/gpio-aspeed.c | 45 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 7 deletions(-) diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c index 129f6a6b4d1d..da33bbbdacb9 100644 --- a/drivers/gpio/gpio-aspeed.c +++ b/drivers/gpio/gpio-aspeed.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -53,7 +54,7 @@ struct aspeed_gpio_config { */ struct aspeed_gpio { struct gpio_chip chip; - struct irq_chip irqc; + struct device *dev; raw_spinlock_t lock; void __iomem *base; int irq; @@ -566,6 +567,10 @@ static void aspeed_gpio_irq_set_mask(struct irq_data *d, bool set) addr = bank_reg(gpio, bank, reg_irq_enable); + /* Unmasking the IRQ */ + if (set) + gpiochip_enable_irq(&gpio->chip, irqd_to_hwirq(d)); + raw_spin_lock_irqsave(&gpio->lock, flags); copro = aspeed_gpio_copro_request(gpio, offset); @@ -579,6 +584,10 @@ static void aspeed_gpio_irq_set_mask(struct irq_data *d, bool set) if (copro) aspeed_gpio_copro_release(gpio, offset); raw_spin_unlock_irqrestore(&gpio->lock, flags); + + /* Masking the IRQ */ + if (!set) + gpiochip_disable_irq(&gpio->chip, irqd_to_hwirq(d)); } static void aspeed_gpio_irq_mask(struct irq_data *d) @@ -1080,6 +1089,30 @@ int aspeed_gpio_copro_release_gpio(struct gpio_desc *desc) } EXPORT_SYMBOL_GPL(aspeed_gpio_copro_release_gpio); +static void aspeed_gpio_irq_print_chip(struct irq_data *d, struct seq_file *p) +{ + const struct aspeed_gpio_bank *bank; + struct aspeed_gpio *gpio; + u32 bit; + int rc, offset; + + rc = irqd_to_aspeed_gpio_data(d, &gpio, &bank, &bit, &offset); + if (rc) + return; + + seq_printf(p, dev_name(gpio->dev)); +} + +static const struct irq_chip aspeed_gpio_irq_chip = { + .irq_ack = aspeed_gpio_irq_ack, + .irq_mask = aspeed_gpio_irq_mask, + .irq_unmask = aspeed_gpio_irq_unmask, + .irq_set_type = aspeed_gpio_set_type, + .irq_print_chip = aspeed_gpio_irq_print_chip, + .flags = IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, +}; + /* * Any banks not specified in a struct aspeed_bank_props array are assumed to * have the properties: @@ -1150,6 +1183,8 @@ static int __init aspeed_gpio_probe(struct platform_device *pdev) if (IS_ERR(gpio->base)) return PTR_ERR(gpio->base); + gpio->dev = &pdev->dev; + raw_spin_lock_init(&gpio->lock); gpio_id = of_match_node(aspeed_gpio_of_table, pdev->dev.of_node); @@ -1208,12 +1243,8 @@ static int __init aspeed_gpio_probe(struct platform_device *pdev) return irq; gpio->irq = irq; girq = &gpio->chip.irq; - girq->chip = &gpio->irqc; - girq->chip->name = dev_name(&pdev->dev); - girq->chip->irq_ack = aspeed_gpio_irq_ack; - girq->chip->irq_mask = aspeed_gpio_irq_mask; - girq->chip->irq_unmask = aspeed_gpio_irq_unmask; - girq->chip->irq_set_type = aspeed_gpio_set_type; + gpio_irq_chip_set_chip(girq, &aspeed_gpio_irq_chip); + girq->parent_handler = aspeed_gpio_irq_handler; girq->num_parents = 1; girq->parents = devm_kcalloc(&pdev->dev, 1, sizeof(*girq->parents), GFP_KERNEL); From patchwork Thu Mar 9 07:45:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 66631 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp156495wrd; Wed, 8 Mar 2023 23:55:01 -0800 (PST) X-Google-Smtp-Source: AK7set8DXF0WjKBSsyw928vPDuPoVm7juAK/V8dZllbi1j5WzPKpixfaZmyf9dO0ikdvonLr8dBE X-Received: by 2002:a17:90b:3841:b0:237:461c:b31a with SMTP id nl1-20020a17090b384100b00237461cb31amr22409243pjb.32.1678348500841; Wed, 08 Mar 2023 23:55:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678348500; cv=none; d=google.com; s=arc-20160816; b=z12+IE+WFUbGYHDZTOzeaOu/ookhLnQaGmO3xJGBRiMbdNu8RotDuV92ZdZMV3qb05 0r5d1X0UYsgki5nauTq3MO3VrZMnzn7BqD5hULk3KgBAJVtlFivhAOvgPK9nTYjrY7cX j3bnHJJ0ALZWh6uSQO0R/QW9pJWs2bZIU+1kogqJdFns5cCIPdxpsVkKD/y0Wj5Ee7Ic CIpa3RuoBOQr4s7m7S3bVEgUh3p6PBA4sRfeElU5mS9NAiHMpaicij+989NhnW5BZFA6 aMPuHYMMmPb2+iCmAIUKjWy0Ev/1Chx4QVQf6RtpwbHWC1qQDdIQ3Rk5Weh+WgQnR96z hEvQ== 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=71KSFXipPt6AFUXeJ7X4eL7ZzgFaUvhDfIYjlqtJPYo=; b=r7nNbX4jlAN8Be3NmGkAM9WuDvHY6hqE4ZmsdI9Qm+aX5XBqdSPlv0hl8Ryuw+Q31Y luJw6a4JKzx+wnMOBsaH4gKH4d1KAGLTWRemQ5hSgzceGt/3xegjX0c8CWLSH/94nyi6 VHRT/47spN+W81snK55Msg8RjarW8lEVApPfgXE7SvWUgjXzPSwvauOF+z27GBUXyfvP p/ctqN4J4XF/Zy4eDKbMf1PhBOkvPke0ukLMEV7rcxPJcNfFaYPqoegwYd2hh192hMAR /3mRWKjJWBWei6o04H7jen9h7H/DwyydJtTspPB1YgV2ix/cfkWXQHOnCgoSoWu6YUfe 8QgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HcD8RafO; 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 x3-20020a63db43000000b005030eb175d1si15202620pgi.107.2023.03.08.23.54.47; 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=HcD8RafO; 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 S230263AbjCIHqb (ORCPT + 99 others); Thu, 9 Mar 2023 02:46:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230163AbjCIHqE (ORCPT ); Thu, 9 Mar 2023 02:46:04 -0500 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F0FFDD594 for ; Wed, 8 Mar 2023 23:46:02 -0800 (PST) Received: by mail-lf1-x12d.google.com with SMTP id d36so1141134lfv.8 for ; Wed, 08 Mar 2023 23:46:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678347960; 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=71KSFXipPt6AFUXeJ7X4eL7ZzgFaUvhDfIYjlqtJPYo=; b=HcD8RafOCrkba+DwCnjWTCDYkCx8BuPvKb3VLA1X+5duW0me6FZXc8kM1t2tmnFRhU PUc6PFWZ+IqLARsCadpuXf9ZD9ilEybWqEcsNFoZ3HGCaPM4FOOLMKItt4biVuqa9TG0 sYKW/ApX0kQ32n/7dbJhyy/CU7krTG6v2iCXsn56jffPFun7Y3NKuwPasjS5+2UwtHYc Z9eAnXzQdnA1hQq9PllyXJ3nxzct+xo//Pp6Z20b8sKN7quaC7WT6fN8p66zZmjGSoaM xBmqnI4fzHk/PRfcXBQF5+/7tuYsTaMR3fGg1nFEKzUhmNt6yzY1g6AJPj033+INFHHh dEFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678347960; 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=71KSFXipPt6AFUXeJ7X4eL7ZzgFaUvhDfIYjlqtJPYo=; b=ePXJK3TZzehbORfiZKWO5brcAgFAnHQMQJLoJnGpQYhDo0Y78RDsAueXn+J5oqQj67 m57M9HdW9YF+KAV+2ZFgjGbJWT7RP7Wjbg2746sF6txdd9txqxlFeAsH90DunZDQSWAM WGfpDtTOJb7hglGXIlFFHoZnLVv5UO9DGAkAElu+5M0cQpPyvSQeDN7dxFKW6Mg5T9u9 wzovWX8PEMiqhHfTYsJw4Q4gMoZ2VCHiBjIpzHWJaZD3HaGZWm/sAV5Sf0lFsKob1JQv gcbqQwPj42QBQ8AuWU3UcxYGYVdJgMSvu8h6/vWeERtzlj/KDlBIR3GlQbg9ARyMCHYf nJCA== X-Gm-Message-State: AO0yUKX0wQYz0yrBI1tcL3nSDlFrtZy0x1RJ72kUIWviVfnsC9ZF8v2y SMUvQC4e0R9ABfuv3LC9pI28+g== X-Received: by 2002:a19:f00f:0:b0:4c0:91d0:e7ab with SMTP id p15-20020a19f00f000000b004c091d0e7abmr4868474lfc.28.1678347960785; Wed, 08 Mar 2023 23:46:00 -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.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 23:46:00 -0800 (PST) From: Linus Walleij Date: Thu, 09 Mar 2023 08:45:53 +0100 Subject: [PATCH v3 05/17] gpio: aspeed-sgpio: Convert to immutable irq_chip MIME-Version: 1.0 Message-Id: <20230215-immutable-chips-v3-5-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=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?1759875957641237849?= X-GMAIL-MSGID: =?utf-8?q?1759875957641237849?= 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-aspeed-sgpio.c | 44 ++++++++++++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/drivers/gpio/gpio-aspeed-sgpio.c b/drivers/gpio/gpio-aspeed-sgpio.c index 454cefbeecf0..3c1c0fc21fc5 100644 --- a/drivers/gpio/gpio-aspeed-sgpio.c +++ b/drivers/gpio/gpio-aspeed-sgpio.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -29,7 +30,7 @@ struct aspeed_sgpio_pdata { struct aspeed_sgpio { struct gpio_chip chip; - struct irq_chip intc; + struct device *dev; struct clk *pclk; raw_spinlock_t lock; void __iomem *base; @@ -296,6 +297,10 @@ static void aspeed_sgpio_irq_set_mask(struct irq_data *d, bool set) irqd_to_aspeed_sgpio_data(d, &gpio, &bank, &bit, &offset); addr = bank_reg(gpio, bank, reg_irq_enable); + /* Unmasking the IRQ */ + if (set) + gpiochip_enable_irq(&gpio->chip, irqd_to_hwirq(d)); + raw_spin_lock_irqsave(&gpio->lock, flags); reg = ioread32(addr); @@ -307,6 +312,12 @@ static void aspeed_sgpio_irq_set_mask(struct irq_data *d, bool set) iowrite32(reg, addr); raw_spin_unlock_irqrestore(&gpio->lock, flags); + + /* Masking the IRQ */ + if (!set) + gpiochip_disable_irq(&gpio->chip, irqd_to_hwirq(d)); + + } static void aspeed_sgpio_irq_mask(struct irq_data *d) @@ -401,6 +412,27 @@ static void aspeed_sgpio_irq_handler(struct irq_desc *desc) chained_irq_exit(ic, desc); } +static void aspeed_sgpio_irq_print_chip(struct irq_data *d, struct seq_file *p) +{ + const struct aspeed_sgpio_bank *bank; + struct aspeed_sgpio *gpio; + u32 bit; + int offset; + + irqd_to_aspeed_sgpio_data(d, &gpio, &bank, &bit, &offset); + seq_printf(p, dev_name(gpio->dev)); +} + +static const struct irq_chip aspeed_sgpio_irq_chip = { + .irq_ack = aspeed_sgpio_irq_ack, + .irq_mask = aspeed_sgpio_irq_mask, + .irq_unmask = aspeed_sgpio_irq_unmask, + .irq_set_type = aspeed_sgpio_set_type, + .irq_print_chip = aspeed_sgpio_irq_print_chip, + .flags = IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, +}; + static int aspeed_sgpio_setup_irqs(struct aspeed_sgpio *gpio, struct platform_device *pdev) { @@ -423,14 +455,8 @@ static int aspeed_sgpio_setup_irqs(struct aspeed_sgpio *gpio, iowrite32(0xffffffff, bank_reg(gpio, bank, reg_irq_status)); } - gpio->intc.name = dev_name(&pdev->dev); - gpio->intc.irq_ack = aspeed_sgpio_irq_ack; - gpio->intc.irq_mask = aspeed_sgpio_irq_mask; - gpio->intc.irq_unmask = aspeed_sgpio_irq_unmask; - gpio->intc.irq_set_type = aspeed_sgpio_set_type; - irq = &gpio->chip.irq; - irq->chip = &gpio->intc; + gpio_irq_chip_set_chip(irq, &aspeed_sgpio_irq_chip); irq->init_valid_mask = aspeed_sgpio_irq_init_valid_mask; irq->handler = handle_bad_irq; irq->default_type = IRQ_TYPE_NONE; @@ -524,6 +550,8 @@ static int __init aspeed_sgpio_probe(struct platform_device *pdev) if (IS_ERR(gpio->base)) return PTR_ERR(gpio->base); + gpio->dev = &pdev->dev; + pdata = device_get_match_data(&pdev->dev); if (!pdata) return -EINVAL; From patchwork Thu Mar 9 07:45: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: 66644 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp157408wrd; Wed, 8 Mar 2023 23:58:05 -0800 (PST) X-Google-Smtp-Source: AK7set+KK0ojtKYKZaFyBHZvRtXWYAAgkXXGyh3KYvRKGN4c1l/X8mev59k3084BeONX99DKQJd/ X-Received: by 2002:a17:902:bd41:b0:19c:f096:bbef with SMTP id b1-20020a170902bd4100b0019cf096bbefmr17811756plx.49.1678348685051; Wed, 08 Mar 2023 23:58:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678348685; cv=none; d=google.com; s=arc-20160816; b=rVpcGvvybzkQDtRKAsqDvPCe1lURo0szgAdn3CH5Fwu9KNO0aNrDdtT187VCvah8jU tkXLqUW0eMlpJW1gk4XWhTp+tvDTfgEWcifYrMjaaVSzO6gKMIugma8f/85rwqmtYk/i PFVJa9rJ1EN1RKocQ+73jZFGrCvpyGFzSefoVMihvtITJdkckvyFtVK7dfLn0gEe6E7C n+9ArMyZaRPr4XQlEJ6IGoC5vJVtEUUYeuRREvz+SNTehdbJDOgAp6AKqJaJwCsHC1M/ q+rFq1WHaW/vIbBl6cyoSb+HMcrbezv07q2kZqEEtRITrT1yfuFUieeKwUdv47P7tQs/ mzjw== 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=3PUEBNIWi9XlpGpt5vSwoRNt6H80aDlupNA++Rohdv4=; b=vwSJu3wRJbhyAOpLPaGQRyN8vuoPz2o8tDs4tvKp3ojbm3ojOOfunSt/avO3u/eeSi OwiPjl6uy69/LZv/ZLsuyhG55rf/ZPU9lJ9IJi1Bu6mF+Vc69JWhJ6LJTaorvGGHvPSI I3n0b4+Vrbr2o+FITmempKY5beEkSYVzWKGoZnjmrFU3hG+/Mh2akHn7t1gFkV63BLC9 Qg1ArzH+4C+WUh7d4lxC3o2x86tGeXKWtWYuuZdv2tquQlscsPtiJNXLrB2EWjFUsEmK lQ2eLGPMyZHvPaYkeZU+ce5ygUPzj7+TcCz+ippQwMAaC26Zu5w5hnB7S536Us7THRuR JQWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nybRzTeW; 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 i15-20020a17090332cf00b00196658893a1si5327419plr.480.2023.03.08.23.57.52; Wed, 08 Mar 2023 23:58:05 -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=nybRzTeW; 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 S229843AbjCIHqv (ORCPT + 99 others); Thu, 9 Mar 2023 02:46:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230119AbjCIHqH (ORCPT ); Thu, 9 Mar 2023 02:46:07 -0500 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90D7FDD5B0 for ; Wed, 8 Mar 2023 23:46:03 -0800 (PST) Received: by mail-lf1-x134.google.com with SMTP id t11so1175937lfr.1 for ; Wed, 08 Mar 2023 23:46:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678347962; 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=3PUEBNIWi9XlpGpt5vSwoRNt6H80aDlupNA++Rohdv4=; b=nybRzTeW6RIm/2SrjGOF5FaP6SKi0d2JiXT906zjXJAVNYdYnXLgomwmFQ3almrEfr 6y+Wk8XrQG9P9BA0tGoydQmWGqeWAPlnB7UABZ/ZBKAlmBp7avsgDU1hBnali3npmo0X 3v1LYSh5mo+nsjTpHlMe3NQJoPm1k9seTsqo4Il5j5WFvoWRD/8AS88vDfTiL9hs/BRy aJ61t8qKUw6AvsY1GuSYuuz8DoPXutrHWXZvxrGAccfwUoMuO6zZHCExNPAlkNCkQlPL WGKfjoe9SFAE7uf/T2V2R2uabcIqtgPSeniJji05bixYq5dYPjT1/yO3BPqumDQTPsbe 42XA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678347962; 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=3PUEBNIWi9XlpGpt5vSwoRNt6H80aDlupNA++Rohdv4=; b=bUfGO8pLbKmvPGFjg3ff4wOcFwf9QD5yNPaJCXzPTU8OdQ6cXXXrWA1fjv3GPFmeQ/ 8zeKrZbZIDwyMJHyF4Wk+ceozFllzKCZUR0wWzoreBPEYcKUjIB1GCmmiyhCCQGJ2Tz5 7DmjDzLPoRdj27HcxytJgPgilJXSmtShzTFYglCohgm09J1p7GGG+XPDdOS4X53OVHpg 6nnjytf2SWhoQh2dkmRoGVKbJ8Mn5JvugdHi81oJSyz9iz3a+zb3D6Et51+J5cxydV8t baZQFySfD3kOGHY0Ko8Mg8J3SV6bGFZ53A9p6i+gEbf/uIul2k67zXEOhb17rZLAZvRp N66A== X-Gm-Message-State: AO0yUKUBm1g+nRgjIj4GRAZ0NbKE2wXwHlZDWe30eomaDz/4tcWHEwsL sYnpzkYEtL03ijsdD7KpbQv8Lg== X-Received: by 2002:a19:7406:0:b0:4d8:5e8e:b138 with SMTP id v6-20020a197406000000b004d85e8eb138mr5587064lfe.14.1678347961936; Wed, 08 Mar 2023 23:46:01 -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.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 23:46:01 -0800 (PST) From: Linus Walleij Date: Thu, 09 Mar 2023 08:45:54 +0100 Subject: [PATCH v3 06/17] gpio: ath79: Convert to immutable irq_chip MIME-Version: 1.0 Message-Id: <20230215-immutable-chips-v3-6-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?1759876150814086711?= X-GMAIL-MSGID: =?utf-8?q?1759876150814086711?= 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-ath79.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpio-ath79.c b/drivers/gpio/gpio-ath79.c index 3958c6d97639..aa0a954b8392 100644 --- a/drivers/gpio/gpio-ath79.c +++ b/drivers/gpio/gpio-ath79.c @@ -71,6 +71,7 @@ static void ath79_gpio_irq_unmask(struct irq_data *data) u32 mask = BIT(irqd_to_hwirq(data)); unsigned long flags; + gpiochip_enable_irq(&ctrl->gc, irqd_to_hwirq(data)); raw_spin_lock_irqsave(&ctrl->lock, flags); ath79_gpio_update_bits(ctrl, AR71XX_GPIO_REG_INT_MASK, mask, mask); raw_spin_unlock_irqrestore(&ctrl->lock, flags); @@ -85,6 +86,7 @@ static void ath79_gpio_irq_mask(struct irq_data *data) raw_spin_lock_irqsave(&ctrl->lock, flags); ath79_gpio_update_bits(ctrl, AR71XX_GPIO_REG_INT_MASK, mask, 0); raw_spin_unlock_irqrestore(&ctrl->lock, flags); + gpiochip_disable_irq(&ctrl->gc, irqd_to_hwirq(data)); } static void ath79_gpio_irq_enable(struct irq_data *data) @@ -169,13 +171,15 @@ static int ath79_gpio_irq_set_type(struct irq_data *data, return 0; } -static struct irq_chip ath79_gpio_irqchip = { +static const struct irq_chip ath79_gpio_irqchip = { .name = "gpio-ath79", .irq_enable = ath79_gpio_irq_enable, .irq_disable = ath79_gpio_irq_disable, .irq_mask = ath79_gpio_irq_mask, .irq_unmask = ath79_gpio_irq_unmask, .irq_set_type = ath79_gpio_irq_set_type, + .flags = IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, }; static void ath79_gpio_irq_handler(struct irq_desc *desc) @@ -274,7 +278,7 @@ static int ath79_gpio_probe(struct platform_device *pdev) /* Optional interrupt setup */ if (!np || of_property_read_bool(np, "interrupt-controller")) { girq = &ctrl->gc.irq; - girq->chip = &ath79_gpio_irqchip; + gpio_irq_chip_set_chip(girq, &ath79_gpio_irqchip); girq->parent_handler = ath79_gpio_irq_handler; girq->num_parents = 1; girq->parents = devm_kcalloc(dev, 1, sizeof(*girq->parents), 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, From patchwork Thu Mar 9 07:45:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 66624 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp154313wrd; Wed, 8 Mar 2023 23:48:19 -0800 (PST) X-Google-Smtp-Source: AK7set/ZUonV66g3fhl1hZaTa0JuxtA6Eas6ZpEkZXWRQaM7XZwbEstSwmYHjhSLWA+Mf0OBboE3 X-Received: by 2002:a17:902:7006:b0:19a:a815:2868 with SMTP id y6-20020a170902700600b0019aa8152868mr17178972plk.44.1678348099036; Wed, 08 Mar 2023 23:48:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678348099; cv=none; d=google.com; s=arc-20160816; b=lPWdPI8QFnJaqLm2bG3vS57+h19/zprTRs/ctJy+lzRXX0jmzIc7zkwS5ctOSqi6Co qt9FAZhVBrSws+UEOTgKQFw7hLXTiPNup2agJgY7NPj4kYPErSVS4MExRSxxHcGqtOV3 JunYTBvNzE0xkdVIxguaVeM7cDHlW2rwgz2MfG2NknUiCz5VotXxIxiQroKxf9AAmI9P O8bWZxyJaS2RbmZBS45jHodmc79h5K+Ty2lYhP623u59DrZSt5CQe0ypclUp9ifaZDnU 5m3YrRyyUuj9tKK9RlgELzooMS/DbZdnPhaVl7KTUVpQBJrNbn6SHvh8Si2ipLxKw47a WHSQ== 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=c+tr96cZPYMIs0/699FeDkH9/3i8GidF6/NXAvTE8Kg=; b=MAdlPkRgn+oZg+7eHtr4vtbR1ruXY/IBiWm5ISA1HsB9hDf+n/DNsMAmgBOhOXTd7U EIeu3T8rxO4rjZogWkR1vEkX8slMqd4Y1hY13wZn92IoVoDMtzF+7J7F/3PCZH4q1l2u 1Hfbrd+c7UO0nsvN8BC6Mbo3BZa+A1/njvisej/sqp3rKS80yFn6y56VoJkZtDtFAAIR bC61SMcs049JL536sIxutVg3juCz5Ly0VHilxo+zt4E2O7hWE629ZL2+VoDZGiw3zcrD BT12cJPvSb+l+twQV4Tv/wgsxWt3ZCwEWY9EXnswnGHvqdnxwaImpaBJZiUuyvOmG3hh uD2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oGW4OUQO; 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 d10-20020a630e0a000000b004ce5301edd5si16460592pgl.711.2023.03.08.23.48.05; Wed, 08 Mar 2023 23:48:19 -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=oGW4OUQO; 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 S230274AbjCIHqm (ORCPT + 99 others); Thu, 9 Mar 2023 02:46:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229716AbjCIHqG (ORCPT ); Thu, 9 Mar 2023 02:46:06 -0500 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8801FDB6E4 for ; Wed, 8 Mar 2023 23:46:04 -0800 (PST) Received: by mail-lf1-x12e.google.com with SMTP id r27so1134932lfe.10 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=1678347964; 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=c+tr96cZPYMIs0/699FeDkH9/3i8GidF6/NXAvTE8Kg=; b=oGW4OUQOWAHop80go+7eApoUqKVJQON4IntulrZQevBtG7/txnRJ1hEPqqfqWliJ3/ eQ4luTNNRRIvo4ZQ5IrXKX2HMtUI5ARBUVi+45UZ1NSgSLq4lvMHn6XqEqz4PuYZPIT8 m1upl/zAA244KcLjUxk4wfhic/fEhP7jUJ3IX4y8pzpIJU3DfwSwgaLQVTGrYIpE1/Zm ZeiA75Yomc6pyu7as9PecDHpKv56m+T6RsagMseeYS43IzgC3i46K4zTFv9L1g0HyJBO gxkj/MIhbE3NYOS/6XbaMpAvFGhW9BbJLj8mSKHyRgsNKzqcStlN38pffi9HgN3ksQ97 XAwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678347964; 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=c+tr96cZPYMIs0/699FeDkH9/3i8GidF6/NXAvTE8Kg=; b=JIlUt/2sTENSsvty92rjlLeOXhusStUI1Kmpo4JR7mLltrNMr0LEwROYPxUafyQmZ7 dMp7qdr2uqQFf8AWT26SAsevNfdXz3/tuZru1mBvDaS8+ddxvFIuwQYzP3c0fNx6Pywy J733QTwb5SrZgBpia6c1mSKKtsEEcrvzJVJvQAhU22UfR3sJiOyrA45WbMAHrtny4EWg 7mQmBMd/deodrsWFrCDbU9B4YKVXs962/80ycbhg5wk6gr5POhG5sl3Oy8GdZJPhpveF IVC6IroOVEzZzlnHemT5nbBSWu/AdczgNmXL3T13tH7THEfoF3mafc3IlneQXhWPd0AR FbJA== X-Gm-Message-State: AO0yUKXAAJ5RMd4pk0ywasf5FNv0VxQT02cYWB6aSpZFR+LJxEtrJf6e 9MJKg6P9eB2NvKEM8OoEmpcV/A== X-Received: by 2002:a05:6512:4c9:b0:4dd:d687:4ea7 with SMTP id w9-20020a05651204c900b004ddd6874ea7mr5528402lfq.36.1678347964117; Wed, 08 Mar 2023 23:46:04 -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.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 23:46:03 -0800 (PST) From: Linus Walleij Date: Thu, 09 Mar 2023 08:45:56 +0100 Subject: [PATCH v3 08/17] gpio: hisi: Convert to immutable irq_chip MIME-Version: 1.0 Message-Id: <20230215-immutable-chips-v3-8-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=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?1759875536047782141?= X-GMAIL-MSGID: =?utf-8?q?1759875536047782141?= Convert the driver to immutable irq-chip with a bit of intuition. The IRQ chip was unnamed which seems unwise, so we just assign the name "HISI-GPIO". Cc: Marc Zyngier Acked-by: Marc Zyngier Signed-off-by: Linus Walleij --- drivers/gpio/gpio-hisi.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/gpio/gpio-hisi.c b/drivers/gpio/gpio-hisi.c index 55bd69043bf4..29a03de37fd8 100644 --- a/drivers/gpio/gpio-hisi.c +++ b/drivers/gpio/gpio-hisi.c @@ -37,7 +37,6 @@ struct hisi_gpio { struct device *dev; void __iomem *reg_base; unsigned int line_num; - struct irq_chip irq_chip; int irq; }; @@ -100,12 +99,14 @@ static void hisi_gpio_irq_set_mask(struct irq_data *d) struct gpio_chip *chip = irq_data_get_irq_chip_data(d); hisi_gpio_write_reg(chip, HISI_GPIO_INTMASK_SET_WX, BIT(irqd_to_hwirq(d))); + gpiochip_disable_irq(chip, irqd_to_hwirq(d)); } static void hisi_gpio_irq_clr_mask(struct irq_data *d) { struct gpio_chip *chip = irq_data_get_irq_chip_data(d); + gpiochip_enable_irq(chip, irqd_to_hwirq(d)); hisi_gpio_write_reg(chip, HISI_GPIO_INTMASK_CLR_WX, BIT(irqd_to_hwirq(d))); } @@ -191,20 +192,24 @@ static void hisi_gpio_irq_handler(struct irq_desc *desc) chained_irq_exit(irq_c, desc); } +static const struct irq_chip hisi_gpio_irq_chip = { + .name = "HISI-GPIO", + .irq_ack = hisi_gpio_set_ack, + .irq_mask = hisi_gpio_irq_set_mask, + .irq_unmask = hisi_gpio_irq_clr_mask, + .irq_set_type = hisi_gpio_irq_set_type, + .irq_enable = hisi_gpio_irq_enable, + .irq_disable = hisi_gpio_irq_disable, + .flags = IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, +}; + static void hisi_gpio_init_irq(struct hisi_gpio *hisi_gpio) { struct gpio_chip *chip = &hisi_gpio->chip; struct gpio_irq_chip *girq_chip = &chip->irq; - /* Set hooks for irq_chip */ - hisi_gpio->irq_chip.irq_ack = hisi_gpio_set_ack; - hisi_gpio->irq_chip.irq_mask = hisi_gpio_irq_set_mask; - hisi_gpio->irq_chip.irq_unmask = hisi_gpio_irq_clr_mask; - hisi_gpio->irq_chip.irq_set_type = hisi_gpio_irq_set_type; - hisi_gpio->irq_chip.irq_enable = hisi_gpio_irq_enable; - hisi_gpio->irq_chip.irq_disable = hisi_gpio_irq_disable; - - girq_chip->chip = &hisi_gpio->irq_chip; + gpio_irq_chip_set_chip(girq_chip, &hisi_gpio_irq_chip); girq_chip->default_type = IRQ_TYPE_NONE; girq_chip->num_parents = 1; girq_chip->parents = &hisi_gpio->irq; From patchwork Thu Mar 9 07:45:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 66625 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp154401wrd; Wed, 8 Mar 2023 23:48:37 -0800 (PST) X-Google-Smtp-Source: AK7set/VA/0DV0eUOWoLXGAGHXMPXXckoaCuEgAo7bgUGALJn2Aij0OXTBy1SEz2G2sJQYRkfWXK X-Received: by 2002:a17:90b:1c0e:b0:237:29b1:1891 with SMTP id oc14-20020a17090b1c0e00b0023729b11891mr21873437pjb.29.1678348117188; Wed, 08 Mar 2023 23:48:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678348117; cv=none; d=google.com; s=arc-20160816; b=ef1qfGKHShDCe0tNSTxmFuZH7VlxEkWfw030v6tL8BDHNtXzwYTUX6bUuYe5WrhX1L ZyCck2nmyOuys5QsoiK2RhlIXtgDMbi2lcLaTfrKjVpjL6bpXmHQucaNfLAPAjkL8+I+ v4CGuOJ8ydemqe9/218W3gT0myGgDfyW2/q3rF9TKYQBGghKCNNoIJbiDFUAaE7/jULv GQzcsxhGlF7Dq2m/4Oq6hoX9TRDJA8CTq/zCfim5uIMlaG4uxCexO2J8zyOtlP1W56ga MHf4wxvkuKmcA5AieyyUzxpgeAwFPVAdSMhuH8Y9sf1pcx26j3lPoKQyDCILOQkCaDSW rb6A== 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=zhXTDSkBpSBmoLnt16h1xxcFV0v4vmTT7mnJI/zNpFI=; b=vaSl49poE0rj7sEgXv4OPQpwzFVg3Up43We1i8bBM42+frTL59NSXDTx5y5t//CkT0 XV00p6nxbLn0e5WZHOQD6LjPZYkicSLoDdaoaJsKUDbAKcVvBKW+zl8bANgJ1ilzFYNn VagR2nxTxxiVohoh7y+yWiMskKHX83xWiS3Qw+5XtrSlmzqt7jAtlyto29I6yvGiKGat OAV2r7WxLjAgMrUgsEY6guqNYTNki0p1vGcnvYgur95ZHGkgdvbUt7pj8GGU3H8b+Hk9 pAb1x9tsbBmLx6CAfalq85PNIKMacTiCIcjRJGoH4OZBuxOPDwRXYHDjKsv5Pfcwmxkj +jtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RdVd7acf; 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 h19-20020a63df53000000b004fb647a765esi16202284pgj.329.2023.03.08.23.48.24; Wed, 08 Mar 2023 23:48:37 -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=RdVd7acf; 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 S230174AbjCIHq4 (ORCPT + 99 others); Thu, 9 Mar 2023 02:46:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230201AbjCIHqR (ORCPT ); Thu, 9 Mar 2023 02:46:17 -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 DB874DF70D for ; Wed, 8 Mar 2023 23:46:06 -0800 (PST) Received: by mail-lf1-x136.google.com with SMTP id r27so1134975lfe.10 for ; Wed, 08 Mar 2023 23:46:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678347965; 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=zhXTDSkBpSBmoLnt16h1xxcFV0v4vmTT7mnJI/zNpFI=; b=RdVd7acfqbV/RJ0zljVIdHf8OEekFM1TtLnwjfbFmZBCfpKs48zDqq9jmJ00FNhc3+ /21cJMiUoapp6aQgyYn2yng55EYkn3VehxFmuN1KnP/66ZoKwnbW0Wb8Gmj1f2X4zxlV 6LNliyaEJkqXcqyNFaQ/sM8kHziZlZvQx4gpkJETQSQ83/q9298lWDpGeGdTJmd6GNn4 cGXLY4Hj3atvGpFxTvp1/dXiAJqtNMlGCMP2rAqJr2cXTfR7dDa2I1yjcHTBYj/eTDgY qwctT1YvUcEGtoaxJZUIzCJNr3Gjesc1tFMnBD9WrbkLI9DoPMhpqxXXFYdpMbMvZm76 LW1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678347965; 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=zhXTDSkBpSBmoLnt16h1xxcFV0v4vmTT7mnJI/zNpFI=; b=DKsjhH8UZHzFXzYBKYE2FkYrNW0irp4GtkT7iCVjpJkAUmjYe5oQXyVBg/0oZL0XTf L1OnFhVjcbwwlp0gNykJrlNiUxPbX6r7iVLIscgVQbFK0RuoY5R2qBCV2wuwDSXbQZ2y /0YuMxqsv/jDLVm7b+iEH7PE+4Kwptkn0JFtYdSwwb1kzcKKpZec7aQbpcj2F3GwY+6U 9Swmzb6l0WJqLY++tupK3E1Y2R55gUc5MQzqGsbuMAzUz8r3FayBdPIFhGDs/lMtvpUr nK27+iz/rDE8AjSgy82AIBAwnK12Vi62sKQm69d2vWRP4A3yg8qwI6ZxgTdzt0Z17zg/ ktBA== X-Gm-Message-State: AO0yUKUcrtwnECPy3cMCFAfrAAJdgGdi64c/l5PIsfObq96niJK0gaRr LubRSuX4ELUJfxvtr/o3FxqJBw== X-Received: by 2002:ac2:5630:0:b0:4db:384c:bb8 with SMTP id b16-20020ac25630000000b004db384c0bb8mr5204447lff.69.1678347965235; Wed, 08 Mar 2023 23:46:05 -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.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 23:46:04 -0800 (PST) From: Linus Walleij Date: Thu, 09 Mar 2023 08:45:57 +0100 Subject: [PATCH v3 09/17] gpio: hlwd: Convert to immutable irq_chip MIME-Version: 1.0 Message-Id: <20230215-immutable-chips-v3-9-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?1759875555445476528?= X-GMAIL-MSGID: =?utf-8?q?1759875555445476528?= 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-hlwd.c | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/drivers/gpio/gpio-hlwd.c b/drivers/gpio/gpio-hlwd.c index 4e13e937f832..c208ac1c54a6 100644 --- a/drivers/gpio/gpio-hlwd.c +++ b/drivers/gpio/gpio-hlwd.c @@ -11,6 +11,7 @@ #include #include #include +#include #include /* @@ -48,7 +49,7 @@ struct hlwd_gpio { struct gpio_chip gpioc; - struct irq_chip irqc; + struct device *dev; void __iomem *regs; int irq; u32 edge_emulation; @@ -123,6 +124,7 @@ static void hlwd_gpio_irq_mask(struct irq_data *data) mask &= ~BIT(data->hwirq); iowrite32be(mask, hlwd->regs + HW_GPIOB_INTMASK); raw_spin_unlock_irqrestore(&hlwd->gpioc.bgpio_lock, flags); + gpiochip_disable_irq(&hlwd->gpioc, irqd_to_hwirq(data)); } static void hlwd_gpio_irq_unmask(struct irq_data *data) @@ -132,6 +134,7 @@ static void hlwd_gpio_irq_unmask(struct irq_data *data) unsigned long flags; u32 mask; + gpiochip_enable_irq(&hlwd->gpioc, irqd_to_hwirq(data)); raw_spin_lock_irqsave(&hlwd->gpioc.bgpio_lock, flags); mask = ioread32be(hlwd->regs + HW_GPIOB_INTMASK); mask |= BIT(data->hwirq); @@ -202,6 +205,24 @@ static int hlwd_gpio_irq_set_type(struct irq_data *data, unsigned int flow_type) return 0; } +static void hlwd_gpio_irq_print_chip(struct irq_data *data, struct seq_file *p) +{ + struct hlwd_gpio *hlwd = + gpiochip_get_data(irq_data_get_irq_chip_data(data)); + + seq_printf(p, dev_name(hlwd->dev)); +} + +static const struct irq_chip hlwd_gpio_irq_chip = { + .irq_mask = hlwd_gpio_irq_mask, + .irq_unmask = hlwd_gpio_irq_unmask, + .irq_enable = hlwd_gpio_irq_enable, + .irq_set_type = hlwd_gpio_irq_set_type, + .irq_print_chip = hlwd_gpio_irq_print_chip, + .flags = IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, +}; + static int hlwd_gpio_probe(struct platform_device *pdev) { struct hlwd_gpio *hlwd; @@ -216,6 +237,8 @@ static int hlwd_gpio_probe(struct platform_device *pdev) if (IS_ERR(hlwd->regs)) return PTR_ERR(hlwd->regs); + hlwd->dev = &pdev->dev; + /* * Claim all GPIOs using the OWNER register. This will not work on * systems where the AHBPROT memory firewall hasn't been configured to @@ -259,14 +282,8 @@ static int hlwd_gpio_probe(struct platform_device *pdev) return hlwd->irq; } - hlwd->irqc.name = dev_name(&pdev->dev); - hlwd->irqc.irq_mask = hlwd_gpio_irq_mask; - hlwd->irqc.irq_unmask = hlwd_gpio_irq_unmask; - hlwd->irqc.irq_enable = hlwd_gpio_irq_enable; - hlwd->irqc.irq_set_type = hlwd_gpio_irq_set_type; - girq = &hlwd->gpioc.irq; - girq->chip = &hlwd->irqc; + gpio_irq_chip_set_chip(girq, &hlwd_gpio_irq_chip); girq->parent_handler = hlwd_gpio_irqhandler; girq->num_parents = 1; girq->parents = devm_kcalloc(&pdev->dev, 1, From patchwork Thu Mar 9 07:45:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 66641 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp157032wrd; Wed, 8 Mar 2023 23:56:51 -0800 (PST) X-Google-Smtp-Source: AK7set+/VLs4rLdmlXH5FPC1bCZ3bS4ih+egCczpYcNY8oXwbHGp14NSy9ULnWibL18dy9ggMvA4 X-Received: by 2002:a05:6a20:2448:b0:cc:c3f7:916b with SMTP id t8-20020a056a20244800b000ccc3f7916bmr20343732pzc.0.1678348611265; Wed, 08 Mar 2023 23:56:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678348611; cv=none; d=google.com; s=arc-20160816; b=fyom/FmRHmmHUmMxsyGUbEjGMFAKCF9/1PU5xXVHd/fn1PcXJxIsdtLbatOeOg99Br HMdJxoRs/karOfesL5zXX7/r7OVucLcp1JFEJknIewVOs6ixBW8yqZORRCCl6KUsNWQ9 rt7whXyvi6ZpsddTiLXmFseqLR4EvqiR6z0GTOPNAFu5jMqHkxBIrjQDOgwr2eDkA3kW upcFsrcnbK6RnMrgzds8B7vB3bga5kvs0ksODwhVWkaCh98kZy5kazyOW2zTtxyvk0h1 twUavQWITQ4ldcGmkaWDnUqvTs8SPRUgXSJ/WYUI63c1gwe6DjQTQz8tKTKnoWK7QF7g ZOjA== 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=mrWM+EAKAzwQ5ezMEftNhFMLDl9SqlbwY2w38EwevvI=; b=nC6HVNy0YAUxfWh6As8WOe7t1GyVs3G2RsfLA8emYr7jMwtEm6y3WwY6lFd4oy+o7d 2R7l+/qicqZh/RePUb4Hz4+W+nhquVSVv6DUlr7mIJFlKBpag+KVMvHnh/hmwNGFuMp4 06pNbwox2aGPHDSHP3xQw49ASIDkEQvOL6Pp4NT3TiCyZCT4hRZw8aweNKUx0xXi95S3 AjuLk2kyizdGbsyAiUK+woo7BIZnodxzAz8yXznkyUNDT5Udlfc4suQloVR8p5JkZmKs iYP5FTtSs3dpEN+cYZ+TC2fgLTTq0x12JU7edslImw6ftqdiNF2WnML1+Ad9W+mJ/3o/ ZK7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dpeqQOhA; 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 n9-20020a634d49000000b004fcda251792si15664538pgl.201.2023.03.08.23.56.08; Wed, 08 Mar 2023 23:56:51 -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=dpeqQOhA; 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 S229968AbjCIHrH (ORCPT + 99 others); Thu, 9 Mar 2023 02:47:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230256AbjCIHqb (ORCPT ); Thu, 9 Mar 2023 02:46:31 -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 0892BDD366 for ; Wed, 8 Mar 2023 23:46:07 -0800 (PST) Received: by mail-lf1-x129.google.com with SMTP id d36so1141395lfv.8 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=1678347966; 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=mrWM+EAKAzwQ5ezMEftNhFMLDl9SqlbwY2w38EwevvI=; b=dpeqQOhAC2IXszdN6b8072Sl3bUiKHrw7h4NcCf0ogXh4B0yfqJj4ByencdTElx2aJ sKF4q5jllyoAmMUW1uRtjq8pRUmfXSCBbZVRrj3c2xQQ0x0vtVj7XokQal+UY9jqLosg Xx+05Ne3vk9lXNGwr8b/JGeQcueOHbwq5PWrmt9z39hSY2nGyWtfcKQRqCpZYWcY6wV4 JW6F/ONnjvJUwNtFnrrd2R099Hw9dktMpGsFvYioElhFKu6kHxEJVHQ5pqKTod0lk1v+ vuTU590mZUpAPXNWN4bYA6rqfMeoD8fC6xhG4fbLX/Sz+AO32D4l60l+nwuZPGTHP3AS dzyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678347966; 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=mrWM+EAKAzwQ5ezMEftNhFMLDl9SqlbwY2w38EwevvI=; b=SZmKbGIsQlGPrjYjPYZAAAGGq7FTLensYvqi3pY+eV2za3lz842JrNeDFb7e6Kojsb uUpiN2nZ0mN1O8ZNnX/58vgO7ECowBznQSave3hOUYKdVSZfhbAb1cnyj3xUMrJXqNzE GDyqGmvk8Rx35L6ErrQknQIx3OBQXnUtcxSlG22jksYZSPQDZ6xiIu6VaOGZHuQ8T+Pb 9dK1WmKSylGqLk483Qx9BZR5oKWhlUh1WZUsIPfOhg3EQVsHI0m1lJH/1DnVypvuX9FA sx6v2iU0z6UJB670SQC5w9/G2voXGsj/WCke0XQq4gxPRh5Bh3JRplxdLJTYLksDhkc7 x8nw== X-Gm-Message-State: AO0yUKUAQSzmPlvFCKejsGOXfe0oMXCqleaXoxXDQpQRmnPH5w+3pUKX 46v0jYq1gMH2Kg0e9uW9480Jig== X-Received: by 2002:ac2:555a:0:b0:4de:6973:82aa with SMTP id l26-20020ac2555a000000b004de697382aamr5913982lfk.68.1678347966337; Wed, 08 Mar 2023 23:46:06 -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.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 23:46:05 -0800 (PST) From: Linus Walleij Date: Thu, 09 Mar 2023 08:45:58 +0100 Subject: [PATCH v3 10/17] gpio: idt3243x: Convert to immutable irq_chip MIME-Version: 1.0 Message-Id: <20230215-immutable-chips-v3-10-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 , Thomas Bogendoerfer 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?1759876073592369771?= X-GMAIL-MSGID: =?utf-8?q?1759876073592369771?= Convert the driver to immutable irq-chip with a bit of intuition. Cc: Marc Zyngier Tested-by: Thomas Bogendoerfer Acked-by: Marc Zyngier Signed-off-by: Linus Walleij --- 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; 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; From patchwork Thu Mar 9 07:46:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 66636 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp156809wrd; Wed, 8 Mar 2023 23:56:05 -0800 (PST) X-Google-Smtp-Source: AK7set87Hy/TgH7X1VOBJAEbbUs4WwCj7jXr0INiSWp5Q5ZtpSzmd0IvMC+pyr5UqC2dRhSSg8eq X-Received: by 2002:a17:902:c10c:b0:19a:bbd0:c5ca with SMTP id 12-20020a170902c10c00b0019abbd0c5camr18857745pli.48.1678348564823; Wed, 08 Mar 2023 23:56:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678348564; cv=none; d=google.com; s=arc-20160816; b=anxOZ6Om9fe/r8A7VqwKDypzDAq9jn+mgJfhzHAIKLiqvFJc8g7AhknvQnYQTEDJh6 0e5ATdsBG701u+0Un9ykcSxd1YM/s+3yGYSbwp/mgsTbfYtDIyOhmc8pRc3PrAl5YEcb N0U1yjfpkjXLgOqs/NvwMiERMIXxAEmgCa9gnsiNf0MjF34bHixTGk9U85/hkOAWAjoR qywFSW6xAks9K6s0fdhtSSCoRNV0tes1ZsGhV7Ux6rO3d5RCsnrQIVpyQKPuCYcXVy0/ O5V8uanXP9jXm9KwNPjkfWLq00K7c8YeutWwymeVI0OTVMyLlA7rEBTiB516GZ2XftTJ GiaQ== 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=Pkmx+b8ik/C6bLfv+4RBCDp/VEmyhMZOMZzx00ojykk=; b=XiFayvZmtvRsLifLdqM4VZkv1O57ifem3EwUaslW/FxqXf3O0quK4VgLYBkjtUrKuZ //3wkanB0DhIgP8ta0DOL7tb0H/lnvhm9ZSkvvW5zfveFJUypGBjBjySRnpE2Uu+GU7l 0tj/nuVzDJBztwxDlo8CdxvOUhBM2KN0+T1dRnGJP4fgTzuGpoEqIZ+nH7jv/Uj1Qr97 k5lxpFM6fgSgbMwIFR2XhQVsexGkilzogRSE3jaZPcdtW5afPoxzqPKnxSJ0rKVheeY3 xfbyPBVrk4OEm9B5W6Vi4H4p7l055kfb6E0/DTrsT2+hJeLGWEDxkC6R0GfgRwr1Ucpz dYzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="p3Kr/WFN"; 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 u8-20020a17090282c800b0019cba5dd485si16122743plz.358.2023.03.08.23.55.52; Wed, 08 Mar 2023 23:56:04 -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="p3Kr/WFN"; 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 S230147AbjCIHrE (ORCPT + 99 others); Thu, 9 Mar 2023 02:47:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230261AbjCIHqb (ORCPT ); Thu, 9 Mar 2023 02:46:31 -0500 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8A1EDDB19 for ; Wed, 8 Mar 2023 23:46:08 -0800 (PST) Received: by mail-lf1-x12e.google.com with SMTP id r27so1135114lfe.10 for ; Wed, 08 Mar 2023 23:46:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678347968; 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=Pkmx+b8ik/C6bLfv+4RBCDp/VEmyhMZOMZzx00ojykk=; b=p3Kr/WFNbbKFk66agzCT4u42Y5KITAZpT48aFDNPE9ZUZHzzWb76fkK8FF1mTSwXvA YN00K6GTgQC1XC+mSoGVipsLmUmGGI2Ditgn5WnNaGmdlVcaT0n1cQsDlfgsKhlAdyIG 0VD4mueZ56RA8/YbfkwoduJ4nCXDurAqKFa6Rt8oQHpjXxLFrUWlgtfVwrrAoMGpKt0w aariaDW/AIcCYsIghKFcThCHY0OPYL8YkfwbdKEkF8qSKkpnlYYSD99dkFG0/dqduNje gSlB2/gHJo7+OIQaV7pAaEMDPRnenW8c0PzItdFAYuv0gBV0pV2zXHmS6KtCDIR3Fn+W Eg0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678347968; 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=Pkmx+b8ik/C6bLfv+4RBCDp/VEmyhMZOMZzx00ojykk=; b=XaxOMzX+/BrLMnZW6upnRJhRzSZwjUfc45UhEeZczz/zdkdvPsEkhydS0lMNytqD3z 2cCgzSx+QEXISAjvsLmVH7eujUPxPmGT/Zyv93cMVivPTsdQGkv4zfbOySg0uVyM0Q+d vY4Jy+X7FXZETuVsN7guZ1GBIdTZEFKszzQHw2lbjjJ5AbMcH3B+z6rk0l7f2N8PyQIf HPznrPRCnSeC1OYo804tOcFak/v3aF/ERw1zxEtkgzehYk7NEfl4eRM9XWOkc9JbGxRn k2KzQdnRtWVZUF9WpKcDd/5YrkH/++HVIRj++0ixcnzuMJw+/A91gFK9N5JXaYzTOvL7 zenA== X-Gm-Message-State: AO0yUKVELHDs82zHKwo21Wykc31+oVpTMbSKUgBYSoEovQGcnaECSmVd UdLb/OY7gWqdMlARYSzhgxnyxQ== X-Received: by 2002:ac2:5dfa:0:b0:4b6:e405:1027 with SMTP id z26-20020ac25dfa000000b004b6e4051027mr6046717lfq.14.1678347968374; Wed, 08 Mar 2023 23:46:08 -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.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 23:46:08 -0800 (PST) From: Linus Walleij Date: Thu, 09 Mar 2023 08:46:00 +0100 Subject: [PATCH v3 12/17] gpio: mlxbf2: Convert to immutable irq_chip MIME-Version: 1.0 Message-Id: <20230215-immutable-chips-v3-12-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?1759876024778868635?= X-GMAIL-MSGID: =?utf-8?q?1759876024778868635?= 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-mlxbf2.c | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/drivers/gpio/gpio-mlxbf2.c b/drivers/gpio/gpio-mlxbf2.c index 77a41151c921..6abe01bc39c3 100644 --- a/drivers/gpio/gpio-mlxbf2.c +++ b/drivers/gpio/gpio-mlxbf2.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -65,10 +66,10 @@ struct mlxbf2_gpio_context_save_regs { /* BlueField-2 gpio block context structure. */ struct mlxbf2_gpio_context { struct gpio_chip gc; - struct irq_chip irq_chip; /* YU GPIO blocks address */ void __iomem *gpio_io; + struct device *dev; struct mlxbf2_gpio_context_save_regs *csave_regs; }; @@ -237,6 +238,7 @@ static void mlxbf2_gpio_irq_enable(struct irq_data *irqd) unsigned long flags; u32 val; + gpiochip_enable_irq(gc, irqd_to_hwirq(irqd)); raw_spin_lock_irqsave(&gs->gc.bgpio_lock, flags); val = readl(gs->gpio_io + YU_GPIO_CAUSE_OR_CLRCAUSE); val |= BIT(offset); @@ -261,6 +263,7 @@ static void mlxbf2_gpio_irq_disable(struct irq_data *irqd) val &= ~BIT(offset); writel(val, gs->gpio_io + YU_GPIO_CAUSE_OR_EVTEN0); raw_spin_unlock_irqrestore(&gs->gc.bgpio_lock, flags); + gpiochip_disable_irq(gc, irqd_to_hwirq(irqd)); } static irqreturn_t mlxbf2_gpio_irq_handler(int irq, void *ptr) @@ -322,6 +325,24 @@ mlxbf2_gpio_irq_set_type(struct irq_data *irqd, unsigned int type) return 0; } +static void mlxbf2_gpio_irq_print_chip(struct irq_data *irqd, + struct seq_file *p) +{ + struct gpio_chip *gc = irq_data_get_irq_chip_data(irqd); + struct mlxbf2_gpio_context *gs = gpiochip_get_data(gc); + + seq_printf(p, dev_name(gs->dev)); +} + +static const struct irq_chip mlxbf2_gpio_irq_chip = { + .irq_set_type = mlxbf2_gpio_irq_set_type, + .irq_enable = mlxbf2_gpio_irq_enable, + .irq_disable = mlxbf2_gpio_irq_disable, + .irq_print_chip = mlxbf2_gpio_irq_print_chip, + .flags = IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, +}; + /* BlueField-2 GPIO driver initialization routine. */ static int mlxbf2_gpio_probe(struct platform_device *pdev) @@ -340,6 +361,8 @@ mlxbf2_gpio_probe(struct platform_device *pdev) if (!gs) return -ENOMEM; + gs->dev = dev; + /* YU GPIO block address */ gs->gpio_io = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(gs->gpio_io)) @@ -376,13 +399,8 @@ mlxbf2_gpio_probe(struct platform_device *pdev) irq = platform_get_irq(pdev, 0); if (irq >= 0) { - gs->irq_chip.name = name; - gs->irq_chip.irq_set_type = mlxbf2_gpio_irq_set_type; - gs->irq_chip.irq_enable = mlxbf2_gpio_irq_enable; - gs->irq_chip.irq_disable = mlxbf2_gpio_irq_disable; - girq = &gs->gc.irq; - girq->chip = &gs->irq_chip; + gpio_irq_chip_set_chip(girq, &mlxbf2_gpio_irq_chip); girq->handler = handle_simple_irq; girq->default_type = IRQ_TYPE_NONE; /* This will let us handle the parent IRQ in the driver */ From patchwork Thu Mar 9 07:46:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 66627 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp154837wrd; Wed, 8 Mar 2023 23:50:05 -0800 (PST) X-Google-Smtp-Source: AK7set+Pry1XylEBpK/QkTb7fTnqHZNh4d/pydWMkc74ILxTYrwW4zhJe8S284F3RPi4Sggr2Kr5 X-Received: by 2002:a05:6a20:6a03:b0:c7:1bac:6ef9 with SMTP id p3-20020a056a206a0300b000c71bac6ef9mr22714340pzk.46.1678348205670; Wed, 08 Mar 2023 23:50:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678348205; cv=none; d=google.com; s=arc-20160816; b=SIPfto9UbwFv7aWbN1NDHP0Q/bpx4cKF0ajod/RXwK+N/9qbKq5JhCldVhhzHHR7jA r/4X5qF/UPpQWavzUOLmkLrb2bGBliNlzf+Hlzt+XWwzvq05OofROWP+KeEQFGppHZSA md2natJgDaQKNSS0FCIS4RnKoHlREkpXfVCWHqLOWrGQavQvpWBp66Q6mYqCFmxiUy+m 7HHA1AbmmfYWOuU0moNnX/SOS45ir34ejFVoRsmPrVRy+iw7SI+QyWWypL0CiXj7jpcw CcBPPn/D3pj9Bi1bQj51hw5eVdCgsAFLN+j0xQy2h8pChY9irj0j7UY1L22FpBzEgTGW 1lOg== 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=OQuA1tF6Ns4xfFrA/n5eFYkzgcWagxF/56/sQxPhA+ecNmCTKXrXa5ojhtwEw0vSmX cSsOx9gicVpoQR909l+M9nWEwEBh97rXouEglPuam0sQH97KSKvr/t+3ZYF09vL/6Wgq ADdxAMDRbMrSZyBOXS3M7c7BD7V2sdwQdLUyAg3JFrcWln/5MrEtctIWi3FGJ8IQlJVo xC37Pm/bE6uvbZYEeTvW9Wetv4iT1l0l2dqEa8OBYC4HKbkO0wYtQSKDxYeQlKBUBFWn v5XJcwj1gS0av1bbCEHwIWr8eN0NKPMNPnJZKMHAhmTwbFDsVWGmV8dJXkcwUqvAcAut 8OYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wJC3zufw; 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 m1-20020a656a01000000b004ff7002e3f9si18592200pgu.164.2023.03.08.23.49.53; Wed, 08 Mar 2023 23:50:05 -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=wJC3zufw; 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 S230112AbjCIHrN (ORCPT + 99 others); Thu, 9 Mar 2023 02:47:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229955AbjCIHqj (ORCPT ); Thu, 9 Mar 2023 02:46:39 -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 F1215DF729 for ; Wed, 8 Mar 2023 23:46:09 -0800 (PST) Received: by mail-lf1-x133.google.com with SMTP id j11so1118071lfg.13 for ; Wed, 08 Mar 2023 23:46:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678347969; 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=wJC3zufwPxxsbKw7VfvKKo3TwQtynJvjK4ttQs4bLtNyCksMt/VUnyY2BAbGcZ0wtG Z8D4qs41flPvAArqB5IeScGx0OuJ3Y7b5xrdlVrR8/nx93gcNo2qIhz9ELUvRLrg5G33 SKHUIgTXjHgfbHrlzU0SyIMIcJjeR0/6LJakIm2q2d1xVcsm13ovij7Qr/i7HpJUYDDZ 5/pHCUJA2ejaKXai6/ynckG06C8xwHNzmp0nBIcXKjVMJK1Yl1Jqu49ECcYleQcCO3BM iV4ZI0ur3ifZGcLbEU/77B5APP93JAcyJcKWXx0P+1HMwVuCU8lmquVKY7yB62YJEjmC 0Tcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678347969; 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=U20QBcic9MeMtCqtBEzWz4Df8LZHrR/xOGJIC+iao2xv+wrVnk7E46UJJGO6Ia3i3b IcpfF1HW+Tbwt8iTK60U2PzOo71KroD72UxVxEL5TBUWYFAEk1A+6BwK4VHK7RQ3thQ6 0HLy9aaWQlDrlEzjFQgdaNdu2oc+SXVZCfN/B6xhw33HnkoQZkV780mNcHzAFfu2YhLj sopXqGrPimDjL6veXyHzUafJ3s30BkieZiHHFLRa8bReH0szpS6VIo2DCooo7R+GB8FE UKjYLOTOs7G5Uo1TtyO7W8iCWo3ZPlPM8PkwtIXG/Rgo8Y7GHn18FI1EeUIOo+rrx7h/ OdxQ== X-Gm-Message-State: AO0yUKUSSCtStvlDJM68oxW5ihNQTZn9DW1BLqnSfuc2yw2XWLYEEx+c kFaXpRLufoVzZ6CvieijVXenKQ== X-Received: by 2002:ac2:50d5:0:b0:4dd:a57e:9960 with SMTP id h21-20020ac250d5000000b004dda57e9960mr5974777lfm.5.1678347969422; Wed, 08 Mar 2023 23:46:09 -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.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 23:46:09 -0800 (PST) From: Linus Walleij Date: Thu, 09 Mar 2023 08:46:01 +0100 Subject: [PATCH v3 13/17] gpio: max732x: Convert to immutable irq_chip MIME-Version: 1.0 Message-Id: <20230215-immutable-chips-v3-13-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=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?1759875648276875173?= X-GMAIL-MSGID: =?utf-8?q?1759875648276875173?= 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; From patchwork Thu Mar 9 07:46:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 66626 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp154672wrd; Wed, 8 Mar 2023 23:49:35 -0800 (PST) X-Google-Smtp-Source: AK7set9xJmOeOIP7kmKn0yRkc1QDNGCAjQkOxHKGHs8XlGM7TwWHUOMyZWhT4hzsE+LMSWZCQKnn X-Received: by 2002:a05:6a20:6615:b0:cc:5c57:7a0d with SMTP id n21-20020a056a20661500b000cc5c577a0dmr23507045pzh.40.1678348174951; Wed, 08 Mar 2023 23:49:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678348174; cv=none; d=google.com; s=arc-20160816; b=KJMQbMXdEzKuITb9aBd5gPxbS83w5w0gbipJwt20Dn9dYm5JpuKbm1rLWEQlR3A0S/ ru8p0scuLdgaPn1CCd0f650hIhbM9fe3dwNldsZgQc4xIMWSpgv9W6mXtYGpqwCthi5J aPBIr2LS/xYwXvP10to7a3zkEwCzWix7Nt/fOyRtAigxqpQ+VgkYqQparVwhbqQmgbM6 tJesri/9wSmjqbKa/QS1eVhb8VHqV/eeY/homYNDpl8QOw9ZP6afd8ckfPjiWDSf/Baw /KOaynoevqSbroPQ7XPyF4sjzvchUuKe1hF/cobkeLoSgfJcR+dWMpLORLYfCZGIXw72 /0Pw== 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=p1r1zyYA9t+QO+JcvGnUo/RuruD1eWdYkbb9TESedm0=; b=qxNsraQMqI/aPNLVSuYRFTFSOIJMuNfIWkLDxB8MI1lcbnbL5BjcrLzocU2/qjuQ4F HyjegpDgy1/B788AepqSvrGCbZyklP3igtaf+7AjuvnnukpTR/9b8d3PX2gNSj2HL3sP DffplJIsZYrRSUpDbagHVrhjp5Bn7K5s9+z2kr9n0F/nd8Xa4TARxjD8JQKitR2Vzmmf QszVWH6W7myVrAa/EO2LPRpuV1gK1zzW89zXAxNvJnTlYZFWTwnb3Yqy5c2Gq+GkrpIP 9csQLmo+WT9D5/Sb6aT3T9j0c2q8ZRCdyBfnp0Eec7RDnyy1K25F7kzJXkN/sJdbgE6Y 7VeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Tn0kT9pG; 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 d10-20020a630e0a000000b004ce5301edd5si16460592pgl.711.2023.03.08.23.49.21; Wed, 08 Mar 2023 23:49:34 -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=Tn0kT9pG; 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 S230190AbjCIHrf (ORCPT + 99 others); Thu, 9 Mar 2023 02:47:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230050AbjCIHqn (ORCPT ); Thu, 9 Mar 2023 02:46:43 -0500 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 456EDDDF17 for ; Wed, 8 Mar 2023 23:46:12 -0800 (PST) Received: by mail-lf1-x134.google.com with SMTP id j11so1118135lfg.13 for ; Wed, 08 Mar 2023 23:46:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678347970; 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=p1r1zyYA9t+QO+JcvGnUo/RuruD1eWdYkbb9TESedm0=; b=Tn0kT9pG+OpUApaG8znHQ+ekGoIVakiLzD95tkVlpHddMSmj9vog6WG1rG3HUDZpgC BuaWUky0NZEFG3ZjPUEXCHe4cjuJR4SB0LLxYr/6BEwlPalYqJ6aOkj73iU3gVyGurYv dgBNUTKW/8M2EvU3Wvmzljdpz+fwneQxO6uQOe1kVLLE7T8m6XX3o8gLdJAbG+wZy4zM JYyqjcm1V+q7sf8tnlK/k2TEUIIRKSJM4OF3CUv3TDMnLRdu342Hsyf6/PmXD1hTlhiV bPOKa03FmOGd6MT+j+We7hC3UCMI3wCQXCQKuU11VOTZ204ZYL8/1oLy8hOm4JNjrCJM m4pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678347970; 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=p1r1zyYA9t+QO+JcvGnUo/RuruD1eWdYkbb9TESedm0=; b=qL+iWGnPtHSB3LwK2IvMDkfsMUjx+8IfhkgRPHJO0faQLa9aImACi0i0jfexuJjxAP PXPi1wvxVgB4O4+Yl0/Ecm7gZDC/k9Qv4kJgittXPn2VJPiWEmBC870yOIjJJcDRpmnb shJFDU0ifypqZC9ctXoUBEFwKgBUFxgTZZ0O0tsCPhZXGrC4reb1yyydEzQv9JFYyeuy jotza8MIml1yyDAX8QTpjGg5aZeWOBW7Ca9xVq5jIWXaHFGYjwP+nprc34uC5BJ/O3pr 0LVUm2dIaPONWBhejwIgkJVCV1EV4D2nsHjvSoUd56Ew3pW4rY5joxM/8AohW9zBERm8 sSsw== X-Gm-Message-State: AO0yUKUjPBPyl/aDmCFajnHVux3mTBA64ZDo8OSwo6ONc4vE10TwpM9F cQeBPI6bPEh01MhzBUUN7FFZEg== X-Received: by 2002:ac2:54a5:0:b0:4dc:4b92:dbc4 with SMTP id w5-20020ac254a5000000b004dc4b92dbc4mr5293556lfk.14.1678347970521; Wed, 08 Mar 2023 23:46:10 -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.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 23:46:10 -0800 (PST) From: Linus Walleij Date: Thu, 09 Mar 2023 08:46:02 +0100 Subject: [PATCH v3 14/17] gpio: omap: Drop irq_base MIME-Version: 1.0 Message-Id: <20230215-immutable-chips-v3-14-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 , Janusz Krzysztofik , Tony Lindgren , Arnd Bergmann , 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?1759875616321419463?= X-GMAIL-MSGID: =?utf-8?q?1759875616321419463?= The OMAP1 at one point was using static irqs but that time is gone, OMAP1 uses sparse irqs like all other multiplatform targets so this static allocation of descriptors should just go. Cc: Janusz Krzysztofik Cc: Tony Lindgren Acked-by: Arnd Bergmann Acked-by: Marc Zyngier Reviewed-by: Tony Lindgren Signed-off-by: Linus Walleij --- drivers/gpio/gpio-omap.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index f5f3d4b22452..1cbd040cf796 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c @@ -992,7 +992,6 @@ static int omap_gpio_chip_init(struct gpio_bank *bank, struct irq_chip *irqc, struct gpio_irq_chip *irq; static int gpio; const char *label; - int irq_base = 0; int ret; /* @@ -1024,19 +1023,6 @@ static int omap_gpio_chip_init(struct gpio_bank *bank, struct irq_chip *irqc, } bank->chip.ngpio = bank->width; -#ifdef CONFIG_ARCH_OMAP1 - /* - * REVISIT: Once we have OMAP1 supporting SPARSE_IRQ, we can drop - * irq_alloc_descs() since a base IRQ offset will no longer be needed. - */ - irq_base = devm_irq_alloc_descs(bank->chip.parent, - -1, 0, bank->width, 0); - if (irq_base < 0) { - dev_err(bank->chip.parent, "Couldn't allocate IRQ numbers\n"); - return -ENODEV; - } -#endif - /* MPUIO is a bit different, reading IRQ status clears it */ if (bank->is_mpuio && !bank->regs->wkup_en) irqc->irq_set_wake = NULL; @@ -1047,7 +1033,6 @@ static int omap_gpio_chip_init(struct gpio_bank *bank, struct irq_chip *irqc, irq->default_type = IRQ_TYPE_NONE; irq->num_parents = 1; irq->parents = &bank->irq; - irq->first = irq_base; ret = gpiochip_add_data(&bank->chip, bank); if (ret) From patchwork Thu Mar 9 07:46:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 66635 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp156787wrd; Wed, 8 Mar 2023 23:56:00 -0800 (PST) X-Google-Smtp-Source: AK7set+d+gyrTw5881VZ7gCHXIENrEbtZ0kVPwfZNwR2OpArrc2pR5wDIJxMpH3A3cmZgEPFI5gl X-Received: by 2002:a05:6a20:42aa:b0:c7:13be:6dec with SMTP id o42-20020a056a2042aa00b000c713be6decmr23066192pzj.15.1678348559971; Wed, 08 Mar 2023 23:55:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678348559; cv=none; d=google.com; s=arc-20160816; b=c7c28AqOG3+u5GnignwPmTyOfcPXrN1iQLytP3T8AGZY7RvAkEZ4BOHg+PZqnxlxHM QB/8YuXTyadmzNIq3ql3dfKtSI5u81xNHkMx1mEb3UX3MXUher5PNkGpDk2JIxS471I0 hEn8EBw0C8ShgIsxTYHx71h0hSgwosm2OQE91QZIS9vhFnPUAJ6uvWHvF3b2D9ewwSdL MnLJImvW4NjCik3EB3MZPCFSKDKJ9k3b6j452xCL8PWhC5YG4w+WJJJAtR57LbBKgAAz mW0jtnahsKlgodEdYRFdM/7kwolMW6yXuNuKOhaF+SZ5bXYk5XaPXqDGf0J2T6rx5XDa Vr3g== 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=vYLgGoAAs4DcH8LZQncbtVAjj3rbStL1HUOVD02/kfE=; b=gf+aN20EqORwwUXRF01eSHHf619TimVbMgPJUrIsFXtoX2SnjJzP4qLQMaQUpJxSM7 /+OlrNQIp71yASXPGy80dnQ9vt4ua8BKBqzT8PybRSbtyehJE5SLbp2s60CyMxFBXngK SqQLthuiBWT4aVyo3eiyj3Y8vbJm9NS1Nwp3sX9Bf39rpIMUOQxYPjUhb5zuBGlNjHCF tSea67s+bnU/PC5CM0XMpqZVwR843iQcYuSvdnTbVRE4gBFn4de+2FDry4Jkt8V/IScH Ft2JTiMLkrNw5gwFiGfyVzw7jmSFdbVN7yAs8VT63fxREv8fxGTuiAKVM86qKiyThLC7 eM+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rJW1pSbw; 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 h17-20020aa79f51000000b005da04220d99si16497321pfr.260.2023.03.08.23.55.47; Wed, 08 Mar 2023 23:55:59 -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=rJW1pSbw; 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 S230285AbjCIHrb (ORCPT + 99 others); Thu, 9 Mar 2023 02:47:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230286AbjCIHqn (ORCPT ); Thu, 9 Mar 2023 02:46:43 -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 F3311DDF10 for ; Wed, 8 Mar 2023 23:46:11 -0800 (PST) Received: by mail-lf1-x133.google.com with SMTP id m6so1161648lfq.5 for ; Wed, 08 Mar 2023 23:46:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678347971; 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=vYLgGoAAs4DcH8LZQncbtVAjj3rbStL1HUOVD02/kfE=; b=rJW1pSbwgXGQIlPm5ZBopg7dEA8C3O55AzE5vYaOruYmgvx5z0j4F7H0Lewh/xU3Dd /xeRDYCyohcL0ULLOkqBAsG46h38ZzjlCTW3uMseFqTSg1h4cuygoaeaJL5N27Y+krl9 XwIDv02p5/81Z9aTe/zJ9iT+5T6G7cfeMDThpA/1G2zkZUNgLKvDm/s4yLJehxUn59Y2 zkg9YB16i46HNi0D1AyIlIyZSE9TCV2nAMM74+snebtys9ozxLiRKJ/Wn0yAwXt8WuXg Wb1AXDnYkimrgs3ZMuS/B8e09KuQwmWyxwCQsGqDOjtXrKfgmI/NTlQOVLm6XUXiTC8D bOIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678347971; 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=vYLgGoAAs4DcH8LZQncbtVAjj3rbStL1HUOVD02/kfE=; b=NYnRtJVImQwx5m/58Z9aXwLA63qtPSBShj5MNloyMYQd1OL4Phh9JbPcRtRTYqVcSo Y8ktIwihVrXCUjhHnp7Rt7u8HaSibERaR7HijaLEOHxftQ6e63SEa4fwqTdmiq0N/Rma X/Xmr+St5W8mWmugiFXsYUilR93lsRg5LuVUkML7acvdX2FBEgvQ9frYiJ0YuDldwD3S mltuS6U/sw0SwRqNZJkqd7+NgTYhNWK4QoEjXpZZ8xPf9ZmKihHPe2RX+AfzVUth1lEi kB+Gn2GX9A2O8IqrBdgOXAX+DzxUN+x9TAO4PpdVm6y+zWbKrY8d4m+8egK1Ji/d+25M WDDg== X-Gm-Message-State: AO0yUKWfTk6rJFn5RXcIhUrJ+VWB4WwSuWCM62Y4cXErN2/+OAwTe32I bBrlwgQRcdozS/I7xmsNyc83Dw== X-Received: by 2002:ac2:5a4c:0:b0:4dc:7ff4:83f9 with SMTP id r12-20020ac25a4c000000b004dc7ff483f9mr6093156lfn.16.1678347971558; Wed, 08 Mar 2023 23:46:11 -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.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 23:46:11 -0800 (PST) From: Linus Walleij Date: Thu, 09 Mar 2023 08:46:03 +0100 Subject: [PATCH v3 15/17] gpio: omap: Convert to immutable irq_chip MIME-Version: 1.0 Message-Id: <20230215-immutable-chips-v3-15-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 , Tony Lindgren 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?1759876019876330758?= X-GMAIL-MSGID: =?utf-8?q?1759876019876330758?= Convert the driver to immutable irq-chip with a bit of intuition. This driver require some special care: .irq_ack() was copied from dummy_irq_chip where it was defined as noop. This only makes sense if using handle_edge_irq() that will unconditionally call .irq_ack() to avoid a crash, but this driver is not ever using handle_edge_irq() so just avoid assigning .irq_ack(). A separate chip had to be created for the non-wakeup instance. Cc: Marc Zyngier Reviewed-by: Tony Lindgren Tested-by: Tony Lindgren Acked-by: Marc Zyngier Signed-off-by: Linus Walleij --- drivers/gpio/gpio-omap.c | 68 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 45 insertions(+), 23 deletions(-) diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index 1cbd040cf796..a08be5bf6808 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -47,6 +48,7 @@ struct gpio_regs { struct gpio_bank { void __iomem *base; const struct omap_gpio_reg_offs *regs; + struct device *dev; int irq; u32 non_wakeup_gpios; @@ -681,6 +683,7 @@ static void omap_gpio_mask_irq(struct irq_data *d) omap_set_gpio_triggering(bank, offset, IRQ_TYPE_NONE); omap_set_gpio_irqenable(bank, offset, 0); raw_spin_unlock_irqrestore(&bank->lock, flags); + gpiochip_disable_irq(&bank->chip, offset); } static void omap_gpio_unmask_irq(struct irq_data *d) @@ -690,6 +693,7 @@ static void omap_gpio_unmask_irq(struct irq_data *d) u32 trigger = irqd_get_trigger_type(d); unsigned long flags; + gpiochip_enable_irq(&bank->chip, offset); raw_spin_lock_irqsave(&bank->lock, flags); omap_set_gpio_irqenable(bank, offset, 1); @@ -708,6 +712,40 @@ static void omap_gpio_unmask_irq(struct irq_data *d) raw_spin_unlock_irqrestore(&bank->lock, flags); } +static void omap_gpio_irq_print_chip(struct irq_data *d, struct seq_file *p) +{ + struct gpio_bank *bank = omap_irq_data_get_bank(d); + + seq_printf(p, dev_name(bank->dev)); +} + +static const struct irq_chip omap_gpio_irq_chip = { + .irq_startup = omap_gpio_irq_startup, + .irq_shutdown = omap_gpio_irq_shutdown, + .irq_mask = omap_gpio_mask_irq, + .irq_unmask = omap_gpio_unmask_irq, + .irq_set_type = omap_gpio_irq_type, + .irq_set_wake = omap_gpio_wake_enable, + .irq_bus_lock = omap_gpio_irq_bus_lock, + .irq_bus_sync_unlock = gpio_irq_bus_sync_unlock, + .irq_print_chip = omap_gpio_irq_print_chip, + .flags = IRQCHIP_MASK_ON_SUSPEND | IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, +}; + +static const struct irq_chip omap_gpio_irq_chip_nowake = { + .irq_startup = omap_gpio_irq_startup, + .irq_shutdown = omap_gpio_irq_shutdown, + .irq_mask = omap_gpio_mask_irq, + .irq_unmask = omap_gpio_unmask_irq, + .irq_set_type = omap_gpio_irq_type, + .irq_bus_lock = omap_gpio_irq_bus_lock, + .irq_bus_sync_unlock = gpio_irq_bus_sync_unlock, + .irq_print_chip = omap_gpio_irq_print_chip, + .flags = IRQCHIP_MASK_ON_SUSPEND | IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, +}; + /*---------------------------------------------------------------------*/ static int omap_mpuio_suspend_noirq(struct device *dev) @@ -986,8 +1024,7 @@ static void omap_gpio_mod_init(struct gpio_bank *bank) writel_relaxed(0, base + bank->regs->ctrl); } -static int omap_gpio_chip_init(struct gpio_bank *bank, struct irq_chip *irqc, - struct device *pm_dev) +static int omap_gpio_chip_init(struct gpio_bank *bank, struct device *pm_dev) { struct gpio_irq_chip *irq; static int gpio; @@ -1023,12 +1060,12 @@ static int omap_gpio_chip_init(struct gpio_bank *bank, struct irq_chip *irqc, } bank->chip.ngpio = bank->width; + irq = &bank->chip.irq; /* MPUIO is a bit different, reading IRQ status clears it */ if (bank->is_mpuio && !bank->regs->wkup_en) - irqc->irq_set_wake = NULL; - - irq = &bank->chip.irq; - irq->chip = irqc; + gpio_irq_chip_set_chip(irq, &omap_gpio_irq_chip_nowake); + else + gpio_irq_chip_set_chip(irq, &omap_gpio_irq_chip); irq->handler = handle_bad_irq; irq->default_type = IRQ_TYPE_NONE; irq->num_parents = 1; @@ -1361,7 +1398,6 @@ static int omap_gpio_probe(struct platform_device *pdev) struct device_node *node = dev->of_node; const struct omap_gpio_platform_data *pdata; struct gpio_bank *bank; - struct irq_chip *irqc; int ret; pdata = device_get_match_data(dev); @@ -1374,21 +1410,7 @@ static int omap_gpio_probe(struct platform_device *pdev) if (!bank) return -ENOMEM; - irqc = devm_kzalloc(dev, sizeof(*irqc), GFP_KERNEL); - if (!irqc) - return -ENOMEM; - - irqc->irq_startup = omap_gpio_irq_startup, - irqc->irq_shutdown = omap_gpio_irq_shutdown, - irqc->irq_ack = dummy_irq_chip.irq_ack, - irqc->irq_mask = omap_gpio_mask_irq, - irqc->irq_unmask = omap_gpio_unmask_irq, - irqc->irq_set_type = omap_gpio_irq_type, - irqc->irq_set_wake = omap_gpio_wake_enable, - irqc->irq_bus_lock = omap_gpio_irq_bus_lock, - irqc->irq_bus_sync_unlock = gpio_irq_bus_sync_unlock, - irqc->name = dev_name(&pdev->dev); - irqc->flags = IRQCHIP_MASK_ON_SUSPEND; + bank->dev = dev; bank->irq = platform_get_irq(pdev, 0); if (bank->irq <= 0) { @@ -1452,7 +1474,7 @@ static int omap_gpio_probe(struct platform_device *pdev) omap_gpio_mod_init(bank); - ret = omap_gpio_chip_init(bank, irqc, dev); + ret = omap_gpio_chip_init(bank, dev); if (ret) { pm_runtime_put_sync(dev); pm_runtime_disable(dev); From patchwork Thu Mar 9 07:46:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 66629 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp155216wrd; Wed, 8 Mar 2023 23:51:02 -0800 (PST) X-Google-Smtp-Source: AK7set/Ha/DQWryyVlu8tgHn38cv8uHwy16GJ6Nv9bpIJ8dt0iM2VTE0SrcjIDtgXrycZYKwEAQD X-Received: by 2002:a17:902:c40b:b0:19e:8bfe:7d68 with SMTP id k11-20020a170902c40b00b0019e8bfe7d68mr27660075plk.11.1678348262149; Wed, 08 Mar 2023 23:51:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678348262; cv=none; d=google.com; s=arc-20160816; b=W9MbZgr2jbZfQAU2ZjOKM8hkITv/GZQHQbU6mM8umztn9ccNrLHYQL9OzPKsdmF1RS 8wFBBUC/61C+kBWhUnhuEwdEPForHN9KuDcME3R1RBF9M+yRmv4ZvnZyehD7N1IcGWoo QLB+owXYNbqwWqsf2IpkGrNY/RFBKSmTWPO5lpIcEHjqqK0UTPjraGasCUEyBz6AL4Zv pM7o8qLFtefY9w8qfo8Fy0E+yTrFHAKyoTMDP/j0TiPz8BlVgc8cpwiB9I2mi81z0Bbr N2pOo5VXcQbiC5r9bkpxFdXFkzdilmjzb1rZ26OBEomRkitf8MDdBiToCD3TOtbDZ4Mm ULiQ== 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=EBLzNrziBJousn1yobeY2nHyRl+4RLWPBMZMMzuQhho=; b=JIkSiPW+2aoPvA0+SmZYZeIw33BjEl01nmTwUgoRSQTl75dfJWn2DPsuKNBabdyRQD 1etEWwJU1TWq2vfepzHOyoyzwB96j/yw3lcEsNXneXBhKCLxIBlC/m3lkK1hj/78wjLS L4ecHQCH0FuvChQ67FVct1OcM5Ka4KKSZqEyrthsYo8FAlo29MVFpfnj8O3qHk+Fstfl 7Z8rR/y+l/yVbGtu4W2KFxis5nsqQJDBY6wGLdp7K0ABPFhuEyNAUCQJueUw1YTTe3Az 70zXYMeSJbiUCTYdl1b87M20hF8AOv9PWKGjlS9Lbhe/Doi/NCjQh9UH0QSFCY8V9S0S 4bfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bWmtMKb6; 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 q12-20020a170902f78c00b0019ead10c044si12862999pln.142.2023.03.08.23.50.48; Wed, 08 Mar 2023 23:51: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=bWmtMKb6; 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 S230304AbjCIHrk (ORCPT + 99 others); Thu, 9 Mar 2023 02:47:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230303AbjCIHqo (ORCPT ); Thu, 9 Mar 2023 02:46:44 -0500 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35BDADDF2C for ; Wed, 8 Mar 2023 23:46:13 -0800 (PST) Received: by mail-lf1-x12e.google.com with SMTP id bi9so1174374lfb.2 for ; Wed, 08 Mar 2023 23:46:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678347972; 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=EBLzNrziBJousn1yobeY2nHyRl+4RLWPBMZMMzuQhho=; b=bWmtMKb6fEUF/NZ6LH5RuXerUIViljmwR4bhAP4X3ybB1hO77AJtkWOPfPKgUmh/jW TmF5VNEgVV1l9zxS2yaBM0mmE1P8UQMBVY06NqrmxcGTY2KexUr8WXnpjvApNqP0XgwS xFDF/9ZXGlZWKSQproLVORlPhMr+pLQOhS6ifVO12cldkZJk2Kkl5fM2G7G0BomE5684 hMVjRCrFdG0EXD8hhzDA6Ppf/gHui37ivuZ/rMpnpbkI447fZlG798+d+wZkcNuKUBkP ppUhPHLOOMIwamflqyJtuoMxXx+FJiaP+JGvKBF9r/jQnXxqls2IIuFdVMDMOeePY5T2 IbXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678347972; 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=EBLzNrziBJousn1yobeY2nHyRl+4RLWPBMZMMzuQhho=; b=6jhl941DDiXQnDGf/S2puQnKhRyDBzUovF1A2cSq+WVlmiy4Ne3ii+GYZpIODq46r3 HRgIUn+mFui4YUHkF9v2bSB4n2LRGOmKXOJ3e9HUjW1VQYK/JH2t7s7nVl5GICYqj3hd 1frVD59Oy7gXOtyBWh4lI6OEtmqgjMOUsO2+8zP7FEbW1x0bsPmr0WIDbRvgiBW+LnrJ joT2crakJWZBYKC5flan4SUeo8EEIFZ5Jqv6lzBn+20PasITCohfgmkk0NR0AS1Vq4Lb y+y8JeEEE7WLM0thHaxCP65U5na8I1iDWbhgJ3LTUvol8reYbXjvNWaEu2qULgeEzIsv YJ2w== X-Gm-Message-State: AO0yUKXI9AmgNHf4KhilqJMYAU7s3vHsZWI5e6+OFshok9sxJpBdRmoN hVuwfjX8eov7O8IcTye+TqTvCQ== X-Received: by 2002:ac2:538c:0:b0:4d7:44c9:9f4c with SMTP id g12-20020ac2538c000000b004d744c99f4cmr5198184lfh.4.1678347972678; Wed, 08 Mar 2023 23:46:12 -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.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 23:46:12 -0800 (PST) From: Linus Walleij Date: Thu, 09 Mar 2023 08:46:04 +0100 Subject: [PATCH v3 16/17] gpio: pci-idio-16: Convert to immutable irq_chip MIME-Version: 1.0 Message-Id: <20230215-immutable-chips-v3-16-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?1759875707548101133?= X-GMAIL-MSGID: =?utf-8?q?1759875707548101133?= Convert the driver to immutable irq-chip with a bit of intuition. Cc: Marc Zyngier Acked-by: William Breathitt Gray Acked-by: Marc Zyngier Signed-off-by: Linus Walleij --- drivers/gpio/gpio-pci-idio-16.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/gpio-pci-idio-16.c b/drivers/gpio/gpio-pci-idio-16.c index a86ce748384b..6726c32e31e6 100644 --- a/drivers/gpio/gpio-pci-idio-16.c +++ b/drivers/gpio/gpio-pci-idio-16.c @@ -107,6 +107,8 @@ static void idio_16_irq_mask(struct irq_data *data) raw_spin_unlock_irqrestore(&idio16gpio->lock, flags); } + + gpiochip_disable_irq(chip, irqd_to_hwirq(data)); } static void idio_16_irq_unmask(struct irq_data *data) @@ -117,6 +119,8 @@ static void idio_16_irq_unmask(struct irq_data *data) const unsigned long prev_irq_mask = idio16gpio->irq_mask; unsigned long flags; + gpiochip_enable_irq(chip, irqd_to_hwirq(data)); + idio16gpio->irq_mask |= mask; if (!prev_irq_mask) { @@ -138,12 +142,14 @@ static int idio_16_irq_set_type(struct irq_data *data, unsigned int flow_type) return 0; } -static struct irq_chip idio_16_irqchip = { +static const struct irq_chip idio_16_irqchip = { .name = "pci-idio-16", .irq_ack = idio_16_irq_ack, .irq_mask = idio_16_irq_mask, .irq_unmask = idio_16_irq_unmask, - .irq_set_type = idio_16_irq_set_type + .irq_set_type = idio_16_irq_set_type, + .flags = IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, }; static irqreturn_t idio_16_irq_handler(int irq, void *dev_id) @@ -242,7 +248,7 @@ static int idio_16_probe(struct pci_dev *pdev, const struct pci_device_id *id) idio_16_state_init(&idio16gpio->state); girq = &idio16gpio->chip.irq; - girq->chip = &idio_16_irqchip; + gpio_irq_chip_set_chip(girq, &idio_16_irqchip); /* This will let us handle the parent IRQ in the driver */ girq->parent_handler = NULL; girq->num_parents = 0; From patchwork Thu Mar 9 07:46:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 66628 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp155174wrd; Wed, 8 Mar 2023 23:50:54 -0800 (PST) X-Google-Smtp-Source: AK7set/VwjC73JBq50KxBk3asuciFZC4z7tOtDWxsqiHujmXgeFQEF1Nle4bHD1YMmc9L2Diy/nv X-Received: by 2002:a17:90b:4a0c:b0:234:5d3c:b02b with SMTP id kk12-20020a17090b4a0c00b002345d3cb02bmr21277488pjb.42.1678348254454; Wed, 08 Mar 2023 23:50:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678348254; cv=none; d=google.com; s=arc-20160816; b=V6uzhNn7PFIcACL9HEgZds2kgDBBrPKN//dP65JRbrDdlc2n8UcrvHcB+3zDZTzp0z Szht+vzkRNs51SEaXCfHSdcz2vOKm11Y8QnaR+/9XvIV69qx1pjkxaXBAZaSy1hdcw97 va8lMTGRNvx470v4YI8eFoabXkF0RpsccNKpOkv+B7rMsHOPQENM8bURfkO9GMDBNRb9 4AFVl+zE+ilUOVXlOxMxE5hHSw/GCndvVF/3tkgYMYYxH/wNTgfYYqqd6pn8xUDmCTS8 ubr3l30CK4WF8J4JXDWzeZ5tkGrl1SXWAeYC5BRGEWo5M57jFlLNiIyF9CE4tKC9uRtY Xguw== 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=/ycp1fOFRcqnvrXtuAswlNcdj2NkXI8qjDu7ztULp4g=; b=0BmdkCc4/zt7uU6Rn6GG1SdgEngFqb0XGglAcsJRrrTUebEQ92XRJr59I9HNkOshLy /kOo6Gzy4b1qYbhRxCVtIiDVypwKHy0zx0fdT4gySK2IZvJ8gkkm8/IbhLcL/XMKGhm7 YaE6mtGt5tuqFZ8m9ikuZnkH3vJoYn9n1l2fwuPaZTHJ3yBpIt022Qp1SKt3iTvOD3mt b9wfp65bdTq+ygIYJvLw0z2nmNdOdT98jQed04Px04RQPFtKj/FdabThcGkP3uo3/2JG HgVCLMV/9Pzpf2+pngL4fkZcX4NMj0+KA/ZuCGGbSLqlQzcWzyNx8TqNn4A3qWWucPOG zvOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hfYUvbEJ; 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 v15-20020a17090a458f00b00226e01736f8si1441912pjg.109.2023.03.08.23.50.40; Wed, 08 Mar 2023 23:50:54 -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=hfYUvbEJ; 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 S230041AbjCIHrp (ORCPT + 99 others); Thu, 9 Mar 2023 02:47:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229817AbjCIHqu (ORCPT ); Thu, 9 Mar 2023 02:46:50 -0500 Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B942DDF22 for ; Wed, 8 Mar 2023 23:46:15 -0800 (PST) Received: by mail-lj1-x229.google.com with SMTP id h9so930910ljq.2 for ; Wed, 08 Mar 2023 23:46:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678347974; 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=/ycp1fOFRcqnvrXtuAswlNcdj2NkXI8qjDu7ztULp4g=; b=hfYUvbEJ/fIs0adm48Nn43F1+/5O7YPhYpEpE/GRRX2ZWZh6Gq+yCigTRjTLV/SkXN EpZ/VQupisd3fsrS7/H/gCFUoMeX5JGZkvaZ7xtzK4gRVZZ2UmkBx9v5BfV5eY5PQy3b sePtBA87IWZ8Ux7FBFpZ3wTFqe67boz1z867/kDMzJfoX82TaPRyMaelqKdFTikiOM8f rvPfgXQXjKPcVm9VeRxRb7H+zXL989U9EAzlfR2uqXTYXvu98NBxaLBdDuUmo7+Pilld 0o3IRXZp5dLbQpnnOVuSp/qIX+2Ys07bLCdGkAgj0vbmtMvdKNe58z8YxfFQTFgwozP1 Nw5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678347974; 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=/ycp1fOFRcqnvrXtuAswlNcdj2NkXI8qjDu7ztULp4g=; b=JolLYm9vkLJ/jA6872E+KXRihJtjGUP+4u91qA6ijXSJLBGqKSApNyGXViWdXBUvnN NswX7j95dKRU5sW85qymS1oHrI3dfyXdo7ZrB4V73BE7tFZyMeuBZTZZBkydtm1fBskm /k5HathP/hkmRtbBY8J19P3MZSL7YjVdyi38n2FcSFvVRj9W2nYsmZGjiHSyvBr7qLt1 RScZypur131BaQJ/acEGDHaGfAgTCNkDfOrZwdan7+KSTuOwEMEH3VKsLwfYPYKD/X6B ZGHmMTV9fymx7KGuM2cKbYcGi6E9SLKXtvlebw87DxHPkI7szIprWx4XejTsSPuSRhS+ kmfw== X-Gm-Message-State: AO0yUKUEYQjqyHodpmI1VuCDfsG0NM2kWFaBYMG3iE+YcVI5QZcEl4C7 +5eUx/W7riebVNdwDPVuQPztfQ== X-Received: by 2002:a05:651c:88:b0:293:3dd6:89a4 with SMTP id 8-20020a05651c008800b002933dd689a4mr6194273ljq.34.1678347973846; Wed, 08 Mar 2023 23:46:13 -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.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 23:46:13 -0800 (PST) From: Linus Walleij Date: Thu, 09 Mar 2023 08:46:05 +0100 Subject: [PATCH v3 17/17] gpio: pcie-idio-24: Convert to immutable irq_chip MIME-Version: 1.0 Message-Id: <20230215-immutable-chips-v3-17-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?1759875699138066338?= X-GMAIL-MSGID: =?utf-8?q?1759875699138066338?= Convert the driver to immutable irq-chip with a bit of intuition. Cc: Marc Zyngier Acked-by: William Breathitt Gray Acked-by: Marc Zyngier Signed-off-by: Linus Walleij --- drivers/gpio/gpio-pcie-idio-24.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/gpio-pcie-idio-24.c b/drivers/gpio/gpio-pcie-idio-24.c index 8a9b98fa418f..ac42150f4009 100644 --- a/drivers/gpio/gpio-pcie-idio-24.c +++ b/drivers/gpio/gpio-pcie-idio-24.c @@ -396,6 +396,8 @@ static void idio_24_irq_mask(struct irq_data *data) } raw_spin_unlock_irqrestore(&idio24gpio->lock, flags); + + gpiochip_disable_irq(chip, irqd_to_hwirq(data)); } static void idio_24_irq_unmask(struct irq_data *data) @@ -408,6 +410,8 @@ static void idio_24_irq_unmask(struct irq_data *data) const unsigned long bank_offset = bit_offset / 8; unsigned char cos_enable_state; + gpiochip_enable_irq(chip, irqd_to_hwirq(data)); + raw_spin_lock_irqsave(&idio24gpio->lock, flags); prev_irq_mask = idio24gpio->irq_mask >> bank_offset * 8; @@ -437,12 +441,14 @@ static int idio_24_irq_set_type(struct irq_data *data, unsigned int flow_type) return 0; } -static struct irq_chip idio_24_irqchip = { +static const struct irq_chip idio_24_irqchip = { .name = "pcie-idio-24", .irq_ack = idio_24_irq_ack, .irq_mask = idio_24_irq_mask, .irq_unmask = idio_24_irq_unmask, - .irq_set_type = idio_24_irq_set_type + .irq_set_type = idio_24_irq_set_type, + .flags = IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, }; static irqreturn_t idio_24_irq_handler(int irq, void *dev_id) @@ -535,7 +541,7 @@ static int idio_24_probe(struct pci_dev *pdev, const struct pci_device_id *id) idio24gpio->chip.set_multiple = idio_24_gpio_set_multiple; girq = &idio24gpio->chip.irq; - girq->chip = &idio_24_irqchip; + gpio_irq_chip_set_chip(girq, &idio_24_irqchip); /* This will let us handle the parent IRQ in the driver */ girq->parent_handler = NULL; girq->num_parents = 0;