From: Peter Korsgaard Date: Thu, 17 Apr 2025 18:04:26 +0000 (+0200) Subject: hwmon: (tmp102) add vcc regulator support X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=3e749ce132676683f3cdeec9a887c3f8f5ed96eb;p=linux.git hwmon: (tmp102) add vcc regulator support Make it optional for backwards compatibility. Signed-off-by: Peter Korsgaard Link: https://lore.kernel.org/r/20250417180426.3872314-2-peter@korsgaard.com Signed-off-by: Guenter Roeck --- diff --git a/drivers/hwmon/tmp102.c b/drivers/hwmon/tmp102.c index 8af44a33055f..a02daa496c9c 100644 --- a/drivers/hwmon/tmp102.c +++ b/drivers/hwmon/tmp102.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #define DRIVER_NAME "tmp102" @@ -204,6 +205,10 @@ static int tmp102_probe(struct i2c_client *client) return -ENODEV; } + err = devm_regulator_get_enable_optional(dev, "vcc"); + if (err < 0 && err != -ENODEV) + return dev_err_probe(dev, err, "Failed to enable regulator\n"); + tmp102 = devm_kzalloc(dev, sizeof(*tmp102), GFP_KERNEL); if (!tmp102) return -ENOMEM;