From patchwork Sat May 18 12:12:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raphael Gallais-Pou X-Patchwork-Id: 13667599 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 9F5A5C25B74 for ; Sat, 18 May 2024 12:13:18 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=DFepISt85SN7Nf8rTGBFRrCIIxDchLoNpPLjU50OzV8=; b=tlEvHmJFCROyZy T23j84CkAVQCw4ycNUm/QK5bf480RpuP9UsqmAZ6WPlpCzZ3Kb8+ROD92bUOwlaB9ZW3nzDUtJZst 1LI/8Mp0OKHAne0W/SS03lJgLL3yvXvQ4chDuZyJBagS6DIzIhicsykgjtb5S+BQAmDJFwfLAveeS nlKtucQoPhEFbNhEMa9yroMxDEagOW1o12khGGsUsk/IeDmVhh9tTtFm1wNT9qz651Z85Lix13IJx 4THKAkYp0DVDDpNQksPi45IR2L2W054AOfbLJd8gvUSA6nKuipZvwmOupBQxiZc1RUrQvlTyW3oZ/ svMIIYUyaOXfijLVMuIg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s8Iw1-0000000A2U3-1YiE; Sat, 18 May 2024 12:13:09 +0000 Received: from mail-lf1-x136.google.com ([2a00:1450:4864:20::136]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s8Ivo-0000000A2Q5-2jyX for linux-arm-kernel@lists.infradead.org; Sat, 18 May 2024 12:13:00 +0000 Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-51f99f9e0faso3299630e87.2 for ; Sat, 18 May 2024 05:12:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716034370; x=1716639170; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=iZK4uEAHMWC7+OzKf8O0ygaLmakDxoLTPfLX2sxqysQ=; b=HBcQTfK3OeSX6c2cbcfklvl8VOSpcJD1lVuIQGew30U5ZwRtQemaQimXIDRjiSl/h7 b/QRoSrm9zd7Eq6c0OhnBSAAu4RN12wDBrq/rsJt54Ic5ljN6b/Asbiz+KAfTXNzKS7A xLJztppxgKrcPt2npyTFAdF77NS4JRWtdzWxhG07HxV2hE8ifIenzWxpRnqgmYkzMN03 calJWaavtl5zgXVPBZktwKdhIWP+WRovul/hkGlhE8LQG74AwGo7Des9/a7BTJd1xIkw weE5oj8tGekDVUZugV59/lshc0rK0gjSa9gWdt9vAGW2rDbtIvFIb6uV+fyXIA7qxO6d wyPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716034370; x=1716639170; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iZK4uEAHMWC7+OzKf8O0ygaLmakDxoLTPfLX2sxqysQ=; b=V6wZkB4GGmgsI0BbIwn3j9eQFvOSb3l4Siy/oUDKcdY0gEJaE6uVZAyqXiB8BfQgXR EmdEfZin6HRupwrBryTffAT5a63GIjunfBurnPhDhPJ8P9qDelB/9lnCZrkr4gyL0jwd NEC8w/XyGmIqmR/sOY6/aSNqSHzhAwHdFmysV6cjwanlDQ5WLDeH6Yml/JYnTbK5EQMi P/EwUso5+qYqqCfvosWBo39Vd1DTH9hlo8YTMV+OqaLWKGNPH8XxieQIGCj67toq1ckV SI1rF6T6pblQ5j5vK47w2dlQJifanG8JUVJ0pADFxrMXDFaGiqLz+I4Wah0QXZ1dgPo2 bTSg== X-Forwarded-Encrypted: i=1; AJvYcCV6yq3QWRYj60A6r5ClkWiv/Zh27z4zgqTHTLkB954oK1vzZKUnMjlG9dkUZfe0ue7+DKd1DKYpaqM6T+N/cqVocOH6ZArwWniGeZLkctIAB93SV+k= X-Gm-Message-State: AOJu0YzpC/kGodbP+A667A9x070HPWNPJX6esAWoxEmXvB/yGvzZT/o8 n6myCNFvdqvF0hxMdynrsC+H30p+Quz63HYrbyM+9Q/stkZ6aPYo X-Google-Smtp-Source: AGHT+IEgVLnhmwBYh/F3A7zypWfD3dPLiM8lgaXLecPRLfLx6gkZ5jPCjuVL5Z1h01pYyi0ORRYBqg== X-Received: by 2002:ac2:46e2:0:b0:523:8744:54ae with SMTP id 2adb3069b0e04-52387445634mr6715047e87.63.1716034369520; Sat, 18 May 2024 05:12:49 -0700 (PDT) Received: from localhost ([2001:861:3385:e20:6384:4cf:52c5:3194]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-523713d5081sm1636086e87.244.2024.05.18.05.12.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 May 2024 05:12:49 -0700 (PDT) From: Raphael Gallais-Pou Date: Sat, 18 May 2024 14:12:04 +0200 Subject: [PATCH 1/3] thermal: st: switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() MIME-Version: 1.0 Message-Id: <20240518-thermal-v1-1-7dfca3ed454b@gmail.com> References: <20240518-thermal-v1-0-7dfca3ed454b@gmail.com> In-Reply-To: <20240518-thermal-v1-0-7dfca3ed454b@gmail.com> To: "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Maxime Coquelin , Alexandre Torgue , Patrice Chotard , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org X-Mailer: b4 0.13.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240518_051256_787797_75C8ADA3 X-CRM114-Status: GOOD ( 15.31 ) 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 Letting the compiler remove these functions when the kernel is built without CONFIG_PM_SLEEP support is simpler and less error prone than the use of #ifdef based kernel configuration guards. Remove those guards on every ST thermal related drivers. Signed-off-by: Raphael Gallais-Pou Reviewed-by: Patrice Chotard --- drivers/thermal/st/st_thermal.c | 4 +--- drivers/thermal/st/st_thermal_memmap.c | 2 +- drivers/thermal/st/stm_thermal.c | 8 +++----- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/thermal/st/st_thermal.c b/drivers/thermal/st/st_thermal.c index 2a105409864e..5f33543a3a54 100644 --- a/drivers/thermal/st/st_thermal.c +++ b/drivers/thermal/st/st_thermal.c @@ -236,7 +236,6 @@ void st_thermal_unregister(struct platform_device *pdev) } EXPORT_SYMBOL_GPL(st_thermal_unregister); -#ifdef CONFIG_PM_SLEEP static int st_thermal_suspend(struct device *dev) { struct st_thermal_sensor *sensor = dev_get_drvdata(dev); @@ -265,9 +264,8 @@ static int st_thermal_resume(struct device *dev) return 0; } -#endif -SIMPLE_DEV_PM_OPS(st_thermal_pm_ops, st_thermal_suspend, st_thermal_resume); +DEFINE_SIMPLE_DEV_PM_OPS(st_thermal_pm_ops, st_thermal_suspend, st_thermal_resume); EXPORT_SYMBOL_GPL(st_thermal_pm_ops); MODULE_AUTHOR("STMicroelectronics (R&D) Limited "); diff --git a/drivers/thermal/st/st_thermal_memmap.c b/drivers/thermal/st/st_thermal_memmap.c index 29c2269b0fb3..28b380013956 100644 --- a/drivers/thermal/st/st_thermal_memmap.c +++ b/drivers/thermal/st/st_thermal_memmap.c @@ -180,7 +180,7 @@ static void st_mmap_remove(struct platform_device *pdev) static struct platform_driver st_mmap_thermal_driver = { .driver = { .name = "st_thermal_mmap", - .pm = &st_thermal_pm_ops, + .pm = pm_sleep_ptr(&st_thermal_pm_ops), .of_match_table = st_mmap_thermal_of_match, }, .probe = st_mmap_probe, diff --git a/drivers/thermal/st/stm_thermal.c b/drivers/thermal/st/stm_thermal.c index 34785b9276fc..ffd988600ed6 100644 --- a/drivers/thermal/st/stm_thermal.c +++ b/drivers/thermal/st/stm_thermal.c @@ -440,7 +440,6 @@ static int stm_thermal_prepare(struct stm_thermal_sensor *sensor) return ret; } -#ifdef CONFIG_PM_SLEEP static int stm_thermal_suspend(struct device *dev) { struct stm_thermal_sensor *sensor = dev_get_drvdata(dev); @@ -466,10 +465,9 @@ static int stm_thermal_resume(struct device *dev) return 0; } -#endif /* CONFIG_PM_SLEEP */ -static SIMPLE_DEV_PM_OPS(stm_thermal_pm_ops, - stm_thermal_suspend, stm_thermal_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(stm_thermal_pm_ops, + stm_thermal_suspend, stm_thermal_resume); static const struct thermal_zone_device_ops stm_tz_ops = { .get_temp = stm_thermal_get_temp, @@ -580,7 +578,7 @@ static void stm_thermal_remove(struct platform_device *pdev) static struct platform_driver stm_thermal_driver = { .driver = { .name = "stm_thermal", - .pm = &stm_thermal_pm_ops, + .pm = pm_sleep_ptr(&stm_thermal_pm_ops), .of_match_table = stm_thermal_of_match, }, .probe = stm_thermal_probe,