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;