From patchwork Tue Oct 3 11:16:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mateusz Majewski X-Patchwork-Id: 13407468 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 57F0CE7544D for ; Tue, 3 Oct 2023 11:17:39 +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=ORqL8VZEJh19YxrHW6jPI1rCZFrH0bqlYutO9hKPTRQ=; b=0cgUv9mnICO2QN tzzM5KpoUlEbDrbeoGPP5ZxP1YG1OGAJr6lhxaZaIgAlLzKnAD6P5iH0xP/k4QSiFquuJXqJJpF9k Q7mgDcw1gvQ7uZWULGcdmgKwbxxD3nZFUrV7TmjlujJYehGoDRSepD1JZEh60I4xq+kwDO2yJHU47 JksKM8Or9LLz+k6NwCXVBb0A9h5udSz4gXIAPPfpk8ZdCnJlZ/UTL1uSRAbqF/uUcu+Zy0Z0K0Idc yYh3KStn6cH27VvaUkF8ICynB2+n6GuHGPA5JJrQd9gaybk92/V7ai9ajhS9mYz2NHPR6GR+HTCo5 DH4RSnM0B6OCYLLtEh9g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qndOu-00EVrG-2T; Tue, 03 Oct 2023 11:17:16 +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 1qndOo-00EVnj-1I for linux-arm-kernel@lists.infradead.org; Tue, 03 Oct 2023 11:17:13 +0000 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20231003111709euoutp013e7363461676ac3702637f7af0730a7b~KlM_k0E-A1147311473euoutp01r for ; Tue, 3 Oct 2023 11:17:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20231003111709euoutp013e7363461676ac3702637f7af0730a7b~KlM_k0E-A1147311473euoutp01r DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1696331829; bh=CCUmjPvJE2taTRrp0O0mccb79s4/56wbyFNyGnHqHRc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hdgk0t288TFpR1FJtTet88IP1k8jyy4ZmQZvIR0sdSwoOqvfVz9slUUpdymDO12bM 3wANaMwqSF9btZm4RMG0rV2c3GOiqz8pbGLda7AO57/N0P5Omv3osJEymEfJJuu2na Q6WyQb7WIHGLl0/G4+IGSZeeafUHIy7LPwkfNrZY= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20231003111708eucas1p220d81655676ed79d728ea5a48ab2000a~KlM_I96U70665806658eucas1p2K; Tue, 3 Oct 2023 11:17:08 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 75.14.11320.438FB156; Tue, 3 Oct 2023 12:17:08 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20231003111708eucas1p29eebdad45a2eae16148c9a5dbbcd47eb~KlM9ueQt_2873428734eucas1p2J; Tue, 3 Oct 2023 11:17:08 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20231003111708eusmtrp1557c1b9222630af8ae63b55e44a6e735~KlM9ttFgI2246422464eusmtrp1Z; Tue, 3 Oct 2023 11:17:08 +0000 (GMT) X-AuditID: cbfec7f4-97dff70000022c38-37-651bf8347486 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 3A.D1.10549.438FB156; Tue, 3 Oct 2023 12:17:08 +0100 (BST) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20231003111707eusmtip27cb19697124906ee428f70d4b9f2ccf5~KlM874NuU2773227732eusmtip2e; Tue, 3 Oct 2023 11:17:07 +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 Subject: [PATCH v3 3/8] thermal: exynos: switch from workqueue-driven interrupt handling to threaded interrupts Date: Tue, 3 Oct 2023 13:16:29 +0200 Message-ID: <20231003111638.241542-4-m.majewski2@samsung.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231003111638.241542-1-m.majewski2@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrHKsWRmVeSWpSXmKPExsWy7djPc7omP6RTDd5f1LB4MG8bm8Xh+RUW Ux8+YbP4vuU6k8W8z7IWe19vZbf4dqWDyWLT42usFpd3zWGz+Nx7hNFixvl9TBYTj01mtlh7 5C67xdwvU5ktnjzsY3Pg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f738Fg8mLeNzeLw/AqL qQ+fsFl833KdyWLeZ1mLva+3slt8u9LBZLHp8TVWi8u75rBZfO49wmgx4/w+JouJxyYzW6w9 cpfdYu6XqcwWTx72sTnwe+ycdZfdY/Gel0wem1Z1snncubaHzWPzknqPvi2rGD0+b5ILYI/S synKLy1JVcjILy6xVYo2tDDSM7S00DMysdQzNDaPtTIyVdK3s0lJzcksSy3St0vQy3hyrpGx YI9kxa6j7ewNjJNEuxg5OSQETCR2Hf3D1sXIxSEksJRR4vT1b6wQCWmJw1+msEPYwhJ/rnVB FTUzSfT37mQCSbAJGEg8eLOMHSQhItDJKNG1+RxYglngFrPE/ddaXYwcHMIC+RL/LqmChFkE VCVaVlwEG8orYCvRdqQLapm8xJ5F38FaOQXsJFb+XA5mCwHV3Fq+jwWiXlDi5MwnLBDj5SWa t85mnsAoMAtJahaS1AJGplWMIqmlxbnpucWGesWJucWleel6yfm5mxiBMbft2M/NOxjnvfqo d4iRiYPxEKMEB7OSCG/YUalUId6UxMqq1KL8+KLSnNTiQ4ymQHdPZJYSTc4HRn1eSbyhmYGp oYmZpYGppZmxkjivZ0FHopBAemJJanZqakFqEUwfEwenVAPTVLed7NcCbkqWTphyKNlkuku3 l+TM++8ESsRb8378VCxS/3rxzmyBtLRPU7e88lheksMqy237dtK7F8/N7t5q9/8aaFxe+enN Lv1bHKcLHm6e+XquVg7zrWLvmE0bb00WilvxZxFLm+OilwKXc9bnlGwOOFHzKUUl5eEnoTt7 FVl7LP07V7b3VhnaL3v54FukxrqzzeXhx5JXca4QFDt2+GPN4/2BKx/39Gxdo5PNdqvU7c+7 vlf/I+tqb/uqzchL0pRo/uhv7HvyyTXOjTn/jixvKNSc+HZVyeyK0//MuJr69P95rFwR9POn GpOPafj9kC37tnTm6WccuPr5TMl/D2HPyQWmqz4yFLXdTph9U4mlOCPRUIu5qDgRANVJxE5C AwAA X-CMS-MailID: 20231003111708eucas1p29eebdad45a2eae16148c9a5dbbcd47eb X-Msg-Generator: CA X-RootMTR: 20231003111708eucas1p29eebdad45a2eae16148c9a5dbbcd47eb X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20231003111708eucas1p29eebdad45a2eae16148c9a5dbbcd47eb References: <20231003111638.241542-1-m.majewski2@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231003_041710_705033_4F836822 X-CRM114-Status: GOOD ( 18.62 ) 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 90c33e8017af..0e970638193d 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;