aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-06-12 16:19:38 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-06-12 16:19:38 -0400
commit98db5e5503c21c27705c49ebda782b4252b5f7a7 (patch)
treeb7f3cec0f0fbea2a8187991219e633a14d32eaa5
parent7259f6452577f2df48f03d07e8302b8535cad74c (diff)
parente9ed3ee61aa62ce280aadeeea1ec959f0c66a290 (diff)
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux
Pull thermal updates from Zhang Rui: "Thermal core and intel thermal drivers: - convert thermal sysfs attributes to use DEVICE_ATTR_{RO|RW|WO}() variants (Viresh Kumar) - update license to SPDX format (Lina Iyer) - add GeminiLake support for int340x processor_thermal driver (Sumeet Pawnikar) - prevent error in reading trip hysteresis attribute for int340x thermal driver (Srinivas Pandruvada)" * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux: thermal: int340x: processor_thermal: Add GeminiLake support drivers: thermal: Update license to SPDX format thermal: int340x: Prevent error in reading trip hysteresis attribute thermal: Use DEVICE_ATTR_{RO|RW|WO}() variants thermal: Shorten name of sysfs callbacks
-rw-r--r--drivers/thermal/int340x_thermal/int340x_thermal_zone.c6
-rw-r--r--drivers/thermal/int340x_thermal/processor_thermal_device.c4
-rw-r--r--drivers/thermal/of-thermal.c19
-rw-r--r--drivers/thermal/thermal_core.c11
-rw-r--r--drivers/thermal/thermal_core.h30
-rw-r--r--drivers/thermal/thermal_helpers.c5
-rw-r--r--drivers/thermal/thermal_hwmon.c17
-rw-r--r--drivers/thermal/thermal_hwmon.h17
-rw-r--r--drivers/thermal/thermal_sysfs.c81
-rw-r--r--include/linux/thermal.h17
10 files changed, 50 insertions, 157 deletions
diff --git a/drivers/thermal/int340x_thermal/int340x_thermal_zone.c b/drivers/thermal/int340x_thermal/int340x_thermal_zone.c
index 145a5c53ff5c..dfdf6dbc2ddc 100644
--- a/drivers/thermal/int340x_thermal/int340x_thermal_zone.c
+++ b/drivers/thermal/int340x_thermal/int340x_thermal_zone.c
@@ -147,9 +147,9 @@ static int int340x_thermal_get_trip_hyst(struct thermal_zone_device *zone,
147 147
148 status = acpi_evaluate_integer(d->adev->handle, "GTSH", NULL, &hyst); 148 status = acpi_evaluate_integer(d->adev->handle, "GTSH", NULL, &hyst);
149 if (ACPI_FAILURE(status)) 149 if (ACPI_FAILURE(status))
150 return -EIO; 150 *temp = 0;
151 151 else
152 *temp = hyst * 100; 152 *temp = hyst * 100;
153 153
154 return 0; 154 return 0;
155} 155}
diff --git a/drivers/thermal/int340x_thermal/processor_thermal_device.c b/drivers/thermal/int340x_thermal/processor_thermal_device.c
index 80bbf9ce2fb6..284cf2c5a8fd 100644
--- a/drivers/thermal/int340x_thermal/processor_thermal_device.c
+++ b/drivers/thermal/int340x_thermal/processor_thermal_device.c
@@ -43,6 +43,9 @@
43#define PCI_DEVICE_ID_PROC_BXTX_THERMAL 0x4A8C 43#define PCI_DEVICE_ID_PROC_BXTX_THERMAL 0x4A8C
44#define PCI_DEVICE_ID_PROC_BXTP_THERMAL 0x5A8C 44#define PCI_DEVICE_ID_PROC_BXTP_THERMAL 0x5A8C
45 45
46/* GeminiLake thermal reporting device */
47#define PCI_DEVICE_ID_PROC_GLK_THERMAL 0x318C
48
46struct power_config { 49struct power_config {
47 u32 index; 50 u32 index;
48 u32 min_uw; 51 u32 min_uw;
@@ -467,6 +470,7 @@ static const struct pci_device_id proc_thermal_pci_ids[] = {
467 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_PROC_BXTP_THERMAL)}, 470 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_PROC_BXTP_THERMAL)},
468 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_PROC_CNL_THERMAL)}, 471 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_PROC_CNL_THERMAL)},
469 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_PROC_CFL_THERMAL)}, 472 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_PROC_CFL_THERMAL)},
473 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_PROC_GLK_THERMAL)},
470 { 0, }, 474 { 0, },
471}; 475};
472 476
diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c
index e09f0354a4bc..eea2fce82bf7 100644
--- a/drivers/thermal/of-thermal.c
+++ b/drivers/thermal/of-thermal.c
@@ -1,26 +1,9 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * of-thermal.c - Generic Thermal Management device tree support. 3 * of-thermal.c - Generic Thermal Management device tree support.
3 * 4 *
4 * Copyright (C) 2013 Texas Instruments 5 * Copyright (C) 2013 Texas Instruments
5 * Copyright (C) 2013 Eduardo Valentin <eduardo.valentin@ti.com> 6 * Copyright (C) 2013 Eduardo Valentin <eduardo.valentin@ti.com>
6 *
7 *
8 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; version 2 of the License.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
22 *
23 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
24 */ 7 */
25#include <linux/thermal.h> 8#include <linux/thermal.h>
26#include <linux/slab.h> 9#include <linux/slab.h>
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index d64325e078db..6ab982309e6a 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -1,13 +1,10 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * thermal.c - Generic Thermal Management Sysfs support. 3 * thermal.c - Generic Thermal Management Sysfs support.
3 * 4 *
4 * Copyright (C) 2008 Intel Corp 5 * Copyright (C) 2008 Intel Corp
5 * Copyright (C) 2008 Zhang Rui <rui.zhang@intel.com> 6 * Copyright (C) 2008 Zhang Rui <rui.zhang@intel.com>
6 * Copyright (C) 2008 Sujith Thomas <sujith.thomas@intel.com> 7 * Copyright (C) 2008 Sujith Thomas <sujith.thomas@intel.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
11 */ 8 */
12 9
13#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 10#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
@@ -736,7 +733,7 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz,
736 sysfs_attr_init(&dev->attr.attr); 733 sysfs_attr_init(&dev->attr.attr);
737 dev->attr.attr.name = dev->attr_name; 734 dev->attr.attr.name = dev->attr_name;
738 dev->attr.attr.mode = 0444; 735 dev->attr.attr.mode = 0444;
739 dev->attr.show = thermal_cooling_device_trip_point_show; 736 dev->attr.show = trip_point_show;
740 result = device_create_file(&tz->device, &dev->attr); 737 result = device_create_file(&tz->device, &dev->attr);
741 if (result) 738 if (result)
742 goto remove_symbol_link; 739 goto remove_symbol_link;
@@ -745,8 +742,8 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz,
745 sysfs_attr_init(&dev->weight_attr.attr); 742 sysfs_attr_init(&dev->weight_attr.attr);
746 dev->weight_attr.attr.name = dev->weight_attr_name; 743 dev->weight_attr.attr.name = dev->weight_attr_name;
747 dev->weight_attr.attr.mode = S_IWUSR | S_IRUGO; 744 dev->weight_attr.attr.mode = S_IWUSR | S_IRUGO;
748 dev->weight_attr.show = thermal_cooling_device_weight_show; 745 dev->weight_attr.show = weight_show;
749 dev->weight_attr.store = thermal_cooling_device_weight_store; 746 dev->weight_attr.store = weight_store;
750 result = device_create_file(&tz->device, &dev->weight_attr); 747 result = device_create_file(&tz->device, &dev->weight_attr);
751 if (result) 748 if (result)
752 goto remove_trip_file; 749 goto remove_trip_file;
diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h
index 5e4150261500..0df190ed82a7 100644
--- a/drivers/thermal/thermal_core.h
+++ b/drivers/thermal/thermal_core.h
@@ -1,24 +1,9 @@
1/* SPDX-License-Identifier: GPL-2.0 */
1/* 2/*
2 * thermal_core.h 3 * thermal_core.h
3 * 4 *
4 * Copyright (C) 2012 Intel Corp 5 * Copyright (C) 2012 Intel Corp
5 * Author: Durgadoss R <durgadoss.r@intel.com> 6 * Author: Durgadoss R <durgadoss.r@intel.com>
6 *
7 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
20 *
21 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22 */ 7 */
23 8
24#ifndef __THERMAL_CORE_H__ 9#ifndef __THERMAL_CORE_H__
@@ -75,15 +60,10 @@ void thermal_zone_destroy_device_groups(struct thermal_zone_device *);
75void thermal_cooling_device_setup_sysfs(struct thermal_cooling_device *); 60void thermal_cooling_device_setup_sysfs(struct thermal_cooling_device *);
76void thermal_cooling_device_destroy_sysfs(struct thermal_cooling_device *cdev); 61void thermal_cooling_device_destroy_sysfs(struct thermal_cooling_device *cdev);
77/* used only at binding time */ 62/* used only at binding time */
78ssize_t 63ssize_t trip_point_show(struct device *, struct device_attribute *, char *);
79thermal_cooling_device_trip_point_show(struct device *, 64ssize_t weight_show(struct device *, struct device_attribute *, char *);
80 struct device_attribute *, char *); 65ssize_t weight_store(struct device *, struct device_attribute *, const char *,
81ssize_t thermal_cooling_device_weight_show(struct device *, 66 size_t);
82 struct device_attribute *, char *);
83
84ssize_t thermal_cooling_device_weight_store(struct device *,
85 struct device_attribute *,
86 const char *, size_t);
87 67
88#ifdef CONFIG_THERMAL_STATISTICS 68#ifdef CONFIG_THERMAL_STATISTICS
89void thermal_cooling_device_stats_update(struct thermal_cooling_device *cdev, 69void thermal_cooling_device_stats_update(struct thermal_cooling_device *cdev,
diff --git a/drivers/thermal/thermal_helpers.c b/drivers/thermal/thermal_helpers.c
index eb03d7e099bb..2ba756af76b7 100644
--- a/drivers/thermal/thermal_helpers.c
+++ b/drivers/thermal/thermal_helpers.c
@@ -1,3 +1,4 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * thermal_helpers.c - helper functions to handle thermal devices 3 * thermal_helpers.c - helper functions to handle thermal devices
3 * 4 *
@@ -7,10 +8,6 @@
7 * Copyright (C) 2008 Intel Corp 8 * Copyright (C) 2008 Intel Corp
8 * Copyright (C) 2008 Zhang Rui <rui.zhang@intel.com> 9 * Copyright (C) 2008 Zhang Rui <rui.zhang@intel.com>
9 * Copyright (C) 2008 Sujith Thomas <sujith.thomas@intel.com> 10 * Copyright (C) 2008 Sujith Thomas <sujith.thomas@intel.com>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; version 2 of the License.
14 */ 11 */
15 12
16#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 13#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
diff --git a/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmon.c
index c4a508a124dc..11278836ed12 100644
--- a/drivers/thermal/thermal_hwmon.c
+++ b/drivers/thermal/thermal_hwmon.c
@@ -1,3 +1,4 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * thermal_hwmon.c - Generic Thermal Management hwmon support. 3 * thermal_hwmon.c - Generic Thermal Management hwmon support.
3 * 4 *
@@ -8,22 +9,6 @@
8 * 9 *
9 * Copyright (C) 2013 Texas Instruments 10 * Copyright (C) 2013 Texas Instruments
10 * Copyright (C) 2013 Eduardo Valentin <eduardo.valentin@ti.com> 11 * Copyright (C) 2013 Eduardo Valentin <eduardo.valentin@ti.com>
11 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; version 2 of the License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License along
23 * with this program; if not, write to the Free Software Foundation, Inc.,
24 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
25 *
26 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27 */ 12 */
28#include <linux/hwmon.h> 13#include <linux/hwmon.h>
29#include <linux/thermal.h> 14#include <linux/thermal.h>
diff --git a/drivers/thermal/thermal_hwmon.h b/drivers/thermal/thermal_hwmon.h
index c798fdb2ae43..019f6f88224e 100644
--- a/drivers/thermal/thermal_hwmon.h
+++ b/drivers/thermal/thermal_hwmon.h
@@ -1,3 +1,4 @@
1/* SPDX-License-Identifier: GPL-2.0 */
1/* 2/*
2 * thermal_hwmon.h - Generic Thermal Management hwmon support. 3 * thermal_hwmon.h - Generic Thermal Management hwmon support.
3 * 4 *
@@ -8,22 +9,6 @@
8 * 9 *
9 * Copyright (C) 2013 Texas Instruments 10 * Copyright (C) 2013 Texas Instruments
10 * Copyright (C) 2013 Eduardo Valentin <eduardo.valentin@ti.com> 11 * Copyright (C) 2013 Eduardo Valentin <eduardo.valentin@ti.com>
11 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; version 2 of the License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License along
23 * with this program; if not, write to the Free Software Foundation, Inc.,
24 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
25 *
26 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27 */ 12 */
28#ifndef __THERMAL_HWMON_H__ 13#ifndef __THERMAL_HWMON_H__
29#define __THERMAL_HWMON_H__ 14#define __THERMAL_HWMON_H__
diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysfs.c
index 23b5e0a709b0..2241ceae7d7f 100644
--- a/drivers/thermal/thermal_sysfs.c
+++ b/drivers/thermal/thermal_sysfs.c
@@ -1,3 +1,4 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * thermal.c - sysfs interface of thermal devices 3 * thermal.c - sysfs interface of thermal devices
3 * 4 *
@@ -7,10 +8,6 @@
7 * Copyright (C) 2008 Intel Corp 8 * Copyright (C) 2008 Intel Corp
8 * Copyright (C) 2008 Zhang Rui <rui.zhang@intel.com> 9 * Copyright (C) 2008 Zhang Rui <rui.zhang@intel.com>
9 * Copyright (C) 2008 Sujith Thomas <sujith.thomas@intel.com> 10 * Copyright (C) 2008 Sujith Thomas <sujith.thomas@intel.com>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; version 2 of the License.
14 */ 11 */
15 12
16#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 13#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
@@ -381,7 +378,7 @@ sustainable_power_store(struct device *dev, struct device_attribute *devattr,
381 \ 378 \
382 return count; \ 379 return count; \
383 } \ 380 } \
384 static DEVICE_ATTR(name, S_IWUSR | S_IRUGO, name##_show, name##_store) 381 static DEVICE_ATTR_RW(name)
385 382
386create_s32_tzp_attr(k_po); 383create_s32_tzp_attr(k_po);
387create_s32_tzp_attr(k_pu); 384create_s32_tzp_attr(k_pu);
@@ -668,17 +665,15 @@ void thermal_zone_destroy_device_groups(struct thermal_zone_device *tz)
668 665
669/* sys I/F for cooling device */ 666/* sys I/F for cooling device */
670static ssize_t 667static ssize_t
671thermal_cooling_device_type_show(struct device *dev, 668cdev_type_show(struct device *dev, struct device_attribute *attr, char *buf)
672 struct device_attribute *attr, char *buf)
673{ 669{
674 struct thermal_cooling_device *cdev = to_cooling_device(dev); 670 struct thermal_cooling_device *cdev = to_cooling_device(dev);
675 671
676 return sprintf(buf, "%s\n", cdev->type); 672 return sprintf(buf, "%s\n", cdev->type);
677} 673}
678 674
679static ssize_t 675static ssize_t max_state_show(struct device *dev, struct device_attribute *attr,
680thermal_cooling_device_max_state_show(struct device *dev, 676 char *buf)
681 struct device_attribute *attr, char *buf)
682{ 677{
683 struct thermal_cooling_device *cdev = to_cooling_device(dev); 678 struct thermal_cooling_device *cdev = to_cooling_device(dev);
684 unsigned long state; 679 unsigned long state;
@@ -690,9 +685,8 @@ thermal_cooling_device_max_state_show(struct device *dev,
690 return sprintf(buf, "%ld\n", state); 685 return sprintf(buf, "%ld\n", state);
691} 686}
692 687
693static ssize_t 688static ssize_t cur_state_show(struct device *dev, struct device_attribute *attr,
694thermal_cooling_device_cur_state_show(struct device *dev, 689 char *buf)
695 struct device_attribute *attr, char *buf)
696{ 690{
697 struct thermal_cooling_device *cdev = to_cooling_device(dev); 691 struct thermal_cooling_device *cdev = to_cooling_device(dev);
698 unsigned long state; 692 unsigned long state;
@@ -705,9 +699,8 @@ thermal_cooling_device_cur_state_show(struct device *dev,
705} 699}
706 700
707static ssize_t 701static ssize_t
708thermal_cooling_device_cur_state_store(struct device *dev, 702cur_state_store(struct device *dev, struct device_attribute *attr,
709 struct device_attribute *attr, 703 const char *buf, size_t count)
710 const char *buf, size_t count)
711{ 704{
712 struct thermal_cooling_device *cdev = to_cooling_device(dev); 705 struct thermal_cooling_device *cdev = to_cooling_device(dev);
713 unsigned long state; 706 unsigned long state;
@@ -726,13 +719,10 @@ thermal_cooling_device_cur_state_store(struct device *dev,
726 return count; 719 return count;
727} 720}
728 721
729static struct device_attribute dev_attr_cdev_type = 722static struct device_attribute
730__ATTR(type, 0444, thermal_cooling_device_type_show, NULL); 723dev_attr_cdev_type = __ATTR(type, 0444, cdev_type_show, NULL);
731static DEVICE_ATTR(max_state, 0444, 724static DEVICE_ATTR_RO(max_state);
732 thermal_cooling_device_max_state_show, NULL); 725static DEVICE_ATTR_RW(cur_state);
733static DEVICE_ATTR(cur_state, 0644,
734 thermal_cooling_device_cur_state_show,
735 thermal_cooling_device_cur_state_store);
736 726
737static struct attribute *cooling_device_attrs[] = { 727static struct attribute *cooling_device_attrs[] = {
738 &dev_attr_cdev_type.attr, 728 &dev_attr_cdev_type.attr,
@@ -791,10 +781,8 @@ unlock:
791 spin_unlock(&stats->lock); 781 spin_unlock(&stats->lock);
792} 782}
793 783
794static ssize_t 784static ssize_t total_trans_show(struct device *dev,
795thermal_cooling_device_total_trans_show(struct device *dev, 785 struct device_attribute *attr, char *buf)
796 struct device_attribute *attr,
797 char *buf)
798{ 786{
799 struct thermal_cooling_device *cdev = to_cooling_device(dev); 787 struct thermal_cooling_device *cdev = to_cooling_device(dev);
800 struct cooling_dev_stats *stats = cdev->stats; 788 struct cooling_dev_stats *stats = cdev->stats;
@@ -808,9 +796,8 @@ thermal_cooling_device_total_trans_show(struct device *dev,
808} 796}
809 797
810static ssize_t 798static ssize_t
811thermal_cooling_device_time_in_state_show(struct device *dev, 799time_in_state_ms_show(struct device *dev, struct device_attribute *attr,
812 struct device_attribute *attr, 800 char *buf)
813 char *buf)
814{ 801{
815 struct thermal_cooling_device *cdev = to_cooling_device(dev); 802 struct thermal_cooling_device *cdev = to_cooling_device(dev);
816 struct cooling_dev_stats *stats = cdev->stats; 803 struct cooling_dev_stats *stats = cdev->stats;
@@ -830,9 +817,8 @@ thermal_cooling_device_time_in_state_show(struct device *dev,
830} 817}
831 818
832static ssize_t 819static ssize_t
833thermal_cooling_device_reset_store(struct device *dev, 820reset_store(struct device *dev, struct device_attribute *attr, const char *buf,
834 struct device_attribute *attr, 821 size_t count)
835 const char *buf, size_t count)
836{ 822{
837 struct thermal_cooling_device *cdev = to_cooling_device(dev); 823 struct thermal_cooling_device *cdev = to_cooling_device(dev);
838 struct cooling_dev_stats *stats = cdev->stats; 824 struct cooling_dev_stats *stats = cdev->stats;
@@ -853,10 +839,8 @@ thermal_cooling_device_reset_store(struct device *dev,
853 return count; 839 return count;
854} 840}
855 841
856static ssize_t 842static ssize_t trans_table_show(struct device *dev,
857thermal_cooling_device_trans_table_show(struct device *dev, 843 struct device_attribute *attr, char *buf)
858 struct device_attribute *attr,
859 char *buf)
860{ 844{
861 struct thermal_cooling_device *cdev = to_cooling_device(dev); 845 struct thermal_cooling_device *cdev = to_cooling_device(dev);
862 struct cooling_dev_stats *stats = cdev->stats; 846 struct cooling_dev_stats *stats = cdev->stats;
@@ -899,13 +883,10 @@ thermal_cooling_device_trans_table_show(struct device *dev,
899 return len; 883 return len;
900} 884}
901 885
902static DEVICE_ATTR(total_trans, 0444, thermal_cooling_device_total_trans_show, 886static DEVICE_ATTR_RO(total_trans);
903 NULL); 887static DEVICE_ATTR_RO(time_in_state_ms);
904static DEVICE_ATTR(time_in_state_ms, 0444, 888static DEVICE_ATTR_WO(reset);
905 thermal_cooling_device_time_in_state_show, NULL); 889static DEVICE_ATTR_RO(trans_table);
906static DEVICE_ATTR(reset, 0200, NULL, thermal_cooling_device_reset_store);
907static DEVICE_ATTR(trans_table, 0444,
908 thermal_cooling_device_trans_table_show, NULL);
909 890
910static struct attribute *cooling_device_stats_attrs[] = { 891static struct attribute *cooling_device_stats_attrs[] = {
911 &dev_attr_total_trans.attr, 892 &dev_attr_total_trans.attr,
@@ -980,8 +961,7 @@ void thermal_cooling_device_destroy_sysfs(struct thermal_cooling_device *cdev)
980 961
981/* these helper will be used only at the time of bindig */ 962/* these helper will be used only at the time of bindig */
982ssize_t 963ssize_t
983thermal_cooling_device_trip_point_show(struct device *dev, 964trip_point_show(struct device *dev, struct device_attribute *attr, char *buf)
984 struct device_attribute *attr, char *buf)
985{ 965{
986 struct thermal_instance *instance; 966 struct thermal_instance *instance;
987 967
@@ -995,8 +975,7 @@ thermal_cooling_device_trip_point_show(struct device *dev,
995} 975}
996 976
997ssize_t 977ssize_t
998thermal_cooling_device_weight_show(struct device *dev, 978weight_show(struct device *dev, struct device_attribute *attr, char *buf)
999 struct device_attribute *attr, char *buf)
1000{ 979{
1001 struct thermal_instance *instance; 980 struct thermal_instance *instance;
1002 981
@@ -1005,10 +984,8 @@ thermal_cooling_device_weight_show(struct device *dev,
1005 return sprintf(buf, "%d\n", instance->weight); 984 return sprintf(buf, "%d\n", instance->weight);
1006} 985}
1007 986
1008ssize_t 987ssize_t weight_store(struct device *dev, struct device_attribute *attr,
1009thermal_cooling_device_weight_store(struct device *dev, 988 const char *buf, size_t count)
1010 struct device_attribute *attr,
1011 const char *buf, size_t count)
1012{ 989{
1013 struct thermal_instance *instance; 990 struct thermal_instance *instance;
1014 int ret, weight; 991 int ret, weight;
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index 7834be668d80..5f4705f46c2f 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -1,25 +1,10 @@
1/* SPDX-License-Identifier: GPL-2.0 */
1/* 2/*
2 * thermal.h ($Revision: 0 $) 3 * thermal.h ($Revision: 0 $)
3 * 4 *
4 * Copyright (C) 2008 Intel Corp 5 * Copyright (C) 2008 Intel Corp
5 * Copyright (C) 2008 Zhang Rui <rui.zhang@intel.com> 6 * Copyright (C) 2008 Zhang Rui <rui.zhang@intel.com>
6 * Copyright (C) 2008 Sujith Thomas <sujith.thomas@intel.com> 7 * Copyright (C) 2008 Sujith Thomas <sujith.thomas@intel.com>
7 *
8 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; version 2 of the License.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
21 *
22 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23 */ 8 */
24 9
25#ifndef __THERMAL_H__ 10#ifndef __THERMAL_H__