From patchwork Fri Dec 1 09:56:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mateusz Majewski X-Patchwork-Id: 13475590 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 8C7BEC46CA0 for ; Fri, 1 Dec 2023 09:57:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:References:MIME-Version:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=PQAJg83vUCKCQ8Gh8Eum7pa3NH/4Kjt3fduFBSjOBGI=; b=afSEGG8HiBZ1RK XBMfLdXZ7Q6zXXRu/BX4E5UFO3iiC0AFhS5Jx7DqHvQv+IwKP2uXGj4bgAbt2Z/Mh7WnS4CS9k/9G jis31/Rx4mfR6nj/JwbrYPrV0e/jMPrDq7TLyoxciMVepCeTWiSqkZtl5xy51INySjBxA1L/h2xWz QnjeLfPwzmBB0LwsqsH76n6kNqahBEG5PUbCaGF2i93n6xEcpSGD+j4Cww6PTDXH5eoW8m+tEEmTe gi131nwjaxMbn/h3A1sAJhtYdQ8FbsGfyq/u7CGtepzYly84quMsUG/2PSotGRhs8QgUAbo+aP8kw Oggcsa3wbCFFSFf3StjA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r90GT-00D8zm-05; Fri, 01 Dec 2023 09:56:53 +0000 Received: from mailout1.w1.samsung.com ([210.118.77.11]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r90GM-00D8uc-0Q for linux-arm-kernel@lists.infradead.org; Fri, 01 Dec 2023 09:56:50 +0000 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20231201095643euoutp0137aa5d07865ddf701f2b94e602e8c023~crKmsW9UU3221632216euoutp013 for ; Fri, 1 Dec 2023 09:56:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20231201095643euoutp0137aa5d07865ddf701f2b94e602e8c023~crKmsW9UU3221632216euoutp013 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1701424604; bh=z+drqHSTXutvqyghqqSngnAvaJMAvU0O0c1Ke0HntPc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K3HjacCitpbsvAAArshg5c4PSE7wFI7byH4NgQMIp/wHpp3stCE6RPypJpEqe0JiW vXixjGjf3o/v9S5+LtskZXXaEGm+u8NfBzfxDxYwRBbDhw135lOWZ8h/mtmlphNb/R RAxgi6IxMobMRSpfabJiSxHN+0EhYTiGnImaHy/Y= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20231201095643eucas1p248111e49847cdb4b7ffd5e7933f55425~crKmTenTx2503225032eucas1p2K; Fri, 1 Dec 2023 09:56:43 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id C4.FF.09552.BDDA9656; Fri, 1 Dec 2023 09:56:43 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20231201095642eucas1p13b5699805523f9afcf6d4034e1b838b2~crKlwCaxA0245502455eucas1p1G; Fri, 1 Dec 2023 09:56:42 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20231201095642eusmtrp1f90b9537441ea0e19c34183c6f809ffa~crKlvZNCU0736407364eusmtrp15; Fri, 1 Dec 2023 09:56:42 +0000 (GMT) X-AuditID: cbfec7f5-853ff70000002550-83-6569addba546 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 66.20.09146.ADDA9656; Fri, 1 Dec 2023 09:56:42 +0000 (GMT) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20231201095641eusmtip2eb358f372ab5769c2c5640d3ac5e896a~crKk2NVYP1302313023eusmtip2T; Fri, 1 Dec 2023 09:56:41 +0000 (GMT) From: Mateusz Majewski To: linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Mateusz Majewski , Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Alim Akhtar , Liam Girdwood , Mark Brown , Marek Szyprowski , Lukasz Luba , Dan Carpenter Subject: [PATCH v6 3/9] thermal: exynos: switch from workqueue-driven interrupt handling to threaded interrupts Date: Fri, 1 Dec 2023 10:56:19 +0100 Message-ID: <20231201095625.301884-4-m.majewski2@samsung.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231201095625.301884-1-m.majewski2@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrLKsWRmVeSWpSXmKPExsWy7djPc7q312amGvzaJWXxYN42NovD8yss pj58wmbxfct1JosP81rZLeZ9lrXY+3oru8W3Kx1MFpseX2O1uLxrDpvF594jjBYzzu9jsljY 1MJuMfHYZG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aHLzFS YinOSDTUYi4qTgQAK7MZXlMDAAA= X-CMS-MailID: 20231201095642eucas1p13b5699805523f9afcf6d4034e1b838b2 X-Msg-Generator: CA X-RootMTR: 20231201095642eucas1p13b5699805523f9afcf6d4034e1b838b2 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20231201095642eucas1p13b5699805523f9afcf6d4034e1b838b2 References: <20231201095625.301884-1-m.majewski2@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231201_015646_698842_48644F4C X-CRM114-Status: GOOD ( 17.45 ) 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 The workqueue boilerplate is mostly one-to-one what the threaded interrupts do. Reviewed-by: Krzysztof Kozlowski Signed-off-by: Mateusz Majewski --- v1 -> v2: devm_request_threaded_irq call formatting change. drivers/thermal/samsung/exynos_tmu.c | 29 +++++++++------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 4ff32245d2a9..c144592d4584 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -142,7 +142,6 @@ enum soc_type { * @base_second: base address of the common registers of the TMU controller. * @irq: irq number of the TMU controller. * @soc: id of the SOC type. - * @irq_work: pointer to the irq work structure. * @lock: lock to implement synchronization. * @clk: pointer to the clock structure. * @clk_sec: pointer to the clock structure for accessing the base_second. @@ -175,7 +174,6 @@ struct exynos_tmu_data { void __iomem *base_second; int irq; enum soc_type soc; - struct work_struct irq_work; struct mutex lock; struct clk *clk, *clk_sec, *sclk; u32 cal_type; @@ -763,10 +761,9 @@ static int exynos7_tmu_read(struct exynos_tmu_data *data) EXYNOS7_TMU_TEMP_MASK; } -static void exynos_tmu_work(struct work_struct *work) +static irqreturn_t exynos_tmu_threaded_irq(int irq, void *id) { - struct exynos_tmu_data *data = container_of(work, - struct exynos_tmu_data, irq_work); + struct exynos_tmu_data *data = id; thermal_zone_device_update(data->tzd, THERMAL_EVENT_UNSPECIFIED); @@ -778,7 +775,8 @@ static void exynos_tmu_work(struct work_struct *work) clk_disable(data->clk); mutex_unlock(&data->lock); - enable_irq(data->irq); + + return IRQ_HANDLED; } static void exynos4210_tmu_clear_irqs(struct exynos_tmu_data *data) @@ -812,16 +810,6 @@ static void exynos4210_tmu_clear_irqs(struct exynos_tmu_data *data) writel(val_irq, data->base + tmu_intclear); } -static irqreturn_t exynos_tmu_irq(int irq, void *id) -{ - struct exynos_tmu_data *data = id; - - disable_irq_nosync(irq); - schedule_work(&data->irq_work); - - return IRQ_HANDLED; -} - static const struct of_device_id exynos_tmu_match[] = { { .compatible = "samsung,exynos3250-tmu", @@ -1023,8 +1011,6 @@ static int exynos_tmu_probe(struct platform_device *pdev) if (ret) goto err_sensor; - INIT_WORK(&data->irq_work, exynos_tmu_work); - data->clk = devm_clk_get(&pdev->dev, "tmu_apbif"); if (IS_ERR(data->clk)) { dev_err(&pdev->dev, "Failed to get clock\n"); @@ -1093,8 +1079,11 @@ static int exynos_tmu_probe(struct platform_device *pdev) goto err_sclk; } - ret = devm_request_irq(&pdev->dev, data->irq, exynos_tmu_irq, - IRQF_TRIGGER_RISING | IRQF_SHARED, dev_name(&pdev->dev), data); + ret = devm_request_threaded_irq(&pdev->dev, data->irq, NULL, + exynos_tmu_threaded_irq, + IRQF_TRIGGER_RISING + | IRQF_SHARED | IRQF_ONESHOT, + dev_name(&pdev->dev), data); if (ret) { dev_err(&pdev->dev, "Failed to request irq: %d\n", data->irq); goto err_sclk;