Re: [PATCH 1/6] hwmon: (lm95245) Use multi-byte regmap operations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 16, 2024 at 04:00:45PM -0700, Guenter Roeck wrote:
> Use multi-byte regmap operations where possible to reduce code size
> and the need for mutex protection.
> 
> No functional change.
> 
> Signed-off-by: Guenter Roeck <linux@xxxxxxxxxxxx>

Reviewed-by: Tzung-Bi Shih <tzungbi@xxxxxxxxxx>

> @@ -181,92 +181,77 @@ static int lm95245_read_temp(struct device *dev, u32 attr, int channel,
[...]
> -		ret = regmap_read(regmap, LM95245_REG_R_REMOTE_TEMPL_U,
> -				  &regvall);
> -		if (ret < 0)
> +		ret = regmap_bulk_read(regmap, LM95245_REG_R_REMOTE_TEMPH_U, regvals, 2);
> +		if (ret)
>  			return ret;
> -		ret = regmap_read(regmap, LM95245_REG_R_REMOTE_TEMPH_U,
> -				  &regvalh);
> -		if (ret < 0)
> -			return ret;
> -		*val = temp_from_reg_unsigned(regvalh, regvall);
> +		*val = temp_from_reg_unsigned(regvals[0], regvals[1]);

Just a note:
I took a while for realizing that a regmap_bulk_read() is sufficient here as
LM95245_REG_R_REMOTE_TEMPH_U and LM95245_REG_R_REMOTE_TEMPL_U are continuous.

The same logic applies to the rest changes.




[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux