All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tzung-Bi Shih <tzungbi@kernel.org>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Hardware Monitoring <linux-hwmon@vger.kernel.org>
Subject: Re: [PATCH 5/6] hwmon: (max6639) Use multi-byte regmap operations
Date: Wed, 17 Jul 2024 21:36:02 +0800	[thread overview]
Message-ID: <ZpfIwpmmte8PUrjk@tzungbi-laptop> (raw)
In-Reply-To: <20240716230050.2049534-6-linux@roeck-us.net>

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.

  reply	other threads:[~2024-07-17 13:36 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-16 23:00 [PATCH 0/6] hwmon: Use multi-byte regmap operations Guenter Roeck
2024-07-16 23:00 ` [PATCH 1/6] hwmon: (lm95245) " Guenter Roeck
2024-07-17 13:33   ` Tzung-Bi Shih
2024-07-16 23:00 ` [PATCH 2/6] hwmon: (nct7802) " Guenter Roeck
2024-07-17 13:35   ` Tzung-Bi Shih
2024-07-16 23:00 ` [PATCH 3/6] hwmon: (adt7x10) " Guenter Roeck
2024-07-17 13:35   ` Tzung-Bi Shih
2024-07-16 23:00 ` [PATCH 4/6] hwmon: (tmp464) " Guenter Roeck
2024-07-17 13:35   ` Tzung-Bi Shih
2024-07-17 14:37     ` Guenter Roeck
2024-07-18  1:29       ` Tzung-Bi Shih
2024-07-16 23:00 ` [PATCH 5/6] hwmon: (max6639) " Guenter Roeck
2024-07-17 13:36   ` Tzung-Bi Shih [this message]
2024-07-17 17:14     ` Guenter Roeck
2024-07-18  1:28       ` Tzung-Bi Shih
2024-07-18  2:27         ` Guenter Roeck
2024-07-16 23:00 ` [PATCH 6/6] hwmon: (amc6821) " Guenter Roeck
2024-07-17 13:36   ` Tzung-Bi Shih

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZpfIwpmmte8PUrjk@tzungbi-laptop \
    --to=tzungbi@kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux@roeck-us.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.