* [PATCH] thermal: consistently use int for trip temp
@ 2016-03-03 7:14 Wei Ni
2016-03-03 7:30 ` kbuild test robot
2016-03-03 7:37 ` kbuild test robot
0 siblings, 2 replies; 3+ messages in thread
From: Wei Ni @ 2016-03-03 7:14 UTC (permalink / raw)
To: rui.zhang, edubezval; +Cc: linux-kernel, Wei Ni
The commit 17e8351a7739 consistently use int for temperature,
however it missed a few in trip temperature and thermal_core.
In current codes, the trip->temperature used "unsigned long"
and zone->temperature used"int", if the temperature is negative
value, it will get wrong result when compare temperature with
trip temperature.
This patch can fix it.
Signed-off-by: Wei Ni <wni@nvidia.com>
---
drivers/thermal/thermal_core.c | 4 ++--
include/linux/thermal.h | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index a0a8fd1235e2..2cde55474e34 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -684,7 +684,7 @@ trip_point_temp_store(struct device *dev, struct device_attribute *attr,
{
struct thermal_zone_device *tz = to_thermal_zone(dev);
int trip, ret;
- unsigned long temperature;
+ int temperature;
if (!tz->ops->set_trip_temp)
return -EPERM;
@@ -895,7 +895,7 @@ emul_temp_store(struct device *dev, struct device_attribute *attr,
{
struct thermal_zone_device *tz = to_thermal_zone(dev);
int ret = 0;
- unsigned long temperature;
+ int temperature;
if (kstrtoul(buf, 10, &temperature))
return -EINVAL;
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index e13a1ace50e9..eee0b7ddd2c1 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -350,8 +350,8 @@ struct thermal_zone_of_device_ops {
struct thermal_trip {
struct device_node *np;
- unsigned long int temperature;
- unsigned long int hysteresis;
+ int temperature;
+ int hysteresis;
enum thermal_trip_type type;
};
--
1.9.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] thermal: consistently use int for trip temp
2016-03-03 7:14 [PATCH] thermal: consistently use int for trip temp Wei Ni
@ 2016-03-03 7:30 ` kbuild test robot
2016-03-03 7:37 ` kbuild test robot
1 sibling, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2016-03-03 7:30 UTC (permalink / raw)
To: Wei Ni; +Cc: kbuild-all, rui.zhang, edubezval, linux-kernel, Wei Ni
[-- Attachment #1: Type: text/plain, Size: 4866 bytes --]
Hi Wei,
[auto build test WARNING on thermal/next]
[also build test WARNING on v4.5-rc6 next-20160302]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]
url: https://github.com/0day-ci/linux/commits/Wei-Ni/thermal-consistently-use-int-for-trip-temp/20160303-151648
base: https://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux.git next
config: sparc64-allyesconfig (attached as .config)
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=sparc64
All warnings (new ones prefixed by >>):
drivers/thermal/thermal_core.c: In function 'trip_point_temp_store':
>> drivers/thermal/thermal_core.c:695:6: warning: passing argument 3 of 'kstrtoul' from incompatible pointer type
if (kstrtoul(buf, 10, &temperature))
^
In file included from include/linux/list.h:8:0,
from include/linux/module.h:9,
from drivers/thermal/thermal_core.c:28:
include/linux/kernel.h:291:32: note: expected 'long unsigned int *' but argument is of type 'int *'
static inline int __must_check kstrtoul(const char *s, unsigned int base, unsigned long *res)
^
drivers/thermal/thermal_core.c: In function 'emul_temp_store':
drivers/thermal/thermal_core.c:900:6: warning: passing argument 3 of 'kstrtoul' from incompatible pointer type
if (kstrtoul(buf, 10, &temperature))
^
In file included from include/linux/list.h:8:0,
from include/linux/module.h:9,
from drivers/thermal/thermal_core.c:28:
include/linux/kernel.h:291:32: note: expected 'long unsigned int *' but argument is of type 'int *'
static inline int __must_check kstrtoul(const char *s, unsigned int base, unsigned long *res)
^
vim +/kstrtoul +695 drivers/thermal/thermal_core.c
203d3d4a drivers/thermal/thermal.c Zhang Rui 2008-01-17 679 }
203d3d4a drivers/thermal/thermal.c Zhang Rui 2008-01-17 680
203d3d4a drivers/thermal/thermal.c Zhang Rui 2008-01-17 681 static ssize_t
c56f5c03 drivers/thermal/thermal_sys.c Durgadoss R 2012-07-25 682 trip_point_temp_store(struct device *dev, struct device_attribute *attr,
c56f5c03 drivers/thermal/thermal_sys.c Durgadoss R 2012-07-25 683 const char *buf, size_t count)
c56f5c03 drivers/thermal/thermal_sys.c Durgadoss R 2012-07-25 684 {
c56f5c03 drivers/thermal/thermal_sys.c Durgadoss R 2012-07-25 685 struct thermal_zone_device *tz = to_thermal_zone(dev);
c56f5c03 drivers/thermal/thermal_sys.c Durgadoss R 2012-07-25 686 int trip, ret;
1afa53cf drivers/thermal/thermal_core.c Wei Ni 2016-03-03 687 int temperature;
c56f5c03 drivers/thermal/thermal_sys.c Durgadoss R 2012-07-25 688
c56f5c03 drivers/thermal/thermal_sys.c Durgadoss R 2012-07-25 689 if (!tz->ops->set_trip_temp)
c56f5c03 drivers/thermal/thermal_sys.c Durgadoss R 2012-07-25 690 return -EPERM;
c56f5c03 drivers/thermal/thermal_sys.c Durgadoss R 2012-07-25 691
c56f5c03 drivers/thermal/thermal_sys.c Durgadoss R 2012-07-25 692 if (!sscanf(attr->attr.name, "trip_point_%d_temp", &trip))
c56f5c03 drivers/thermal/thermal_sys.c Durgadoss R 2012-07-25 693 return -EINVAL;
c56f5c03 drivers/thermal/thermal_sys.c Durgadoss R 2012-07-25 694
c56f5c03 drivers/thermal/thermal_sys.c Durgadoss R 2012-07-25 @695 if (kstrtoul(buf, 10, &temperature))
c56f5c03 drivers/thermal/thermal_sys.c Durgadoss R 2012-07-25 696 return -EINVAL;
c56f5c03 drivers/thermal/thermal_sys.c Durgadoss R 2012-07-25 697
c56f5c03 drivers/thermal/thermal_sys.c Durgadoss R 2012-07-25 698 ret = tz->ops->set_trip_temp(tz, trip, temperature);
ad74e46c drivers/thermal/thermal_core.c Kuninori Morimoto 2015-12-15 699 if (ret)
ad74e46c drivers/thermal/thermal_core.c Kuninori Morimoto 2015-12-15 700 return ret;
c56f5c03 drivers/thermal/thermal_sys.c Durgadoss R 2012-07-25 701
ad74e46c drivers/thermal/thermal_core.c Kuninori Morimoto 2015-12-15 702 thermal_zone_device_update(tz);
ad74e46c drivers/thermal/thermal_core.c Kuninori Morimoto 2015-12-15 703
:::::: The code at line 695 was first introduced by commit
:::::: c56f5c0342dfee11a1a13d2f5bb7618de5b17590 Thermal: Make Thermal trip points writeable
:::::: TO: Durgadoss R <dugardoss.r@intel.com>
:::::: CC: Len Brown <len.brown@intel.com>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 45105 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] thermal: consistently use int for trip temp
2016-03-03 7:14 [PATCH] thermal: consistently use int for trip temp Wei Ni
2016-03-03 7:30 ` kbuild test robot
@ 2016-03-03 7:37 ` kbuild test robot
1 sibling, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2016-03-03 7:37 UTC (permalink / raw)
To: Wei Ni; +Cc: kbuild-all, rui.zhang, edubezval, linux-kernel, Wei Ni
[-- Attachment #1: Type: text/plain, Size: 11598 bytes --]
Hi Wei,
[auto build test WARNING on thermal/next]
[also build test WARNING on v4.5-rc6 next-20160302]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]
url: https://github.com/0day-ci/linux/commits/Wei-Ni/thermal-consistently-use-int-for-trip-temp/20160303-151648
base: https://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux.git next
config: x86_64-randconfig-x015-201609 (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All warnings (new ones prefixed by >>):
In file included from include/uapi/linux/stddef.h:1:0,
from include/linux/stddef.h:4,
from include/uapi/linux/posix_types.h:4,
from include/uapi/linux/types.h:13,
from include/linux/types.h:5,
from include/linux/list.h:4,
from include/linux/module.h:9,
from drivers/thermal/thermal_core.c:28:
drivers/thermal/thermal_core.c: In function 'trip_point_temp_store':
drivers/thermal/thermal_core.c:695:24: warning: passing argument 3 of 'kstrtoul' from incompatible pointer type [-Wincompatible-pointer-types]
if (kstrtoul(buf, 10, &temperature))
^
include/linux/compiler.h:147:30: note: in definition of macro '__trace_if'
if (__builtin_constant_p(!!(cond)) ? !!(cond) : \
^
>> drivers/thermal/thermal_core.c:695:2: note: in expansion of macro 'if'
if (kstrtoul(buf, 10, &temperature))
^
In file included from include/linux/list.h:8:0,
from include/linux/module.h:9,
from drivers/thermal/thermal_core.c:28:
include/linux/kernel.h:291:32: note: expected 'long unsigned int *' but argument is of type 'int *'
static inline int __must_check kstrtoul(const char *s, unsigned int base, unsigned long *res)
^
In file included from include/uapi/linux/stddef.h:1:0,
from include/linux/stddef.h:4,
from include/uapi/linux/posix_types.h:4,
from include/uapi/linux/types.h:13,
from include/linux/types.h:5,
from include/linux/list.h:4,
from include/linux/module.h:9,
from drivers/thermal/thermal_core.c:28:
drivers/thermal/thermal_core.c:695:24: warning: passing argument 3 of 'kstrtoul' from incompatible pointer type [-Wincompatible-pointer-types]
if (kstrtoul(buf, 10, &temperature))
^
include/linux/compiler.h:147:42: note: in definition of macro '__trace_if'
if (__builtin_constant_p(!!(cond)) ? !!(cond) : \
^
>> drivers/thermal/thermal_core.c:695:2: note: in expansion of macro 'if'
if (kstrtoul(buf, 10, &temperature))
^
In file included from include/linux/list.h:8:0,
from include/linux/module.h:9,
from drivers/thermal/thermal_core.c:28:
include/linux/kernel.h:291:32: note: expected 'long unsigned int *' but argument is of type 'int *'
static inline int __must_check kstrtoul(const char *s, unsigned int base, unsigned long *res)
^
In file included from include/uapi/linux/stddef.h:1:0,
from include/linux/stddef.h:4,
from include/uapi/linux/posix_types.h:4,
from include/uapi/linux/types.h:13,
from include/linux/types.h:5,
from include/linux/list.h:4,
from include/linux/module.h:9,
from drivers/thermal/thermal_core.c:28:
drivers/thermal/thermal_core.c:695:24: warning: passing argument 3 of 'kstrtoul' from incompatible pointer type [-Wincompatible-pointer-types]
if (kstrtoul(buf, 10, &temperature))
^
include/linux/compiler.h:158:16: note: in definition of macro '__trace_if'
______r = !!(cond); \
^
>> drivers/thermal/thermal_core.c:695:2: note: in expansion of macro 'if'
if (kstrtoul(buf, 10, &temperature))
^
In file included from include/linux/list.h:8:0,
from include/linux/module.h:9,
from drivers/thermal/thermal_core.c:28:
include/linux/kernel.h:291:32: note: expected 'long unsigned int *' but argument is of type 'int *'
static inline int __must_check kstrtoul(const char *s, unsigned int base, unsigned long *res)
^
In file included from include/uapi/linux/stddef.h:1:0,
from include/linux/stddef.h:4,
from include/uapi/linux/posix_types.h:4,
from include/uapi/linux/types.h:13,
from include/linux/types.h:5,
from include/linux/list.h:4,
from include/linux/module.h:9,
from drivers/thermal/thermal_core.c:28:
drivers/thermal/thermal_core.c: In function 'emul_temp_store':
drivers/thermal/thermal_core.c:900:24: warning: passing argument 3 of 'kstrtoul' from incompatible pointer type [-Wincompatible-pointer-types]
if (kstrtoul(buf, 10, &temperature))
^
include/linux/compiler.h:147:30: note: in definition of macro '__trace_if'
if (__builtin_constant_p(!!(cond)) ? !!(cond) : \
^
drivers/thermal/thermal_core.c:900:2: note: in expansion of macro 'if'
if (kstrtoul(buf, 10, &temperature))
^
In file included from include/linux/list.h:8:0,
from include/linux/module.h:9,
from drivers/thermal/thermal_core.c:28:
include/linux/kernel.h:291:32: note: expected 'long unsigned int *' but argument is of type 'int *'
static inline int __must_check kstrtoul(const char *s, unsigned int base, unsigned long *res)
^
In file included from include/uapi/linux/stddef.h:1:0,
from include/linux/stddef.h:4,
from include/uapi/linux/posix_types.h:4,
from include/uapi/linux/types.h:13,
from include/linux/types.h:5,
from include/linux/list.h:4,
from include/linux/module.h:9,
from drivers/thermal/thermal_core.c:28:
drivers/thermal/thermal_core.c:900:24: warning: passing argument 3 of 'kstrtoul' from incompatible pointer type [-Wincompatible-pointer-types]
if (kstrtoul(buf, 10, &temperature))
^
include/linux/compiler.h:147:42: note: in definition of macro '__trace_if'
if (__builtin_constant_p(!!(cond)) ? !!(cond) : \
^
drivers/thermal/thermal_core.c:900:2: note: in expansion of macro 'if'
if (kstrtoul(buf, 10, &temperature))
^
In file included from include/linux/list.h:8:0,
from include/linux/module.h:9,
from drivers/thermal/thermal_core.c:28:
include/linux/kernel.h:291:32: note: expected 'long unsigned int *' but argument is of type 'int *'
static inline int __must_check kstrtoul(const char *s, unsigned int base, unsigned long *res)
^
In file included from include/uapi/linux/stddef.h:1:0,
from include/linux/stddef.h:4,
from include/uapi/linux/posix_types.h:4,
from include/uapi/linux/types.h:13,
from include/linux/types.h:5,
from include/linux/list.h:4,
from include/linux/module.h:9,
from drivers/thermal/thermal_core.c:28:
drivers/thermal/thermal_core.c:900:24: warning: passing argument 3 of 'kstrtoul' from incompatible pointer type [-Wincompatible-pointer-types]
if (kstrtoul(buf, 10, &temperature))
^
include/linux/compiler.h:158:16: note: in definition of macro '__trace_if'
______r = !!(cond); \
^
drivers/thermal/thermal_core.c:900:2: note: in expansion of macro 'if'
if (kstrtoul(buf, 10, &temperature))
^
In file included from include/linux/list.h:8:0,
from include/linux/module.h:9,
from drivers/thermal/thermal_core.c:28:
include/linux/kernel.h:291:32: note: expected 'long unsigned int *' but argument is of type 'int *'
static inline int __must_check kstrtoul(const char *s, unsigned int base, unsigned long *res)
^
vim +/if +695 drivers/thermal/thermal_core.c
203d3d4a drivers/thermal/thermal.c Zhang Rui 2008-01-17 679 }
203d3d4a drivers/thermal/thermal.c Zhang Rui 2008-01-17 680
203d3d4a drivers/thermal/thermal.c Zhang Rui 2008-01-17 681 static ssize_t
c56f5c03 drivers/thermal/thermal_sys.c Durgadoss R 2012-07-25 682 trip_point_temp_store(struct device *dev, struct device_attribute *attr,
c56f5c03 drivers/thermal/thermal_sys.c Durgadoss R 2012-07-25 683 const char *buf, size_t count)
c56f5c03 drivers/thermal/thermal_sys.c Durgadoss R 2012-07-25 684 {
c56f5c03 drivers/thermal/thermal_sys.c Durgadoss R 2012-07-25 685 struct thermal_zone_device *tz = to_thermal_zone(dev);
c56f5c03 drivers/thermal/thermal_sys.c Durgadoss R 2012-07-25 686 int trip, ret;
1afa53cf drivers/thermal/thermal_core.c Wei Ni 2016-03-03 687 int temperature;
c56f5c03 drivers/thermal/thermal_sys.c Durgadoss R 2012-07-25 688
c56f5c03 drivers/thermal/thermal_sys.c Durgadoss R 2012-07-25 689 if (!tz->ops->set_trip_temp)
c56f5c03 drivers/thermal/thermal_sys.c Durgadoss R 2012-07-25 690 return -EPERM;
c56f5c03 drivers/thermal/thermal_sys.c Durgadoss R 2012-07-25 691
c56f5c03 drivers/thermal/thermal_sys.c Durgadoss R 2012-07-25 692 if (!sscanf(attr->attr.name, "trip_point_%d_temp", &trip))
c56f5c03 drivers/thermal/thermal_sys.c Durgadoss R 2012-07-25 693 return -EINVAL;
c56f5c03 drivers/thermal/thermal_sys.c Durgadoss R 2012-07-25 694
c56f5c03 drivers/thermal/thermal_sys.c Durgadoss R 2012-07-25 @695 if (kstrtoul(buf, 10, &temperature))
c56f5c03 drivers/thermal/thermal_sys.c Durgadoss R 2012-07-25 696 return -EINVAL;
c56f5c03 drivers/thermal/thermal_sys.c Durgadoss R 2012-07-25 697
c56f5c03 drivers/thermal/thermal_sys.c Durgadoss R 2012-07-25 698 ret = tz->ops->set_trip_temp(tz, trip, temperature);
ad74e46c drivers/thermal/thermal_core.c Kuninori Morimoto 2015-12-15 699 if (ret)
ad74e46c drivers/thermal/thermal_core.c Kuninori Morimoto 2015-12-15 700 return ret;
c56f5c03 drivers/thermal/thermal_sys.c Durgadoss R 2012-07-25 701
ad74e46c drivers/thermal/thermal_core.c Kuninori Morimoto 2015-12-15 702 thermal_zone_device_update(tz);
ad74e46c drivers/thermal/thermal_core.c Kuninori Morimoto 2015-12-15 703
:::::: The code at line 695 was first introduced by commit
:::::: c56f5c0342dfee11a1a13d2f5bb7618de5b17590 Thermal: Make Thermal trip points writeable
:::::: TO: Durgadoss R <dugardoss.r@intel.com>
:::::: CC: Len Brown <len.brown@intel.com>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 24875 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-03-03 7:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-03 7:14 [PATCH] thermal: consistently use int for trip temp Wei Ni
2016-03-03 7:30 ` kbuild test robot
2016-03-03 7:37 ` kbuild test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®