From patchwork Thu Feb 16 09:37:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 57947 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp203870wrn; Thu, 16 Feb 2023 01:42:01 -0800 (PST) X-Google-Smtp-Source: AK7set+psb3UKXo5MBoYxVpUhiNIkZXdsUzz2eW/0tzyrvobjKF1Mu4WrlSkjKUf0ZGihpbDidy2 X-Received: by 2002:aa7:d95a:0:b0:4ad:6db4:b922 with SMTP id l26-20020aa7d95a000000b004ad6db4b922mr269063eds.14.1676540521134; Thu, 16 Feb 2023 01:42:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676540521; cv=none; d=google.com; s=arc-20160816; b=ixk2K6wBBLc5yowkIoguYIz6Sskyl/iCcn7iJwjzJl3Zw0Ecb9tkhjeMYQHFKD8Wed Yt3hxcJwbfC4Vtu0tvlYMrsHAdkBL9V9F8hCr93rZa3t39VTFWSLW2TTxyzaDGjXF8LO qrsNgCYv3oRV80JbRQtsmirAX7eDWJTolOrlxzuAW6c19ppJrxBWpB3yDyDKwSXSmQuv Pvztw2fYZ4myuyS6tQce2alJCkzHHH0hKUDV4Ggl+f+amLudMWPscd4Vb8zo4Nt/vyuY 7ZRT0NkodwREj7/VUHJEl2mIFZtRF/R7vv36KCYfDiZE0xEmrIeQw7990h5Gu0gBoDKC YjMw== 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=g0M1pC0INpYl+CXS8Dns9xjvleXqdjGQq3X1BFk3EBQ=; b=lQUMc4k/VYC3RNQNCFtWTNGR5QrSLDy65OwwlBi/OIsRQ2BFg1M69obtYYXaJiW4Ge k8if+YTAfmPjiivhbv56LazrOosUQw8qzio7erCMEjnlC0ATCiXkisqZbyAUIbc1ZrNk T0gJKDCkh4I3mHmbVJ9NwaIKW1mRngX0/BJ2TIP+WcRcKfUzm+CfgZHfVCNSr8E5+RNT 4Cwqi4rUSCjnpb5aYu8J/4qLJ4+3dIg/ayFjBsiZitxbwXMEaG9biYR2tDE1RIMl9YEr Ce2jU3KP+oG+zLCzfpvSSqBU2jj6eIzphF2yOILZuqQeTygrzuu4sxT89Q2x8INjf3YJ Dbmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GxKGRRhH; 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 d19-20020aa7d693000000b004ad05b994c3si1622342edr.544.2023.02.16.01.41.37; Thu, 16 Feb 2023 01:42:01 -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=GxKGRRhH; 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 S229517AbjBPJiK (ORCPT + 99 others); Thu, 16 Feb 2023 04:38:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229490AbjBPJht (ORCPT ); Thu, 16 Feb 2023 04:37:49 -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 3D76E4C6C3 for ; Thu, 16 Feb 2023 01:37:22 -0800 (PST) Received: by mail-lf1-x12a.google.com with SMTP id o20so2033253lfk.5 for ; Thu, 16 Feb 2023 01:37:22 -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=g0M1pC0INpYl+CXS8Dns9xjvleXqdjGQq3X1BFk3EBQ=; b=GxKGRRhHLh6q02DnIHnu5KYNkcTneUuEswYrHE39BakqGtlXzlqP6k5Z/Ibb1xVZ9o sB0xYZU81v8ZuuWYlaGGdvr4zOwwG7fYNfQYjgqGAiI9hcWUZjDhymZonSZHfFYD1MCf 7MoAGMSvd2Lho9OUF223H0CUljPdV+nezQSMRa994BlbFF08qxMbIE1BBMawIkcKo/Ms 4KzeQW46uYYY6BGTwqTSqIAoe+cFL0mTniS4TRJrylCanR5O//HCZhRE5kSO3SyM/8Rk yFQgbkDVnQh5PAp+AdJYIiwgKiH3pXwTP2XtYaUZReVh3IJLUn4eS1MEG9BLNljOMZbP CJQQ== 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=g0M1pC0INpYl+CXS8Dns9xjvleXqdjGQq3X1BFk3EBQ=; b=n2nwqyslifHdWgQYh3Tt9BkQDhLFZcsUUVnxjPnuTLXUbFHuhLNdAiuqFuQGIBm1tK IurGrJCemedjyejZ85xEbbjsdsKNs8HBH54vjGtVzXsj94KJl1QybFJRboSQopbIaA0q 0l+snRncqQUX6UwSDPkQtL+JTT9fwfJcHaHkEjz6kwrFuzRIC3XPIptvsfbg64zERKXX ZtjPbkcDYQh7wx8cIc8fCOCvZFtYw2qbpSpV7LczNSK2G9Sn2f7YFCRx4kOYLO6THBsW G7YKRcdO2N9j5XzF/I+IFl5KKkgJKoL+sQ0u/Umx5/NvkhyNkCp9QGRJ/eKPW+atnyQa VSNg== X-Gm-Message-State: AO0yUKUrGU3jQyubY02VGiZqq1O+SZ4WDu4TlEoz1VjjIZI8U57epjyR KRB4bxHRHIQFniCy2TJACpyNOA== X-Received: by 2002:ac2:44ab:0:b0:4d8:8ad1:a05f with SMTP id c11-20020ac244ab000000b004d88ad1a05fmr1234138lfm.48.1676540240506; Thu, 16 Feb 2023 01:37:20 -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.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Feb 2023 01:37:20 -0800 (PST) From: Linus Walleij Date: Thu, 16 Feb 2023 10:37:14 +0100 Subject: [PATCH 13/17] gpio: max732x: Convert to immutable irq_chip MIME-Version: 1.0 Message-Id: <20230215-immutable-chips-v1-13-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=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?1757980153784443740?= X-GMAIL-MSGID: =?utf-8?q?1757980153784443740?= Convert the driver to immutable irq-chip with a bit of intuition. Cc: 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;