diff mbox series

[RFC,1/5] hwmon: (lm75) simplify lm75_write_config()

Message ID 20241219225522.3490-8-wsa+renesas@sang-engineering.com (mailing list archive)
State Accepted
Headers show
Series hwmon: (lm75) add I3C support | expand

Commit Message

Wolfram Sang Dec. 19, 2024, 10:55 p.m. UTC
After previous refactoring, it is now possible to make
lm75_write_config() a simple inline function.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/hwmon/lm75.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

Comments

Geert Uytterhoeven Dec. 20, 2024, 8:48 a.m. UTC | #1
On Thu, Dec 19, 2024 at 11:55 PM Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
> After previous refactoring, it is now possible to make
> lm75_write_config() a simple inline function.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert
Guenter Roeck Dec. 20, 2024, 2:56 p.m. UTC | #2
On Thu, Dec 19, 2024 at 11:55:23PM +0100, Wolfram Sang wrote:
> After previous refactoring, it is now possible to make
> lm75_write_config() a simple inline function.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Applied.

Thanks,
Gueter
diff mbox series

Patch

diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c
index b8889392d5da..b03e760cf3a1 100644
--- a/drivers/hwmon/lm75.c
+++ b/drivers/hwmon/lm75.c
@@ -340,17 +340,11 @@  static inline long lm75_reg_to_mc(s16 temp, u8 resolution)
 	return ((temp >> (16 - resolution)) * 1000) >> (resolution - 8);
 }
 
-static int lm75_write_config(struct lm75_data *data, u16 set_mask,
-			     u16 clr_mask)
+static inline int lm75_write_config(struct lm75_data *data, u16 set_mask,
+				    u16 clr_mask)
 {
-	int err;
-
-	err = regmap_update_bits(data->regmap, LM75_REG_CONF,
-				 clr_mask | LM75_SHUTDOWN, set_mask);
-	if (err)
-		return err;
-
-	return 0;
+	return regmap_update_bits(data->regmap, LM75_REG_CONF,
+				  clr_mask | LM75_SHUTDOWN, set_mask);
 }
 
 static irqreturn_t lm75_alarm_handler(int irq, void *private)