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: 13407486 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 C27A4E7544D for ; Tue, 3 Oct 2023 11:17:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239977AbjJCLRS (ORCPT ); Tue, 3 Oct 2023 07:17:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239921AbjJCLRO (ORCPT ); Tue, 3 Oct 2023 07:17:14 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BA4FBD for ; Tue, 3 Oct 2023 04:17:10 -0700 (PDT) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20231003111709euoutp0114bf4bcbadb1f236f8fa9bf8d060b24d~KlM_lJ_Dj1220312203euoutp01e for ; Tue, 3 Oct 2023 11:17:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20231003111709euoutp0114bf4bcbadb1f236f8fa9bf8d060b24d~KlM_lJ_Dj1220312203euoutp01e 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 5C67xdwvU5ktnjzsY3Pg99g56y67x+I9L5k8Nq3qZPO4c20Pm8fmJfUefVtWMXp83iQXwB7F ZZOSmpNZllqkb5fAlfHkXCNjwR7Jil1H29kbGCeJdjFyckgImEjMOtLA0sXIxSEksIJRYsuq dkYI5wujRHv/FmYI5zOjxJHOvWwwLbuO/mGDSCxnlHjc84cVwmllkvi3dh8rSBWbgIHEgzfL 2EFsEYFWRomZTeogRcwCl5gl7t5cywKSEBYolJj8ZivYWBYBVYmWFRfBGngFbCXajnSxQqyT l9iz6DsTiM0pYCex8udyJogaQYmTM5+AzWEGqmneOhvsVgmB/xwSG77MgLrVRWLenoNMELaw xKvjW9ghbBmJ05N7WCDsfIkZm98D2RxAdoXE3YNeEKa1xMczzCAms4CmxPpd+hDFjhL/dx6G KuaTuPFWEOIAPolJ26YzQ4R5JTrahCCqVSWO75nEDGFLSzxpuc0EUeIh0bLYZQKj4iwkn8xC 8skshLULGJlXMYqnlhbnpqcWG+WllusVJ+YWl+al6yXn525iBCax0/+Of9nBuPzVR71DjEwc jIcYJTiYlUR4w45KpQrxpiRWVqUW5ccXleakFh9ilOZgURLn1bY9mSwkkJ5Ykpqdml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emJJanZqakFqEUwfEwenVAPTVLed7NcCbkqWTphyKNlkuku3 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> Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.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;