All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Zhang Rui <rui.zhang@intel.com>
Cc: Guenter Roeck <linux@roeck-us.net>,
	pali.rohar@gmail.com, sre@kernel.org,
	kernel list <linux-kernel@vger.kernel.org>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	linux-omap@vger.kernel.org, tony@atomide.com, khilman@kernel.org,
	aaro.koskinen@iki.fi, ivo.g.dimitrov.75@gmail.com,
	patrikbachan@gmail.com, serge@hallyn.com, abcloriens@gmail.com,
	fabio.estevam@nxp.com
Subject: Re: v4.10-rc4 to v4.10-rc5: battery regression on Nokia N900
Date: Tue, 24 Jan 2017 08:37:20 +0100	[thread overview]
Message-ID: <20170124073720.GB5603@amd> (raw)
In-Reply-To: <20170124070639.GA5068@rzhang1-surface>

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

On Tue 2017-01-24 15:06:39, Zhang Rui wrote:
> On Mon, Jan 23, 2017 at 03:49:12PM -0800, Guenter Roeck wrote:
> > On Tue, Jan 24, 2017 at 12:26:54AM +0100, Pavel Machek wrote:
> > > Hi!
> > > 
> > > > > >I'll try to revert it on the top of v4.10-rc5 now... and yes, it fixes
> > > > > >the issue.
> > > > > >
> > > > > >Any idea what went wrong and how to fix that?
> > > > > >
> > > > > >Anyway as we are at -rc5 and this is warning fix that caused a
> > > > > >regression on different hardware... it should be reverted.
> > > > > >
> > > > > Agreed.
> > > > > 
> > > > > What exactly does "stopped working" mean ? That might help understanding
> > > > > what went wrong.
> > > > 
> > > > /sys files related to battery no longer appear. I beieve this has
> > > > something to do with it:
> > > > 
> > > > [    2.374877] of_get_named_gpiod_flags: parsed 'reset-gpios' property
> > > > of node '/ocp@68000000/spi@48098000/tsc2005@0[0]' - status (0)
> > > > [    2.375946] input: TSC2005 touchscreen as
> > > > /devices/platform/68000000.ocp/48098000.spi/spi_master/spi1/spi1.0/input/input5
> > > > [    2.392120] rx51-battery: probe of n900-battery failed with error
> > > > -22
> > > 
> > > Mystery solved:
> > > 
> > > diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
> > > index 3932f92..fe5ec82 100644
> > > --- a/drivers/hwmon/hwmon.c
> > > +++ b/drivers/hwmon/hwmon.c
> > > @@ -545,8 +545,10 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata,
> > >  	int i, j, err, id;
> > >  
> > >  	/* Do not accept invalid characters in hwmon name attribute */
> > > -	if (name && (!strlen(name) || strpbrk(name, "-* \t\n")))
> > > +	if (name && (!strlen(name) || strpbrk(name, "-* \t\n"))) {
> > > +		printk("hwmon: Invalid character detected: %s\n", name);
> > >  		return ERR_PTR(-EINVAL);
> > > +	}
> > >  
> > >  	id = ida_simple_get(&hwmon_ida, 0, 0, GFP_KERNEL);
> > >  	if (id < 0)
> > > 
> > > 
> > > pavel@n900:~$ dmesg | grep -5 Invalid
> > > [    0.829650] of_get_named_gpiod_flags: parsed 'gpio-reset' property
> > > of node '/ocp@68000000/i2c@48072000/tlv320aic3x@19[0]' - status (0)
> > > [    0.833831] tsl2563 2-0029: model 7, rev. 0
> > > [    0.837768] of_get_named_gpiod_flags: parsed 'enable-gpio' property
> > > of node '/ocp@68000000/i2c@48072000/lp5523@32[0]' - status (0)
> > > [    1.921417] omap_i2c 48072000.i2c: controller timed out
> > > [    2.056823] lp5523x 2-0032: lp5523 Programmable led chip found
> > > [    2.064147] hwmon: Invalid character detected: bq27200-0
> > 
> > So the problem is really that the thermal driver needs to create a valid name.
> >
> Right.
> 
> Before reverting, can you please try if this patch works or not?

Not really. Revert now. Sorry.

Are you sure? This does not look equivalent to me at all.

"name" file handling moved from drivers to the core, which added some
crazy checks what name can contain. Even if this "works", what is the
expected effect on the "name" file?

								Pavel

