From patchwork Thu Feb 16 09:37:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 57939 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp203543wrn; Thu, 16 Feb 2023 01:41:05 -0800 (PST) X-Google-Smtp-Source: AK7set/GI1lLSHtbS5SJJ7gb9z7ZH/GFAJCtPMONhoQ5ePZRK03vlFMCCUu/7rm7QaEN3VNAxjDJ X-Received: by 2002:a17:906:184d:b0:8af:54d2:2088 with SMTP id w13-20020a170906184d00b008af54d22088mr4834016eje.37.1676540464922; Thu, 16 Feb 2023 01:41:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676540464; cv=none; d=google.com; s=arc-20160816; b=tzmeHQy6sFBN84wgRK1W2PguK6aWoQTOb0uGTDI06G/woj6JjvZyau5syDF6KL49ei A/82YSpWjeBJpXX8zw92ylYn1C6r6Az6f2uCOnqMAmpz4iWyOalRK9kyRa8PUY30NTg0 Ey1x7tx1jecOz6A5wYENwKpxPkDnbsGTzwd4jijqx8KtryvSeJN63q8zn4UwaYaHVOXT XOovXTXjSiEaYRsMaWrMvQpiUwgMwgGdwuq+TwA/PenBffgSgoN/v0hmKvdPwWBh5qfV 1s/GVugg2hwgQoku6mdoBO+H2vv/rQP8qe2dBwLaEPO9z0al/Ya9OOgRDxHpdAvvJHwV xPLQ== 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=oTDvGM9p1jJCryqrt+aMoXej/NnnEuuvfQsw+EzO32s=; b=uyKldkgyMmEEBtMzKNte+Kpfc8kBCYpEDDb+ootOQyCs5Ay2LFTF/WqsropunwL/6n tVFfPyxPX6BQ7XrJ8+23OGL198GRqHD8b9jMdKfSqbteFssCfN17mkUyb1RUwT0yp//p DYhy3nm6Xl0Pu1acGLjmgpfWb7kgKL8xbqUA4LI2WMD3cjMslgskixDNNvBornJoq1ON /B/jGuWQPn0bamD8okuCDEsfn8kVgga8fLqfG2yAXJpl/+rdx+ipB4KHWcXi255kv9sz QqI6Fo0M1yG+/N9N7T9i5m6rTzV9CTYrC7mPXTqjdhdE2zz/0NwH1dsnl9UXUzS/Qo3/ FuNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=y2mQvmmU; 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 v25-20020a17090610d900b00882423d0b7fsi1521950ejv.779.2023.02.16.01.40.42; Thu, 16 Feb 2023 01:41:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=y2mQvmmU; 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 S230058AbjBPJhO (ORCPT + 99 others); Thu, 16 Feb 2023 04:37:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229554AbjBPJhJ (ORCPT ); Thu, 16 Feb 2023 04:37:09 -0500 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 639B63E623 for ; Thu, 16 Feb 2023 01:37:08 -0800 (PST) Received: by mail-lf1-x133.google.com with SMTP id c20so2023968lfv.6 for ; Thu, 16 Feb 2023 01:37:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=oTDvGM9p1jJCryqrt+aMoXej/NnnEuuvfQsw+EzO32s=; b=y2mQvmmUVj3HR0h5kau6zCrKsh4HXqe/j4fug+zGCIRzs7GU3A0y8VkVmN/AnB4t+I Rkdjb2Znj4eZUteiBWpj0wCeSBmKzOqWYDccpcouTRnGsszTJVYP+8lwINCQ+u3lx+0I PE5VPgdzWxC/djxtmhCEwjGPrMT8ug832gann1eOu+EjyS8Y1Iym3kNGwmDGaOdWCIDe UOwuAe5FEW3xV9Ag6i//giVsAR7eWTT4NNz/gv5lpwaH0uIqcNGULCo6FAG41MHbhnNO 1BMKNh/xGUkN3eFlxy3jMFR3hhNnJ/uspr9BEr3wGz5WDeF7+yJkoOmdUk7xBoP+HKlo GUww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=oTDvGM9p1jJCryqrt+aMoXej/NnnEuuvfQsw+EzO32s=; b=t1JExgo2ecx/wRsXzBgP92dn+orkf42m9KFiR8DeEo3k0O4Dx2jHAEH+uM51l9VxFs v/H18e2ZyEL/iw5CuVlwLXifOAN/HheoKZNcI8gaJtEPWFdlRzaQx4CuhBLmgO9NXAID JpuStl6r6GkF1o7J3XJ6kty8SU3hiXXRDBtYYB3KiCK6lY4Mds5uXWXh2OSkT1bNUHTL yb8b9+erJ+caj77CbEwEmijD9MiOpnmvxAihEmJMnbsvVXAMWs3YvflntgzvLwPtawzD UHVJzN0GQEwHSikm6Y2zYa4+SkOJxvaDFEfKOd1jy/cM2V6U5mzf8V8qhbxVCke1IPsn uifg== X-Gm-Message-State: AO0yUKWJdEP5mAlN0peO9n3IJxNqcpV7/rCnpyjGYcYN2byrYQcx+FrJ 00TggWuq3FLLpVIUjPAnrPxzaw== X-Received: by 2002:ac2:4c29:0:b0:4b3:d6e1:26bb with SMTP id u9-20020ac24c29000000b004b3d6e126bbmr1460112lfq.29.1676540226776; Thu, 16 Feb 2023 01:37:06 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id r3-20020a19ac43000000b004d8758a452asm229069lfc.288.2023.02.16.01.37.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Feb 2023 01:37:06 -0800 (PST) From: Linus Walleij Date: Thu, 16 Feb 2023 10:37:03 +0100 Subject: [PATCH 02/17] gpio: adnp: Convert to immutable irq_chip MIME-Version: 1.0 Message-Id: <20230215-immutable-chips-v1-2-51a8f224a5d0@linaro.org> References: <20230215-immutable-chips-v1-0-51a8f224a5d0@linaro.org> In-Reply-To: <20230215-immutable-chips-v1-0-51a8f224a5d0@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 , Grygorii Strashko , Santosh Shilimkar , Kevin Hilman , William Breathitt Gray Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-omap@vger.kernel.org, Linus Walleij , Marc Zyngier X-Mailer: b4 0.12.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757980094385130105?= X-GMAIL-MSGID: =?utf-8?q?1757980094385130105?= Convert the driver to immutable irq-chip with a bit of intuition. Cc: 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;