public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>,
	Linus Torvalds <torvalds@linux-foundation.org>
Cc: Len Brown <lenb@kernel.org>,
	linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
	Sebastian Reichel <sre@kernel.org>,
	Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>,
	David Woodhouse <dwmw2@infradead.org>,
	linux-pm@vger.kernel.org
Subject: Re: [PATCH] ACPI / battery: Fix doubly added battery on system suspend
Date: Tue, 14 Apr 2015 16:49:51 +0200	[thread overview]
Message-ID: <11175509.8BujP5BLVe@vostro.rjw.lan> (raw)
In-Reply-To: <1429017853-3520-1-git-send-email-k.kozlowski.k@gmail.com>

On Tuesday, April 14, 2015 10:24:13 PM Krzysztof Kozlowski wrote:
> The commit 297d716f6260 ("power_supply: Change ownership from driver to
> core") inverted the logic in battery_notify(). As an effect already
> present battery was re-added on each system suspend or hibernation.
> 
> Dmesg:
> [  107.999370] WARNING: CPU: 0 PID: 303 at ../fs/sysfs/dir.c:31 sysfs_warn_dup+0x68/0x80()
> [  107.999374] sysfs: cannot create duplicate filename '/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A03:00/PNP0C0A:00/power_supply/BAT0'
> [  107.999418] CPU: 0 PID: 303 Comm: rtcwake Not tainted 4.0.0-ARCH-02621-g07e6253af953 #48
> [  107.999421] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
> [  107.999425]  0000000000000000 000000008600f41a ffff88001cf3f9f8 ffffffff8156c77d
> [  107.999430]  0000000000000000 ffff88001cf3fa50 ffff88001cf3fa38 ffffffff81074cea
> [  107.999434]  000029b71cf3fa38 ffff88001e387000 ffff88001cc3bfb8 ffff88001ce1e258
> [  107.999439] Call Trace:
> [  107.999446]  [<ffffffff8156c77d>] dump_stack+0x4c/0x6e
> [  107.999453]  [<ffffffff81074cea>] warn_slowpath_common+0x8a/0xc0
> [  107.999458]  [<ffffffff81074d75>] warn_slowpath_fmt+0x55/0x70
> [  107.999464]  [<ffffffff8124c548>] ? kernfs_path+0x48/0x60
> [  107.999468]  [<ffffffff8124fd28>] sysfs_warn_dup+0x68/0x80
> [  107.999472]  [<ffffffff8124fdcd>] sysfs_create_dir_ns+0x8d/0xa0
> [  107.999478]  [<ffffffff812bfae6>] kobject_add_internal+0xb6/0x370
> [  107.999483]  [<ffffffff812bffbf>] kobject_add+0x6f/0xd0
> [  107.999489]  [<ffffffff813e0310>] device_add+0x120/0x6c0
> [  107.999494]  [<ffffffff813de800>] ? dev_set_name+0x50/0x70
> [  107.999500]  [<ffffffff8141ed95>] __power_supply_register+0x145/0x290
> [  107.999506]  [<ffffffffa0104234>] ? extract_package+0x73/0xc5 [battery]
> [  107.999511]  [<ffffffff8141ef10>] power_supply_register_no_ws+0x10/0x20
> [  107.999517]  [<ffffffffa01044aa>] sysfs_add_battery+0x84/0xc5 [battery]
> [  107.999522]  [<ffffffffa0104b7f>] battery_notify+0x45/0x6b [battery]
> [  107.999527]  [<ffffffff8109476f>] notifier_call_chain+0x4f/0x80
> [  107.999532]  [<ffffffff81094b5b>] __blocking_notifier_call_chain+0x4b/0x70
> [  107.999537]  [<ffffffff81094b96>] blocking_notifier_call_chain+0x16/0x20
> [  107.999543]  [<ffffffff810c20aa>] pm_notifier_call_chain+0x1a/0x40
> [  107.999548]  [<ffffffff810c399d>] pm_suspend+0x3ed/0x4e0
> [  107.999552]  [<ffffffff810c2087>] state_store+0xa7/0xb0
> [  107.999557]  [<ffffffff812bee0f>] kobj_attr_store+0xf/0x20
> [  107.999561]  [<ffffffff8124f41a>] sysfs_kf_write+0x3a/0x50
> [  107.999565]  [<ffffffff8124e8f7>] kernfs_fop_write+0x127/0x180
> [  107.999571]  [<ffffffff811d5727>] vfs_write+0xb7/0x200
> [  107.999576]  [<ffffffff811d6409>] SyS_write+0x59/0xd0
> [  107.999581]  [<ffffffff81571f2e>] system_call_fastpath+0x12/0x71
> [  107.999586] ---[ end trace 3977e3a58591fca2 ]---
> 
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
> Reported-by: Linus Torvalds <torvalds@linux-foundation.org>

Fixes: 297d716f6260 (power_supply: Change ownership from driver to core)
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Linus, can you please apply this one directly if it works for you?

Rafael


> ---
> 
> This fixes commit 297d716f6260 which was recently pulled from battery
> tree:
> https://lkml.org/lkml/2015/4/13/396.
> ---
>  drivers/acpi/battery.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
> index fdc16ce9d272..672263a3832c 100644
> --- a/drivers/acpi/battery.c
> +++ b/drivers/acpi/battery.c
> @@ -1106,7 +1106,7 @@ static int battery_notify(struct notifier_block *nb,
>  		if (!acpi_battery_present(battery))
>  			return 0;
>  
> -		if (battery->bat) {
> +		if (!battery->bat) {
>  			result = acpi_battery_get_info(battery);
>  			if (result)
>  				return result;
> 


      parent reply	other threads:[~2015-04-14 14:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-14 13:24 [PATCH] ACPI / battery: Fix doubly added battery on system suspend Krzysztof Kozlowski
2015-04-14 14:41 ` Sebastian Reichel
2015-04-14 14:49 ` Rafael J. Wysocki [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=11175509.8BujP5BLVe@vostro.rjw.lan \
    --to=rjw@rjwysocki.net \
    --cc=dbaryshkov@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=k.kozlowski.k@gmail.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=sre@kernel.org \
    --cc=torvalds@linux-foundation.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