23 Jul, 2019

1 commit


18 Apr, 2019

28 commits


06 Mar, 2019

2 commits

  • [ Upstream commit 129699bb8c7572106b5bbb2407c2daee4727ccad ]

    Changes since V1:
    * Use dev_info instead of printk
    * Use dev_warn instead of BUG_ON

    Previously, sysfs_create_group was called before all initialization had
    fully run - specifically, before pci_set_drvdata was called. Since the
    sysctl group is visible to userspace as soon as sysfs_create_group
    returns, a small window of time existed during which a process could read
    from an uninitialized/partially-initialized device.

    This commit moves the creation of the sysctl group to after all
    initialized is completed. This ensures that it's impossible for
    userspace to read from a sysctl file before initialization has fully
    completed.

    To catch any future regressions, I've added a check to ensure
    that proc_thermal_emum_mode is never PROC_THERMAL_NONE when a process
    tries to read from a sysctl file. Previously, the aforementioned race
    condition could result in the 'else' branch
    running while PROC_THERMAL_NONE was set,
    leading to a null pointer deference.

    Signed-off-by: Aaron Hill
    Signed-off-by: Zhang Rui
    Signed-off-by: Sasha Levin

    Aaron Hill
     
  • [ Upstream commit 3fe931b31a4078395c1967f0495dcc9e5ec6b5e3 ]

    The intel_soc_dts_iosf_init() function doesn't return NULL, it returns
    error pointers.

    Fixes: 4d0dd6c1576b ("Thermal/int340x/processor_thermal: Enable auxiliary DTS for Braswell")
    Signed-off-by: Dan Carpenter
    Signed-off-by: Zhang Rui
    Signed-off-by: Sasha Levin

    Dan Carpenter
     

13 Feb, 2019

