From patchwork Wed Dec 14 13:16:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 33201 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp214579wrn; Wed, 14 Dec 2022 05:21:43 -0800 (PST) X-Google-Smtp-Source: AA0mqf5Ca3quBWe8ijs7LL4XlHvV3/JXVS8kMIE1G9FsF3j5JIAMbyFyYd0aqjF+d7qK80zrApEP X-Received: by 2002:a17:906:a148:b0:7af:bc9:5e51 with SMTP id bu8-20020a170906a14800b007af0bc95e51mr21335686ejb.41.1671024103078; Wed, 14 Dec 2022 05:21:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671024103; cv=none; d=google.com; s=arc-20160816; b=rBDG4YTlS5TkQaYhNNYkhiRPD+PPwhICeFFl6nvj9bPyGllXlb2NWDxVaspwlZ6bif 7Nc5Idn1KhaoIiE/bp+/s7tk+r8pJ1iAa1X0HkFY8p2xkSN4Ub6R2Cqi7smhaiqyHEYv S4j4XVwlsiNHtNCuKSNyGgcBcTZNOvP2PNGxecKaKcwY+rHdOULh0PtespDkjlKH2hnW pyB7aEIq5NrBtvyUoPpP9juTaymbZGdNakmhpytFyDvTWglAQ9DI+neNmPNBBHyQgkvC s/E1aueL+nv75E+EJssegKxb26ZKxm/SDixZXj+z07/rt8Z9QQTeWEBmk9CnMFizhIHu USRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=a4hI6UsBiw7aCkL0PcywkQ0FEO8YbDmUUU/KycZpHwY=; b=vIvrKqtdeb1RbY/GBK+mHUZrriaGtsKdmCfiuRPRc2VX7Lu92LsVJIJEYMwPp/VoWM SydHLsU1/C7jVR5gzigZX43DOs4GyLhcrPk4iZ4tZU7insJBqVynhhD8h6aDwnzW6Lm1 H4/UGCJS9Ti6inJE7HRSrV7wIqBxD1abd/htEVomfixJ2CBll1bm2Bf2S5OHW35xzPb5 vHenHfSnCg3EIV3i+XSiZ1YgfCY7hjU7ys4apkxOrVoxd3bKsWjW9iWCIShLVTqfdUY/ m81qhyF+2me32KUneAqIor9ZXZ9OOdJi4IOFv9AWr1bxiF6GwwrcZmLWG7dCRvgYuY5j w39g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=e2WaLz9u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fj3-20020a1709069c8300b007c1100d2875si11777540ejc.750.2022.12.14.05.21.17; Wed, 14 Dec 2022 05:21:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=e2WaLz9u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238481AbiLNNTI (ORCPT + 99 others); Wed, 14 Dec 2022 08:19:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238446AbiLNNS5 (ORCPT ); Wed, 14 Dec 2022 08:18:57 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E53EAEE16; Wed, 14 Dec 2022 05:18:56 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 989F0B818B1; Wed, 14 Dec 2022 13:18:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43BDEC433D2; Wed, 14 Dec 2022 13:18:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1671023934; bh=I3NjFkga/P0GdNEJyAvlKrNR4+s/YWzEm5lbyRY0s9o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e2WaLz9uLD0YeDJNA+Ip5rqhGSXG1u8qeishyJFdMYLR6Q4x2qHmyPIxxxb5STvGM A/G5AzxETsvPhBcetsWvZUtJipLXsjwDoDXwif3Wi1NdluMHisdWXhaROrgnmVs5eV XB+913GHKWDIleY8/bmovAaooXU5CJk+5jxkG5EewY6aaaF4Kj1t8DzP8MzeoHnpxh Z6NzORvKUPLloBA4ok1WE85k7cJZWuR9mD/2FAakMLTfbTGaCc08HkNIPhxAFvdatL cxbqlyACrKBkyTZBicZB6GTYFHuLEAP5mA/ccsZXdtdB8lT1vjB50P3vCOj5Q221nb qY++E7gwzKEoA== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1p5RfO-0000gK-Hc; Wed, 14 Dec 2022 14:19:22 +0100 From: Johan Hovold To: Daniel Lezcano , "Rafael J. Wysocki" Cc: Amit Kucheria , Thara Gopinath , Andy Gross , Bjorn Andersson , Konrad Dybcio , Zhang Rui , Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , Alim Akhtar , Thierry Reding , Jonathan Hunter , Dmitry Baryshkov , linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org, Johan Hovold Subject: [PATCH 2/4] thermal/drivers/exynos: fix set_trip_temp() deadlock Date: Wed, 14 Dec 2022 14:16:15 +0100 Message-Id: <20221214131617.2447-3-johan+linaro@kernel.org> X-Mailer: git-send-email 2.37.4 In-Reply-To: <20221214131617.2447-1-johan+linaro@kernel.org> References: <20221214131617.2447-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752195769957637581?= X-GMAIL-MSGID: =?utf-8?q?1752195769957637581?= The set_trip_temp() callback is used when changing the trip temperature through sysfs. As it is called with the thermal-zone-device lock held it must not use thermal_zone_get_trip() directly or it will deadlock. Fixes: 169865e317f2 ("thermal/drivers/exynos: Use generic thermal_zone_get_trip() function") Signed-off-by: Johan Hovold --- drivers/thermal/samsung/exynos_tmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 37465af59262..cf9028f80415 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -354,7 +354,7 @@ static void exynos4210_tmu_set_trip_temp(struct exynos_tmu_data *data, struct thermal_trip trip; u8 ref, th_code; - if (thermal_zone_get_trip(data->tzd, 0, &trip)) + if (__thermal_zone_get_trip(data->tzd, 0, &trip)) return; ref = trip.temperature / MCELSIUS;