[PATCH] soc: samsung: exynos-pmu: Annotate online/offline functions with __must_hold

Krzysztof Kozlowski posted 1 patch 5 months ago
drivers/soc/samsung/exynos-pmu.c | 2 ++
1 file changed, 2 insertions(+)
[PATCH] soc: samsung: exynos-pmu: Annotate online/offline functions with __must_hold
Posted by Krzysztof Kozlowski 5 months ago
Annotate functions writing to PMU registers to online and offline CPUs
as __must_hold() the necessary spinlock for code correctness.  These are
static functions so possibility of mistakes is low here, but
__must_hold() serves as self-documenting code.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 drivers/soc/samsung/exynos-pmu.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/soc/samsung/exynos-pmu.c b/drivers/soc/samsung/exynos-pmu.c
index 22c50ca2aa79..105293970d48 100644
--- a/drivers/soc/samsung/exynos-pmu.c
+++ b/drivers/soc/samsung/exynos-pmu.c
@@ -364,6 +364,7 @@ EXPORT_SYMBOL_GPL(exynos_get_pmu_regmap_by_phandle);
  * disabled and cpupm_lock held.
  */
 static int __gs101_cpu_pmu_online(unsigned int cpu)
+	__must_hold(&pmu_context->cpupm_lock)
 {
 	unsigned int cpuhint = smp_processor_id();
 	u32 reg, mask;
@@ -424,6 +425,7 @@ static int gs101_cpuhp_pmu_online(unsigned int cpu)
 
 /* Common function shared by both CPU hot plug and CPUIdle */
 static int __gs101_cpu_pmu_offline(unsigned int cpu)
+	__must_hold(&pmu_context->cpupm_lock)
 {
 	unsigned int cpuhint = smp_processor_id();
 	u32 reg, mask;
-- 
2.48.1
Re: [PATCH] soc: samsung: exynos-pmu: Annotate online/offline functions with __must_hold
Posted by Krzysztof Kozlowski 3 months, 4 weeks ago
On Fri, 05 Sep 2025 19:37:18 +0200, Krzysztof Kozlowski wrote:
> Annotate functions writing to PMU registers to online and offline CPUs
> as __must_hold() the necessary spinlock for code correctness.  These are
> static functions so possibility of mistakes is low here, but
> __must_hold() serves as self-documenting code.
> 
> 

Applied, thanks!

[1/1] soc: samsung: exynos-pmu: Annotate online/offline functions with __must_hold
      https://git.kernel.org/krzk/linux/c/326312707492c136ba44cf96730e70aabc959da9

Best regards,
-- 
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>