5 commits

  • commit 03334ba8b425b2ad275c8f390cf83c7b081c3095 upstream.

    Avoid warnings like this:
    thermal_hwmon.h:29:1: warning: ‘thermal_remove_hwmon_sysfs’ defined but not used [-Wunused-function]
    thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz)

    Fixes: 0dd88793aacd ("thermal: hwmon: move hwmon support to single file")
    Reviewed-by: Geert Uytterhoeven
    Signed-off-by: Eduardo Valentin
    Signed-off-by: Greg Kroah-Hartman

    Eduardo Valentin
     
  • [ Upstream commit 9d216211fded20fff301d0317af3238d8383634c ]

    First correct the edge case to return the last element if we're
    outside the range, rather than at the last element, so that
    interpolation is not omitted for points between the two last entries in
    the table.

    Then correct the formula to perform linear interpolation based the two
    points surrounding the read ADC value. The indices for temp are kept as
    "hi" and "lo" to pair with the adc indices, but there's no requirement
    that the temperature is provided in descendent order. mult_frac() is
    used to prevent issues with overflowing the int.

    Cc: Laxman Dewangan
    Signed-off-by: Bjorn Andersson
    Signed-off-by: Eduardo Valentin
    Signed-off-by: Sasha Levin

    Bjorn Andersson
     
  • [ Upstream commit d56c19d07e0bc3ceff366a49b7d7a2440c967b1b ]

    By defaul of-based thermal driver do not enable hwmon.
    This patch does this explicitly, so that the temperature can be read
    through the common hwmon sysfs.

    Signed-off-by: Matthias Brugger
    Acked-by: Stefan Wahren
    Signed-off-by: Eduardo Valentin
    Signed-off-by: Sasha Levin

    Matthias Brugger
     
  • [ Upstream commit 68000a0d983f539c95ebe5dccd4f29535c7ac0af ]

    Sysfs interface to update cooling device cur_state does not
    currently holding cooling device lock sometimes leading to
    stale values in cur_state if getting updated simultanelously
    from user space and thermal framework. Adding the proper locking
    code fixes this issue.

    Signed-off-by: Thara Gopinath
    Signed-off-by: Zhang Rui
    Signed-off-by: Sasha Levin

    Thara Gopinath
     
  • [ Upstream commit 964f4843a455d2ffb199512b08be8d5f077c4cac ]

    commit ff140fea847e ("Thermal: handle thermal zone device properly
    during system sleep") added PM hook to call thermal zone reset during
    sleep. However resetting thermal zone will also clear the passive state
    and thus cancel the polling queue which leads the passive cooling device
    state not being cleared properly after sleep.

    thermal_pm_notify => thermal_zone_device_reset set passive to 0
    thermal_zone_trip_update will skip update passive as `old_target ==
    instance->target'.
    monitor_thermal_zone => thermal_zone_device_set_polling will cancel
    tz->poll_queue, so the cooling device state will not be changed
    afterwards.

    Reported-by: Kame Wang
    Signed-off-by: Wei Wang
    Signed-off-by: Zhang Rui
    Signed-off-by: Sasha Levin

    Wei Wang
     

21 Dec, 2018

1 commit

  • [ Upstream commit 70bb27b79adf63ea39e37371d09c823c7a8f93ce ]

    Commit 8c0e64ac4075 ("thermal: armada: get rid of the ->is_valid()
    pointer") removed the unnecessary indirection through a function
    pointer, but in doing so, also removed the negation operator too:

    - if (priv->data->is_valid && !priv->data->is_valid(priv)) {
    + if (armada_is_valid(priv)) {

    which results in:

    armada_thermal f06f808c.thermal: Temperature sensor reading not valid
    armada_thermal f2400078.thermal: Temperature sensor reading not valid
    armada_thermal f4400078.thermal: Temperature sensor reading not valid

    at boot, or whenever the "temp" sysfs file is read. Replace the
    negation operator.

    Fixes: 8c0e64ac4075 ("thermal: armada: get rid of the ->is_valid() pointer")
    Signed-off-by: Russell King
    Signed-off-by: Eduardo Valentin
    Signed-off-by: Sasha Levin

    Russell King
     

21 Nov, 2018

1 commit

  • commit 3c587768271e9c20276522025729e4ebca51583b upstream.

    This patch fixes use-after-free that was detected by KASAN. The bug is
    triggered on a CPUFreq driver module unload by freeing 'cdev' on device
    unregister and then using the freed structure during of the cdev's sysfs
    data destruction. The solution is to unregister the sysfs at first, then
    destroy sysfs data and finally release the cooling device.

    Cc: # v4.17+
    Fixes: 8ea229511e06 ("thermal: Add cooling device's statistics in sysfs")
    Signed-off-by: Dmitry Osipenko
    Acked-by: Viresh Kumar
    Acked-by: Eduardo Valentin
    Signed-off-by: Zhang Rui
    Signed-off-by: Greg Kroah-Hartman

    Dmitry Osipenko
     

14 Nov, 2018

2 commits

  • [ Upstream commit 760eea43f8c6d48684f1f34b8a02fddc1456e849 ]

    The workqueue used for monitoring the hardware may run while the device
    is already suspended. Fix this by using the freezable system workqueue
    instead, cfr. commit 51e20d0e3a60cf46 ("thermal: Prevent polling from
    happening during system suspend").

    Fixes: 608567aac3206ae8 ("thermal: da9062/61: Thermal junction temperature monitoring driver")
    Signed-off-by: Geert Uytterhoeven
    Acked-by: Steve Twiss
    Signed-off-by: Eduardo Valentin
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Geert Uytterhoeven
     
  • [ Upstream commit 697ee786f15d7b65c7f3045d45fe3a05d28e0911 ]

    When testing bind/unbind on r8a7791/koelsch:

    WARNING: CPU: 1 PID: 697 at lib/debugobjects.c:329 debug_print_object+0x8c/0xb4
    ODEBUG: free active (active state 0) object type: timer_list hint: delayed_work_timer_fn+0x0/0x10

    This happens if the workqueue runs after the device has been unbound.
    Fix this by cancelling any queued work during remove.

    Fixes: e0a5172e9eec7f0d ("thermal: rcar: add interrupt support")
    Signed-off-by: Geert Uytterhoeven
    Reviewed-by: Niklas Söderlund
    Signed-off-by: Eduardo Valentin
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Geert Uytterhoeven