diff mbox series

[v3,1/2] hwmon: pwm-fan: Store device pointer in pwm_fan_ctx

Message ID 20201110112817.52549-2-pbarker@konsulko.com (mailing list archive)
State Superseded
Headers show
Series Fix RPM calculation in pwm-fan | expand

Commit Message

Paul Barker Nov. 10, 2020, 11:28 a.m. UTC
This allows us to use dev_err() and friends from functions which only
have a pwm_fan_ctx pointer.

Signed-off-by: Paul Barker <pbarker@konsulko.com>
---
 drivers/hwmon/pwm-fan.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/drivers/hwmon/pwm-fan.c b/drivers/hwmon/pwm-fan.c
index bdba2143021a..edc0453be25a 100644
--- a/drivers/hwmon/pwm-fan.c
+++ b/drivers/hwmon/pwm-fan.c
@@ -26,6 +26,7 @@  struct pwm_fan_ctx {
 	struct mutex lock;
 	struct pwm_device *pwm;
 	struct regulator *reg_en;
+	struct device *dev;
 
 	int irq;
 	atomic_t pulses;
@@ -290,6 +291,7 @@  static int pwm_fan_probe(struct platform_device *pdev)
 	if (!ctx)
 		return -ENOMEM;
 
+	ctx->dev = dev;
 	mutex_init(&ctx->lock);
 
 	ctx->pwm = devm_of_pwm_get(dev, dev->of_node, NULL);