<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/include/linux/power, branch v4.4.125</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.4.125</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.4.125'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2015-09-23T15:15:27Z</updated>
<entry>
<title>power: bq27xxx_battery: Add support for additional bq27xxx family devices</title>
<updated>2015-09-23T15:15:27Z</updated>
<author>
<name>Andrew F. Davis</name>
<email>afd@ti.com</email>
</author>
<published>2015-09-22T19:35:09Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=d74534c27775857cb09abd0f92ed9539dc8d0a93'/>
<id>urn:sha1:d74534c27775857cb09abd0f92ed9539dc8d0a93</id>
<content type='text'>
Add support for additional devices and register equivalent family devices
including the bq27010, bq27210, bq27500, bq27510, bq27520, bq27530,
bq27531, bq27541, bq27542, bq27546, bq27545, bq27441, bq27421, and the
bq27641.

To facilitate this process the register mapings have been moved to tables
and other small cleanups have been made.

Signed-off-by: Andrew F. Davis &lt;afd@ti.com&gt;
Signed-off-by: Sebastian Reichel &lt;sre@kernel.org&gt;
</content>
</entry>
<entry>
<title>power: bq27xxx_battery: Platform initialization must declare a device</title>
<updated>2015-09-23T14:23:12Z</updated>
<author>
<name>Andrew F. Davis</name>
<email>afd@ti.com</email>
</author>
<published>2015-09-22T19:35:07Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=424cfde49acaf1426e90837961e8aead0238b11b'/>
<id>urn:sha1:424cfde49acaf1426e90837961e8aead0238b11b</id>
<content type='text'>
When initialized as a platform device the initializer must now specify
a device. An empty device name is no longer valid.

Signed-off-by: Andrew F. Davis &lt;afd@ti.com&gt;
Signed-off-by: Sebastian Reichel &lt;sre@kernel.org&gt;
</content>
</entry>
<entry>
<title>power: bq27x00_battery: Renaming for consistency</title>
<updated>2015-09-23T14:16:22Z</updated>
<author>
<name>Andrew F. Davis</name>
<email>afd@ti.com</email>
</author>
<published>2015-09-22T19:35:06Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=081bab217db769526c1202c87099ff69737126ae'/>
<id>urn:sha1:081bab217db769526c1202c87099ff69737126ae</id>
<content type='text'>
Rename functions that are used by multiple devices. New devices
have been added and the function names and driver name are no longer
general enough for the functionality they provide.

Signed-off-by: Andrew F. Davis &lt;afd@ti.com&gt;
Acked-by: Tony Lindgren &lt;tony@atomide.com&gt;
Acked-by: GUAN Xuetao &lt;gxt@mprc.pku.edu.cn&gt;
Signed-off-by: Sebastian Reichel &lt;sre@kernel.org&gt;
</content>
</entry>
<entry>
<title>power: charger-manager: comment spelling fixes</title>
<updated>2015-09-22T14:04:30Z</updated>
<author>
<name>Marcel Ziswiler</name>
<email>marcel@ziswiler.com</email>
</author>
<published>2015-09-19T22:13:37Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=75ea8ca844fd35ce365e35e1617b239892d31f72'/>
<id>urn:sha1:75ea8ca844fd35ce365e35e1617b239892d31f72</id>
<content type='text'>
By accident I stumbled over a few misspelled words in the
charger-manager header file which this patch fixes. Namely:
- Extcon rather than Exton
- constraint rather than constratint
- existence rather than existance
- difference rather than diffential

While at it also add a missing space before a closing comment star
forward-slash.

Signed-off-by: Marcel Ziswiler &lt;marcel@ziswiler.com&gt;
Signed-off-by: Sebastian Reichel &lt;sre@kernel.org&gt;
</content>
</entry>
<entry>
<title>power: max17042_battery: add HEALTH and TEMP_* properties support</title>
<updated>2015-05-23T20:43:28Z</updated>
<author>
<name>Ramakrishna Pallala</name>
<email>ramakrishna.pallala@intel.com</email>
</author>
<published>2015-05-24T03:41:58Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=edd4ab0559316a1efe0881a4e2ccaeb4fec73142'/>
<id>urn:sha1:edd4ab0559316a1efe0881a4e2ccaeb4fec73142</id>
<content type='text'>
This patch adds the support for following battery properties
to max17042 fuel gauge driver.

