From patchwork Mon Nov 20 14:50:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mateusz Majewski X-Patchwork-Id: 13461422 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 A6C4BC197A0 for ; Mon, 20 Nov 2023 14:51:53 +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=FkopHFE2YA/Fzm Yw89FHu+h1BibH/UDUpf69KRl3HjSqq4NOpoDADVN1tkLgB66wSoEZTvw8BGWSBCpuTdVtzeHveYP ZP8DAEvddcuGBua6EcyCJaAKDZjc04H2BokjqqveO8e8UmrqPYWJd0W4UVLLqL1LzAHL8BcUiiNb/ WnG5czvxhYJP9ZmEEar4VumkIioh2OwNvR5E5jzbdEBLne79vZ+fRJLGNtq6nlgmTAoHRkHDdec9F WAiHlScLqM+NJ6Cewgs66Jy/DERts+2JpmY07e7NgX0526B1qgN2FVkjh4zmtlFm8ucEabzKI/Euo 4sEvfAWxx4gBF0eWicFg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r55cP-00CO5M-2Z; Mon, 20 Nov 2023 14:51:21 +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 1r55cA-00CNva-1G for linux-arm-kernel@lists.infradead.org; Mon, 20 Nov 2023 14:51:11 +0000 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20231120145102euoutp0138e7777a80b714397f95962db1e83a1f~ZXFb7UMD12424024240euoutp01A for ; Mon, 20 Nov 2023 14:51:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20231120145102euoutp0138e7777a80b714397f95962db1e83a1f~ZXFb7UMD12424024240euoutp01A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1700491863; bh=z+drqHSTXutvqyghqqSngnAvaJMAvU0O0c1Ke0HntPc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kwZQvROpy8RL9K+EGs6KHsA0Mf9sO/JY5dnuz7xmgxq9dfTS6qwGqfNBcMr9rf3QG Rc+SFlLt1/YRkrs6NoA1zo2Kbl+BOFIWsRjtVvtEv/agLI/ArCNsKSPigN8xVRvA4Z YTJ+K/1pkXLYnIrL59q9RRIGWxtsUCUJnGhd657c= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20231120145102eucas1p1a44aa06fa354de95a8205ea742f5460a~ZXFbfJwLv1858518585eucas1p1Q; Mon, 20 Nov 2023 14:51:02 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id CA.37.09539.6527B556; Mon, 20 Nov 2023 14:51:02 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20231120145101eucas1p2f5da2c4612cf10b0b8b2055863fbd7c2~ZXFa3T_6J1100611006eucas1p2u; Mon, 20 Nov 2023 14:51:01 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20231120145101eusmtrp235997a8555478e4749b94eb8b26820f2~ZXFa1sjfI0691806918eusmtrp2B; Mon, 20 Nov 2023 14:51:01 +0000 (GMT) X-AuditID: cbfec7f2-515ff70000002543-52-655b7256120d Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 24.C3.09146.5527B556; Mon, 20 Nov 2023 14:51:01 +0000 (GMT) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20231120145100eusmtip271c74bbc8e56a76859f5bf666ad20f0f~ZXFZ-1b0v0740707407eusmtip2Y; Mon, 20 Nov 2023 14:51:00 +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 Subject: [PATCH v5 3/9] thermal: exynos: switch from workqueue-driven interrupt handling to threaded interrupts Date: Mon, 20 Nov 2023 15:50:43 +0100 Message-ID: <20231120145049.310509-4-m.majewski2@samsung.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231120145049.310509-1-m.majewski2@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrOKsWRmVeSWpSXmKPExsWy7djP87phRdGpBrOWS1k8mLeNzeLw/AqL qQ+fsFl833KdyWLeZ1mLva+3slt8u9LBZLHp8TVWi8u75rBZfO49wmgx4/w+JouFTS3sFhOP TWa2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DAAA= X-CMS-MailID: 20231120145101eucas1p2f5da2c4612cf10b0b8b2055863fbd7c2 X-Msg-Generator: CA X-RootMTR: 20231120145101eucas1p2f5da2c4612cf10b0b8b2055863fbd7c2 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20231120145101eucas1p2f5da2c4612cf10b0b8b2055863fbd7c2 References: <20231120145049.310509-1-m.majewski2@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231120_065106_874281_C28C083F X-CRM114-Status: GOOD ( 17.87 ) 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;