From patchwork Tue Mar 7 13:04:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 65469 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2424994wrd; Tue, 7 Mar 2023 05:21:23 -0800 (PST) X-Google-Smtp-Source: AK7set8zb8K69WCzLpiE9a7OVyzrzxT4uwET5zQVouW6oLXrTQUKAoPH5rwEcaAs3ppTatScy5tj X-Received: by 2002:a17:90b:3805:b0:234:b05a:c3c8 with SMTP id mq5-20020a17090b380500b00234b05ac3c8mr14647668pjb.9.1678195282841; Tue, 07 Mar 2023 05:21:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678195282; cv=none; d=google.com; s=arc-20160816; b=QBxZRui+MaYsGIQt3MoYVoyXpqylRctXD1CcH+OVIV0iuMTDOwYNHptmiFDI41GbFA w+ygHiarQlAUf8vZaZNKWT36eQUb0kQ+TnAIS4TlnO+uVS/QLloIJTJuIfNao8Jn+Xsb NPDXWgz6tmVWdQSjeFgfUmoc8CIBsPLUovgylXH7+fF0hQWT/SEVOO4EhxGkFBoFKzhd gALco/t3AF543CB0DcaY7zCLWxvHyhOJ6VVCucSB9AwEt71sSXk9NQjpzwRFN2snB0rp wq15EIklLJ9skoRANsJMl1rLkiEJTcicPOf7+lQwaoWqtcWPf7N0fjM4vLdDmGhHifmP hzcw== 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=Sm1AS+7fEJX7LZroqd/ivL37rq5XIszsQepAr26qaoAFgj7ESwNaVOyQT52Yp0+zHL HgM10EtzHtenaXPC2VSQ2Q/Q8jzfQTGECfVw08Za57sxBrcSYspilvgqf8shhdoUk4Tq 6Gx7z1NAOAQ3+nqdxC28KIniJEjCTiB1n7ofoet484hLMir3ygcaPijxdE8r+KZSBxrS bOLd7luWkL/Qp4yXcn9UoAmDmQBRbU9fNHOFNP72MfC2hRp3aSK79qrLtL20A9p+1eBJ ej9Q/AY48PBzUQUSGRm4PXtt3RPCeqFNHZMuwWRhUL5NSVFQfRhw5b3Jj78Kmvki5zpC Ceqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ivIOKdjX; 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 a190-20020a6390c7000000b004d08be9517fsi1896478pge.478.2023.03.07.05.21.10; Tue, 07 Mar 2023 05:21:22 -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=ivIOKdjX; 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 S230293AbjCGNFp (ORCPT + 99 others); Tue, 7 Mar 2023 08:05:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230012AbjCGNF0 (ORCPT ); Tue, 7 Mar 2023 08:05:26 -0500 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2F9EE0 for ; Tue, 7 Mar 2023 05:04:56 -0800 (PST) Received: by mail-lf1-x131.google.com with SMTP id k14so16963290lfj.7 for ; Tue, 07 Mar 2023 05:04:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678194286; 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=ivIOKdjXJOAGhCprjPgOdvonPXMyFzqBR0VHl+PrzMbdmTRzJIvMQr3bkAKB8TUTt6 VJkVZq/cX3c6mxFLVPYwZAbo9fHd4WpwZzvU/jNVSjyBXMIhIPbqSgXfzP7vMc0r3IR0 Wze9ZWsbA0eXNu8gx6u40bSLeg5OM8NxSflVtn2+EDdVG/3Wunq+WQjvhK9CH/ut8iLl DLShDAZeZ1gnYiYq/GR88Ag/QBSlaM7NT/KJyuCN6pY2cnBGW5+eHQuoRzhxX0DOuR2F G/FF/Mhd6tyK9fPpwgYzbzj6MdPtz4hrae/mLZ4JX1+vbjzHzVUoiz/mT6tFPlV/3/CK s6Fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678194286; 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=ry65MwBIDuTTYDYR2/na0t47sds3UFOUFvclq5ILJSL9SMTH2Mw6BNK9zwUgb776od ruKnzgfr/v/3w8rWVCX5SoLwohkQip08qgKeH7DogdGR9uHC3NpnMRZI7MiAMA4CZ9Xi NtrIt+DL+pvMqqV44Q5gDas5LTn6A9CygjSCIEnHtc8qMUQ0roOTUmUIgUUpdBZJ6sKk 5wSACMOEsn3ncOdPVZnxyJBAYnbTU0Lr8GAS26ecy9xnv8XNRyACTQWl9lDFxBvba50A 9ts/Kk0AByrnE53rNQRb655bxgrOQrOtc8dZahD9Kd7abXWWxyHUPP2jT/+HT/+UU9Fj HHiQ== X-Gm-Message-State: AO0yUKX29270X77TdR5BAQbQbb0LKrs87hBcdueRig3olGNr8gUkpUIT v6I05LDKuvEov7amBtwie8mQkg== X-Received: by 2002:ac2:5504:0:b0:4e1:d90:e754 with SMTP id j4-20020ac25504000000b004e10d90e754mr4113951lfk.7.1678194286233; Tue, 07 Mar 2023 05:04:46 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id w14-20020ac2598e000000b004caf992bba9sm2030548lfn.268.2023.03.07.05.04.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 05:04:45 -0800 (PST) From: Linus Walleij Date: Tue, 07 Mar 2023 14:04:43 +0100 Subject: [PATCH v2 01/16] gpio: altera: Convert to immutable irq_chip MIME-Version: 1.0 Message-Id: <20230215-immutable-chips-v2-1-d6b0e3f2d991@linaro.org> References: <20230215-immutable-chips-v2-0-d6b0e3f2d991@linaro.org> In-Reply-To: <20230215-immutable-chips-v2-0-d6b0e3f2d991@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,URIBL_BLOCKED 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?1759715296677610306?= X-GMAIL-MSGID: =?utf-8?q?1759715296677610306?= 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 Tue Mar 7 13:04:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 65467 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2424741wrd; Tue, 7 Mar 2023 05:20:48 -0800 (PST) X-Google-Smtp-Source: AK7set+Cvg1OkJpOlYBob+VEEU+fA6EZ0izfYNcU/cz0/bbkrJMssYaVoYjesliMmhEeo756D5ud X-Received: by 2002:a17:90b:3a88:b0:237:b702:4958 with SMTP id om8-20020a17090b3a8800b00237b7024958mr15098455pjb.38.1678195248194; Tue, 07 Mar 2023 05:20:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678195248; cv=none; d=google.com; s=arc-20160816; b=vYvIeT2EgkTNlnbRazBPAGrY2ZgNFH5i3mkzIpI2KXK3GqhWYRZHxH4UJ+sMAvD0YN HPL2+N/QUUnOSaoTkKIIr/im2RiL38cxQUOVuQD0gcWNvWdMEEpUCvZ/4IztN72zbtWM uGSbyevnMG2I+8qsv/dG69iBtXnFCfJQKAXBr+xyQgs++B860zxpuZgqn5VLWYM68qxs xlwA6YrsAwN/AVb/sB2JIwtabGZn6i8HORIXZ7sgD61N8k1gdb6hsuGOaGXzMbT7S/F3 TP/Q8pKezO1TFfjrd2lovT9SqLsT16gUc0ZeqLoxkyIlLe0cS2mkyEYoKrktOZdXj2Tc gqVw== 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=QgrA5pma3cfd8xSKI7RDvsSWN2C+3M+XN9IHU2hD0dh+mT9pOAaBeY08PkyvwNoPEg RfINNosZ0Zakctmbatm9jJqQs/y7G4H2o6XaNtzvzcXx0QlIyMTGMWtq1EgOaCB+o/Ay 0MOno+8M7tCYgHGVa2ofUwKODWHuWEiODlrJAwgNjE9H/KjZQAhmNnOAKbHj3y6ktTTf jlF6RkR/umgDdEGetQKwbt0nU0Fy3KsTTu3tj8Xd0oGzyO1syhXHwDlFN+C05Vts0PIG rIuP6S4bUrglQkfLqlrXYp001waSoSBurglB5oMDD/C4xvpWtGhPrJlZfHaxadcVcf25 GwLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JyrVtTmO; 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 y20-20020a63e254000000b005030e22ea14si12396432pgj.136.2023.03.07.05.20.35; Tue, 07 Mar 2023 05:20:48 -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=JyrVtTmO; 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 S230176AbjCGNFj (ORCPT + 99 others); Tue, 7 Mar 2023 08:05:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229999AbjCGNF0 (ORCPT ); Tue, 7 Mar 2023 08:05:26 -0500 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D870193CD for ; Tue, 7 Mar 2023 05:04:57 -0800 (PST) Received: by mail-lf1-x131.google.com with SMTP id n2so16923657lfb.12 for ; Tue, 07 Mar 2023 05:04:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678194287; 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=JyrVtTmOCBIoOhyPdDdC18qctC1k7zocllhJ3F82qo4ju64IjASdsxHZ5LbSWxWdSp qVV8eZeaHm2+CzX6q/TqnSUbEV2PVAl5SPusA3wxaKCHCWuyAttPKXJ0x/OP1149kTxr tVYNUtMZrWK1zPFfefu7Er/bh5FEqV4Lj4prZaTVXMMt9Zjo05BF82u0KmHuold1L+7V fck0z0YSuJE1bKOiEm1jdwbd12qrmPoU30BMUs1D/LnnLypE3gF5ZcwyA/sblnsKXhgw LWP10pUJnyFXYuJNc9KUnuT7JI3l58FhKby2F/7bUkUJwtHissEnY1oATIKvFccvsb0W bIVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678194287; 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=ik3q1oN/VoCcvMAb022eFO3Ibe4unpnzz5lKTYc/eh5uGpAuS24WBZn14vrROp2VFb OLEICzm3E+Bgeyu3I+Z8KqBazYnnPrx6gFY2xt7GZyIe5MSMhpEwG4h+CurbAo2QBx1K 6BdY9EOkPZCSbN+4t6/Ig4D9uvvyhYuLtBLxydschugwQqQb7tBtIC+dMuyhHog59Pj5 RTSDMC9/+mPnjBTq4+e6vOZbvRfGfhBEAIMi/iGWTlIP97iOWpkLfoxvI94E7gYlEW6i xkFerzv9RfIvr9275EsZUElOOSfuANI97m7Eo/Y0WYE7hZ5kLqnaEp9BQdfeG2/SuB0S zl3w== X-Gm-Message-State: AO0yUKUawcN0s5Lu7tiw9SeC8sMt/E/iUN3G2Lwou+B6nREzdFVOFaus pEkD8bMnEuvIOkgCSgFU5+Djnw== X-Received: by 2002:ac2:483a:0:b0:4df:51a7:a92 with SMTP id 26-20020ac2483a000000b004df51a70a92mr3942917lft.11.1678194287438; Tue, 07 Mar 2023 05:04:47 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id w14-20020ac2598e000000b004caf992bba9sm2030548lfn.268.2023.03.07.05.04.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 05:04:47 -0800 (PST) From: Linus Walleij Date: Tue, 07 Mar 2023 14:04:44 +0100 Subject: [PATCH v2 02/16] gpio: adnp: Convert to immutable irq_chip MIME-Version: 1.0 Message-Id: <20230215-immutable-chips-v2-2-d6b0e3f2d991@linaro.org> References: <20230215-immutable-chips-v2-0-d6b0e3f2d991@linaro.org> In-Reply-To: <20230215-immutable-chips-v2-0-d6b0e3f2d991@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,URIBL_BLOCKED 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?1759715260683366582?= X-GMAIL-MSGID: =?utf-8?q?1759715260683366582?= 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 Tue Mar 7 13:04:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 65463 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2424404wrd; Tue, 7 Mar 2023 05:20:16 -0800 (PST) X-Google-Smtp-Source: AK7set+a/IRl7CdoC7CEi6MpSkvmYx7XKbjdCUJ8FcxQ5O5GMpLohXPHFuxmWjEQnxAeFWN/9CSM X-Received: by 2002:a17:902:ab41:b0:196:44d4:2453 with SMTP id ij1-20020a170902ab4100b0019644d42453mr11524840plb.7.1678195215819; Tue, 07 Mar 2023 05:20:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678195215; cv=none; d=google.com; s=arc-20160816; b=XqYbgVYLDUDu30FksVHf165foUfYoKyfXP9GYAN5NSLrciIVfg6N9Vem05TL6ITLMj i3IYcFuGyp1m0MpsPsZD8zMvh3G4pggJkHZ9R3SyXx0IsKyjJrKYUE05iB9+FJHDdnxR Gr9Es7gJUpcfOx08PLr7HAqVmvtARSV4thBK7tEpp4PPGlRSZsbEWJEOhCABZUMV2QMe r/sBuzSv3/+/jqlXqhW/cXAHxi0/mprumr50SvjabrVNLBMgeWTtMM3AyNA/75SwpW44 iIg/RYAw39w0BeT67RDWK0mcuhs2pXs4xFE4mtL9ljxC6I2YyDrcLwf9ba7H3The6HRx CmNA== 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=b0p5EbpuJP6hwcjXoMYtiND4JppiiLVgXD+CFpX3rE4=; b=clH0kdye19QvYGieutgIia8mLyOKiQGZeQHTJ3c9obbX3XETlHSsHDP6Ow/vOnbaw4 pdNt9CO9NVXp+FGaOQp0pCMNOPq/hb4nwLaSb0Wq4pU7ln0epU9LR/jAgJNnuiwKUfep 5N/X5Hw2ODF2sNhu7cxdv/+wD/Ztxls2ZYGypBCo7jroOuT9okSx1bPg+NAgwj23dP/+ /2Jy9WcO84WqJKCPBjt53ejkV6gH+yK4v53qJnH3Nonh5QQn1IoIyFOZc9RKAmK0Xxjy cWHISYRRKNKY6XHvyVgXZLKPxyUq8mQSpRSYAEmcNcFnUk0tetVlzOu2ko4s5718HeEL 6B5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xFEOAYGu; 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 kn15-20020a170903078f00b0019a96849d6dsi6032988plb.605.2023.03.07.05.20.03; Tue, 07 Mar 2023 05:20: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=xFEOAYGu; 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 S230328AbjCGNFv (ORCPT + 99 others); Tue, 7 Mar 2023 08:05:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230143AbjCGNFb (ORCPT ); Tue, 7 Mar 2023 08:05:31 -0500 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C0E37B481 for ; Tue, 7 Mar 2023 05:05:00 -0800 (PST) Received: by mail-lf1-x12a.google.com with SMTP id r27so16941576lfe.10 for ; Tue, 07 Mar 2023 05:05:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678194288; 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=b0p5EbpuJP6hwcjXoMYtiND4JppiiLVgXD+CFpX3rE4=; b=xFEOAYGuIoPsxPVhSwnYu52ahL7geiD4JVsX78tkiKB0nDxX66O85TkmquqlMnV3Cf KFT9X4bqt5tlWpqJAvS5nYwxT8BHqoEvAJLGm07IPzLBcFnoUfUsxg2mF5Bh7UxTpmcY br0YeIBO98Hp3nNOFbKpVqEqKRqnlIFsR0xn2ggRhWM1OOw0tzyYYawGXjt8jdbc8tP9 EJZOC7XmbmHahw2Q/qcEC1YKAtlX49HY9TO16gaaJt6v1uDqU55HClT+gx6G5+/3mLaQ Kb94zbPBynfFJXDzuqWS4ulOsWjA61IsdxelOB/Cc8MSGiAMkj8fP5wzey3fV3vui+RG 1pkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678194288; 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=b0p5EbpuJP6hwcjXoMYtiND4JppiiLVgXD+CFpX3rE4=; b=rrRi9kGUhBHOVG3MLLPJH2eNxD3Pw3EsQg6Uq13TAhGgg1tdhUYoQfiW9KXUsk4Gup doBnV8Q4wG/XFvHELnJWqkv0iizb8fyc62Rg1em9qKBmgPuoD9jJNBKgOUzydLHzIiAi /4tpxpXqfFNetwFCdmewoqP0UuXbeHujGrE70oOLs/mhrAxl2wOoKfj8qz+N98NJsqs7 HjyRppzi8pAxVlI0Wr/YqOcWE/JmE4HZkmchg9LWOv/Y8hEeoJq2dJ/WKY3xEfP8+kMN u2GBfEPNIbsgO9Bz/Ivwr9+WaD1L/C9w7kdnk0BhhmNvSbvJoSclMq4i5zECliV0oSyP Ki6g== X-Gm-Message-State: AO0yUKV1+xrN+f2YD5iC0/gVQe6uMnL3geiPJb2pZxiFIu/gHjE9bv2x Qun8NTuWdnrtyi1fHatv9FUVag== X-Received: by 2002:ac2:551d:0:b0:4dd:9a38:fcc with SMTP id j29-20020ac2551d000000b004dd9a380fccmr3973440lfk.63.1678194288471; Tue, 07 Mar 2023 05:04:48 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id w14-20020ac2598e000000b004caf992bba9sm2030548lfn.268.2023.03.07.05.04.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 05:04:48 -0800 (PST) From: Linus Walleij Date: Tue, 07 Mar 2023 14:04:45 +0100 Subject: [PATCH v2 03/16] gpio: aspeed: Convert to immutable irq_chip MIME-Version: 1.0 Message-Id: <20230215-immutable-chips-v2-3-d6b0e3f2d991@linaro.org> References: <20230215-immutable-chips-v2-0-d6b0e3f2d991@linaro.org> In-Reply-To: <20230215-immutable-chips-v2-0-d6b0e3f2d991@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,URIBL_BLOCKED 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?1759715226262091140?= X-GMAIL-MSGID: =?utf-8?q?1759715226262091140?= 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 --- drivers/gpio/gpio-aspeed.c | 44 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c index a94da80d3a95..9c4852de2733 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: @@ -1149,6 +1182,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,9 @@ static int __init aspeed_gpio_probe(struct platform_device *pdev) gpio->irq = rc; girq = &gpio->chip.irq; - girq->chip = &gpio->irqc; + gpio_irq_chip_set_chip(girq, &aspeed_gpio_irq_chip); 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, From patchwork Tue Mar 7 13:04:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 65470 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2425096wrd; Tue, 7 Mar 2023 05:21:32 -0800 (PST) X-Google-Smtp-Source: AK7set/WP17Q3vXyqWbE1olP1WDRLvdSgE2El5bas5Tccs9Q6k5PoYH2uoh7dwwsZqfvdIoEbu4m X-Received: by 2002:a62:3142:0:b0:5dc:e543:c62d with SMTP id x63-20020a623142000000b005dce543c62dmr10009758pfx.23.1678195291741; Tue, 07 Mar 2023 05:21:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678195291; cv=none; d=google.com; s=arc-20160816; b=AMR8Ji0VjgZ3e4dZpm07HiwEimdjfmLCLhtIg+biSWEGp/3weoj9CmhWy3MEYpIRjX GPTA+YCjqPiBFLvhmK68AgcDR8ohb1e1+COPUrRuWIXOmpgSj7o19BRv1PiGOp5YCccc PVADYNj7WrRf2ozVNI5jiF66qmC0XHykSm4u1wydZrsQJlbg12o8Y1GL3vog9jxC9qn7 d26cMCV0NhQMbQuNmyZvd01iOSxLOi0zWQc59XLVjrlT3LHWh14NhJZbTDqQpjUNLeBL SVtfCs7Lq0Y5ae7eqCvL7vlsUTE2JFR3dqOOfFs6j9P61BGKU5OoPljJrIWCqDDuaOF7 gEyA== 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=UH+5RNf9yG28dHR3I/aKzf14PTzGZPTBJmPoJ98z1KntCcCc2rjhCfqHZ2brR4LKOG DefK7M+xQuodX3uFLUBjrVmKfZbobg3WYtggbc9Jf/d1uxfJwbRUGwrJ4lxk3AIEMgX0 W42wCu7LT/K/Io/NV9Uuxr3XF95T7zWlo0JkZkdcsw5WLTItva/ZMzhy0PGyJW0elV07 SbQDTtTebOpl/BW1ZU68VdPFobx2o7AA5Dl7MwTBokU1Qro/ISCsT3LZMgPwGvpA8oL2 iSj0vfRMUDPUgDbyyqYUcw9O7JzKekZQPdgrj29ACflPDfzwvxRCArjvf17HakNucJ1A kCEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LaGKvhnO; 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 f128-20020a625186000000b005a72b5eaf96si1552484pfb.152.2023.03.07.05.21.19; Tue, 07 Mar 2023 05:21:31 -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=LaGKvhnO; 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 S230367AbjCGNGE (ORCPT + 99 others); Tue, 7 Mar 2023 08:06:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230172AbjCGNFg (ORCPT ); Tue, 7 Mar 2023 08:05:36 -0500 Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [IPv6:2a00:1450:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8BAD25BBC for ; Tue, 7 Mar 2023 05:05:03 -0800 (PST) Received: by mail-lj1-x235.google.com with SMTP id b10so13123481ljr.0 for ; Tue, 07 Mar 2023 05:05:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678194289; 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=LaGKvhnOuEdjQlskLsAk3XTkexGofp5EYb2xlFvIN7HrICTe8agB7umlUaSpjQtRGb mATWkUpjInHrxhvx98qMCuSYPZFcPI+TjrZdC0rnVMh9Um0xmPLCPNk3dwIys+irE8BX PfTyCTn2IPe9tuiyPRC2j//RWo67afoXMKrhi3fgqY+fPYX8z3B1OqJEvSdfGBsr5H/I l9HEpeWtmW0OHCe05sHzT3w0AyTgM51/RbaEC0MZVZN5JJ56B3/+9gVQ78gskQIM4hMi 5sxsXjqvrxy2K/nY4JInBGHzBp+OmjQ/TP7zw27rRqtRqKhffAX2atnU6MygylR5fnlj UD9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678194289; 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=TotUwAO6Nu0/MT5cGyAlKx8nC/o6i/HwOiIrkrczLM3YFvmfdEoDGtbBwWc1M6IItF qBloAh+2KyGb3HI2TLEOGr+6PZAQfXsR0EKXVz8qkf1uo14FCbBJGt60Wa+ktSoSl8Bp kRgShMeL0i40MusoPISbzzqe96BgqCI0IFcnEYEStGqtZNTj9sGG8/abOLJdQhXN6FlM MDHaOdf0CMLJ7y2q4srhXlsbmKQGxa0y1RXFr7KeSyWUSgjh5GMFOik6v6XRFdrOmTtY 6iK+jwNAd9bFREguK99bHe3xONkn4JDN1nIfO26jqW3UTYo7RwHrG6sa0gMqmR8PSz3u vyRQ== X-Gm-Message-State: AO0yUKUgMQ1EBiA/DD9cjyNHxIDHqTOT3kssVG780dzYaSRfNaL09tBO IgJmaUP7uqLQ1Zr2BAQOE1QbCA== X-Received: by 2002:a2e:8085:0:b0:295:a32b:92ed with SMTP id i5-20020a2e8085000000b00295a32b92edmr4144886ljg.48.1678194289545; Tue, 07 Mar 2023 05:04:49 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id w14-20020ac2598e000000b004caf992bba9sm2030548lfn.268.2023.03.07.05.04.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 05:04:49 -0800 (PST) From: Linus Walleij Date: Tue, 07 Mar 2023 14:04:46 +0100 Subject: [PATCH v2 04/16] gpio: aspeed-sgpio: Convert to immutable irq_chip MIME-Version: 1.0 Message-Id: <20230215-immutable-chips-v2-4-d6b0e3f2d991@linaro.org> References: <20230215-immutable-chips-v2-0-d6b0e3f2d991@linaro.org> In-Reply-To: <20230215-immutable-chips-v2-0-d6b0e3f2d991@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,URIBL_BLOCKED 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?1759715306325087679?= X-GMAIL-MSGID: =?utf-8?q?1759715306325087679?= 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 Tue Mar 7 13:04:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 65459 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2423389wrd; Tue, 7 Mar 2023 05:18:12 -0800 (PST) X-Google-Smtp-Source: AK7set++0qy59wrSpeQp7vMVA9v0TmzHAwYqkX3N6TvTlijQCz17B1o0egRYlWFN5zDePAAd4EPk X-Received: by 2002:a17:90b:33cc:b0:233:e0d5:a2b8 with SMTP id lk12-20020a17090b33cc00b00233e0d5a2b8mr14935475pjb.29.1678195092160; Tue, 07 Mar 2023 05:18:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678195092; cv=none; d=google.com; s=arc-20160816; b=jYjZvjgaFeUAzvpat8GHZeiuDIOV7DW6DdenvTf8M2yl4YV/Rk1b8VqccUgKbL+FVE S8R+Q9dHHq4nyQdH3vl7tOkPjGKAeovB7NxHD3Sj7F6y7txQCu0j5z+nv/rW4/M2sR9T J6fQgMzOTFDNCMu6QR3Wvhu8aIL4z5Ysjb2bkXagEOzmOK4fKyB7wFOLrCw4fapMxZYM BrddEFarfexYI+m9K4ynfdlWYArOPiSKBQqkvi1VsXwkl6y1ZjUIOXjcVWBKMMTgWtIU 8HEvfRxCF3FropkJpR0GilP6Gi+EQEnE8SZWYPmwo38i90MJUPoVhzW0EdVJq6ylx8HS 6ncA== 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=idvQ4+QLl7KuJ/mcnxUM5jyBY0MVa+tmZOJ8L7xwqBrbzPrsbC5tyEeRxv8MzQgMvg 1+hGIFRF8Idslv5JJa7rpSKY21T7aiPeGfMOvVlPLuEoi36Lb35NotDZAaya6LkJ835R 3o/y9q2V9qSFkg5jjsaVgm/T5cVpQbueo+jQnFt8wBDVt+3EE/hJhiOBQpFMcfTJwlPI ISrFj8+Fm/XZNRmjCVZpY5BnpmL20RTJgHdvHUuo4BUoLozg75oVbJkBTD212DTDSrbo nKbrqveEYduxx++jvhFVqP9zdqpjU6Mr4C0xlaV1xJhXnihmHet3+LsYRaF45rsCUcGk 9Hdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QXsMqYlK; 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 kt16-20020a170903089000b0019cd4cc77bbsi11186296plb.557.2023.03.07.05.17.57; Tue, 07 Mar 2023 05:18:12 -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=QXsMqYlK; 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 S230340AbjCGNFy (ORCPT + 99 others); Tue, 7 Mar 2023 08:05:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229887AbjCGNFb (ORCPT ); Tue, 7 Mar 2023 08:05:31 -0500 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BB85BDD3 for ; Tue, 7 Mar 2023 05:05:04 -0800 (PST) Received: by mail-lf1-x12b.google.com with SMTP id bi9so17001978lfb.2 for ; Tue, 07 Mar 2023 05:05:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678194290; 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=QXsMqYlKGC8BIFrpVBwoMJw3jitiZ7aT6M1ELBa0ist/N1XoxIZooLBDUNVrnzAbmI yoXGbnY4TSmgf7jXGuGWkHGSWiFEoZeK9OgM+GuB3nUBU5Ke2z7KpZ3l9kUew9rHrG0T ol3sQvqoMY69wVHCoaCRgnJEegNl1rfkzA3Z5O+Rt9DKDg7otFNmc1o5JfFzrjGu6q0M D4p3rjfwpy1JfLOnf7q2X8U382eYyVR2/3/VsmU20rB8GUKl2jXuqGEf/lzImnl3K4fb 55e+VC3ry3ANQT3FMYt24J9jaXKivzjNPkSdFSrMaCq2O8ubTy47vf8VvC9W30vfVpQs w2Mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678194290; 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=aBSeqsxs9vMKLVZIQrIyPbCjmagEqEooDEI4lDl2Xumq4Mh+QinJDLIg5Q3dqsxsdV GC+64pOH28fmxqm0GQR7stcOgMbgm+LibpwBebNHD3MTLJzQ42xbaSh0KR48stnx5S4M k/4klTQ4qgaZHO2/DvZvwB7PtRnjT+qeE1SfrCf8vBQFp68Hj8zyuUUMbS+fKxp5peaM 4HDkW6qx9phrDVGjx/Vlj9wi2gjIJE4HKvOg2X0MfRoE4a7wqzyDpKS9fRiqR3eROJ9s WEHov+SUNL87l/6uD1wazF3xtqfIAIWy+AF5+jP3yCOa6fif/svfszY6WT81Qt4+Ugya BK9g== X-Gm-Message-State: AO0yUKUIPY6Cah7hxRKc2LxOsKgzWDhNn3El9IFB64lTEnN9U8OTwMVz L4Wfmgvy4Kbwyqijzt7V1J9yIQ== X-Received: by 2002:a19:c208:0:b0:4df:9ce8:300 with SMTP id l8-20020a19c208000000b004df9ce80300mr3966975lfc.52.1678194290600; Tue, 07 Mar 2023 05:04:50 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id w14-20020ac2598e000000b004caf992bba9sm2030548lfn.268.2023.03.07.05.04.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 05:04:50 -0800 (PST) From: Linus Walleij Date: Tue, 07 Mar 2023 14:04:47 +0100 Subject: [PATCH v2 05/16] gpio: ath79: Convert to immutable irq_chip MIME-Version: 1.0 Message-Id: <20230215-immutable-chips-v2-5-d6b0e3f2d991@linaro.org> References: <20230215-immutable-chips-v2-0-d6b0e3f2d991@linaro.org> In-Reply-To: <20230215-immutable-chips-v2-0-d6b0e3f2d991@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,URIBL_BLOCKED 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?1759715097016880729?= X-GMAIL-MSGID: =?utf-8?q?1759715097016880729?= 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 Tue Mar 7 13:04:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 65478 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2426433wrd; Tue, 7 Mar 2023 05:24:03 -0800 (PST) X-Google-Smtp-Source: AK7set92v+WQxoB2qiIAm3tlptSNw6cpCoJzyyJq344WUwmvCaR6IJsaQwnIPsP+LOdbatfUAeuy X-Received: by 2002:a17:906:ece2:b0:8af:2f5e:93e3 with SMTP id qt2-20020a170906ece200b008af2f5e93e3mr17725606ejb.29.1678195443703; Tue, 07 Mar 2023 05:24:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678195443; cv=none; d=google.com; s=arc-20160816; b=zmqD06KhjhrnvQM9kWQaLJ99gD8J2qUC23yMzL0MIyinsmYuIIToSfbW2YU2SvV5Na DBUYrXIbL4y0/yDPqJh2Xb4NGv4CPa6I7Z+F34DlY1my1Yd52xT75sYEbA5kUQ5ggRNx uFxAkjgmScB0lUIdWhWiabts3+9weXS7DiQ4Wl2eewtYE6T2xoDhuavjzdH5goDJs6bY YGGLMLwYwBFZkfqFg5Beejhx+VkImiX9CPN0AHHrJf6sdoLSVKhlOZaz0EiqWx/egd+w 3iBfmTnQBzo4dz81d48qF8w3ufiBDQ2y20kLgyjOQBehwItl/Bzk4Jci751LDEsdRckG KVGA== 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=X8XZucGVv0ycuiFQARym/OdP5w3qplESZKaaN7uoHNbej09zabWvJ5+DyI+EfWavlR WRLkD/Uh0F/cbVjD2iBZly4FEaIn+GR2aHj40zh8L7mHCmboDun0MDxKvGHsk4BoIJtY jL7buBtCfXNg8v+WHNEPMPFbjzJ+QTHg9nLuepv2WD2wRRcbBaXNpZe+STFpQzL34uqk /5sDbbqhzZX6UgaY/hjm91JBdJNiOdJfh8mIJdRMMlkrE8Td7GSrmhlPuPzBYw6IZQ6A U07arjQ2vYgSbRjzNAKzuit2Ah5vV6ol2inGUkABMolN/hoD436sM5M5xIBt/K1BCWzQ 0cBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FOsLAFR4; 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 i19-20020a170906a29300b008b138238f31si12098152ejz.970.2023.03.07.05.23.40; Tue, 07 Mar 2023 05:24:03 -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=FOsLAFR4; 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 S230353AbjCGNF6 (ORCPT + 99 others); Tue, 7 Mar 2023 08:05:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230171AbjCGNFg (ORCPT ); Tue, 7 Mar 2023 08:05:36 -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 66EFE4FF04 for ; Tue, 7 Mar 2023 05:05:05 -0800 (PST) Received: by mail-lf1-x136.google.com with SMTP id r27so16941816lfe.10 for ; Tue, 07 Mar 2023 05:05:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678194291; 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=FOsLAFR4aJaT6cegudEG+nQzhg/px9P0RBR3m2KqmJXANgyhdZkOgw0Oqs/2NwomjO cNp7npQYIZ+zBcHN1RcsOqNPaVgcLdlTzLmwbqXXbqyAa6DWI8nttbGR7YVg52zyxiR8 QffXvLy84zDBN8oWts17U5XpHOEecbe58+/BwLQ4VQrLqhk6whlyMPWoOYE4iA63xJ+j 4wJ+sxiQhb3y2ftp6oQrPLYWIJ4Cbk97ymR5SrP+I1yi/Jf4gNaYHRxRtJ+R4gpuOI/F /Zdq9EgQ+4blVaLXq6zhOfo0Nkyxh1Hprys2CEK6+yjk/dZCdyWL79gAm8XIOJ+ew0Dx xepA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678194291; 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=1tuXsX3lJ8yEyK6Kr2SqBw/50/C4et7zc2R/Q7pWjXECvmO8eeyPXVT8+m3X7X29De AGJz1/0bBsXoEDNk745LHgctzW2fkg3utexb3zKfMPDJdhFgMcxq2U7kWY8T09YGwsB2 WDuCfHvPYTY2LUUVu9bZWfxRlPvjBF18Se8vNYJPrb4/1JDj8E7Im26tgoQK0o9GaDug 5+gTgdfqOXWgFsUHnJfLoeUe0zqsGLu/STAumCniksYDAJNSIvt4lAIWpnQ1KP75WEOl kjQNlkKsbX7hNPVPVE9KHvSB94x/3ewdRPeBlodIwdsD94iOHijchZV7YspJH8taoXwb E/Pw== X-Gm-Message-State: AO0yUKWCYqEEv6GyKO4QppoLCBRem4YlHCeUZYkknMEvm1Spke5m/nBp UTzCQSC5uSO6zxb3iOSJ4LLWyg== X-Received: by 2002:a05:6512:10c2:b0:4d8:86c1:4772 with SMTP id k2-20020a05651210c200b004d886c14772mr4298774lfg.7.1678194291670; Tue, 07 Mar 2023 05:04:51 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id w14-20020ac2598e000000b004caf992bba9sm2030548lfn.268.2023.03.07.05.04.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 05:04:51 -0800 (PST) From: Linus Walleij Date: Tue, 07 Mar 2023 14:04:48 +0100 Subject: [PATCH v2 06/16] gpio: cadence: Convert to immutable irq_chip MIME-Version: 1.0 Message-Id: <20230215-immutable-chips-v2-6-d6b0e3f2d991@linaro.org> References: <20230215-immutable-chips-v2-0-d6b0e3f2d991@linaro.org> In-Reply-To: <20230215-immutable-chips-v2-0-d6b0e3f2d991@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,URIBL_BLOCKED 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?1759715465577959336?= X-GMAIL-MSGID: =?utf-8?q?1759715465577959336?= 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 Tue Mar 7 13:04: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: 65465 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2424539wrd; Tue, 7 Mar 2023 05:20:29 -0800 (PST) X-Google-Smtp-Source: AK7set+Y5UtObyPT2aov23Z+1VdEh7prRiGnNNqmDZ23NsGrhn3b10S55j+t1cghYkg7NRSN0sLl X-Received: by 2002:a17:90a:1944:b0:239:cb9a:52d1 with SMTP id 4-20020a17090a194400b00239cb9a52d1mr15629648pjh.41.1678195229551; Tue, 07 Mar 2023 05:20:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678195229; cv=none; d=google.com; s=arc-20160816; b=Tmq0Mq7h6OHdy6/u99XuW0L9+LHRJuUHgQ6gCj5g/asaGl0zBmCg7cZvK2eYTdZscj dR0rhdxd3xl7clneCzWrp02V9K+QPmHJ1wFNP+44ejL/cedSOu2aMdrQ89Q3ZjycLUUk w54XNR56ozTG+DBoPMhO+0AFPDdOEudVxtXDvv8qIA6nae+im3V9rmb9ufdWvA9HhJ1E a60csY9tgDx8kYktrlHwb3Bsp+Ao8X+dHZgfGS7f1RMu6vvcS8NY4tcJ8nnsXvEsbfld Ck9k1br026i3QNi+6s9r0Fezy/zXDRdAqF3KFLFaj7ezbQTaVwwrcxzbVtKNpX9w2KY3 nAqA== 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=pLn+AolAjBb3ma5a+LW7FHDkw6y8VrtfQTVtDQCJZpMNFOIjQztGNmnKmZpzsV0QJQ 2sJ1MexfSEqEz8mRrFXJTFWghpP0H4u1jEx/Mq6H70rSUf0eHt7DxYVSUBfZDFvvnIy9 EQwmuY+W4IUSjOfpI2uUXPsVRmjaIxt9JtgON+vjNCtjpJQilBjRWXrNiIleawD3qC/I MLKkZZK9HavWTBXYs7hNziv6e6qJUiz5KXHcYCXdAnMsoiJ6Wl9PKprdsG3SPJh6o0Ht F//9uD4R3mgv8P+O90GmERI871EiCJ9rzgshLwjum/5ngFX18mgqIbGRJCIE3Qep3hta M9/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MTRyrWkS; 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 r12-20020a63440c000000b004fbacd1a872si11223559pga.853.2023.03.07.05.20.16; Tue, 07 Mar 2023 05:20:29 -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=MTRyrWkS; 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 S230203AbjCGNGB (ORCPT + 99 others); Tue, 7 Mar 2023 08:06:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230178AbjCGNFh (ORCPT ); Tue, 7 Mar 2023 08:05:37 -0500 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEDA0222D6 for ; Tue, 7 Mar 2023 05:05:06 -0800 (PST) Received: by mail-lf1-x12f.google.com with SMTP id g17so16984413lfv.4 for ; Tue, 07 Mar 2023 05:05:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678194292; 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=MTRyrWkS7GsWcEkunnMBjIRdfCenrGT6pejPsQpaMjny1E9LxOLhNuYcmE63XcretE q32JKPriAzgizybVT2MdxJB81iYgmxx9BDGvO5sThBiHenSJ7TSi/mcCS7HV45kNSB+o nFuYaRyNuTrLB/gDQWIzcHqjGHC4nG+KIehAX49XQhAmP6StJuWO/emG5x7MtfyOBx9l GaidXtEecvBXnaThlgDQYyk6Tii4rSQ5+FWEGPJMgf0tXP/G8OvA1Q4Owy9fxFZtgjTS Z73ZjNA+ds7dyP6GQI9sn+6ttAPoCeqV+GNke2NCiS00Xz8TQ5J4gx5NG89RyXvxS8in LnRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678194292; 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=Tm1KTLmu7W0mKUf2aN1iOyPOYg+n4a/XDv0SAnrqI8JDvqjXNjyIMBGGRydck8poi6 ViuM1/unD5I4S0B+CYJwYM5lOJpEG2iab7G6++CtCbpmJ65ImbvgEWcwDmd96CJFoHlY J8SOjCNVyFpDWx1wbq1V+vLz7mEEGZFZQ1ePLM1RRiyM10fV/u0h0GhT0Q7Vg9M9H5NW 15yYLb56u1ktNv1zImQ9QMfvbmAXhz1+GsN2Q+MekxSoUhLilqTLBT4lSkvkQqTTJUKx gPnmhz1nyI++FHioWqfptZjOUu+aWd0+ObkyblKSmVlSP7+CDjKErIXKrR34JHN63c60 FssQ== X-Gm-Message-State: AO0yUKV/X0JBCvTXNT1Lvvoj4qmgRjOq5tFJu5QVwnWvd7PXYF+hMtqO TQWAGDucQ3FzbQOYq6o+TDjcig== X-Received: by 2002:ac2:5214:0:b0:4cb:4378:9c6 with SMTP id a20-20020ac25214000000b004cb437809c6mr3479109lfl.23.1678194292689; Tue, 07 Mar 2023 05:04:52 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id w14-20020ac2598e000000b004caf992bba9sm2030548lfn.268.2023.03.07.05.04.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 05:04:52 -0800 (PST) From: Linus Walleij Date: Tue, 07 Mar 2023 14:04:49 +0100 Subject: [PATCH v2 07/16] gpio: hisi: Convert to immutable irq_chip MIME-Version: 1.0 Message-Id: <20230215-immutable-chips-v2-7-d6b0e3f2d991@linaro.org> References: <20230215-immutable-chips-v2-0-d6b0e3f2d991@linaro.org> In-Reply-To: <20230215-immutable-chips-v2-0-d6b0e3f2d991@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,URIBL_BLOCKED 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?1759715240677057982?= X-GMAIL-MSGID: =?utf-8?q?1759715240677057982?= 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 Tue Mar 7 13:04: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: 65451 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2419873wrd; Tue, 7 Mar 2023 05:11:18 -0800 (PST) X-Google-Smtp-Source: AK7set/z6WPTLZWkYerMJiP7Ge+QzJFy6WOTu0WcGrUu/0QlZzkpws1OvTI3r0kPM2CFhBZa/5mn X-Received: by 2002:a17:906:3a0c:b0:8f1:939b:8a84 with SMTP id z12-20020a1709063a0c00b008f1939b8a84mr12836442eje.25.1678194678377; Tue, 07 Mar 2023 05:11:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678194678; cv=none; d=google.com; s=arc-20160816; b=Jz+ZLNdTyrAQduhCPnM9LIFVLu74bQYcmGhCj+VZcQc3nk5qT/Ltnlzbszid3q1EM4 6w1Q+ty8cv9bs+LZVwD2ZW84f3CZMxJYH/SBtEafd7wwb15FYzeZO/zy7JemqfnEOo6G 07I6XH/sD/+07dwPn6pzNPdCrmpauamnOBX+zeAcFBiVow4qntYMrA+ywDw17VqebBwt nn7tYCcDqBHql7ZyGoLsd9GeEQaEtDSdCbJ65mIE7RsorS+9UhufefpQcahpFy1ejiRv RQ7cB2FhPs3wgFiaYN9LgrIzXIjM77hCJRPXTkBhYI5FbqoXmGQDJA1mrNU2aTAjETTx hr9Q== 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=EcRY2c7ivtVJPMlWSdomSam2EIyZxCRHgT168hCeXM4HhP9EE0J6FVEN3D4T/Ab0kg Mvsra3TYjPItOZNEDbWOWmzTbIj8rx89lpawjAlOdTqQHE+0o5QG4f4ZGhktAkWrx75k vYGtVsRFaDwiYXbIcsEe5CDGtqKeOyhE58+A5261PmiMonvXpIFc4bjcO64B5BrhpGmJ I1GO2O0u4k9hwyh1I/HdGL4giK1e0e63sLOLA2cNbg0NaKslIzrh7bs1HkdpvwOtbMb8 9sksVdpxJ0D4WbPqiWRIjHUFqLymU6Z0Aw4npR5q/G76ilhO/+tL+eohtSCBKgpMDMER vLCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SefXo38Q; 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 l9-20020a170906078900b008d8c2516b26si990517ejc.211.2023.03.07.05.10.53; Tue, 07 Mar 2023 05:11:18 -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=SefXo38Q; 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 S230381AbjCGNGL (ORCPT + 99 others); Tue, 7 Mar 2023 08:06:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229624AbjCGNFi (ORCPT ); Tue, 7 Mar 2023 08:05:38 -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 322AD36096 for ; Tue, 7 Mar 2023 05:05:08 -0800 (PST) Received: by mail-lf1-x129.google.com with SMTP id k14so16963787lfj.7 for ; Tue, 07 Mar 2023 05:05:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678194293; 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=SefXo38QgFexmgMWTApFnWYCQ1D38J1mZxECZRSEWq2DgCPStiPBhN7E0gHFh/oKnO a/ctUs9MCxRKx/PwkqBSuaAB9/QSurcpyPlLYRJZRoTDIGaTgrOK/hZQY9Km0isk5eNW tufwKDB5XDxiA5gOxd4mKIwwT5bnjIKlugZWVVDZAI2TpZeoTWm3uKyZOPHaVDjhrJfC az++FZPBChNabjvBHtcIEGQGaesTb5YHV7pL8kUK0kQZ7fOLQSq3DvGw0XCmrGOaOA9I /zR1FzEAt3kDie5OWkpsVikEaTD3X+hsElGVMnrs4J7XEzHTfupYzB0bMTmreCDN4qhI GUYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678194293; 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=kG1myfN/E+bI5ljA3E9+ZswD6MAPM24kKg/8s2RnRrMPoy4DJL/ZFW2BIRBKUPiu7W s2pRU/4XCYIcJrmDSgdf25f9TEclEgR30cgx9ZDzmlI2Efic/RLH/VUtqQ5hnGgIUv2E bnkhLKNuKjsrnNOWjLoEQ9rNF0MFGiATQhgXWCGZQShkB/ceph091BF/KO4PLjk0HNBB wwqxkDxPDIdsEGkfQo9ULaTfUnTynhOFSN/mnpkJkaVMH6C5tvz3O9yZ6EE8M9dUKpZW eCijIjxAOqbYNXAOHFdWl+VmEu6cuVvYZPeJxDFV6OPZ7dIx/jbyozFmSXyFHRUH8inc o4Ng== X-Gm-Message-State: AO0yUKV1+VUzsbMtbzNJaRJSzQQxF45AZpTIBrFX67THR4d29d4pne9u O/4KQ21C3U26urEBH/I2fAjKGQ== X-Received: by 2002:a05:6512:4c2:b0:4dd:cbf3:e981 with SMTP id w2-20020a05651204c200b004ddcbf3e981mr3773006lfq.28.1678194293760; Tue, 07 Mar 2023 05:04:53 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id w14-20020ac2598e000000b004caf992bba9sm2030548lfn.268.2023.03.07.05.04.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 05:04:53 -0800 (PST) From: Linus Walleij Date: Tue, 07 Mar 2023 14:04:50 +0100 Subject: [PATCH v2 08/16] gpio: hlwd: Convert to immutable irq_chip MIME-Version: 1.0 Message-Id: <20230215-immutable-chips-v2-8-d6b0e3f2d991@linaro.org> References: <20230215-immutable-chips-v2-0-d6b0e3f2d991@linaro.org> In-Reply-To: <20230215-immutable-chips-v2-0-d6b0e3f2d991@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,URIBL_BLOCKED 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?1759714663073566638?= X-GMAIL-MSGID: =?utf-8?q?1759714663073566638?= 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 Tue Mar 7 13:04: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: 65458 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2422513wrd; Tue, 7 Mar 2023 05:16:29 -0800 (PST) X-Google-Smtp-Source: AK7set/krXQzZsfcwaDXPPcsWzb6TmBXheYbJVqbhiQPji4XBz+M/0PUPsGRJjwR4g3cL+Qd/BT0 X-Received: by 2002:aa7:c0cd:0:b0:4af:59fa:2a20 with SMTP id j13-20020aa7c0cd000000b004af59fa2a20mr14536619edp.15.1678194989235; Tue, 07 Mar 2023 05:16:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678194989; cv=none; d=google.com; s=arc-20160816; b=gNFAhCUWqix9rBC/4tuQ8gTmy5t6M3nfiVY1tqqdggTnoxGjqNKCRLmSctkIjVpZa5 Zf+Om3B4+LQN6XtiR+G4NU9WiTCgjFkvBgWDBK6+vL/vxqIRxfcewp58IMPctbicHyGZ iLXNYbtfe/VUPDy6w2iiu8z781O/v8yY47A8P0IosLLJvslwVDij6bgpg1KVVG74pIAW mI6Zi/0xL/DMZHPyHrRI3RiDr8xQtN8rwKFDsYdtEtaPD/JivTyx3KRKA9s7WPlJ39lW u1oTabXIRJqL17pPs/dJ1fNCfHc/aZZ8g+KKipDf3YF7mRZUpO0wvui5jWuLVfvLp5KK WtsQ== 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=tkY/ZUmiw5SaOAfpUZari9kmmEut88esuH4tQSJBVPXvJZkUdljZhFb2kF/g9OOEtn xPmyd4sQfdnze77zk3QuIdMHKq8FHT9HzHC4GeQVhTQ0qk4lj3fO4oXN4l8lRs8oOI8y 191e+xKDWOKC8CVxQcG3clzMYCWJShgANn26Yuz6EtlOgMdwdjONS6upTdF3did51s+M nMXSv/pU2AICEkfnsEmQvxsxY3Rl4aBEIe7kVmrhvVle6cd1qEu48QFXfNsAG2O5j2kc pY+0EWtbQ8XU3eHdx6CnEw2lyimRj9UcckXQsCEsE+9GTz2iQn/WUTVQMOmsmEYuz14o q0JA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qEmoyYvt; 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 w23-20020a17090633d700b008cbb481fc7asi7222264eja.614.2023.03.07.05.16.06; Tue, 07 Mar 2023 05:16:29 -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=qEmoyYvt; 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 S230167AbjCGNGH (ORCPT + 99 others); Tue, 7 Mar 2023 08:06:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230183AbjCGNFi (ORCPT ); Tue, 7 Mar 2023 08:05:38 -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 639BD360B1 for ; Tue, 7 Mar 2023 05:05:08 -0800 (PST) Received: by mail-lf1-x129.google.com with SMTP id bi9so17002254lfb.2 for ; Tue, 07 Mar 2023 05:05:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678194295; 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=qEmoyYvtgIkJSqf2Pqh6Ym564INZh0BwzurBMQLlWZmSk8nzc8RGKvmI0hegLFxPKY vcwgmnrbX8J6CXWiJNG56ybOQpRIzjmrfLiPW9MzQfCDwgA6bUUnD0Ocpa20ATwBgP9m A/kNsIOkf6r9XFr9kj2EMb5Nrhno/+FcFquWbL69edEYKrrRQYWXF4RRp8TxDzmfLggt lpDEFkFu37kGvJ2OLITkQJg2lYcKqCzkmVy4n4eox8eBHZVvg5k4QHyCMIs5Z0ynE3zm FuV41w/UN0D41os3dqTUZxxRP69iho+WD29viJZOccqZ2Lm217SWEXDOnsKwcFDfPpQ6 KjEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678194295; 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=MF/cN/eRg4LZnRFclKkpGgQSRuG3L+Ed7U5H1yDR1ROKs6L0Y135NWO74vuZDQfHy9 +FOfUZH03PwPcllzpFISXX4NughYnnOWD+9+qjDbSMvE+XvW8JZgcwnNq6cm1sAQ/rFY Vd4XcRxXd0yB8UItTCodvro3cerExxhziCyindAUqZp1W1xbGIEY9ttbLYrTz4xXWvG9 TrVJAk6S+g1UxFGL2wpeaK4sOaFk+tHzckisQbaxPH/CpBAswUwnhccZo44zjIhHOPm1 xR2zE/D75ZDBDgPdani77uNVQQViyV80mvzc5/P1gVh5V9opU86qHQd4VUX9dPLIaWX8 OYeg== X-Gm-Message-State: AO0yUKW5i1ddRfzZEEnu5O8MChWc3ayvc3cGLU5yLgegrkSQCs00Oufq CYMclgeJlFFuVacm+1ttCfoRnQ== X-Received: by 2002:a19:5206:0:b0:4e7:4a3c:695 with SMTP id m6-20020a195206000000b004e74a3c0695mr3596668lfb.65.1678194294792; Tue, 07 Mar 2023 05:04:54 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id w14-20020ac2598e000000b004caf992bba9sm2030548lfn.268.2023.03.07.05.04.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 05:04:54 -0800 (PST) From: Linus Walleij Date: Tue, 07 Mar 2023 14:04:51 +0100 Subject: [PATCH v2 09/16] gpio: idt3243x: Convert to immutable irq_chip MIME-Version: 1.0 Message-Id: <20230215-immutable-chips-v2-9-d6b0e3f2d991@linaro.org> References: <20230215-immutable-chips-v2-0-d6b0e3f2d991@linaro.org> In-Reply-To: <20230215-immutable-chips-v2-0-d6b0e3f2d991@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,URIBL_BLOCKED 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?1759714989339234874?= X-GMAIL-MSGID: =?utf-8?q?1759714989339234874?= 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 Tue Mar 7 13:04: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: 65472 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2425555wrd; Tue, 7 Mar 2023 05:22:25 -0800 (PST) X-Google-Smtp-Source: AK7set9CUPgOrJG71unVzgr3EijPENqvD1h9osC8hpB35RD03I9pTfyH3po96X5BJ4U/Vyz9NNNO X-Received: by 2002:a17:902:7285:b0:19e:7bcf:b32 with SMTP id d5-20020a170902728500b0019e7bcf0b32mr11860996pll.24.1678195344960; Tue, 07 Mar 2023 05:22:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678195344; cv=none; d=google.com; s=arc-20160816; b=XHFdzNMIIM5aAza6jR6fjJaHFen+EyTVCDOb01/nuE9sPqpKJmow+frOlTfhzOhiIw jS4oYpfpA1kY6LCWE0wHAm8iXnme5jB4y4kEEAjGiwIf+iehJ3TH7hL8R+tfGGGuogGY RpFyFN36bia/iU560cWw7CU68O1ZRyKloc0mEDkbdjVPAcmY8Cz47S+8QDj6mPvdyKx2 P1y9WVl8kE83RzESKRvsmoPp9rka3kAphyywifMfM3BOYejBRSpHnMix1Lt9iGLAAquF G0GUE5Y57lwAbDTm4Hgk+Cgm1k37q57rbKSeAzc0qUVYbIvp/80/JPmDjm6KhMCVgNlW hGLw== 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=YlqHyGpboWnVLFpmndLELkdCOKH3vZvc8bKLnxeCkFDeaxy972EDMpa6WMTIJ9TqRY Zuj2qS1FYAJArVlMXIdekZOdeN9XcSCVKjHtLxnyZQ0ggt9vZwsjMsIyxayh9zClyVq7 jT4jnztsf7/81iHVPlm+7+Rlwn7xqqAqAlHESOBUysthoZti2XeRwg/T/IgSdW4RlbPh wxRWTY5KX0Fq2d0SMQ4SwsA0Z5KVhsKPW+/Y0Np5x8cBjSJ09H4Ow6kRmjbouaY59rR3 R8eANtt24Mq0R1nbhh9o0FRzu/dRR5g0HnwTySUNRCvwsq1q+yFRFS4YEoclWOUlGeNL /sVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gTl0sWAH; 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 jh11-20020a170903328b00b00188fce355c9si11864217plb.42.2023.03.07.05.22.12; Tue, 07 Mar 2023 05:22:24 -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=gTl0sWAH; 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 S229993AbjCGNGU (ORCPT + 99 others); Tue, 7 Mar 2023 08:06:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230198AbjCGNFi (ORCPT ); Tue, 7 Mar 2023 08:05:38 -0500 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CC761EBC6 for ; Tue, 7 Mar 2023 05:05:09 -0800 (PST) Received: by mail-lf1-x12c.google.com with SMTP id k14so16963913lfj.7 for ; Tue, 07 Mar 2023 05:05:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678194296; 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=gTl0sWAHZELkBxPNjBg4QMipl5SoU+iNUQxL6p5sL5f0MBR5nPYOyZaiMzeOB+Q+xj 3GaijKUlUOO0C2yVej7qgB6oK4tr/pCZr0ZEHV3NQ5+miMkcnDahGA/O2BQgaULoJJBd mU/TWvz84AOJwTsrP7ocKUZty9JD/vdR3+cBkaTmVo2RmLiLbhmhjLtFpH+IvL4FvP1U jQB+d450gCmiksPXVpSBV6LL4OGkFDeHg2jIJQFjV3MrsgmqD2KJ6N5fTf0JUeHvQwLI 5NK3CVAcz1wSJrJfFumcuXHqd2qH6tJmF8ovGZVTV6xhphAgnT1ITng5XXRqFgzJSOmu gM5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678194296; 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=CzR5TwNH06HhsV9rrYzS1dq1En/vZMy/FhMUp2EO86QLwMM63Pn1OfdfY2cCFt6rv2 vInK9u+P6l2EDhE0t9YpyphcE2F1jhE5VI6/ltQ/pd+EOHxUl6yLbnwdSIr8e+C5dBVu 06FLZJxZby21JpChF4AMg2V2JcfQVVPwvsIhCaK8mlPgT6ZDWt/wxSQh5yfj0zxOA9uf WFocWTnEoze0SeQS58ErgtVgZ8vgEEvJz3UeF9j3/4udzEIEk7uRcjjxrztcJ2yURuBu 3K1bA4I8QqoVQ/r6mMnVfTco1wcsQSdawMCi0xyJvahjFiu05apUGk8ItBT/XWgfjgvb dagg== X-Gm-Message-State: AO0yUKXTI4gsMIlOke7QnKdJbZB6LC40nZdCntcQzLna+HGfUzpMEVSJ VJ7A3mLeW/A/pv/i2kWmh2dmQg== X-Received: by 2002:ac2:4ac9:0:b0:4dc:84dd:eb91 with SMTP id m9-20020ac24ac9000000b004dc84ddeb91mr4510736lfp.22.1678194295779; Tue, 07 Mar 2023 05:04:55 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id w14-20020ac2598e000000b004caf992bba9sm2030548lfn.268.2023.03.07.05.04.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 05:04:55 -0800 (PST) From: Linus Walleij Date: Tue, 07 Mar 2023 14:04:52 +0100 Subject: [PATCH v2 10/16] gpio: msc313: Convert to immutable irq_chip MIME-Version: 1.0 Message-Id: <20230215-immutable-chips-v2-10-d6b0e3f2d991@linaro.org> References: <20230215-immutable-chips-v2-0-d6b0e3f2d991@linaro.org> In-Reply-To: <20230215-immutable-chips-v2-0-d6b0e3f2d991@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,URIBL_BLOCKED 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?1759715362238909579?= X-GMAIL-MSGID: =?utf-8?q?1759715362238909579?= 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 --- 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 Tue Mar 7 13:04: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: 65468 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2424974wrd; Tue, 7 Mar 2023 05:21:20 -0800 (PST) X-Google-Smtp-Source: AK7set9+/NcB4wW2vA4nUl74ENku+0x5x+m13oQBQB3kHoy5d6GdLXKXlx2IcINb8jLU/QLbUiz7 X-Received: by 2002:a05:6a20:430f:b0:d0:4361:9720 with SMTP id h15-20020a056a20430f00b000d043619720mr1755074pzk.61.1678195279814; Tue, 07 Mar 2023 05:21:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678195279; cv=none; d=google.com; s=arc-20160816; b=QSJZbWz4KkaiEdYHireuF2/EwHdY6+qjYzmWO/0eI7vWQKY9XfbM443yO5s2FqaGvA SQD7Nx+nrytTt6zMt9auAUgBAwfweek9eYgo1YupeCTX8iiDYKSuxvg+Dzk6MIsTrKlx 5yXjvRzyT7urHHzI2/U+ViG0Jk3lGTwmxsOaTqc6jU11P6H/4ijnDFA7XETFQ4JLALG+ iBZtjGEwWyen6vnLIigMt/gHVRAQDKOA+ai6CO1ZsRtNqSatBUu4KF7UFRAVB4JEtI7K fRUBQ5lcfmLF9K76FkHQu59PnxwtTbrn4KmnLcgpv9Sz3vNxmt3wR0bztV3a0HfK0m5W bRCg== 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=xBDHobpyYsv2eHBxgRdl+pmXic5KEvmWmRvwoEXfOT/c9UWmO9H2zGQOoMIGjCzXuG 1nj8GSJEQWFoCwbxcnIijzgvphlZth7k5ZVyuEUxUSnlNhkNDvXfBGIfc5vy2okpft8z sAynoNOiDY0u/0Uj/X8cjiKbx+V4C7J7eYlcZzm8fDNgj2BYs5nDfic6hlrv4Ly1Tzqz zuvZNjnqEj6sdFOnN6bNbEUOS8Or0T9ZSTDHAQbYHyZWoRXL9NtCsu9o2/AnoBMbKehN y5YSpGVa8DUiiBWQfnYva2kpW5G2atHxuWgnPghlKWKGo0Lrn2z9cICHzUHf3cX+a7Mk xsWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tdXfnpQv; 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 v69-20020a638948000000b004f2022f3cc2si11152561pgd.813.2023.03.07.05.21.06; Tue, 07 Mar 2023 05:21: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=tdXfnpQv; 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 S230422AbjCGNGb (ORCPT + 99 others); Tue, 7 Mar 2023 08:06:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230146AbjCGNFl (ORCPT ); Tue, 7 Mar 2023 08:05:41 -0500 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA0874FF1B for ; Tue, 7 Mar 2023 05:05:10 -0800 (PST) Received: by mail-lf1-x135.google.com with SMTP id t11so16987872lfr.1 for ; Tue, 07 Mar 2023 05:05:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678194297; 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=tdXfnpQveQZ13YRTjuwgCi+dCDAKPyozw1qYk19o2EtuyEuikBRxXl6nyMRSB2xKRJ WoI6iAmTDBWherJFYCKCXcxRe/4XJHx/fCeWmZ2DZcA3HbL4fOi6nokat7LiDvCQuXYG gU4udntoQ0XJ6m+b5ON3WpTR8+YyCXOtbXyrqj8uhMVAbxIy6TMWKhfBezu6mscGBj0J TwcV9YsgtwqysWedxow5kbw5KklVoarBDjxm0WDoB0g65+qOJdrsFtY6YuNQA//qVo36 AxYfUHWcp7ClBdAzlY8RLrdBA/86dbEVMh44W/lFDzziSOxKOoBukra245PzOwLMl0Pl YYWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678194297; 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=fOShDjZ/wQUy+rsLRloiczrrEE35ASHswXISdnGLHyuESjsoV+223q9IZa1EESfT01 CgJVANRaoSdyGzcLLCMRrryB5fG2MFqAEeu2LMPaSW9jAXKEJFx5gLEO5l2AB4kN52jo cI03LyasYP4GrBTm06eNHRsmP6ByKcKuKcr52m2ajsJEjdOt44WUIOPNHAX6c+CJtXuL td7CI6Po9AIXojSlimz1I2FyIaKi8c7LPZSlFI+k/vOHpIXhxPsL6DLHdlHa7v2+cWgW zDnoX8TzFTuyIYD6TDN4vbn09li7S4nhWmJcuZT5MFJ09A8DDlSEjW+XSnqnDvHWSwJO x2UA== X-Gm-Message-State: AO0yUKVjCuHglif/qWkxC76BDixJ2zlYjq2MPyaW6feKLeyFXhYqubVu o5s1ZJ15fRIrUZc17afvZN8FwA== X-Received: by 2002:ac2:46d6:0:b0:4da:f436:d423 with SMTP id p22-20020ac246d6000000b004daf436d423mr3963036lfo.21.1678194296895; Tue, 07 Mar 2023 05:04:56 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id w14-20020ac2598e000000b004caf992bba9sm2030548lfn.268.2023.03.07.05.04.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 05:04:56 -0800 (PST) From: Linus Walleij Date: Tue, 07 Mar 2023 14:04:53 +0100 Subject: [PATCH v2 11/16] gpio: mlxbf2: Convert to immutable irq_chip MIME-Version: 1.0 Message-Id: <20230215-immutable-chips-v2-11-d6b0e3f2d991@linaro.org> References: <20230215-immutable-chips-v2-0-d6b0e3f2d991@linaro.org> In-Reply-To: <20230215-immutable-chips-v2-0-d6b0e3f2d991@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,URIBL_BLOCKED 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?1759715293567119863?= X-GMAIL-MSGID: =?utf-8?q?1759715293567119863?= 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 Tue Mar 7 13:04: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: 65452 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2420261wrd; Tue, 7 Mar 2023 05:12:02 -0800 (PST) X-Google-Smtp-Source: AK7set+379DvIAgO5kQKqpSkEf2bCv/IEcsBU0XnHkxjVr8Z6N3VqxyA/u4N2yWCDn0pTDlVYSef X-Received: by 2002:a17:906:271a:b0:8f0:143d:ee34 with SMTP id z26-20020a170906271a00b008f0143dee34mr11435208ejc.1.1678194722581; Tue, 07 Mar 2023 05:12:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678194722; cv=none; d=google.com; s=arc-20160816; b=ubZ/SjIaGV6+9oVvQ629PotK1raGn2oi9MSy5R3vorAg6u7Nz2FprVYSS35LWaP490 6UUvCReSyOzwPVM08U1lQNQ1N3mQhJocLClV6BlpIt+aC1deBF3+SNwiLXLPo4ufor7y xRZP5XzOVj7BdYLmNw1EgSgRHMV4QTeQtzbI+LBbmUrwhfVawPLfXHpDrc9U8BBmVJ9M OR6MznGcuRFGTB71bGpGQflpegymxzNdIl6t8nfUy+xIHSq20JUyBs13X6kS2UbUGLp4 lBIGb0qZv/kLYs3lvUzyfNugiONP1bpqLAfQeHZoaVJheLun47jFi9skg8yAtGQmGFvi hffw== 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=LNdSADinBnpwdp5gMUjYWmH76Rv1Qlo+mPP/3xUfODA/quGrBcxukDo03IMTSjKT9A Cj8wm3/u+uuDMzaDDZ6WVl/SOnZyMRdD2rLTcCpOHwgHPN8J1EBAS38GgoOrSQgZGbk+ zrQruLOGxnTzHfEiRzM3dIT4RujcJCY/Ale1VZGBsSJ2W35BrDQrVYb9ygsTq1MTKWKc nGydv+5YpbRRN6T8lYblTHWfTR0duJjhEI1m3dbKIst4qrsD/JJjvZm1AEVTzKhV11W5 XXIxy+m/pfHApYwggipV6G6ER+/75wFLjILWzxL2WltSUT36FooEorwo970bmHPvA6r2 5KSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vZKm0sHQ; 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 m9-20020a17090607c900b008d9156e6409si1066790ejc.517.2023.03.07.05.11.38; Tue, 07 Mar 2023 05:12: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=vZKm0sHQ; 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 S230093AbjCGNFs (ORCPT + 99 others); Tue, 7 Mar 2023 08:05:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230133AbjCGNF3 (ORCPT ); Tue, 7 Mar 2023 08:05:29 -0500 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 632871968C for ; Tue, 7 Mar 2023 05:04:58 -0800 (PST) Received: by mail-lf1-x12b.google.com with SMTP id r27so16942217lfe.10 for ; Tue, 07 Mar 2023 05:04:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678194298; 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=vZKm0sHQNOSMMZoNqibcrK3Qe6Lg01/4Fr1aaxO9TGYf/45NkCHHxU/yfX8ZsCGMx/ J9zXwTKz+qF5UBNy0qy4JohKdNJ2XymtlmWrfhlrgGpAO0PHnES4m2FWy9S8RxHJXPUq wzs1CANIN4hrO+6RHsyevTyy1CwkdAbUJYmUtP73VVtm1ucs9J7twojT3oreATjs7YQf UAyT80ziocByhf7ZYiouICdsrHgNauSbu71i+RphcnA7crEl+YsM74LvNV2BN70FI8H5 1rVIfU6qqA2Fa9brCUIIg1nI8ecG+TXZBn84g9c2Jfe8TAFLkKN9LLRBCjHzML+yhZq8 DdXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678194298; 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=vtPVYWyAPlhKrqNKTQI1q9sqOTFeREKFSwX/KYYoipJJJPekRn89nBXz4EU+9SOrVH x0E1/yQyC00BReG8wrU7hc64PZOnAwEBrJTXy2khfAbNBogx41o4IGBNFNq4AGsM2HZx DvsCJLmreTLRl1E5hZVx6Vx2xM20HX29AlE2KNqXpt3/CoDm1z2vRO/XEccz/jvY3tYC tZkr5PG2fMRkxJ2fPrE9JYWMvSo/qzyH3vkAqhjmtsd7KkYfx6JfqW73ilkkFiTJitxp 5pSfkiSl2tKGnaj0GNwHGjpkF1luVg9Rap43YKSMmFyzAPd/3cot+qun4XCPTdCJJ9kY mxew== X-Gm-Message-State: AO0yUKUBBBrf2vjDkxbJ6A6HXSczQ/zpHmz9/tgiaExb09tQg12PtIxg vGRY9M+pw3by1/HCoR090Foy8Q== X-Received: by 2002:ac2:52bb:0:b0:4d8:5de4:e3b4 with SMTP id r27-20020ac252bb000000b004d85de4e3b4mr4312862lfm.1.1678194297974; Tue, 07 Mar 2023 05:04:57 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id w14-20020ac2598e000000b004caf992bba9sm2030548lfn.268.2023.03.07.05.04.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 05:04:57 -0800 (PST) From: Linus Walleij Date: Tue, 07 Mar 2023 14:04:54 +0100 Subject: [PATCH v2 12/16] gpio: max732x: Convert to immutable irq_chip MIME-Version: 1.0 Message-Id: <20230215-immutable-chips-v2-12-d6b0e3f2d991@linaro.org> References: <20230215-immutable-chips-v2-0-d6b0e3f2d991@linaro.org> In-Reply-To: <20230215-immutable-chips-v2-0-d6b0e3f2d991@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,URIBL_BLOCKED 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?1759714709523397101?= X-GMAIL-MSGID: =?utf-8?q?1759714709523397101?= 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 Tue Mar 7 13:04: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: 65473 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2425749wrd; Tue, 7 Mar 2023 05:22:43 -0800 (PST) X-Google-Smtp-Source: AK7set9peVnnhMSR+sgfdEReHR2AKM+4pn6JgsqG/EKAupVhTKkIL8GW+3R3EeK/+DQt+vQzvZyA X-Received: by 2002:a17:902:ce91:b0:19d:1dfe:eac8 with SMTP id f17-20020a170902ce9100b0019d1dfeeac8mr19534486plg.26.1678195362903; Tue, 07 Mar 2023 05:22:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678195362; cv=none; d=google.com; s=arc-20160816; b=WjXH311d/JhUsAsw77d5amTd886obuu94RA0VoSi/9KZ83K+bIJ++vD32qDQFvb879 Scj8cskXPbefqRBvTAFTOs/0cgRI1ZeGahG4p7dsne53MuiOAcBnz1lsNyYO+j5gqlhk RyZf7Zh+eN4UHUsGNTRq+uvsgOcpLtU6SYwJ5k5AhNWu7kIYpEOqf9/JGNTK4CPPeATw NEaksN2YM7x4R6T2yYm//AtF0K3nRXe4uv5yYAKQc43ufvlSAIvGEYPw0uEi1XSf/svK UPHeUfNPsFSI5B+tEnydhO64c2YsUVRuXCe2lkt5QWxJSAhyERYcSU8B+i4NJ4iYjV21 od/g== 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=ZblNK9AqhUhOVo8lBZ8za+GyG7isnlv3ILedL7wJkZKep43hgeE/OqfiWIQsSjcAZF 6wrvFO5gV7TqzlJYmdBOt5gXNVnGkNdaAemlvqs7SmL5iB47SCUmiSyxBCribZ4fsJuw qAzjvaum+XCGUFoX/+02vKUfNsoVf4Y/f2r3G5DaB5KbU9/S3fOS5DK1LKHoS7Ak/5Nj VgKoUl36OsX7EonGOAuo5EwMc4t6D/4YQVRI94THPM3Ki0AhfI88Ei36IWDsDxMIF7U2 EROothdj8f4JReITs66Ek7+opq+OZiyubmQyr15OEcuaxB5RJjE54+b0UrkAXA7ITqvW p+vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XI0UmKS1; 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 iy19-20020a170903131300b0019cac966629si11422538plb.245.2023.03.07.05.22.29; Tue, 07 Mar 2023 05:22:42 -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=XI0UmKS1; 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 S230440AbjCGNGh (ORCPT + 99 others); Tue, 7 Mar 2023 08:06:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230251AbjCGNFm (ORCPT ); Tue, 7 Mar 2023 08:05:42 -0500 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45445AE for ; Tue, 7 Mar 2023 05:05:13 -0800 (PST) Received: by mail-lf1-x135.google.com with SMTP id n2so16924398lfb.12 for ; Tue, 07 Mar 2023 05:05:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678194299; 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=XI0UmKS1DqsLREENXEyfQRgiR7jhCtGsIzKxy49toW+kuBW4SQlQoHVh0hwV6jFcu+ aYbUbgsFyN8oj7PPp3WcL7Z+4F+Y094WggSBSS8z7xY8qPeUN+l160jmOr9Y1LqPqvqR wR+mqRS3HlNIGJLI0cGBYiV4m/pVb3+pheIdC5rg6RwjNpDB+UyT89JZ8zC3s8HHi5Ug RzKh+pgaU5eyNQr6uSTb7kraNJTBjxGsxAtXkqsFGbP3YA3jEMaBgHB4DWd2ZX8l5i+i hl9GEpV2AMq7t9uy18J8uHMpSIul0CNfP4FqaSw7oV536zICcuz4cUiypiBR31J2CElz QRUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678194299; 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=gan2ZCsHXuVLoeb0fWOFLz3zMPQUhbNsdRm0+MNEALLtawdjmuqamlknEeP4f57kTv N3AmnmA7bBJ++6hfI/paXQLVd/CQ5iQ5v9xQAaou5EsZzNcJ34nXqO53NDaehj2CUJIk e7ISmz9zpryc9VcckAuTonIbPSYXuQnAW3zp2tirxitrac5nlVmbNnG8Isca09w+3Gt/ hYVnRPajJCkiFtK9seY13rjWRMxbo1KqG5Fql0QdIsIuZIjNUNmrutval1pV05x3HqXc ta7/B4KUJaNk0hAdYf0M/Ya/bvVioYK0jRDPyoYxJvzP+Rrv6MvTlDKk87C1mrfC6QMA tmBw== X-Gm-Message-State: AO0yUKXas0+oiEFC6ROJHYhctV0t1V3L7fd+4sMBbbJUwPLqL23ZRjvl 4GE7NOC6hGHBMRa0QukTjEb0vw== X-Received: by 2002:a19:7418:0:b0:4cc:73ff:579a with SMTP id v24-20020a197418000000b004cc73ff579amr3664898lfe.38.1678194299039; Tue, 07 Mar 2023 05:04:59 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id w14-20020ac2598e000000b004caf992bba9sm2030548lfn.268.2023.03.07.05.04.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 05:04:58 -0800 (PST) From: Linus Walleij Date: Tue, 07 Mar 2023 14:04:55 +0100 Subject: [PATCH v2 13/16] gpio: omap: Drop irq_base MIME-Version: 1.0 Message-Id: <20230215-immutable-chips-v2-13-d6b0e3f2d991@linaro.org> References: <20230215-immutable-chips-v2-0-d6b0e3f2d991@linaro.org> In-Reply-To: <20230215-immutable-chips-v2-0-d6b0e3f2d991@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,URIBL_BLOCKED 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?1759715380960761822?= X-GMAIL-MSGID: =?utf-8?q?1759715380960761822?= 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 Tue Mar 7 13:04: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: 65455 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2421513wrd; Tue, 7 Mar 2023 05:14:31 -0800 (PST) X-Google-Smtp-Source: AK7set8eH49+foRaF644myHy1eI03jTp65Dzh5TE0NVHli7PEIHNLI8s3kb9d49Wi5YhGnxQ9GBy X-Received: by 2002:aa7:db53:0:b0:4af:6c25:f04b with SMTP id n19-20020aa7db53000000b004af6c25f04bmr13223581edt.13.1678194871481; Tue, 07 Mar 2023 05:14:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678194871; cv=none; d=google.com; s=arc-20160816; b=FQUJ3g+s5QWHg+Q0AV/DgANc9RfThhtEXLgtFdqA0ZdymQYRlOZXUjSx4grleqDzX9 jubyn2WshqhrB1+xIUgWhXM+ZySFkqZ732UOFSFMWDmi66S0USswjRawxDSOE/St1LdD onPiWleghQhs56xWTPG2h3vQts4SuPx7EO/CRD0Wk+7TZ6F2SEOSf5RPNAZG83gkHWeM DbZ17ISg3qWdWaQERokvqxc9wyoZi9HUGizAThsk8oObS/dF+c42cwjgh1V7tJDUDzHb IiTlbJz+NH0a/iPYx/t9y0bkgEYIjeNrwlZXOCEP08Cd5okMOv+ngIys40T/5m4+se6P ATxQ== 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=OW48VjeU2TxGVEeLSc7oAjqd4mYn6U+4SJEdiHOyL6ImBLoXu0F4s8vIFWbOByUIvz PUVRCfKEr9rXOVJ5xTdaocUdZKJhZzsr8w/Ikl0Ig31wiGoz5n9m7kSRRXFsDfF5ckUO 6AGD6KOjMH8/IWz1uJ7YSymMWYfA/6tncqzdcuQOgwgFm6dN9lH+ZAYzuA1n6Xqnvqb6 ukLIwg3Z6/f3mesViywxhj50VbGYyhIyLjFr8qWXjk/PNBsw28xu53VsBkXRETHz9J4K MmNJYzlp4wkZpMEbw6S4xpmHSx813YzQg0/0IK4KTlS9lUjHfmiKjFdyh3Be6r9NzlO4 Xrjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xFksW1uc; 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 w21-20020a056402071500b004ad15de0646si3507066edx.591.2023.03.07.05.14.07; Tue, 07 Mar 2023 05:14:31 -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=xFksW1uc; 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 S230286AbjCGNGp (ORCPT + 99 others); Tue, 7 Mar 2023 08:06:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230267AbjCGNFm (ORCPT ); Tue, 7 Mar 2023 08:05:42 -0500 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 284687B4B7 for ; Tue, 7 Mar 2023 05:05:14 -0800 (PST) Received: by mail-lf1-x135.google.com with SMTP id bi9so17002590lfb.2 for ; Tue, 07 Mar 2023 05:05:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678194300; 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=xFksW1ucR4VOlqND6VFtfCf8TmvKFAMaPgfmp89lUYxRs/sod65QrfiIah7Gh/Dy39 u1yUTnfZG8eABAidi24UpO/uHNb/HrPCEKyWBVqrM4etXND3x8pr2PkwDDULloTm6G0U 7FYs892dZq4G1/2pi5X+pCiqihETM0BZ055oUEhbh5iBVT17MORRCwbHuucrepQR9XKV G2GHTrQefD4prN4B1VTCjuXQlFJ1YUWHxu19RLWtFzIjQOmIDiSYjOPamg/ffYDJK8pE sErqOCZ1CIxpOatarkfbwdhpirqgqiDTVzDqc/j4E0TjqBk5tXkuGpeHuS09pFbq1VI7 vDvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678194300; 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=AwTroZj7fYmliLWJeQvK3IrP3cO3y3hPiMU8wW8F3bIvz+gSTEvJXNJ+qY8J242en5 gRPpEnyRSL4jDE4APNXTNn24iOmuQ3Qaq02myewbTv+6/gKwR48rSBrdGEayUFs8vQTt l/oZvUX/e9bDPbBoztHBWyL+0Cy2cg+87tu4BlCO1PRtDgFmGm6zKsqmg7sBJC8DnTRW Rb1gcUMRMVZuRokdOirzdS31Xyps0jUCQKShxh8FhhIUI6dIsq6jylR+WTDkmKmi2eeR lVWTg290+R45Lfrp1x9Taux2ajeqOJvJ5srawG5sEJJVZQLzBXZst7QPJnsmDBuOoKBq 96Jw== X-Gm-Message-State: AO0yUKXjqiWcYjvx3w6UZhweFg6hBklSL3aSrlB/s0oi0wdk6+TE9e8C gM1SCDI7GdpjBIuW0sn2kfl/XQ== X-Received: by 2002:a05:6512:144:b0:4db:513f:fe2a with SMTP id m4-20020a056512014400b004db513ffe2amr4069156lfo.23.1678194300102; Tue, 07 Mar 2023 05:05:00 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id w14-20020ac2598e000000b004caf992bba9sm2030548lfn.268.2023.03.07.05.04.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 05:04:59 -0800 (PST) From: Linus Walleij Date: Tue, 07 Mar 2023 14:04:56 +0100 Subject: [PATCH v2 14/16] gpio: omap: Convert to immutable irq_chip MIME-Version: 1.0 Message-Id: <20230215-immutable-chips-v2-14-d6b0e3f2d991@linaro.org> References: <20230215-immutable-chips-v2-0-d6b0e3f2d991@linaro.org> In-Reply-To: <20230215-immutable-chips-v2-0-d6b0e3f2d991@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,URIBL_BLOCKED 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?1759714865575049948?= X-GMAIL-MSGID: =?utf-8?q?1759714865575049948?= 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 Tue Mar 7 13:04: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: 65474 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2425793wrd; Tue, 7 Mar 2023 05:22:47 -0800 (PST) X-Google-Smtp-Source: AK7set9EJQo7sD1bj986yiwEQkHuSjt0mwV9OCzH/y2dLIdSzoPyYaKJWorlmCY29ItsrIZv6fhP X-Received: by 2002:a05:6a20:cf54:b0:c0:53f7:7d16 with SMTP id hz20-20020a056a20cf5400b000c053f77d16mr11844319pzb.39.1678195367752; Tue, 07 Mar 2023 05:22:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678195367; cv=none; d=google.com; s=arc-20160816; b=Ocrk8tX4ncpf3xeQwxT2JeK+u976umEWlmHSchd7T6B5DajN+U7jSOrBmoXXYVvAT9 vLigBNZxFEQXQZKiBpwBX8vfj+mBeXqnzPA7vqXrHLqViNBS6PU3Qg4mt6gLdJtrnzGW onmWlRRi7VVf/HIb0gstPvaK7KLXVjSZHq9pIasZ0w9XSaTBIHfoG2fp/V5dATMwrrTz KaeYerwrMAfh91PDA5Uw2N3DCXw3su6hHyl0jOumvk3mqvawYR2PBY0XTz6VFv0LDIuI 1LTT5I4/mbJ32n+DrSjznL7ZieMlbWH5e4OGG3MzFrzTjjGbhiwoM+cFDxRibW0vSPZa RqYA== 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=BFklpaLQ2Sy1KyHG/s4ES/Eei12N4a+GggTai4FH3ZgAvMP1MLN9EyVW4BAdefbb2F 73U8SgGiELTCJj5BOGKXYuGLH2e1C+Vg8/Jar+G6GozH/jfeIpXQ4vRdEfQBen1M3dyH x6stfn4FGQ5+4mRGbbajIH3210aT72wGrXO3vVdyB3YGZKFnTBKNv8vVcsLy1wG6QVMv 9WVpaZ/VsvqilXXBqLZ7tG4eY3u6Gewwt+RhsuayAapXsLxxfiHtKj6Q08osf5C8vYAI eX/zaNLsDt4TFTUmGkhAQlyoUiXpTIKVsib5VJJix//eyE6zuvHP/2IcvNRkGMMUSLnW QCRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WoDr9naT; 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 s3-20020a656903000000b004fb98a13f0fsi11836831pgq.144.2023.03.07.05.22.34; Tue, 07 Mar 2023 05:22:47 -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=WoDr9naT; 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 S230301AbjCGNGt (ORCPT + 99 others); Tue, 7 Mar 2023 08:06:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230284AbjCGNFo (ORCPT ); Tue, 7 Mar 2023 08:05:44 -0500 Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [IPv6:2a00:1450:4864:20::234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A33BA277 for ; Tue, 7 Mar 2023 05:05:16 -0800 (PST) Received: by mail-lj1-x234.google.com with SMTP id t14so13056810ljd.5 for ; Tue, 07 Mar 2023 05:05:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678194301; 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=WoDr9naT88KPAmWtmecnyXyKXIJdxVKHY3fSLJFVbGwG76jmxOMnW1et6daEkqtG8a ihRSCVa77byEIL8HXfej//ovzCXo2+wz4tewtmwIYanbdWMiw1u7VZSjs3FvkhLGWAAz 8bU+ToyGYK5TQqxPFixsNJk3BwPb+xCmOtBb1wfh0vJiixcJpC+jZ6wCUl1pBey1Sfnj 5O+2O/5WrBnQhSh/+P8FR0PuM04bQvZab0oLWH67mE9DsyTdVwceUHDEC87OzrOq7RJH NAeSyLCPgKw2C9ADzYlHWxkINSMPIl1OEVULA0x0k+31OVxFKBls9sFnQoFEVdHaeguW 1tkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678194301; 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=gBC3PpNW7ho6E+2Rnn6AjUlsKlAjuetvKnHsyybmd3IXVn7v6tfjlvTjSuIa7EnTv6 g+mHifsx0ZU0MM5h28xtNcXjWTzPsrXk5+5uQj6sYt+izexcP4CNsxQG/gdWMsolx0td dc7z9JK7Y4TXUTKzuIsyj9B3426gwT/p9JqUgIcxHNRJy5ibb0qyflzWgvhlJvFyoZfz /53hYRGl3sf7/hTeR7kz4xVrHvX/+HDAn7E7VtLBYjejrCKQMe+TEYM/h4rdBzyHVs8j KnTgWtdJlEpSQKcyphIlFLMPlG9FQEODJVUTkzhHZLmQjmloUYsitE3qw4Rz7Yc0+K3B 24GQ== X-Gm-Message-State: AO0yUKVhfdgDhxgrjpm/avNsBfFVJeZhVPKh+606Gv859yl0uKHm5vdP pb+5HDq0y0LekzzINlu4wI3IVA== X-Received: by 2002:a2e:a99b:0:b0:28b:6525:e6b1 with SMTP id x27-20020a2ea99b000000b0028b6525e6b1mr4810829ljq.24.1678194301238; Tue, 07 Mar 2023 05:05:01 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id w14-20020ac2598e000000b004caf992bba9sm2030548lfn.268.2023.03.07.05.05.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 05:05:00 -0800 (PST) From: Linus Walleij Date: Tue, 07 Mar 2023 14:04:57 +0100 Subject: [PATCH v2 15/16] gpio: pci-idio-16: Convert to immutable irq_chip MIME-Version: 1.0 Message-Id: <20230215-immutable-chips-v2-15-d6b0e3f2d991@linaro.org> References: <20230215-immutable-chips-v2-0-d6b0e3f2d991@linaro.org> In-Reply-To: <20230215-immutable-chips-v2-0-d6b0e3f2d991@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,URIBL_BLOCKED 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?1759715386108779163?= X-GMAIL-MSGID: =?utf-8?q?1759715386108779163?= 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 Tue Mar 7 13:04: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: 65475 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2425851wrd; Tue, 7 Mar 2023 05:22:53 -0800 (PST) X-Google-Smtp-Source: AK7set8I/q8v/73m9MSsNjHAyhSCOWE4UqaPJ+BYyiijZPECxuBEL+T2oat9jEC49ylhKQGT7Vh7 X-Received: by 2002:a17:906:d51:b0:886:50d:be8d with SMTP id r17-20020a1709060d5100b00886050dbe8dmr16905398ejh.13.1678195373597; Tue, 07 Mar 2023 05:22:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678195373; cv=none; d=google.com; s=arc-20160816; b=B+fXBoF6kxP0aZHjJVHkuTUUU6+1mG9ON+ACWyBFlzC/+TqtTg/ONprajkyL4/NReY MGhEbFs5TqZqxw2kORWCWmdW57F38U8rGXwGgNKaGJ1F+lmhUQdApY18atRjmbVQcrQl iYzWYelVNmecb4fn8nrArCYCSr1nEEtCRIKcqPI7tmos1W3uAgeHl1waW3qj40z/LWbb R34X29U1UE0eCxpNXb/F4j2bzn4zGmdC5OYY0o8k9tjp0drt/tsKGQVBVdDqXrKAIZYR /QZGCxUBD94RZhxWxJkYeegyaUmEJNePhRWngVijZw5TTD1H18caLNQeNVAkRb6Ekjij TD8Q== 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=wXwk1FovDqDlemR6Y3ZnVM23McXXwCC3RONoLz3WHzBFB7M74B06F1LjCSRPexskyR OcbXCEurlyfWw1mHv9Z2/PZv967Wtf9G4cLJU11caIq4SZKCwo3qNPK5rPfAg8M5rkMx V4juwG4V8C9fM0JdsO3x/SGVX1lXcEw5P+wdAFuqmiiKO9onka3WFEbbjcUoWXxXDkFk NeEpkGpKWwOMuxYp4HMe/HilnzPCjwg+/JiTBkbBEk9OQkLvGqTeioW/XdD0PLZtyDo8 db2cBOrmjMjOL1zhQLn7auIA//j/Mvo9UOURar8KAQ6HKPR/iiYEAvvDJcpXydokvUJ9 QQuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QehD1bhY; 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 i19-20020a170906a29300b008b138238f31si12098152ejz.970.2023.03.07.05.22.30; Tue, 07 Mar 2023 05:22:53 -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=QehD1bhY; 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 S230197AbjCGNHB (ORCPT + 99 others); Tue, 7 Mar 2023 08:07:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230190AbjCGNFs (ORCPT ); Tue, 7 Mar 2023 08:05:48 -0500 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFF627E8A4 for ; Tue, 7 Mar 2023 05:05:19 -0800 (PST) Received: by mail-lf1-x12b.google.com with SMTP id n2so16924624lfb.12 for ; Tue, 07 Mar 2023 05:05:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678194302; 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=QehD1bhYUi9CqVD9QXVP0PtANkHCGauBClYHYYp0hr12HX7h0TkjG6fFMxmn9vm4Fq A0X4es0spCzccWcbPoMxmOrMCNy/A5TG0QfpzMRBydTn0gUeRbHifX49RoaxF28/p4c3 3MPzisEdzqQcDpwFKdn1vn0WbPQoyeWfa56aT8dso6OaTuDQ3wnHvEk04IKND9fyVPLy Q6J9Et8+kF3WOl+6mfaK7yqU8cRBEec7+/1TvJLaC+JdzO19/KWv8b2nUAnoD8s5OhEH /FYgtuMbVw+pao3NUpX0jp4lf0kWuC3tKBRndIYTnNOznEgDVQg2LLCkUfoNy87pvt5c k3cQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678194302; 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=uzMz5R1nYftb+3SoVjKy5rfxqnYT7LS0jiNJkLhCaz5MhM2nG+6TZ98VbYpJSE9mFf 6VZS6H+mhFf4xpmkfBAnW1v6T6FNaVZ6/nO77ccmq0a3CMdtaogRuFUNJhhyt2J8KsfG WPbHfpZeRnGjnUBJVO+qbpeuVMY/Ark3wY62QqjdOAIsQCOA4YQq8aqUD82eSyCz+J4t H0BxXiR9tmTEKnn7EI/B7mxZ8OuL8e8pHbxJMyjZlPnFbUjGjFDgxbBYCPWMQcMQmkdD EfMjNwkBi8QDnl0AEZZ9RZibd+L1DXOis22ZwfWwG4oChqLM/fisSD+Q7cNnVvPgAjnU SaXw== X-Gm-Message-State: AO0yUKUzBVXl38/t55miX8DgNx4Uv3qwoA+o8d7ym0BKOvVjOCDhO98E C39iTETX8TVHCydoEMvRthgCeA== X-Received: by 2002:a19:760e:0:b0:4df:2c71:57fb with SMTP id c14-20020a19760e000000b004df2c7157fbmr4088445lff.43.1678194302348; Tue, 07 Mar 2023 05:05:02 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id w14-20020ac2598e000000b004caf992bba9sm2030548lfn.268.2023.03.07.05.05.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 05:05:01 -0800 (PST) From: Linus Walleij Date: Tue, 07 Mar 2023 14:04:58 +0100 Subject: [PATCH v2 16/16] gpio: pcie-idio-24: Convert to immutable irq_chip MIME-Version: 1.0 Message-Id: <20230215-immutable-chips-v2-16-d6b0e3f2d991@linaro.org> References: <20230215-immutable-chips-v2-0-d6b0e3f2d991@linaro.org> In-Reply-To: <20230215-immutable-chips-v2-0-d6b0e3f2d991@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,URIBL_BLOCKED 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?1759715392414467162?= X-GMAIL-MSGID: =?utf-8?q?1759715392414467162?= 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;