public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Eddie James <eajames@linux.ibm.com>
Cc: linux-hwmon@vger.kernel.org, jdelvare@suse.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] hwmon: occ: Fix power sensor indexing
Date: Wed, 20 Mar 2019 06:29:30 -0700	[thread overview]
Message-ID: <20190320132930.GA8011@roeck-us.net> (raw)
In-Reply-To: <1553029318-31703-1-git-send-email-eajames@linux.ibm.com>

On Tue, Mar 19, 2019 at 04:01:58PM -0500, Eddie James wrote:
> In the case of power sensor version 0xA0, the sensor indexing overlapped
> with the "caps" power sensors, resulting in probe failure and kernel
> warnings. Fix this by specifying the next index for each power sensor
> version.
> 
> Fixes: 54076cb ("hwmon (occ): Add sensor attributes and register ...")
> Signed-off-by: Eddie James <eajames@linux.ibm.com>
> Tested-by: Joel Stanley <joel@jms.id.au>

Applied.

Side note: There is no v4.21.

Thanks,
Guenter

> ---
>  drivers/hwmon/occ/common.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hwmon/occ/common.c b/drivers/hwmon/occ/common.c
> index 391118c..c888f4a 100644
> --- a/drivers/hwmon/occ/common.c
> +++ b/drivers/hwmon/occ/common.c
> @@ -889,6 +889,8 @@ static int occ_setup_sensor_attrs(struct occ *occ)
>  				s++;
>  			}
>  		}
> +
> +		s = (sensors->power.num_sensors * 4) + 1;
>  	} else {
>  		for (i = 0; i < sensors->power.num_sensors; ++i) {
>  			s = i + 1;
> @@ -917,11 +919,11 @@ static int occ_setup_sensor_attrs(struct occ *occ)
>  						     show_power, NULL, 3, i);
>  			attr++;
>  		}
> -	}
>  
> -	if (sensors->caps.num_sensors >= 1) {
>  		s = sensors->power.num_sensors + 1;
> +	}
>  
> +	if (sensors->caps.num_sensors >= 1) {
>  		snprintf(attr->name, sizeof(attr->name), "power%d_label", s);
>  		attr->sensor = OCC_INIT_ATTR(attr->name, 0444, show_caps, NULL,
>  					     0, 0);

      parent reply	other threads:[~2019-03-20 13:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-19 21:01 [PATCH] hwmon: occ: Fix power sensor indexing Eddie James
2019-03-20  6:15 ` Joel Stanley
2019-03-20 13:29 ` Guenter Roeck [this message]

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=20190320132930.GA8011@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=eajames@linux.ibm.com \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox