From patchwork Thu Feb 16 09:37:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 57942 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp203615wrn; Thu, 16 Feb 2023 01:41:14 -0800 (PST) X-Google-Smtp-Source: AK7set9qLuJIAZD01EYsI106uCIh8xdyaqI5FNfB+LIqRp0vc6Og8BGRGUzJTtfVxd65wNxheE6U X-Received: by 2002:a05:6402:885:b0:4ac:ce81:9c1a with SMTP id e5-20020a056402088500b004acce819c1amr5008001edy.13.1676540474434; Thu, 16 Feb 2023 01:41:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676540474; cv=none; d=google.com; s=arc-20160816; b=fp6CQ92oEtFwlqsc+m60oSKkjFTJq8dJ0w4Ro0FaRM6KcX0HdSj+rty+tIidTrrjC7 VffLeL8UTpDNPKXlGU4oW2s950xt8EE3mlpnmYkaYNlLhwJ8SNG7ZcKQh5e4K/ZetFVE ympjyPA7xJpI23Dm5LcGfyjORC1oPvss18czf9zYsyNZ2NzUxXX5Xn9GbmhTKSZmX2XG zmvhqYw846zo9tR7wk8LPgf16IYw4EwzTr89twzK8jS7BjGBiBP7AIgDFzmS/w6nPVNm vDxaMOfHWcl9kJg4Sd+1xMmDB5LVvBb31ag9pJY5vAILDjKwfKeSIxNI/fG1kfPGScdO QT9Q== 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=hXmJn+K3Vz/15Sqwyaox25jzy6Vyc7x15lGcSP8/NaY=; b=wlMIG+eNvPOJR/rb65yAEcXADzbe01RZ7+d940/XjhnZKAx3tbLbFtxVzFv6u+MY4q JzIVTd8UJTFINRJsO/t3RyY59ozSkDe8HvV2Y+bGbmZi2XQ7m+llWSXf9p/xKFW/MWNM Wf0FcmsQgzULQWvgS+SPYZEUf0CzWrngZhC7xy1AuSme4gQqeD+d8Kx5OOMRKYHPVE95 STt3RDrTN+5KqigVtLqWe5WZwXOfoIDYs8i0GqZ6OTWqOd4NkFuZZbSAYzAxc8QG7Jyy duIR3TqXwDmpxHPqxt1zjFpjSH2/9qv4cX2rqKaiEHUQxaFf/7ddXGB6RZBMclsiQBWt tzhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=x9R24WT7; 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 j2-20020a50ed02000000b004acdc22b44fsi1697780eds.103.2023.02.16.01.40.51; Thu, 16 Feb 2023 01:41:14 -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=x9R24WT7; 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 S230131AbjBPJhd (ORCPT + 99 others); Thu, 16 Feb 2023 04:37:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230090AbjBPJhW (ORCPT ); Thu, 16 Feb 2023 04:37:22 -0500 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5979D4DBDC for ; Thu, 16 Feb 2023 01:37:14 -0800 (PST) Received: by mail-lf1-x130.google.com with SMTP id c20so2024331lfv.6 for ; Thu, 16 Feb 2023 01:37:14 -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=hXmJn+K3Vz/15Sqwyaox25jzy6Vyc7x15lGcSP8/NaY=; b=x9R24WT7DLFj5wDQ2WTnH9aFyJaEV4l8z7iYVqag/tu3hR12ACANpeBqKenMIbmHnc zVKOTOiASbVkg+B+5i/dGYpFVb6ERiZfwahT6KLQfutXUWoqaM25sfOf/q8thr6ObVNX W46iyg8o7oZbHUcj8ZKOSLeoLOQ5Z/P3t+WsacKTjSDbNPE1pUTcV/sQslkY9MQujRAn 24FSu0r9zjALfDvTvMY846sQkkRprAOHI2irYCGLxeBtQ+JoCD6KELQ+FfvUN16f8mpV ZIDh0uJG3UjKAw8CYbxJDIsQsKWN6KnfiDTKPAI8pBGE4FGtt3QZuhK3cdFAIFNgfxxI 7y2g== 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=hXmJn+K3Vz/15Sqwyaox25jzy6Vyc7x15lGcSP8/NaY=; b=esVJAmTHmdp1deI+WqnVls275Vi7WJwuCJxUAZN6H0s9BHXoQoEYYwLqpPfrDEYE4f 5oxie6UG1GNG/BgTDchMiQYr+YCo8eBPXuKeToRo6bf0sGL9+Q2y8LnqbuTXKmYSRLFb v8jb65Z5gRtKdDHGoJTqyZhH28FAygk17WEdckyuhYo8UsJm//kclB1ljRW/I15P+MlZ zwfKIJNpshG4d38tMCzq3vefS+uAvMFPzFfGed2ph6YBUnM7FyhT//Ra08DfUB+qdKlK 3Z6elK6gDZXCBCk7fS506On7HraT6a9ARexW8ZiEKKAt2wzWzMNln6r7nees3Su3ZBEE POCQ== X-Gm-Message-State: AO0yUKWj0SCXp/qW2UrnEI5qTtNVlDQV1O5esuEwFuARjIFdpoKG/31w pzDW+E1HKYAc4GFay1vkJtiwfg== X-Received: by 2002:a05:6512:501:b0:4b5:83b8:2c49 with SMTP id o1-20020a056512050100b004b583b82c49mr1398648lfb.1.1676540233907; Thu, 16 Feb 2023 01:37:13 -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.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Feb 2023 01:37:13 -0800 (PST) From: Linus Walleij Date: Thu, 16 Feb 2023 10:37:09 +0100 Subject: [PATCH 08/17] gpio: hisi: Convert to immutable irq_chip MIME-Version: 1.0 Message-Id: <20230215-immutable-chips-v1-8-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?1757980104573717438?= X-GMAIL-MSGID: =?utf-8?q?1757980104573717438?= 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 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;