POWER_SUPPLY_PROP_TEMP_ALERT_MIN
POWER_SUPPLY_PROP_TEMP_ALERT_MAX
POWER_SUPPLY_PROP_TEMP_MIN
POWER_SUPPLY_PROP_TEMP_MAX
POWER_SUPPLY_PROP_HEALTH

Signed-off-by: Ramakrishna Pallala &lt;ramakrishna.pallala@intel.com&gt;
Reviewed-by: Krzysztof Kozlowski &lt;k.kozlowski.k@gmail.com&gt;
Signed-off-by: Sebastian Reichel &lt;sre@kernel.org&gt;
</content>
</entry>
<entry>
<title>power: max17042_battery: Use reg type instead of chip type</title>
<updated>2015-04-06T15:46:27Z</updated>
<author>
<name>Beomho Seo</name>
<email>beomho.seo@samsung.com</email>
</author>
<published>2015-04-03T08:26:08Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=709c2c70c8ea73f488971f1de3c39fbdac995951'/>
<id>urn:sha1:709c2c70c8ea73f488971f1de3c39fbdac995951</id>
<content type='text'>
Currently, max17042 battery driver choose register map by MAX17042_DevName
register. But it is return IC specific firmware version. So other maxim chip
hard to use this drvier. This patch choose chip type from driver_data.

Signed-off-by: Beomho Seo &lt;beomho.seo@samsung.com&gt;
Reviewed-by: Krzysztof Kozlowski &lt;k.kozlowski@samsung.com&gt;
Signed-off-by: Sebastian Reichel &lt;sre@kernel.org&gt;
</content>
</entry>
<entry>
<title>power_supply: Change ownership from driver to core</title>
<updated>2015-03-13T22:15:51Z</updated>
<author>
<name>Krzysztof Kozlowski</name>
<email>k.kozlowski@samsung.com</email>
</author>
<published>2015-03-12T07:44:11Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=297d716f6260cc9421d971b124ca196b957ee458'/>
<id>urn:sha1:297d716f6260cc9421d971b124ca196b957ee458</id>
<content type='text'>
Change the ownership of power_supply structure from each driver
implementing the class to the power supply core.

The patch changes power_supply_register() function thus all drivers
implementing power supply class are adjusted.

Each driver provides the implementation of power supply. However it
should not be the owner of power supply class instance because it is
exposed by core to other subsystems with power_supply_get_by_name().
These other subsystems have no knowledge when the driver will unregister
the power supply. This leads to several issues when driver is unbound -
mostly because user of power supply accesses freed memory.

Instead let the core own the instance of struct 'power_supply'.  Other
users of this power supply will still access valid memory because it
will be freed when device reference count reaches 0. Currently this
means "it will leak" but power_supply_put() call in next patches will
solve it.

This solves invalid memory references in following race condition
scenario:

Thread 1: charger manager
Thread 2: power supply driver, used by charger manager

THREAD 1 (charger manager)         THREAD 2 (power supply driver)
==========================         ==============================
psy = power_supply_get_by_name()
                                   Driver unbind, .remove
                                     power_supply_unregister()
                                     Device fully removed
psy-&gt;get_property()

The 'get_property' call is executed in invalid context because the driver was
unbound and struct 'power_supply' memory was freed.

This could be observed easily with charger manager driver (here compiled
with max17040 fuel gauge):

