mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexander Stein <alexander.stein@ew.tq-group.com>
To: Jean Delvare <jdelvare@suse.com>,
	Guenter Roeck <linux@roeck-us.net>, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>
Cc: Alexander Stein <alexander.stein@ew.tq-group.com>,
	linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 3/5] hwmon: (gpio-fan) Ensure lock is held during set_fan_speed()
Date: Mon, 10 Feb 2025 15:59:31 +0100	[thread overview]
Message-ID: <20250210145934.761280-4-alexander.stein@ew.tq-group.com> (raw)
In-Reply-To: <20250210145934.761280-1-alexander.stein@ew.tq-group.com>

Instead of just documenting by comment, ensure locking per code.

Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
---
 drivers/hwmon/gpio-fan.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/hwmon/gpio-fan.c b/drivers/hwmon/gpio-fan.c
index b779240328d59..322b161d5ca1f 100644
--- a/drivers/hwmon/gpio-fan.c
+++ b/drivers/hwmon/gpio-fan.c
@@ -124,9 +124,10 @@ static int __get_fan_ctrl(struct gpio_fan_data *fan_data)
 	return ctrl_val;
 }
 
-/* Must be called with fan_data->lock held, except during initialization. */
 static void set_fan_speed(struct gpio_fan_data *fan_data, int speed_index)
 {
+	WARN_ON_ONCE(!mutex_is_locked(&fan_data->lock));
+
 	if (fan_data->speed_index == speed_index)
 		return;
 
-- 
2.34.1


  parent reply	other threads:[~2025-02-10 15:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-10 14:59 [PATCH 0/5] gpio-fan: regulator support Alexander Stein
2025-02-10 14:59 ` [PATCH 1/5] dt-bindings: hwmon: gpio-fan: Add optional " Alexander Stein
2025-02-13  8:58   ` Krzysztof Kozlowski
2025-03-02 16:51   ` Guenter Roeck
2025-02-10 14:59 ` [PATCH 2/5] hwmon: (gpio-fan) Add missing mutex locks Alexander Stein
2025-03-02 16:52   ` Guenter Roeck
2025-02-10 14:59 ` Alexander Stein [this message]
2025-03-02 16:54   ` [PATCH 3/5] hwmon: (gpio-fan) Ensure lock is held during set_fan_speed() Guenter Roeck
2025-02-10 14:59 ` [PATCH 4/5] hwmon: (gpio-fan) Remove unnecessary comment Alexander Stein
2025-03-02 16:55   ` Guenter Roeck
2025-02-10 14:59 ` [PATCH 5/5] hwmon: (gpio-fan) Add regulator support Alexander Stein
2025-02-10 15:26   ` Mark Brown
2025-03-02 17:01     ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250210145934.761280-4-alexander.stein@ew.tq-group.com \
    --to=alexander.stein@ew.tq-group.com \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jdelvare@suse.com \
    --cc=krzk+dt@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®