From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CABA6CF31AF for ; Wed, 2 Oct 2024 10:31:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: Message-ID:Date:References:In-Reply-To:Subject:Cc:To:From:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=6PJVrnVEM5cfMb5vScxdTKMt9fhDfO9Z+hAavmEhwIU=; b=RdUDmcFExjfmdzFuwDcCP9Vs+E PDu9ziqDEcKVQGje3rBaiG4KQGKhgcmNdBsVfs99yq+OlP2ULcBq4gWOlYiHNM+2gro5DzL/t04qa YuBZxQxhWBxDZhehe0qaWTk8vW/HYIzwbLe9gB8OCuimPTiz5Wt+cDNTJ3hOvq/JownzeYntdj7g1 UsiOcGDlBkkKAjU0tudZfFesOFK0aTDzbt4+e1OrDb3vMaWSbj1OcbUXLTsz3y9Do0k4CmoI1S/AT eBhDwnxQZ0ZVulBfx8kg7FnmChZhEiOIPIs4h5k4j6gzG/1MbhsLnLmcyGGyDvJp2ipyiSj0y5vOG 9yeRn7dA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1svwdd-00000005UvQ-3n56; Wed, 02 Oct 2024 10:31:21 +0000 Received: from galois.linutronix.de ([2a0a:51c0:0:12e:550::1]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1svwc0-00000005UZl-3mcy for linux-arm-kernel@lists.infradead.org; Wed, 02 Oct 2024 10:29:45 +0000 From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1727864979; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=6PJVrnVEM5cfMb5vScxdTKMt9fhDfO9Z+hAavmEhwIU=; b=yB1oAT7E1XlN630uOzFK88nJIYEI99pPkqNC7MzylFVOj1IHHLL4wQdAvyaZyP4PagTpOx bxnuVy3hPxeaRunRUQWRz7PLnx8jC0XM/QBipRCtwDXt5yk/GnTnLgawl6+Jpj357eInF4 feHK1LkX8aAxPoSFSnq6FIiAbwkHqopcOJoxhHy670GOTPC6bBLMxPFLRA0TkjO6QuHrgM dnySzEfNcKCD4u6/Ie7tYBxX+e2CISpmNjazTC0R1oQIBq9Ylik81p5JcGwgXjOL58GSxN 55PJEsrPb5JN7Vz1JoYqp0HGychuDbfIpdbgbOUe0N70jPiGXLaRsgrf6hFtoQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1727864979; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=6PJVrnVEM5cfMb5vScxdTKMt9fhDfO9Z+hAavmEhwIU=; b=MhIpu/cax/LLZ8lM46QyQvLchwXnRKNKa5cv+msYl2uLTyj87E3kBnHwolI8nutZOK39SI uCKJQkyTfUQG9jCQ== To: Arturs Artamonovs via B4 Relay , Catalin Marinas , Will Deacon , Greg Malysa , Philipp Zabel , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Utsav Agarwal , Michael Turquette , Stephen Boyd , Linus Walleij , Bartosz Golaszewski , Andi Shyti , Greg Kroah-Hartman , Jiri Slaby , Arnd Bergmann , Olof Johansson , soc@kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-clk@vger.kernel.org, linux-gpio@vger.kernel.org, linux-i2c@vger.kernel.org, linux-serial@vger.kernel.org, Arturs Artamonovs , adsp-linux@analog.com, Arturs Artamonovs , Nathan Barrett-Morrison Subject: Re: [PATCH 11/21] irqchip: Add irqchip for ADI ADSP-SC5xx platform In-Reply-To: <20240912-test-v1-11-458fa57c8ccf@analog.com> References: <20240912-test-v1-0-458fa57c8ccf@analog.com> <20240912-test-v1-11-458fa57c8ccf@analog.com> Date: Wed, 02 Oct 2024 12:29:38 +0200 Message-ID: <87ed4yyezx.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241002_032941_243280_64F56E5D X-CRM114-Status: GOOD ( 22.18 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Sep 12 2024 at 19:24, Arturs Artamonovs via wrote: > From: Arturs Artamonovs > > Support seting extra indepdendent interrupt on pin activity. So the subject says it adds a new interrupt chip. Now the changelog mumbles about support of something extra. Please describe your changes properly and explain what this is about. Also spell check your change log. > +struct adsp_pint { > + struct irq_chip chip; > + void __iomem *regs; > + struct irq_domain *domain; > + unsigned int irq; https://www.kernel.org/doc/html/latest/process/maintainer-tip.html#struct-declarations-and-initializers And please read and follow the rest of that document too. > + * This relies on the default configuration of the hardware, which we do not > + * expose an interface to change. > + */ > +int adsp_attach_pint_to_gpio(struct adsp_gpio_port *port) Where is this function declared and where is it used? > +static void adsp_pint_dispatch_irq(struct irq_desc *desc) > +{ > + struct irq_chip *chip = irq_desc_get_chip(desc); > + struct adsp_pint *pint = to_adsp_pint(chip); > + unsigned int type = irqd_get_trigger_type(&desc->irq_data); > + u32 pos = BIT(desc->irq_data.hwirq); > + > + /* for both edge interrupt, toggle invert bit to catch next edge */ > + if (type == IRQ_TYPE_EDGE_BOTH) { > + u32 invert = readl(pint->regs + ADSP_PINT_REG_INVERT_SET) & pos; > + > + if (invert) > + writel(pos, pint->regs + ADSP_PINT_REG_INVERT_CLEAR); > + else > + writel(pos, pint->regs + ADSP_PINT_REG_INVERT_SET); What protects pint->regs against concurrent modifications? > +static void adsp_pint_irq_mask(struct irq_data *d) > +{ > + struct adsp_pint *pint = irq_data_get_irq_chip_data(d); > + > + writel(BIT(d->hwirq), pint->regs + ADSP_PINT_REG_MASK_CLEAR); Same question. > +static int adsp_pint_probe(struct platform_device *pdev) > +{ > + struct device *dev = &pdev->dev; > + struct device_node *np = dev->of_node; > + struct adsp_pint *pint; > + > + pint = devm_kzalloc(dev, sizeof(*pint), GFP_KERNEL); > + if (!pint) > + return -ENOMEM; > + > + pint->regs = devm_platform_ioremap_resource(pdev, 0); > + if (IS_ERR(pint->regs)) > + return PTR_ERR(pint->regs); > + > + pint->chip.name = "adsp-pint"; > + pint->chip.irq_ack = adsp_pint_irq_ack; > + pint->chip.irq_mask = adsp_pint_irq_mask; > + pint->chip.irq_unmask = adsp_pint_irq_unmask; > + pint->chip.irq_set_type = adsp_pint_irq_set_type; > + // @todo potentially only SEC supports wake options, not gic > + > + // @todo determine if we actually need a raw spinlock This should have been determined before posting, no? > + pint->domain = irq_domain_add_linear(np, ADSP_PINT_IRQS, > + &adsp_irq_domain_ops, pint); devm_irq_domain_instantiate() > + if (!pint->domain) { > + dev_err(dev, "Could not create irq domain\n"); > + return -EINVAL; > + } > + > + pint->irq = platform_get_irq(pdev, 0); > + if (!pint->irq) { > + dev_err(dev, "Could not find parent interrupt for port\n"); > + return -EINVAL; Then this would not leak the interrupt domain. Also why is this not checked _before_ instantiating the domain? > +static int __init adsp_pint_init(void) > +{ > + return platform_driver_register(&adsp_pint_driver); > +} > + Pointless new line > +arch_initcall(adsp_pint_init); > + > +MODULE_DESCRIPTION("Analog Devices IRQChip driver"); > +MODULE_LICENSE("GPL v2"); > +MODULE_AUTHOR("Greg Malysa "); > \ No newline at end of file This message has a meaning, no? Thanks, tglx