> thanks,
> rui
> 
> >From 79320ea3721314ec29ed6cdd6987ff922b11d6f9 Mon Sep 17 00:00:00 2001
> From: Zhang Rui <rui.zhang@intel.com>
> Date: Tue, 24 Jan 2017 14:11:03 +0800
> Subject: [PATCH] thermal: fix parameter when registering hwmon
> 
> commit 7611fb68062f ("thermal: thermal_hwmon: Convert to
> hwmon_device_register_with_info()") converts thermal core to use
> hwmon_device_register_with_info() to register to hwmon instead of
> deprecated hwmon_device_register().
> But at the same time, the name of the hwmon device created is changed to
> the thermal zone device name in this commit, which may contain
> incompatible characters for hwmon.
> 
> Fixes it by using exactly the same parameters as before this commit.
> 
> Fixes: 7611fb68062f ("thermal: thermal_hwmon: Convert to hwmon_devce_register_with_info()")
> Reported-by: Pavel Machek <pavel@ucw.cz>
> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
> ---
>  drivers/thermal/thermal_hwmon.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmon.c
> index c4a508a..0c6789f 100644
> --- a/drivers/thermal/thermal_hwmon.c
> +++ b/drivers/thermal/thermal_hwmon.c
> @@ -157,8 +157,8 @@ int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz)
>  
>  	INIT_LIST_HEAD(&hwmon->tz_list);
>  	strlcpy(hwmon->type, tz->type, THERMAL_NAME_LENGTH);
> -	hwmon->device = hwmon_device_register_with_info(NULL, hwmon->type,
> -							hwmon, NULL, NULL);
> +	hwmon->device = hwmon_device_register_with_info(NULL, NULL, NULL,
> +							NULL, NULL);
>  	if (IS_ERR(hwmon->device)) {
>  		result = PTR_ERR(hwmon->device);
>  		goto free_mem;

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: pavel@ucw.cz (Pavel Machek)
To: linux-arm-kernel@lists.infradead.org
Subject: v4.10-rc4 to v4.10-rc5: battery regression on Nokia N900
Date: Tue, 24 Jan 2017 08:37:20 +0100	[thread overview]
Message-ID: <20170124073720.GB5603@amd> (raw)
In-Reply-To: <20170124070639.GA5068@rzhang1-surface>

On Tue 2017-01-24 15:06:39, Zhang Rui wrote:
> On Mon, Jan 23, 2017 at 03:49:12PM -0800, Guenter Roeck wrote:
> > On Tue, Jan 24, 2017 at 12:26:54AM +0100, Pavel Machek wrote:
> > > Hi!
> > > 
> > > > > >I'll try to revert it on the top of v4.10-rc5 now... and yes, it fixes
> > > > > >the issue.
> > > > > >
> > > > > >Any idea what went wrong and how to fix that?
> > > > > >
> > > > > >Anyway as we are at -rc5 and this is warning fix that caused a
> > > > > >regression on different hardware... it should be reverted.
> > > > > >
> > > > > Agreed.
> > > > > 
> > > > > What exactly does "stopped working" mean ? That might help understanding
> > > > > what went wrong.
> > > > 
> > > > /sys files related to battery no longer appear. I beieve this has
> > > > something to do with it:
> > > > 
> > > > [    2.374877] of_get_named_gpiod_flags: parsed 'reset-gpios' property
> > > > of node '/ocp at 68000000/spi at 48098000/tsc2005 at 0[0]' - status (0)
> > > > [    2.375946] input: TSC2005 touchscreen as
> > > > /devices/platform/68000000.ocp/48098000.spi/spi_master/spi1/spi1.0/input/input5
> > > > [    2.392120] rx51-battery: probe of n900-battery failed with error
> > > > -22
> > > 
> > > Mystery solved:
> > > 
> > > diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
> > > index 3932f92..fe5ec82 100644
> > > --- a/drivers/hwmon/hwmon.c
> > > +++ b/drivers/hwmon/hwmon.c
> > > @@ -545,8 +545,10 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata,
> > >  	int i, j, err, id;
> > >  
> > >  	/* Do not accept invalid characters in hwmon name attribute */
> > > -	if (name && (!strlen(name) || strpbrk(name, "-* \t\n")))
> > > +	if (name && (!strlen(name) || strpbrk(name, "-* \t\n"))) {
> > > +		printk("hwmon: Invalid character detected: %s\n", name);
> > >  		return ERR_PTR(-EINVAL);
> > > +	}
> > >  
> > >  	id = ida_simple_get(&hwmon_ida, 0, 0, GFP_KERNEL);
> > >  	if (id < 0)
> > > 
> > > 
> > > pavel at n900:~$ dmesg | grep -5 Invalid
> > > [    0.829650] of_get_named_gpiod_flags: parsed 'gpio-reset' property
> > > of node '/ocp at 68000000/i2c at 48072000/tlv320aic3x at 19[0]' - status (0)
> > > [    0.833831] tsl2563 2-0029: model 7, rev. 0
> > > [    0.837768] of_get_named_gpiod_flags: parsed 'enable-gpio' property
> > > of node '/ocp at 68000000/i2c at 48072000/lp5523 at 32[0]' - status (0)
> > > [    1.921417] omap_i2c 48072000.i2c: controller timed out
> > > [    2.056823] lp5523x 2-0032: lp5523 Programmable led chip found
> > > [    2.064147] hwmon: Invalid character detected: bq27200-0
> > 
> > So the problem is really that the thermal driver needs to create a valid name.
> >
> Right.
> 
> Before reverting, can you please try if this patch works or not?

Not really. Revert now. Sorry.

Are you sure? This does not look equivalent to me at all.

"name" file handling moved from drivers to the core, which added some
crazy checks what name can contain. Even if this "works", what is the
expected effect on the "name" file?

								Pavel

> thanks,
> rui
> 
> >From 79320ea3721314ec29ed6cdd6987ff922b11d6f9 Mon Sep 17 00:00:00 2001
> From: Zhang Rui <rui.zhang@intel.com>
> Date: Tue, 24 Jan 2017 14:11:03 +0800
> Subject: [PATCH] thermal: fix parameter when registering hwmon
> 
> commit 7611fb68062f ("thermal: thermal_hwmon: Convert to
> hwmon_device_register_with_info()") converts thermal core to use
> hwmon_device_register_with_info() to register to hwmon instead of
> deprecated hwmon_device_register().
> But at the same time, the name of the hwmon device created is changed to
> the thermal zone device name in this commit, which may contain
> incompatible characters for hwmon.
> 
> Fixes it by using exactly the same parameters as before this commit.
> 
> Fixes: 7611fb68062f ("thermal: thermal_hwmon: Convert to hwmon_devce_register_with_info()")
> Reported-by: Pavel Machek <pavel@ucw.cz>
> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
> ---
>  drivers/thermal/thermal_hwmon.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmon.c
> index c4a508a..0c6789f 100644
> --- a/drivers/thermal/thermal_hwmon.c
> +++ b/drivers/thermal/thermal_hwmon.c
> @@ -157,8 +157,8 @@ int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz)
>  
>  	INIT_LIST_HEAD(&hwmon->tz_list);
>  	strlcpy(hwmon->type, tz->type, THERMAL_NAME_LENGTH);
> -	hwmon->device = hwmon_device_register_with_info(NULL, hwmon->type,
> -							hwmon, NULL, NULL);
> +	hwmon->device = hwmon_device_register_with_info(NULL, NULL, NULL,
> +							NULL, NULL);
>  	if (IS_ERR(hwmon->device)) {
>  		result = PTR_ERR(hwmon->device);
>  		goto free_mem;

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170124/d40ba625/attachment.sig>

  reply	other threads:[~2017-01-24  7:37 UTC|newest]

Thread overview: 97+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-23 12:40 v4.10-rc4 to v4.10-rc5: battery regression on Nokia N900 Pavel Machek
2017-01-23 12:40 ` Pavel Machek
2017-01-23 12:42 ` Pali Rohár
2017-01-23 12:42   ` Pali Rohár
2017-01-23 14:20   ` Pavel Machek
2017-01-23 14:20     ` Pavel Machek
2017-01-23 14:19 ` Pavel Machek
2017-01-23 14:19   ` Pavel Machek
2017-01-23 14:31   ` Guenter Roeck
2017-01-23 14:31     ` Guenter Roeck
2017-01-23 14:40     ` Pavel Machek
2017-01-23 14:40       ` Pavel Machek
2017-01-23 17:10       ` Guenter Roeck
2017-01-23 17:10         ` Guenter Roeck
2017-01-23 23:26       ` Pavel Machek
2017-01-23 23:26         ` Pavel Machek
2017-01-23 23:49         ` Guenter Roeck
2017-01-23 23:49           ` Guenter Roeck
2017-01-24  7:06           ` Zhang Rui
2017-01-24  7:06             ` Zhang Rui
2017-01-24  7:37             ` Pavel Machek [this message]
2017-01-24  7:37               ` Pavel Machek
2017-01-24 14:18               ` Guenter Roeck
2017-01-24 14:18                 ` Guenter Roeck
2017-01-24 17:58                 ` Pavel Machek
2017-01-24 17:58                   ` Pavel Machek
2017-01-24 18:45                   ` Guenter Roeck
2017-01-24 18:45                     ` Guenter Roeck
2017-01-24 22:46                     ` Pavel Machek
2017-01-24 22:46                       ` Pavel Machek
2017-01-24 23:07                       ` Fabio Estevam
2017-01-24 23:07                         ` Fabio Estevam
2017-01-25  5:29                         ` Zhang Rui
2017-01-25  5:29                           ` Zhang Rui
2017-01-25 10:17                           ` Pavel Machek
2017-01-25 10:17                             ` Pavel Machek
2017-01-25 11:12                     ` Pavel Machek
2017-01-25 11:12                       ` Pavel Machek
2017-01-25 11:51                       ` Guenter Roeck
2017-01-25 11:51                         ` Guenter Roeck
2017-01-25 11:51                         ` Guenter Roeck
2017-01-25 12:09                       ` Pali Rohár
2017-01-25 12:09                         ` Pali Rohár
2017-01-27  1:37                         ` Zhang Rui
2017-01-27  1:37                           ` Zhang Rui
2017-01-27  1:37                           ` Zhang Rui
2017-01-27  2:03                           ` Guenter Roeck
2017-01-27  2:03                             ` Guenter Roeck
2017-01-27  3:39                             ` Zhang Rui
2017-01-27  3:39                               ` Zhang Rui
2017-01-27  3:39                               ` Zhang Rui
2017-01-27  6:27                               ` Guenter Roeck
2017-01-27  6:27                                 ` Guenter Roeck
2017-01-27  6:27                                 ` Guenter Roeck
2017-01-27 11:16                                 ` Pavel Machek
2017-01-27 11:16                                   ` Pavel Machek
2017-01-27 14:13                                   ` Guenter Roeck
2017-01-27 14:13                                     ` Guenter Roeck
2017-01-27 19:06                                     ` Pavel Machek
2017-01-27 19:06                                       ` Pavel Machek
2017-01-27 19:06                                       ` Pavel Machek
2017-01-27 14:40                                 ` Zhang Rui
2017-01-27 14:40                                   ` Zhang Rui
2017-01-27 17:20                                   ` Guenter Roeck
2017-01-27 17:20                                     ` Guenter Roeck
2017-01-27 19:12                                     ` Pavel Machek
2017-01-27 19:12                                       ` Pavel Machek
2017-01-27 19:12                                       ` Pavel Machek
2017-01-27 19:29                                   ` Pavel Machek
2017-01-27 19:29                                     ` Pavel Machek
2017-01-27 19:29                                     ` Pavel Machek
2017-01-27  8:35                               ` Pali Rohár
2017-01-27  8:35                                 ` Pali Rohár
2017-01-27 11:09                             ` Pavel Machek
2017-01-27 11:09                               ` Pavel Machek
2017-01-27 11:09                               ` Pavel Machek
2017-01-27 14:14                               ` Guenter Roeck
2017-01-27 14:14                                 ` Guenter Roeck
2017-01-27 14:14                                 ` Guenter Roeck
2017-01-27 19:02                                 ` Pavel Machek
2017-01-27 19:02                                   ` Pavel Machek
2017-01-27 19:02                                   ` Pavel Machek
2017-01-27 11:29                         ` Pavel Machek
2017-01-27 11:29                           ` Pavel Machek
2017-01-24 14:10             ` Guenter Roeck
2017-01-24 14:10               ` Guenter Roeck
2017-01-24 14:15               ` Pavel Machek
2017-01-24 14:15                 ` Pavel Machek
2017-01-24 14:30                 ` Guenter Roeck
2017-01-24 14:30                   ` Guenter Roeck
2017-01-24  7:34           ` Pavel Machek
2017-01-24  7:34             ` Pavel Machek
2017-01-24 14:15             ` Guenter Roeck
2017-01-24 14:15               ` Guenter Roeck
2017-01-23 20:22   ` Pavel Machek
2017-01-23 20:22     ` Pavel Machek
2017-01-23 20:22     ` Pavel Machek

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=20170124073720.GB5603@amd \
    --to=pavel@ucw.cz \
    --cc=aaro.koskinen@iki.fi \
    --cc=abcloriens@gmail.com \
    --cc=fabio.estevam@nxp.com \
    --cc=ivo.g.dimitrov.75@gmail.com \
    --cc=khilman@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=pali.rohar@gmail.com \
    --cc=patrikbachan@gmail.com \
    --cc=rui.zhang@intel.com \
    --cc=serge@hallyn.com \
    --cc=sre@kernel.org \
    --cc=tony@atomide.com \
    /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.