$ cat /sys/devices/virtual/power_supply/cm-battery/capacity &amp;
$ echo "1-0036" &gt; /sys/bus/i2c/drivers/max17040/unbind
[   55.725123] Unable to handle kernel NULL pointer dereference at virtual address 00000000
[   55.732584] pgd = d98d4000
[   55.734060] [00000000] *pgd=5afa2831, *pte=00000000, *ppte=00000000
[   55.740318] Internal error: Oops: 80000007 [#1] PREEMPT SMP ARM
[   55.746210] Modules linked in:
[   55.749259] CPU: 1 PID: 2936 Comm: cat Tainted: G        W       3.19.0-rc1-next-20141226-00048-gf79f475f3c44-dirty #1496
[   55.760190] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[   55.766270] task: d9b76f00 ti: daf54000 task.ti: daf54000
[   55.771647] PC is at 0x0
[   55.774182] LR is at charger_get_property+0x2f4/0x36c
[   55.779201] pc : [&lt;00000000&gt;]    lr : [&lt;c034b0b4&gt;]    psr: 60000013
[   55.779201] sp : daf55e90  ip : 00000003  fp : 00000000
[   55.790657] r10: 00000000  r9 : c06e2878  r8 : d9b26c68
[   55.795865] r7 : dad81610  r6 : daec7410  r5 : daf55ebc  r4 : 00000000
[   55.802367] r3 : 00000000  r2 : daf55ebc  r1 : 0000002a  r0 : d9b26c68
[   55.808879] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
[   55.815994] Control: 10c5387d  Table: 598d406a  DAC: 00000015
[   55.821723] Process cat (pid: 2936, stack limit = 0xdaf54210)
[   55.827451] Stack: (0xdaf55e90 to 0xdaf56000)
[   55.831795] 5e80:                                     60000013 c01459c4 0000002a c06f8ef8
[   55.839956] 5ea0: db651000 c06f8ef8 daebac00 c04cb668 daebac08 c0346864 00000000 c01459c4
[   55.848115] 5ec0: d99eaa80 c06f8ef8 00000fff 00001000 db651000 c027f25c c027f240 d99eaa80
[   55.856274] 5ee0: d9a06c00 c0146218 daf55f18 00001000 d99eaa80 db4c18c0 00000001 00000001
[   55.864468] 5f00: daf55f80 c0144c78 c0144c54 c0107f90 00015000 d99eaab0 00000000 00000000
[   55.872603] 5f20: 000051c7 00000000 db4c18c0 c04a9370 00015000 00001000 daf55f80 00001000
[   55.880763] 5f40: daf54000 00015000 00000000 c00e53dc db4c18c0 c00e548c 0000000d 00008124
[   55.888937] 5f60: 00000001 00000000 00000000 db4c18c0 db4c18c0 00001000 00015000 c00e5550
[   55.897099] 5f80: 00000000 00000000 00001000 00001000 00015000 00000003 00000003 c000f364
[   55.905239] 5fa0: 00000000 c000f1a0 00001000 00015000 00000003 00015000 00001000 0001333c
[   55.913399] 5fc0: 00001000 00015000 00000003 00000003 00000002 00000000 00000000 00000000
[   55.921560] 5fe0: 7fffe000 be999850 0000a225 b6f3c19c 60000010 00000003 00000000 00000000
[   55.929744] [&lt;c034b0b4&gt;] (charger_get_property) from [&lt;c0346864&gt;] (power_supply_show_property+0x48/0x20c)
[   55.939286] [&lt;c0346864&gt;] (power_supply_show_property) from [&lt;c027f25c&gt;] (dev_attr_show+0x1c/0x48)
[   55.948130] [&lt;c027f25c&gt;] (dev_attr_show) from [&lt;c0146218&gt;] (sysfs_kf_seq_show+0x84/0x104)
[   55.956298] [&lt;c0146218&gt;] (sysfs_kf_seq_show) from [&lt;c0144c78&gt;] (kernfs_seq_show+0x24/0x28)
[   55.964536] [&lt;c0144c78&gt;] (kernfs_seq_show) from [&lt;c0107f90&gt;] (seq_read+0x1b0/0x484)
[   55.972172] [&lt;c0107f90&gt;] (seq_read) from [&lt;c00e53dc&gt;] (__vfs_read+0x18/0x4c)
[   55.979188] [&lt;c00e53dc&gt;] (__vfs_read) from [&lt;c00e548c&gt;] (vfs_read+0x7c/0x100)
[   55.986304] [&lt;c00e548c&gt;] (vfs_read) from [&lt;c00e5550&gt;] (SyS_read+0x40/0x8c)
[   55.993164] [&lt;c00e5550&gt;] (SyS_read) from [&lt;c000f1a0&gt;] (ret_fast_syscall+0x0/0x48)
[   56.000626] Code: bad PC value
[   56.011652] ---[ end trace 7b64343fbdae8ef1 ]---

Signed-off-by: Krzysztof Kozlowski &lt;k.kozlowski@samsung.com&gt;
Reviewed-by: Bartlomiej Zolnierkiewicz &lt;b.zolnierkie@samsung.com&gt;

[for the nvec part]
Reviewed-by: Marc Dietrich &lt;marvin24@gmx.de&gt;

[for compal-laptop.c]
Acked-by: Darren Hart &lt;dvhart@linux.intel.com&gt;

[for the mfd part]
Acked-by: Lee Jones &lt;lee.jones@linaro.org&gt;

[for the hid part]
Acked-by: Jiri Kosina &lt;jkosina@suse.cz&gt;

[for the acpi part]
Acked-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;

Signed-off-by: Sebastian Reichel &lt;sre@kernel.org&gt;
</content>
</entry>
<entry>
<title>power: charger-manager: Use alarmtimer for battery monitoring in suspend.</title>
<updated>2015-01-21T19:52:07Z</updated>
<author>
<name>Jonghwa Lee</name>
<email>jonghwa3.lee@samsung.com</email>
</author>
<published>2014-12-19T08:55:13Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=c1155c64e603378dccfc21ee0612cf60dd11725b'/>
<id>urn:sha1:c1155c64e603378dccfc21ee0612cf60dd11725b</id>
<content type='text'>
To guerantee proper charing and managing batteries even in suspend,
charger-manager has used rtc device with rtc framework interface.
However, it is better to use alarmtimer for cleaner and more appropriate
operation.
This patch makes driver to use alarmtimer for polling work in suspend and
removes all deprecated codes related with using rtc interface.

Signed-off-by: Jonghwa Lee &lt;jonghwa3.lee@samsung.com&gt;
Signed-off-by: Sebastian Reichel &lt;sre@kernel.org&gt;
</content>
</entry>
<entry>
<title>power: charger-manager: Fix accessing invalidated power supply after charger unbind</title>
<updated>2014-10-28T02:30:21Z</updated>
<author>
<name>Krzysztof Kozlowski</name>
<email>k.kozlowski@samsung.com</email>
</author>
<published>2014-10-13T13:34:31Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=cdaf3e15385d3232b52287e50692506f8fd01a09'/>
<id>urn:sha1:cdaf3e15385d3232b52287e50692506f8fd01a09</id>
<content type='text'>
The charger manager obtained in probe references to power supplies for
all chargers with power_supply_get_by_name() for later usage. However
if such charger driver was removed then this reference would point to
old power supply (from driver which was removed).

This lead to accessing invalid memory which could be observed with:
$ echo "max77693-charger" &gt; /sys/bus/platform/drivers/max77693-charger/unbind
$ grep . /sys/devices/virtual/power_supply/battery/charger.0/*
$ grep . /sys/devices/virtual/power_supply/battery/*
[   15.339817] Unable to handle kernel paging request at virtual address 0001c12c
[   15.346187] pgd = edd08000
[   15.348814] [0001c12c] *pgd=6dce2831, *pte=00000000, *ppte=00000000
[   15.355075] Internal error: Oops: 80000007 [#1] PREEMPT SMP ARM
[   15.360967] Modules linked in:
[   15.364010] CPU: 2 PID: 1388 Comm: grep Not tainted 3.17.0-next-20141007-00027-ga95e761db1b0 #245
[   15.372859] task: ee03ad00 ti: edcf6000 task.ti: edcf6000
[   15.378241] PC is at 0x1c12c
[   15.381113] LR is at is_ext_pwr_online+0x30/0x6c
[   15.385706] pc : [&lt;0001c12c&gt;]    lr : [&lt;c0339fc4&gt;]    psr: a0000013
[   15.385706] sp : edcf7e88  ip : 00000000  fp : 00000000
[   15.397161] r10: eeb02c08  r9 : c04b1f84  r8 : eeb02c00
[   15.402369] r7 : edc69a10  r6 : eea6ac10  r5 : eea6ac10  r4 : 00000004
[   15.408878] r3 : 0001c12c  r2 : edcf7e8c  r1 : 00000004  r0 : ee914418
[   15.415390] Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
[   15.422506] Control: 10c5387d  Table: 6dd0804a  DAC: 00000015
[   15.428236] Process grep (pid: 1388, stack limit = 0xedcf6240)
[   15.434050] Stack: (0xedcf7e88 to 0xedcf8000)
[   15.438395] 7e80:                   ee03ad00 00000000 edcf7f80 eea6aca8 edcf7ec4 c033b7b0
[   15.446554] 7ea0: 00000001 ee1cc3f0 00000004 c06e1e44 eebdc000 c06e1e44 eeb02c00 c0337144
[   15.454713] 7ec0: ee2dac68 c005cffc ee1cc3c0 c06e1e44 00000fff 00001000 eebdc000 c0278ca8
[   15.462872] 7ee0: c0278c8c ee1cc3c0 eeb7ce00 c014422c edcf7f20 00008000 ee1cc3c0 ee9a48c0
[   15.471030] 7f00: 00000001 00000001 edcf7f80 c0142d94 c0142d70 c01060f4 00021000 ee1cc3f0
[   15.479190] 7f20: 00000000 00000000 c06a2150 eebdc000 2e7ec000 ee9a48c0 00008000 00021000
[   15.487349] 7f40: edcf7f80 00008000 edcf6000 00021000 00021000 c00e39a4 00000000 ee9a48c0
[   15.495508] 7f60: 00004000 00000000 00000000 ee9a48c0 ee9a48c0 00008000 00021000 c00e3aa0
[   15.503668] 7f80: 00000000 00000000 0001f2e0 0001f2e0 00021000 00001000 00000003 c000f364
[   15.511826] 7fa0: 00000000 c000f1a0 0001f2e0 00021000 00000003 00021000 00008000 00000000
[   15.519986] 7fc0: 0001f2e0 00021000 00001000 00000003 00000001 000205e8 00000000 00021000
[   15.528145] 7fe0: 00008000 bebbe910 0000a7ad b6edc49c 60000010 00000003 aaaaaaaa aaaaaaaa
[   15.536320] [&lt;c0339fc4&gt;] (is_ext_pwr_online) from [&lt;c033b7b0&gt;] (charger_get_property+0x170/0x314)
[   15.545164] [&lt;c033b7b0&gt;] (charger_get_property) from [&lt;c0337144&gt;] (power_supply_show_property+0x48/0x20c)
[   15.554719] [&lt;c0337144&gt;] (power_supply_show_property) from [&lt;c0278ca8&gt;] (dev_attr_show+0x1c/0x48)
[   15.563577] [&lt;c0278ca8&gt;] (dev_attr_show) from [&lt;c014422c&gt;] (sysfs_kf_seq_show+0x84/0x104)
[   15.571725] [&lt;c014422c&gt;] (sysfs_kf_seq_show) from [&lt;c0142d94&gt;] (kernfs_seq_show+0x24/0x28)
[   15.579973] [&lt;c0142d94&gt;] (kernfs_seq_show) from [&lt;c01060f4&gt;] (seq_read+0x1b0/0x484)
[   15.587614] [&lt;c01060f4&gt;] (seq_read) from [&lt;c00e39a4&gt;] (vfs_read+0x88/0x144)
[   15.594552] [&lt;c00e39a4&gt;] (vfs_read) from [&lt;c00e3aa0&gt;] (SyS_read+0x40/0x8c)
[   15.601417] [&lt;c00e3aa0&gt;] (SyS_read) from [&lt;c000f1a0&gt;] (ret_fast_syscall+0x0/0x48)
[   15.608877] Code: bad PC value
[   15.611991] ---[ end trace a88fcc95208db283 ]---

The charger-manager should get reference to charger power supply on
each use of get_property callback.

Signed-off-by: Krzysztof Kozlowski &lt;k.kozlowski@samsung.com&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Fixes: 3bb3dbbd56ea ("power_supply: Add initial Charger-Manager driver")
Signed-off-by: Sebastian Reichel &lt;sre@kernel.org&gt;
</content>
</entry>
<entry>
<title>power: charger-manager: Fix accessing invalidated power supply after fuel gauge unbind</title>
<updated>2014-10-28T02:30:20Z</updated>
<author>
<name>Krzysztof Kozlowski</name>
<email>k.kozlowski@samsung.com</email>
</author>
<published>2014-10-13T13:34:30Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=bdbe81445407644492b9ac69a24d35e3202d773b'/>
<id>urn:sha1:bdbe81445407644492b9ac69a24d35e3202d773b</id>
<content type='text'>
The charger manager obtained reference to fuel gauge power supply in probe
with power_supply_get_by_name() for later usage. However if fuel gauge
driver was removed and re-added then this reference would point to old
power supply (from driver which was removed).

This lead to accessing old (and probably invalid) memory which could be
observed with:
$ echo "12-0036" &gt; /sys/bus/i2c/drivers/max17042/unbind
$ echo "12-0036" &gt; /sys/bus/i2c/drivers/max17042/bind
$ cat /sys/devices/virtual/power_supply/battery/capacity
[  240.480084] INFO: task cat:1393 blocked for more than 120 seconds.
[  240.484799]       Not tainted 3.17.0-next-20141007-00028-ge60b6dd79570 #203
[  240.491782] "echo 0 &gt; /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[  240.499589] cat             D c0469530     0  1393      1 0x00000000
[  240.505947] [&lt;c0469530&gt;] (__schedule) from [&lt;c0469d3c&gt;] (schedule_preempt_disabled+0x14/0x20)
[  240.514449] [&lt;c0469d3c&gt;] (schedule_preempt_disabled) from [&lt;c046af08&gt;] (mutex_lock_nested+0x1bc/0x458)
[  240.523736] [&lt;c046af08&gt;] (mutex_lock_nested) from [&lt;c0287a98&gt;] (regmap_read+0x30/0x60)
[  240.531647] [&lt;c0287a98&gt;] (regmap_read) from [&lt;c032238c&gt;] (max17042_get_property+0x2e8/0x350)
[  240.540055] [&lt;c032238c&gt;] (max17042_get_property) from [&lt;c03247d8&gt;] (charger_get_property+0x264/0x348)
[  240.549252] [&lt;c03247d8&gt;] (charger_get_property) from [&lt;c0320764&gt;] (power_supply_show_property+0x48/0x1e0)
[  240.558808] [&lt;c0320764&gt;] (power_supply_show_property) from [&lt;c027308c&gt;] (dev_attr_show+0x1c/0x48)
[  240.567664] [&lt;c027308c&gt;] (dev_attr_show) from [&lt;c0141fb0&gt;] (sysfs_kf_seq_show+0x84/0x104)
[  240.575814] [&lt;c0141fb0&gt;] (sysfs_kf_seq_show) from [&lt;c0140b18&gt;] (kernfs_seq_show+0x24/0x28)
[  240.584061] [&lt;c0140b18&gt;] (kernfs_seq_show) from [&lt;c0104574&gt;] (seq_read+0x1b0/0x484)
[  240.591702] [&lt;c0104574&gt;] (seq_read) from [&lt;c00e1e24&gt;] (vfs_read+0x88/0x144)
[  240.598640] [&lt;c00e1e24&gt;] (vfs_read) from [&lt;c00e1f20&gt;] (SyS_read+0x40/0x8c)
[  240.605507] [&lt;c00e1f20&gt;] (SyS_read) from [&lt;c000e760&gt;] (ret_fast_syscall+0x0/0x48)
[  240.612952] 4 locks held by cat/1393:
[  240.616589]  #0:  (&amp;p-&gt;lock){+.+.+.}, at: [&lt;c01043f4&gt;] seq_read+0x30/0x484
[  240.623414]  #1:  (&amp;of-&gt;mutex){+.+.+.}, at: [&lt;c01417dc&gt;] kernfs_seq_start+0x1c/0x8c
[  240.631086]  #2:  (s_active#31){++++.+}, at: [&lt;c01417e4&gt;] kernfs_seq_start+0x24/0x8c
[  240.638777]  #3:  (&amp;map-&gt;mutex){+.+...}, at: [&lt;c0287a98&gt;] regmap_read+0x30/0x60

The charger-manager should get reference to fuel gauge power supply on
each use of get_property callback. The thermal zone 'tzd' field of
power supply should not be used because of the same reason.

Additionally this change solves also the issue with nested
thermal_zone_get_temp() calls and related false lockdep positive for
deadlock for thermal zone's mutex [1]. When fuel gauge is used as source of
temperature then the charger manager forwards its get_temp calls to fuel
gauge thermal zone. So actually different mutexes are used (one for
charger manager thermal zone and second for fuel gauge thermal zone) but
for lockdep this is one class of mutex.

The recursion is removed by retrieving temperature through power
supply's get_property().

In case external thermal zone is used ('cm-thermal-zone' property is
present in DTS) the recursion does not exist. Charger manager simply
exports POWER_SUPPLY_PROP_TEMP_AMBIENT property (instead of
POWER_SUPPLY_PROP_TEMP) thus no thermal zone is created for this power
supply.

[1] https://lkml.org/lkml/2014/10/6/309

Signed-off-by: Krzysztof Kozlowski &lt;k.kozlowski@samsung.com&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Fixes: 3bb3dbbd56ea ("power_supply: Add initial Charger-Manager driver")
Signed-off-by: Sebastian Reichel &lt;sre@kernel.org&gt;
</content>
</entry>
</feed>
