Re: [PATCH 5/6] hwmon: (max6639) 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:49PM -0700, Guenter Roeck wrote:
> @@ -88,25 +88,16 @@ struct max6639_data {
>  
>  static int max6639_temp_read_input(struct device *dev, int channel, long *temp)
>  {
> +	u32 regs[2] = {MAX6639_REG_TEMP_EXT(channel), MAX6639_REG_TEMP(channel) };
                       ^                                                       ^
To be consistent, either drop the space or insert an extra space otherwise.

> @@ -290,8 +281,10 @@ static umode_t max6639_fan_is_visible(const void *_data, u32 attr, int channel)
>  static int max6639_read_pwm(struct device *dev, u32 attr, int channel,
>  			    long *pwm_val)
>  {
> +	u32 regs[2] = { MAX6639_REG_FAN_CONFIG3(channel), MAX6639_REG_GCONFIG };
                       ^                                                     ^
Same here.

> @@ -303,26 +296,13 @@ static int max6639_read_pwm(struct device *dev, u32 attr, int channel,
>  		*pwm_val = val * 255 / 120;
>  		return 0;
>  	case hwmon_pwm_freq:
> -		mutex_lock(&data->update_lock);
> -		res = regmap_read(data->regmap, MAX6639_REG_FAN_CONFIG3(channel), &val);
> -		if (res < 0) {
> -			mutex_unlock(&data->update_lock);
> +		res = regmap_multi_reg_read(data->regmap, regs, regvals, 2);
> +		if (res < 0)
>  			return res;
> -		}
> -		i = val & MAX6639_FAN_CONFIG3_FREQ_MASK;
> -
> -		res = regmap_read(data->regmap, MAX6639_REG_GCONFIG, &val);
> -		if (res < 0) {
> -			mutex_unlock(&data->update_lock);
> -			return res;
> -		}
> -
> -		if (val & MAX6639_GCONFIG_PWM_FREQ_HI)
> +		i = regvals[0] & MAX6639_FAN_CONFIG3_FREQ_MASK;
> +		if (regvals[1] & MAX6639_GCONFIG_PWM_FREQ_HI)
>  			i |= 0x4;
> -		i &= 0x7;

Just a note: this line can be safely dropped.




[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