1. 28 Oct, 2014 5 commits
    • Krzysztof Kozlowski's avatar
      power: charger-manager: Fix accessing invalidated power supply after fuel gauge unbind · bdbe8144
      Krzysztof Kozlowski authored
      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" > /sys/bus/i2c/drivers/max17042/unbind
      $ echo "12-0036" > /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 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
      [  240.499589] cat             D c0469530     0  1393      1 0x00000000
      [  240.505947] [<c0469530>] (__schedule) from [<c0469d3c>] (schedule_preempt_disabled+0x14/0x20)
      [  240.514449] [<c0469d3c>] (schedule_preempt_disabled) from [<c046af08>] (mutex_lock_nested+0x1bc/0x458)
      [  240.523736] [<c046af08>] (mutex_lock_nested) from [<c0287a98>] (regmap_read+0x30/0x60)
      [  240.531647] [<c0287a98>] (regmap_read) from [<c032238c>] (max17042_get_property+0x2e8/0x350)
      [  240.540055] [<c032238c>] (max17042_get_property) from [<c03247d8>] (charger_get_property+0x264/0x348)
      [  240.549252] [<c03247d8>] (charger_get_property) from [<c0320764>] (power_supply_show_property+0x48/0x1e0)
      [  240.558808] [<c0320764>] (power_supply_show_property) from [<c027308c>] (dev_attr_show+0x1c/0x48)
      [  240.567664] [<c027308c>] (dev_attr_show) from [<c0141fb0>] (sysfs_kf_seq_show+0x84/0x104)
      [  240.575814] [<c0141fb0>] (sysfs_kf_seq_show) from [<c0140b18>] (kernfs_seq_show+0x24/0x28)
      [  240.584061] [<c0140b18>] (kernfs_seq_show) from [<c0104574>] (seq_read+0x1b0/0x484)
      [  240.591702] [<c0104574>] (seq_read) from [<c00e1e24>] (vfs_read+0x88/0x144)
      [  240.598640] [<c00e1e24>] (vfs_read) from [<c00e1f20>] (SyS_read+0x40/0x8c)
      [  240.605507] [<c00e1f20>] (SyS_read) from [<c000e760>] (ret_fast_syscall+0x0/0x48)
      [  240.612952] 4 locks held by cat/1393:
      [  240.616589]  #0:  (&p->lock){+.+.+.}, at: [<c01043f4>] seq_read+0x30/0x484
      [  240.623414]  #1:  (&of->mutex){+.+.+.}, at: [<c01417dc>] kernfs_seq_start+0x1c/0x8c
      [  240.631086]  #2:  (s_active#31){++++.+}, at: [<c01417e4>] kernfs_seq_start+0x24/0x8c
      [  240.638777]  #3:  (&map->mutex){+.+...}, at: [<c0287a98>] 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/309Signed-off-by: default avatarKrzysztof Kozlowski <k.kozlowski@samsung.com>
      Cc: <stable@vger.kernel.org>
      Fixes: 3bb3dbbd ("power_supply: Add initial Charger-Manager driver")
      Signed-off-by: default avatarSebastian Reichel <sre@kernel.org>
      bdbe8144
    • Krzysztof Kozlowski's avatar
      power: charger-manager: Avoid recursive thermal get_temp call · ba9c9182
      Krzysztof Kozlowski authored
      The charger manager supports POWER_SUPPLY_PROP_TEMP property and acts
      as a thermal zone if any of these conditions match:
      1. Fuel gauge used by charger manager supports POWER_SUPPLY_PROP_TEMP.
      2. 'cm-thermal-zone' property is present in DTS (then it will supersede
         the fuel gauge temperature property).
      
      However in case 1 (fuel gauge reports temperature and 'cm-thermal-zone'
      is not set) the charger manager forwards its get_temp calls to fuel
      gauge thermal zone.
      
      This leads to reporting by lockdep a false positive deadlock for thermal
      zone's mutex because of nested calls to thermal_zone_get_temp(). This is
      false positive because these are different mutexes: one for charger
      manager thermal zone and second for fuel gauge thermal zone.
      
      Get rid of false lockdep alert and recursive call by setting
      'no_thermal' property for this power supply class. The thermal zone for
      charger manager won't be created (user space does not use it anyway).
      
      The lockdep report:
      [    2.540339] charger-manager charger-manager@0: Ignoring full-battery voltage threshold as it is not supplied
      [    2.540351] charger-manager charger-manager@0: Ignoring full-battery full capacity threshold as it is not supplied
      [    2.546296]
      [    2.546302] =============================================
      [    2.546305] [ INFO: possible recursive locking detected ]
      [    2.546312] 3.17.0-rc6-next-20140926-00012-gbb13895e46af-dirty #39 Not tainted
      [    2.546316] ---------------------------------------------
      [    2.546321] swapper/0/1 is trying to acquire lock:
      [    2.546348]  (&tz->lock){+.+...}, at: [<c0321d24>] thermal_zone_get_temp+0x38/0x68
      [    2.546352]
      [    2.546352] but task is already holding lock:
      [    2.546369]  (&tz->lock){+.+...}, at: [<c0321d24>] thermal_zone_get_temp+0x38/0x68
      [    2.546373]
      [    2.546373] other info that might help us debug this:
      [    2.546376]  Possible unsafe locking scenario:
      [    2.546376]
      [    2.546378]        CPU0
      [    2.546380]        ----
      [    2.546386]   lock(&tz->lock);
      [    2.546392]   lock(&tz->lock);
      [    2.546394]
      [    2.546394]  *** DEADLOCK ***
      [    2.546394]
      [    2.546397]  May be due to missing lock nesting notation
      [    2.546397]
      [    2.546401] 2 locks held by swapper/0/1:
      [    2.546430]  #0:  (&dev->mutex){......}, at: [<c02720c4>] __driver_attach+0x58/0x98
      [    2.546448]  #1:  (&tz->lock){+.+...}, at: [<c0321d24>] thermal_zone_get_temp+0x38/0x68
      [    2.546451]
      [    2.546451] stack backtrace:
      [    2.546460] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.17.0-rc6-next-20140926-00012-gbb13895e46af-dirty #39
      [    2.546497] [<c00140f0>] (unwind_backtrace) from [<c0011228>] (show_stack+0x10/0x14)
      [    2.546526] [<c0011228>] (show_stack) from [<c046158c>] (dump_stack+0x70/0xbc)
      [    2.546554] [<c046158c>] (dump_stack) from [<c005e32c>] (validate_chain.isra.24+0x718/0x890)
      [    2.546569] [<c005e32c>] (validate_chain.isra.24) from [<c005f0a0>] (__lock_acquire+0x498/0xa78)
      [    2.546581] [<c005f0a0>] (__lock_acquire) from [<c005fb50>] (lock_acquire+0x78/0xb8)
      [    2.546594] [<c005fb50>] (lock_acquire) from [<c0464260>] (mutex_lock_nested+0x64/0x458)
      [    2.546605] [<c0464260>] (mutex_lock_nested) from [<c0321d24>] (thermal_zone_get_temp+0x38/0x68)
      [    2.546634] [<c0321d24>] (thermal_zone_get_temp) from [<c031f1e0>] (charger_get_property+0x10c/0x348)
      [    2.546649] [<c031f1e0>] (charger_get_property) from [<c031af18>] (power_supply_read_temp+0x28/0x58)
      [    2.546662] [<c031af18>] (power_supply_read_temp) from [<c0321d38>] (thermal_zone_get_temp+0x4c/0x68)
      [    2.546676] [<c0321d38>] (thermal_zone_get_temp) from [<c03233d8>] (thermal_zone_device_update+0x24/0x9c)
      [    2.546687] [<c03233d8>] (thermal_zone_device_update) from [<c0323874>] (thermal_zone_device_register+0x424/0x550)
      [    2.546701] [<c0323874>] (thermal_zone_device_register) from [<c031b3c0>] (__power_supply_register+0x2a4/0x348)
      [    2.546714] [<c031b3c0>] (__power_supply_register) from [<c031ff64>] (charger_manager_probe+0x600/0xe5c)
      [    2.546727] [<c031ff64>] (charger_manager_probe) from [<c0273384>] (platform_drv_probe+0x48/0xa4)
      [    2.546746] [<c0273384>] (platform_drv_probe) from [<c0271f54>] (driver_probe_device+0x10c/0x224)
      [    2.546760] [<c0271f54>] (driver_probe_device) from [<c0272100>] (__driver_attach+0x94/0x98)
      [    2.546772] [<c0272100>] (__driver_attach) from [<c0270780>] (bus_for_each_dev+0x54/0x88)
      [    2.546784] [<c0270780>] (bus_for_each_dev) from [<c027173c>] (bus_add_driver+0xd4/0x1d0)
      [    2.546797] [<c027173c>] (bus_add_driver) from [<c027271c>] (driver_register+0x78/0xf4)
      [    2.546809] [<c027271c>] (driver_register) from [<c0008984>] (do_one_initcall+0x80/0x1d4)
      [    2.546829] [<c0008984>] (do_one_initcall) from [<c0612d60>] (kernel_init_freeable+0x10c/0x1d8)
      [    2.546847] [<c0612d60>] (kernel_init_freeable) from [<c045c238>] (kernel_init+0x8/0xec)
      [    2.546863] [<c045c238>] (kernel_init) from [<c000e828>] (ret_from_fork+0x14/0x2c)
      [    2.551396] charger-manager charger-manager@0: 'chg-reg' regulator's externally_control is 0
      Signed-off-by: default avatarKrzysztof Kozlowski <k.kozlowski@samsung.com>
      Signed-off-by: default avatarSebastian Reichel <sre@kernel.org>
      ba9c9182
    • Krzysztof Kozlowski's avatar
      power_supply: Add no_thermal property to prevent recursive get_temp calls · a69d82b9
      Krzysztof Kozlowski authored
      Add a 'no_thermal' property to the power supply class. If true then
      thermal zone won't be created for this power supply in
      power_supply_register().
      
      Power supply drivers may want to set it if they support
      POWER_SUPPLY_PROP_TEMP and they are forwarding this get property call to
      other thermal zone.
      
      If they won't set it lockdep may report false positive deadlock for
      thermal zone's mutex because of nested calls to thermal_zone_get_temp().
      First is the call to thermal_zone_get_temp() of the driver's thermal
      zone. Thermal core gets POWER_SUPPLY_PROP_TEMP property from this
      driver. The driver then calls other thermal zone thermal_zone_get_temp()
      and returns result.
      
      Example of such driver is charger manager.
      Signed-off-by: default avatarKrzysztof Kozlowski <k.kozlowski@samsung.com>
      Signed-off-by: default avatarSebastian Reichel <sre@kernel.org>
      a69d82b9
    • Krzysztof Kozlowski's avatar
      power: bq2415x_charger: Fix memory leak on DTS parsing error · 21e863b2
      Krzysztof Kozlowski authored
      Memory allocated for 'name' was leaking if required binding properties
      were not present.
      
      The memory for 'name' was allocated early at probe with kasprintf(). It
      was freed in error paths executed before and after parsing DTS but not
      in that error path.
      
      Fix the error path for parsing device tree properties.
      Signed-off-by: default avatarKrzysztof Kozlowski <k.kozlowski@samsung.com>
      Fixes: faffd234 ("bq2415x_charger: Add DT support")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarSebastian Reichel <sre@kernel.org>
      21e863b2
    • Krzysztof Kozlowski's avatar
      power: bq2415x_charger: Properly handle ENODEV from power_supply_get_by_phandle · 0eaf437a
      Krzysztof Kozlowski authored
      The power_supply_get_by_phandle() on error returns ENODEV or NULL.
      The driver later expects obtained pointer to power supply to be
      valid or NULL. If it is not NULL then it dereferences it in
      bq2415x_notifier_call() which would lead to dereferencing ENODEV-value
      pointer.
      
      Properly handle the power_supply_get_by_phandle() error case by
      replacing error value with NULL. This indicates that usb charger
      detection won't be used.
      
      Fix also memory leak of 'name' if power_supply_get_by_phandle() fails
      with NULL and probe should defer.
      Signed-off-by: default avatarKrzysztof Kozlowski <k.kozlowski@samsung.com>
      Fixes: faffd234 ("bq2415x_charger: Add DT support")
      Cc: <stable@vger.kernel.org>
      [small fix regarding the missing ti,usb-charger-detection info message]
      Signed-off-by: default avatarSebastian Reichel <sre@kernel.org>
      0eaf437a
  2. 15 Oct, 2014 1 commit
  3. 05 Oct, 2014 1 commit
  4. 03 Oct, 2014 2 commits
  5. 01 Oct, 2014 3 commits
  6. 26 Sep, 2014 14 commits
    • Pramod Gurav's avatar
      power: reset: use restart_notifier mechanism for msm-poweroff · 18a702e0
      Pramod Gurav authored
      This change replaces use of arm_pm_restart with recently introduced
      reset mechanism in Linux kernel called restart_notifier.
      
      Choosing priority 128, which is default priority, as according to
      documentation, this mechanism is sufficient to restart the entire system.
      
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: Josh Cartwright <joshc@codeaurora.org>
      Cc: Sebastian Reichel <sre@kernel.org>
      Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
      Cc: David Woodhouse <dwmw2@infradead.org>
      Cc: Stephen Boyd <sboyd@codeaurora.org>
      Cc: linux-pm@vger.kernel.org
      Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Reviewed-by: default avatarStephen Boyd <sboyd@codeaurora.org>
      Signed-off-by: default avatarPramod Gurav <pramod.gurav@smartplayin.com>
      Signed-off-by: default avatarSebastian Reichel <sre@kernel.org>
      18a702e0
    • David Riley's avatar
      power: Add simple gpio-restart driver · 371bb20d
      David Riley authored
      This driver registers a restart handler to set a GPIO line high/low
      to reset a board based on devicetree bindings.
      Signed-off-by: default avatarDavid Riley <davidriley@chromium.org>
      Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarSebastian Reichel <sre@kernel.org>
      371bb20d
    • Sebastian Reichel's avatar
      Merge tag 'tags/restart-handler-for-v3.18' into next · 1670d856
      Sebastian Reichel authored
      Immutable branch with restart handler patches for v3.18
      1670d856
    • Lee Jones's avatar
    • Lee Jones's avatar
      power: reset: Add restart functionality for STiH41x platforms · f0745f36
      Lee Jones authored
      This driver adds the restart functionality for STiH415 and STiH416
      platforms from STMicroelectronics.  This driver registers an
      arm_pm_restart function to reset the platform.
      Signed-off-by: default avatarChristophe Kerello <christophe.kerello@st.com>
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      Signed-off-by: default avatarSebastian Reichel <sre@kernel.org>
      f0745f36
    • Krzysztof Kozlowski's avatar
      power: charger-manager: Fix NULL pointer exception with missing cm-fuel-gauge · 661a8886
      Krzysztof Kozlowski authored
      NULL pointer exception happens during charger-manager probe if
      'cm-fuel-gauge' property is not present.
      
      [    2.448536] Unable to handle kernel NULL pointer dereference at virtual address 00000000
      [    2.456572] pgd = c0004000
      [    2.459217] [00000000] *pgd=00000000
      [    2.462759] Internal error: Oops: 5 [#1] PREEMPT SMP ARM
      [    2.468047] Modules linked in:
      [    2.471089] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.17.0-rc6-00251-ge44cf96cd525-dirty #969
      [    2.479765] task: ea890000 ti: ea87a000 task.ti: ea87a000
      [    2.485161] PC is at strcmp+0x4/0x30
      [    2.488719] LR is at power_supply_match_device_by_name+0x10/0x1c
      [    2.494695] pc : [<c01f4220>]    lr : [<c030fe38>]    psr: a0000113
      [    2.494695] sp : ea87bde0  ip : 00000000  fp : eaa97010
      [    2.506150] r10: 00000004  r9 : ea97269c  r8 : ea3bbfd0
      [    2.511360] r7 : eaa97000  r6 : c030fe28  r5 : 00000000  r4 : ea3b0000
      [    2.517869] r3 : 0000006d  r2 : 00000000  r1 : 00000000  r0 : c057c195
      [    2.524381] Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
      [    2.531671] Control: 10c5387d  Table: 4000404a  DAC: 00000015
      [    2.537399] Process swapper/0 (pid: 1, stack limit = 0xea87a240)
      [    2.543388] Stack: (0xea87bde0 to 0xea87c000)
      [    2.547733] bde0: ea3b0210 c026b1c8 eaa97010 eaa97000 eaa97010 eabb60a8 ea3b0210 00000000
      [    2.555891] be00: 00000008 ea2db210 ea1a3410 c030fee0 ea3bbf90 c03138fc c068969c c013526c
      [    2.564050] be20: eaa040c0 00000000 c068969c 00000000 eaa040c0 ea2da300 00000002 00000000
      [    2.572208] be40: 00000001 ea2da3c0 00000000 00000001 00000000 eaa97010 c068969c 00000000
      [    2.580367] be60: 00000000 c068969c 00000000 00000002 00000000 c026b71c c026b6f0 eaa97010
      [    2.588527] be80: c0e82530 c026a330 00000000 eaa97010 c068969c eaa97044 00000000 c061df50
      [    2.596686] bea0: ea87a000 c026a4dc 00000000 c068969c c026a448 c0268b5c ea8054a8 eaa8fd50
      [    2.604845] bec0: c068969c ea2db180 c06801f8 c0269b18 c0590f68 c068969c c0656c98 c068969c
      [    2.613004] bee0: c0656c98 ea3bbe40 c06988c0 c026aaf0 00000000 c0656c98 c0656c98 c00088a4
      [    2.621163] bf00: 00000000 c0055f48 00000000 00000004 00000000 ea890000 c05dbc54 c062c178
      [    2.629323] bf20: c0603518 c005f674 00000001 ea87a000 eb7ff83b c0476440 00000091 c003d41c
      [    2.637482] bf40: c05db344 00000007 eb7ff858 00000007 c065a76c c0647d24 00000007 c062c170
      [    2.645642] bf60: c06988c0 00000091 c062c178 c0603518 00000000 c0603cc4 00000007 00000007
      [    2.653801] bf80: c0603518 c0c0c0c0 00000000 c0453948 00000000 00000000 00000000 00000000
      [    2.661959] bfa0: 00000000 c0453950 00000000 c000e728 00000000 00000000 00000000 00000000
      [    2.670118] bfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
      [    2.678277] bfe0: 00000000 00000000 00000000 00000000 00000013 00000000 c0c0c0c0 c0c0c0c0
      [    2.686454] [<c01f4220>] (strcmp) from [<c030fe38>] (power_supply_match_device_by_name+0x10/0x1c)
      [    2.695303] [<c030fe38>] (power_supply_match_device_by_name) from [<c026b1c8>] (class_find_device+0x54/0xac)
      [    2.705106] [<c026b1c8>] (class_find_device) from [<c030fee0>] (power_supply_get_by_name+0x1c/0x30)
      [    2.714137] [<c030fee0>] (power_supply_get_by_name) from [<c03138fc>] (charger_manager_probe+0x3d8/0xe58)
      [    2.723683] [<c03138fc>] (charger_manager_probe) from [<c026b71c>] (platform_drv_probe+0x2c/0x5c)
      [    2.732532] [<c026b71c>] (platform_drv_probe) from [<c026a330>] (driver_probe_device+0x10c/0x224)
      [    2.741384] [<c026a330>] (driver_probe_device) from [<c026a4dc>] (__driver_attach+0x94/0x98)
      [    2.749813] [<c026a4dc>] (__driver_attach) from [<c0268b5c>] (bus_for_each_dev+0x54/0x88)
      [    2.757969] [<c0268b5c>] (bus_for_each_dev) from [<c0269b18>] (bus_add_driver+0xd4/0x1d0)
      [    2.766123] [<c0269b18>] (bus_add_driver) from [<c026aaf0>] (driver_register+0x78/0xf4)
      [    2.774110] [<c026aaf0>] (driver_register) from [<c00088a4>] (do_one_initcall+0x80/0x1bc)
      [    2.782276] [<c00088a4>] (do_one_initcall) from [<c0603cc4>] (kernel_init_freeable+0x100/0x1cc)
      [    2.790952] [<c0603cc4>] (kernel_init_freeable) from [<c0453950>] (kernel_init+0x8/0xec)
      [    2.799029] [<c0453950>] (kernel_init) from [<c000e728>] (ret_from_fork+0x14/0x2c)
      [    2.806572] Code: e12fff1e e1a03000 eafffff7 e4d03001 (e4d12001)
      [    2.812832] ---[ end trace 7f12556111b9e7ef ]---
      Signed-off-by: default avatarKrzysztof Kozlowski <k.kozlowski@samsung.com>
      Cc: <stable@vger.kernel.org>
      Fixes: 856ee611 ("charger-manager: Support deivce tree in charger manager driver")
      Signed-off-by: default avatarSebastian Reichel <sre@kernel.org>
      661a8886
    • Guenter Roeck's avatar
      arm/arm64: unexport restart handlers · 6cd6d94d
      Guenter Roeck authored
      Implementing a restart handler in a module don't make sense as there would
      be no guarantee that the module is loaded when a restart is needed.
      Unexport arm_pm_restart to ensure that no one gets the idea to do it
      anyway.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Acked-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Acked-by: default avatarHeiko Stuebner <heiko@sntech.de>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: David Woodhouse <dwmw2@infradead.org>
      Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jonas Jensen <jonas.jensen@gmail.com>
      Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
      Cc: Randy Dunlap <rdunlap@infradead.org>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Tomasz Figa <t.figa@samsung.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Wim Van Sebroeck <wim@iguana.be>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      6cd6d94d
    • Guenter Roeck's avatar
      watchdog: sunxi: register restart handler with kernel restart handler · d20a1d90
      Guenter Roeck authored
      The kernel core now provides an API to trigger a system restart.  Register
      with it instead of setting arm_pm_restart.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Acked-by: default avatarHeiko Stuebner <heiko@sntech.de>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: David Woodhouse <dwmw2@infradead.org>
      Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jonas Jensen <jonas.jensen@gmail.com>
      Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
      Cc: Randy Dunlap <rdunlap@infradead.org>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Tomasz Figa <t.figa@samsung.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Wim Van Sebroeck <wim@iguana.be>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      d20a1d90
    • Guenter Roeck's avatar
      watchdog: alim7101: register restart handler with kernel restart handler · 87ffc69e
      Guenter Roeck authored
      The kernel core now provides an API to trigger a system restart.  Register
      with it to restart the system instead of misusing the reboot notifier.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Acked-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Acked-by: default avatarHeiko Stuebner <heiko@sntech.de>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: David Woodhouse <dwmw2@infradead.org>
      Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jonas Jensen <jonas.jensen@gmail.com>
      Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
      Cc: Randy Dunlap <rdunlap@infradead.org>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Tomasz Figa <t.figa@samsung.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Wim Van Sebroeck <wim@iguana.be>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      87ffc69e
    • Guenter Roeck's avatar
      watchdog: moxart: register restart handler with kernel restart handler · ad0e0e68
      Guenter Roeck authored
      The kernel now provides an API to trigger a system restart.  Register with
      it instead of setting arm_pm_restart.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Acked-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Acked-by: default avatarHeiko Stuebner <heiko@sntech.de>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: David Woodhouse <dwmw2@infradead.org>
      Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jonas Jensen <jonas.jensen@gmail.com>
      Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
      Cc: Randy Dunlap <rdunlap@infradead.org>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Tomasz Figa <t.figa@samsung.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Wim Van Sebroeck <wim@iguana.be>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      ad0e0e68
    • Guenter Roeck's avatar
      arm: support restart through restart handler call chain · 1a9607a3
      Guenter Roeck authored
      The kernel core now supports a restart handler call chain for system
      restart functions.
      
      With this change, the arm_pm_restart callback is now optional, so drop its
      initialization and check if it is set before calling it.  Only call the
      kernel restart handler if arm_pm_restart is not set.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Acked-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Acked-by: default avatarHeiko Stuebner <heiko@sntech.de>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: David Woodhouse <dwmw2@infradead.org>
      Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jonas Jensen <jonas.jensen@gmail.com>
      Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
      Cc: Randy Dunlap <rdunlap@infradead.org>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Tomasz Figa <t.figa@samsung.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Wim Van Sebroeck <wim@iguana.be>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      1a9607a3
    • Guenter Roeck's avatar
      arm64: support restart through restart handler call chain · 1c7ffc32
      Guenter Roeck authored
      The kernel core now supports a restart handler call chain to restart the
      system.  Call it if arm_pm_restart is not set.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Acked-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Acked-by: default avatarHeiko Stuebner <heiko@sntech.de>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: David Woodhouse <dwmw2@infradead.org>
      Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jonas Jensen <jonas.jensen@gmail.com>
      Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
      Cc: Randy Dunlap <rdunlap@infradead.org>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Tomasz Figa <t.figa@samsung.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Wim Van Sebroeck <wim@iguana.be>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      1c7ffc32
    • Guenter Roeck's avatar
      power/restart: call machine_restart instead of arm_pm_restart · 0713e143
      Guenter Roeck authored
      machine_restart is supported on non-ARM platforms, and and ultimately
      calls arm_pm_restart, so dont call arm_pm_restart directly but use the
      more generic function.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Acked-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Acked-by: default avatarHeiko Stuebner <heiko@sntech.de>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: David Woodhouse <dwmw2@infradead.org>
      Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jonas Jensen <jonas.jensen@gmail.com>
      Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
      Cc: Randy Dunlap <rdunlap@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Tomasz Figa <t.figa@samsung.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Wim Van Sebroeck <wim@iguana.be>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      0713e143
    • Guenter Roeck's avatar
      kernel: add support for kernel restart handler call chain · b63adb97
      Guenter Roeck authored
      Various drivers implement architecture and/or device specific means to
      restart (reset) the system.  Various mechanisms have been implemented to
      support those schemes.  The best known mechanism is arm_pm_restart, which
      is a function pointer to be set either from platform specific code or from
      drivers.  Another mechanism is to use hardware watchdogs to issue a reset;
      this mechanism is used if there is no other method available to reset a
      board or system.  Two examples are alim7101_wdt, which currently uses the
      reboot notifier to trigger a reset, and moxart_wdt, which registers the
      arm_pm_restart function.
      
      The existing mechanisms have a number of drawbacks.  Typically only one
      scheme to restart the system is supported (at least if arm_pm_restart is
      used).  At least in theory there can be multiple means to restart the
      system, some of which may be less desirable (for example one mechanism may
      only reset the CPU, while another may reset the entire system).  Using
      arm_pm_restart can also be racy if the function pointer is set from a
      driver, as the driver may be in the process of being unloaded when
      arm_pm_restart is called.  Using the reboot notifier is always racy, as it
      is unknown if and when other functions using the reboot notifier have
      completed execution by the time the watchdog fires.
      
      Introduce a system restart handler call chain to solve the described
      problems.  This call chain is expected to be executed from the
      architecture specific machine_restart() function.  Drivers providing
      system restart functionality (such as the watchdog drivers mentioned
      above) are expected to register with this call chain.  By using the
      priority field in the notifier block, callers can control restart handler
      execution sequence and thus ensure that the restart handler with the
      optimal restart capabilities for a given system is called first.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Acked-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Acked-by: default avatarHeiko Stuebner <heiko@sntech.de>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Wim Van Sebroeck <wim@iguana.be>
      Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Jonas Jensen <jonas.jensen@gmail.com>
      Cc: Randy Dunlap <rdunlap@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
      Cc: David Woodhouse <dwmw2@infradead.org>
      Cc: Tomasz Figa <t.figa@samsung.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      b63adb97
  7. 25 Sep, 2014 1 commit
    • Krzysztof Kozlowski's avatar
      power: max14577: Fix circular config SYSFS dependency · 6a91e854
      Krzysztof Kozlowski authored
      Make the max14577 charger driver depending on SYSFS instead selecting
      it. This fixes warning on x86_64 with allmodconfig:
      
      scripts/kconfig/conf --allmodconfig Kconfig
      fs/sysfs/Kconfig:1:error: recursive dependency detected!
      fs/sysfs/Kconfig:1:	symbol SYSFS is selected by CHARGER_MAX14577
      drivers/power/Kconfig:327:	symbol CHARGER_MAX14577 depends on POWER_SUPPLY
      drivers/power/Kconfig:1:	symbol POWER_SUPPLY is selected by HID_SONY
      drivers/hid/Kconfig:638:	symbol HID_SONY depends on NEW_LEDS
      drivers/leds/Kconfig:8:	symbol NEW_LEDS is selected by SENSORS_APPLESMC
      drivers/hwmon/Kconfig:299:	symbol SENSORS_APPLESMC depends on HWMON
      drivers/hwmon/Kconfig:5:	symbol HWMON is selected by EEEPC_LAPTOP
      drivers/platform/x86/Kconfig:496:	symbol EEEPC_LAPTOP depends on HOTPLUG_PCI
      drivers/pci/hotplug/Kconfig:5:	symbol HOTPLUG_PCI depends on SYSFS
      Signed-off-by: default avatarKrzysztof Kozlowski <k.kozlowski@samsung.com>
      Reported-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: default avatarSebastian Reichel <sre@kernel.org>
      6a91e854
  8. 24 Sep, 2014 13 commits