Linux-Hwmon Archive on lore.kernel.org
 help / color / Atom feed
From: "Pali Rohár" <pali.rohar@gmail.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Michele Sorcinelli <michelesr@autistici.org>,
	Jean Delvare <jdelvare@suse.com>,
	linux-hwmon@vger.kernel.org
Subject: Re: [PATCH v3] dell-smm-hwmon.c: Additional temperature sensors
Date: Sat, 22 Dec 2018 13:50:21 +0100
Message-ID: <20181222125021.kzwzupc4hj7y4vlc@pali> (raw)
In-Reply-To: <20181221234032.GA17715@roeck-us.net>

[-- Attachment #1: Type: text/plain, Size: 8145 bytes --]

On Friday 21 December 2018 15:40:32 Guenter Roeck wrote:
> On Fri, Dec 14, 2018 at 11:57:59PM +0000, Michele Sorcinelli wrote:
> > The code has been extended to support up to 10 temperature sensors.
> > 
> > Changes from previous patch versions:
> > 
> > - fix wrong index ranges in i8k_is_visible() if conditions
> > - restore i8k_get_temp_type() as probe method for temp sensors because
> >   i8k_get_temp() is not reliable (for example it won't work when
> >   the sensors is turned off)
> > 
> > Signed-off-by: Michele Sorcinelli <michelesr@autistici.org>
> 
> Pali, this is waiting for your feedbacck. Any comments ?
> 
> Thanks,
> Guenter

Hi! Sorry for delay.

> > ---
> >  drivers/hwmon/dell-smm-hwmon.c | 105 ++++++++++++++++++++++++++++-----
> >  1 file changed, 90 insertions(+), 15 deletions(-)
> >  mode change 100644 => 100755 drivers/hwmon/dell-smm-hwmon.c

This change is wrong, source code files should not be executable.

Otherwise looks good. After removing executable bit, you can add my
Reviewed-by: Pali Rohár <pali.rohar@gmail.com>

> > 
> > --
> > 2.20.0
> > 
> > diff --git a/drivers/hwmon/dell-smm-hwmon.c b/drivers/hwmon/dell-smm-hwmon.c
> > old mode 100644
> > new mode 100755
> > index 367a8a617..73a30e3e4
> > --- a/drivers/hwmon/dell-smm-hwmon.c
> > +++ b/drivers/hwmon/dell-smm-hwmon.c
> > @@ -82,9 +82,16 @@ static bool disallow_fan_support;
> >  #define I8K_HWMON_HAVE_TEMP2	(1 << 1)
> >  #define I8K_HWMON_HAVE_TEMP3	(1 << 2)
> >  #define I8K_HWMON_HAVE_TEMP4	(1 << 3)
> > -#define I8K_HWMON_HAVE_FAN1	(1 << 4)
> > -#define I8K_HWMON_HAVE_FAN2	(1 << 5)
> > -#define I8K_HWMON_HAVE_FAN3	(1 << 6)
> > +#define I8K_HWMON_HAVE_TEMP5	(1 << 4)
> > +#define I8K_HWMON_HAVE_TEMP6	(1 << 5)
> > +#define I8K_HWMON_HAVE_TEMP7	(1 << 6)
> > +#define I8K_HWMON_HAVE_TEMP8	(1 << 7)
> > +#define I8K_HWMON_HAVE_TEMP9	(1 << 8)
> > +#define I8K_HWMON_HAVE_TEMP10	(1 << 9)
> > +
> > +#define I8K_HWMON_HAVE_FAN1	(1 << 10)
> > +#define I8K_HWMON_HAVE_FAN2	(1 << 11)
> > +#define I8K_HWMON_HAVE_FAN3	(1 << 12)
> > 
> >  MODULE_AUTHOR("Massimo Dal Zotto (dz@debian.org)");
> >  MODULE_AUTHOR("Pali Rohár <pali.rohar@gmail.com>");
> > @@ -743,6 +750,25 @@ static SENSOR_DEVICE_ATTR(temp3_label, S_IRUGO, i8k_hwmon_show_temp_label, NULL,
> >  static SENSOR_DEVICE_ATTR(temp4_input, S_IRUGO, i8k_hwmon_show_temp, NULL, 3);
> >  static SENSOR_DEVICE_ATTR(temp4_label, S_IRUGO, i8k_hwmon_show_temp_label, NULL,
> >  			  3);
> > +static SENSOR_DEVICE_ATTR(temp5_input, S_IRUGO, i8k_hwmon_show_temp, NULL, 4);
> > +static SENSOR_DEVICE_ATTR(temp5_label, S_IRUGO, i8k_hwmon_show_temp_label, NULL,
> > +			  4);
> > +static SENSOR_DEVICE_ATTR(temp6_input, S_IRUGO, i8k_hwmon_show_temp, NULL, 5);
> > +static SENSOR_DEVICE_ATTR(temp6_label, S_IRUGO, i8k_hwmon_show_temp_label, NULL,
> > +			  5);
> > +static SENSOR_DEVICE_ATTR(temp7_input, S_IRUGO, i8k_hwmon_show_temp, NULL, 6);
> > +static SENSOR_DEVICE_ATTR(temp7_label, S_IRUGO, i8k_hwmon_show_temp_label, NULL,
> > +			  6);
> > +static SENSOR_DEVICE_ATTR(temp8_input, S_IRUGO, i8k_hwmon_show_temp, NULL, 7);
> > +static SENSOR_DEVICE_ATTR(temp8_label, S_IRUGO, i8k_hwmon_show_temp_label, NULL,
> > +			  7);
> > +static SENSOR_DEVICE_ATTR(temp9_input, S_IRUGO, i8k_hwmon_show_temp, NULL, 8);
> > +static SENSOR_DEVICE_ATTR(temp9_label, S_IRUGO, i8k_hwmon_show_temp_label, NULL,
> > +			  8);
> > +static SENSOR_DEVICE_ATTR(temp10_input, S_IRUGO, i8k_hwmon_show_temp, NULL, 9);
> > +static SENSOR_DEVICE_ATTR(temp10_label, S_IRUGO, i8k_hwmon_show_temp_label, NULL,
> > +			  9);
> > +
> >  static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, i8k_hwmon_show_fan, NULL, 0);
> >  static SENSOR_DEVICE_ATTR(fan1_label, S_IRUGO, i8k_hwmon_show_fan_label, NULL,
> >  			  0);
> > @@ -770,15 +796,27 @@ static struct attribute *i8k_attrs[] = {
> >  	&sensor_dev_attr_temp3_label.dev_attr.attr,	/* 5 */
> >  	&sensor_dev_attr_temp4_input.dev_attr.attr,	/* 6 */
> >  	&sensor_dev_attr_temp4_label.dev_attr.attr,	/* 7 */
> > -	&sensor_dev_attr_fan1_input.dev_attr.attr,	/* 8 */
> > -	&sensor_dev_attr_fan1_label.dev_attr.attr,	/* 9 */
> > -	&sensor_dev_attr_pwm1.dev_attr.attr,		/* 10 */
> > -	&sensor_dev_attr_fan2_input.dev_attr.attr,	/* 11 */
> > -	&sensor_dev_attr_fan2_label.dev_attr.attr,	/* 12 */
> > -	&sensor_dev_attr_pwm2.dev_attr.attr,		/* 13 */
> > -	&sensor_dev_attr_fan3_input.dev_attr.attr,	/* 14 */
> > -	&sensor_dev_attr_fan3_label.dev_attr.attr,	/* 15 */
> > -	&sensor_dev_attr_pwm3.dev_attr.attr,		/* 16 */
> > +	&sensor_dev_attr_temp5_input.dev_attr.attr,	/* 8 */
> > +	&sensor_dev_attr_temp5_label.dev_attr.attr,	/* 9 */
> > +	&sensor_dev_attr_temp6_input.dev_attr.attr,	/* 10 */
> > +	&sensor_dev_attr_temp6_label.dev_attr.attr,	/* 11 */
> > +	&sensor_dev_attr_temp7_input.dev_attr.attr,	/* 12 */
> > +	&sensor_dev_attr_temp7_label.dev_attr.attr,	/* 13 */
> > +	&sensor_dev_attr_temp8_input.dev_attr.attr,	/* 14 */
> > +	&sensor_dev_attr_temp8_label.dev_attr.attr,	/* 15 */
> > +	&sensor_dev_attr_temp9_input.dev_attr.attr,	/* 16 */
> > +	&sensor_dev_attr_temp9_label.dev_attr.attr,	/* 17 */
> > +	&sensor_dev_attr_temp10_input.dev_attr.attr,	/* 18 */
> > +	&sensor_dev_attr_temp10_label.dev_attr.attr,	/* 19 */
> > +	&sensor_dev_attr_fan1_input.dev_attr.attr,	/* 20 */
> > +	&sensor_dev_attr_fan1_label.dev_attr.attr,	/* 21 */
> > +	&sensor_dev_attr_pwm1.dev_attr.attr,		/* 22 */
> > +	&sensor_dev_attr_fan2_input.dev_attr.attr,	/* 23 */
> > +	&sensor_dev_attr_fan2_label.dev_attr.attr,	/* 24 */
> > +	&sensor_dev_attr_pwm2.dev_attr.attr,		/* 25 */
> > +	&sensor_dev_attr_fan3_input.dev_attr.attr,	/* 26 */
> > +	&sensor_dev_attr_fan3_label.dev_attr.attr,	/* 27 */
> > +	&sensor_dev_attr_pwm3.dev_attr.attr,		/* 28 */
> >  	NULL
> >  };
> > 
> > @@ -802,13 +840,32 @@ static umode_t i8k_is_visible(struct kobject *kobj, struct attribute *attr,
> >  	if (index >= 6 && index <= 7 &&
> >  	    !(i8k_hwmon_flags & I8K_HWMON_HAVE_TEMP4))
> >  		return 0;
> > -	if (index >= 8 && index <= 10 &&
> > +	if (index >= 8 && index <= 9 &&
> > +	    !(i8k_hwmon_flags & I8K_HWMON_HAVE_TEMP5))
> > +		return 0;
> > +	if (index >= 10 && index <= 11 &&
> > +	    !(i8k_hwmon_flags & I8K_HWMON_HAVE_TEMP6))
> > +		return 0;
> > +	if (index >= 12 && index <= 13 &&
> > +	    !(i8k_hwmon_flags & I8K_HWMON_HAVE_TEMP7))
> > +		return 0;
> > +	if (index >= 14 && index <= 15 &&
> > +	    !(i8k_hwmon_flags & I8K_HWMON_HAVE_TEMP8))
> > +		return 0;
> > +	if (index >= 16 && index <= 17 &&
> > +	    !(i8k_hwmon_flags & I8K_HWMON_HAVE_TEMP9))
> > +		return 0;
> > +	if (index >= 18 && index <= 19 &&
> > +	    !(i8k_hwmon_flags & I8K_HWMON_HAVE_TEMP10))
> > +		return 0;
> > +
> > +	if (index >= 20 && index <= 22 &&
> >  	    !(i8k_hwmon_flags & I8K_HWMON_HAVE_FAN1))
> >  		return 0;
> > -	if (index >= 11 && index <= 13 &&
> > +	if (index >= 23 && index <= 25 &&
> >  	    !(i8k_hwmon_flags & I8K_HWMON_HAVE_FAN2))
> >  		return 0;
> > -	if (index >= 14 && index <= 16 &&
> > +	if (index >= 26 && index <= 28 &&
> >  	    !(i8k_hwmon_flags & I8K_HWMON_HAVE_FAN3))
> >  		return 0;
> > 
> > @@ -841,6 +898,24 @@ static int __init i8k_init_hwmon(void)
> >  	err = i8k_get_temp_type(3);
> >  	if (err >= 0)
> >  		i8k_hwmon_flags |= I8K_HWMON_HAVE_TEMP4;
> > +	err = i8k_get_temp_type(4);
> > +	if (err >= 0)
> > +		i8k_hwmon_flags |= I8K_HWMON_HAVE_TEMP5;
> > +	err = i8k_get_temp_type(5);
> > +	if (err >= 0)
> > +		i8k_hwmon_flags |= I8K_HWMON_HAVE_TEMP6;
> > +	err = i8k_get_temp_type(6);
> > +	if (err >= 0)
> > +		i8k_hwmon_flags |= I8K_HWMON_HAVE_TEMP7;
> > +	err = i8k_get_temp_type(7);
> > +	if (err >= 0)
> > +		i8k_hwmon_flags |= I8K_HWMON_HAVE_TEMP8;
> > +	err = i8k_get_temp_type(8);
> > +	if (err >= 0)
> > +		i8k_hwmon_flags |= I8K_HWMON_HAVE_TEMP9;
> > +	err = i8k_get_temp_type(9);
> > +	if (err >= 0)
> > +		i8k_hwmon_flags |= I8K_HWMON_HAVE_TEMP10;
> > 
> >  	/* First fan attributes, if fan status or type is OK */
> >  	err = i8k_get_fan_status(0);

-- 
Pali Rohár
pali.rohar@gmail.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

  reply index

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-27 23:06 [PATCH] dell-smm-hwmon.c: Add XPS 9570 to supported devices list Michele Sorcinelli
2018-11-28  8:14 ` Pali Rohár
2018-11-28 12:30 ` Michele Sorcinelli
2018-11-28 12:56   ` Pali Rohár
2018-11-28 13:01     ` Michele Sorcinelli
2018-11-28 23:23       ` Michele Sorcinelli
2018-11-29  9:48         ` Pali Rohár
2018-11-29 21:42           ` Michele Sorcinelli
2018-12-05  9:15             ` Pali Rohár
2018-12-07 20:29               ` [PATCH] dell-smm-hwmon.c: Add support for additional temperature sensors Michele Sorcinelli
2018-12-08  0:52                 ` Michele Sorcinelli
2018-12-08  0:56                 ` [PATCH] dell-smm-hwmon.c: Additional " Michele Sorcinelli
2018-12-08  4:24                   ` Guenter Roeck
2018-12-08 15:34                     ` Michele Sorcinelli
2018-12-08 15:43                       ` Michele Sorcinelli
2018-12-08 16:52                       ` Guenter Roeck
2018-12-10 10:58                     ` Pali Rohár
2018-12-10 11:53                       ` Michele Sorcinelli
2018-12-10 12:03                         ` Pali Rohár
2019-02-07 12:16                       ` Michele Sorcinelli
2019-02-07 12:40                         ` Pali Rohár
2019-04-21 17:00                           ` Michele Sorcinelli
2019-06-14 21:38                           ` Michele Sorcinelli
2018-12-08 17:02               ` [PATCH v2] " Michele Sorcinelli
2018-12-14 23:57               ` [PATCH v3] " Michele Sorcinelli
2018-12-21 23:40                 ` Guenter Roeck
2018-12-22 12:50                   ` Pali Rohár [this message]
2018-12-22 14:18                     ` [PATCH v3.1] " Michele Sorcinelli
2018-12-23 22:59                       ` Michele Sorcinelli
2018-12-24  1:16                         ` Guenter Roeck

Reply instructions:

You may reply publically 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=20181222125021.kzwzupc4hj7y4vlc@pali \
    --to=pali.rohar@gmail.com \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=michelesr@autistici.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

Linux-Hwmon Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-hwmon/0 linux-hwmon/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-hwmon linux-hwmon/ https://lore.kernel.org/linux-hwmon \
		linux-hwmon@vger.kernel.org linux-hwmon@archiver.kernel.org
	public-inbox-index linux-hwmon


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-hwmon


AGPL code for this site: git clone https://public-inbox.org/ public-inbox