From patchwork Mon Mar 20 09:55:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 665418 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8A53EC7618A for ; Mon, 20 Mar 2023 09:55:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229925AbjCTJz2 (ORCPT ); Mon, 20 Mar 2023 05:55:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229876AbjCTJzY (ORCPT ); Mon, 20 Mar 2023 05:55:24 -0400 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 E28C52054F for ; Mon, 20 Mar 2023 02:55:18 -0700 (PDT) Received: by mail-lf1-x133.google.com with SMTP id y15so14112014lfa.7 for ; Mon, 20 Mar 2023 02:55:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1679306117; 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=iBy8uglh8gI3CtA/oUcnRDs25I4dMI2aaLdEiGdH3E4=; b=VJSWksEl6WxkHvKzPymzEi6mf3ZUeAsMB9WkGKvRi4yYReG0Nz/6sBKaHTNxqci5JY nqhyqfT+O4UI8OcnALy74NJgtnZkDTgmzaryyCzE18tQHFKDZaX/vCyj9bmzq4MQwEqm 7JspHuKpDSc9if5ybl5cxPLcd/u09a8lpVxbPNjMNhC1EVybYUH2BndXo7a2u+IJ12Tg Q1W984RSdg1rOcpmKqad1UkvNu2z1qqFc0ZJCIlsvJj3EI3CeUk2I4EBv1NfTJt/teZh kfeqyDjdd2/ny+QZeNEIVEdYu9QSsg+sQxIsHwHcN+SGVLdMwzvc1TikYc5i4lF/FyMo KnPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679306117; 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=iBy8uglh8gI3CtA/oUcnRDs25I4dMI2aaLdEiGdH3E4=; b=Te1rmijlTRs9nrx7JE5KQlITqobFOtJZ/JFXoFlT+Fll1jDMi20iKqUp5VaCpR+TD2 kCtSWAQnAaFtBXCFgCaMR4FeDRS5kEC8LXByPc5Vd7Cpl2PKBpzDtTNcBHRT442BcQY5 Tg3h47bQa7OwdLXPmqFpAWqKstTEPydfk9RxkDdc3xnejnb0bBrKdFQInQdbCEKr0UfB bmYZXdMAIXKa3i8pu/FmbXv09y3YmTIlluEecqaHsVkbGPh9lWQSM20iurh6sJvSdgX5 drzVFTY1+s6LRO1E5p8j5Wl9z8wv66xT5wZHJjirV8/C+e92zLFJaFB/+j8loqG1LEyH YVGg== X-Gm-Message-State: AO0yUKXXENwSG+DZhBkWOP9g72+jWsQHKRiTMOLRM5RHNgF6KrLwbjXm hmPoV7L5NMP20OnhJ/IbR03VWg== X-Google-Smtp-Source: AK7set9qOc4rmnFzJJmDKRIXSY9dptpUANbsXnl/EmAKnXz6o60CYgbqOnnyCFdeWMHDggShDpHNzg== X-Received: by 2002:a19:ee14:0:b0:4e9:ccff:daa6 with SMTP id g20-20020a19ee14000000b004e9ccffdaa6mr939758lfb.30.1679306117176; Mon, 20 Mar 2023 02:55:17 -0700 (PDT) Received: from [127.0.1.1] ([85.235.12.219]) by smtp.gmail.com with ESMTPSA id c3-20020ac244a3000000b004e792045b3dsm1640104lfm.106.2023.03.20.02.55.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Mar 2023 02:55:16 -0700 (PDT) From: Linus Walleij Date: Mon, 20 Mar 2023 10:55:10 +0100 Subject: [PATCH 3/9] gpio: stmpe: Convert to immutable irq_chip MIME-Version: 1.0 Message-Id: <20230316-immutable-chips-2-v1-3-053d6ede831b@linaro.org> References: <20230316-immutable-chips-2-v1-0-053d6ede831b@linaro.org> In-Reply-To: <20230316-immutable-chips-2-v1-0-053d6ede831b@linaro.org> To: linux-gpio@vger.kernel.org, Bartosz Golaszewski , Manivannan Sadhasivam , Thorsten Scherer , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Pengutronix Kernel Team , Maxime Coquelin , Alexandre Torgue , Robert Richter , Nobuhiro Iwamatsu , Ray Jui , Scott Branden , Broadcom internal kernel review list , Shubhrajyoti Datta , Srinivas Neeli , Michal Simek Cc: linux-arm-kernel@lists.infradead.org, linux-unisoc@lists.infradead.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, Linus Walleij , Marc Zyngier X-Mailer: b4 0.12.1 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Convert the driver to immutable irq-chip with a bit of intuition. Cc: Marc Zyngier Signed-off-by: Linus Walleij --- drivers/gpio/gpio-stmpe.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpio-stmpe.c b/drivers/gpio/gpio-stmpe.c index 0fa4f0a93378..27cc4da53565 100644 --- a/drivers/gpio/gpio-stmpe.c +++ b/drivers/gpio/gpio-stmpe.c @@ -234,6 +234,7 @@ static void stmpe_gpio_irq_mask(struct irq_data *d) int mask = BIT(offset % 8); stmpe_gpio->regs[REG_IE][regoffset] &= ~mask; + gpiochip_disable_irq(gc, offset); } static void stmpe_gpio_irq_unmask(struct irq_data *d) @@ -244,6 +245,7 @@ static void stmpe_gpio_irq_unmask(struct irq_data *d) int regoffset = offset / 8; int mask = BIT(offset % 8); + gpiochip_enable_irq(gc, offset); stmpe_gpio->regs[REG_IE][regoffset] |= mask; } @@ -357,13 +359,15 @@ static void stmpe_dbg_show(struct seq_file *s, struct gpio_chip *gc) } } -static struct irq_chip stmpe_gpio_irq_chip = { +static const struct irq_chip stmpe_gpio_irq_chip = { .name = "stmpe-gpio", .irq_bus_lock = stmpe_gpio_irq_lock, .irq_bus_sync_unlock = stmpe_gpio_irq_sync_unlock, .irq_mask = stmpe_gpio_irq_mask, .irq_unmask = stmpe_gpio_irq_unmask, .irq_set_type = stmpe_gpio_irq_set_type, + .flags = IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, }; #define MAX_GPIOS 24 @@ -511,7 +515,7 @@ static int stmpe_gpio_probe(struct platform_device *pdev) } girq = &stmpe_gpio->chip.irq; - girq->chip = &stmpe_gpio_irq_chip; + gpio_irq_chip_set_chip(girq, &stmpe_gpio_irq_chip); /* This will let us handle the parent IRQ in the driver */ girq->parent_handler = NULL; girq->num_parents = 0;