Re: [PATCH] thermal: re-calculate k_po/k_pu when update sustainable power

2015-12-29 Thread kbuild test robot
Hi Leo,

[auto build test ERROR on thermal/next]
[also build test ERROR on v4.4-rc7 next-20151223]
[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/Leo-Yan/thermal-re-calculate-k_po-k_pu-when-update-sustainable-power/20151230-141446
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux.git next
config: x86_64-randconfig-x007-12291635 (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All errors (new ones prefixed by >>):

   drivers/thermal/thermal_core.c:1007:33: sparse: no member 'kpo' in struct 
thermal_zone_params
   drivers/thermal/thermal_core.c:1008:33: sparse: no member 'kpu' in struct 
thermal_zone_params
   drivers/thermal/thermal_core.c: In function 'sustainable_power_store':
>> drivers/thermal/thermal_core.c:1007:26: error: 'struct thermal_zone_params' 
>> has no member named 'kpo'
 tz->tzp->k_po = (tz->tzp->kpo * sustainable_power) / old_val;
 ^
>> drivers/thermal/thermal_core.c:1008:26: error: 'struct thermal_zone_params' 
>> has no member named 'kpu'
 tz->tzp->k_pu = (tz->tzp->kpu * sustainable_power) / old_val;
 ^

vim +1007 drivers/thermal/thermal_core.c

  1001  return -EINVAL;
  1002  
  1003  old_val = tz->tzp->sustainable_power;
  1004  
  1005  tz->tzp->sustainable_power = sustainable_power;
  1006  
> 1007  tz->tzp->k_po = (tz->tzp->kpo * sustainable_power) / old_val;
> 1008  tz->tzp->k_pu = (tz->tzp->kpu * sustainable_power) / old_val;
  1009  return count;
  1010  }
  1011  static DEVICE_ATTR(sustainable_power, S_IWUSR | S_IRUGO, 
sustainable_power_show,

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


[PATCH] thermal: re-calculate k_po/k_pu when update sustainable power

2015-12-29 Thread Leo Yan
k_po/k_pu are in essence ratio values compared with sustainable power.
So when update sustainable power, we can recalculate k_po/k_pu simply
with below formula:

   sustainable_power(new)
k_p(new) = -- * k_p(old)
   sustainable_power(old)

Signed-off-by: Leo Yan 
---
 drivers/thermal/thermal_core.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index d9e525c..212688a 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -908,7 +908,7 @@ sustainable_power_store(struct device *dev, struct 
device_attribute *devattr,
const char *buf, size_t count)
 {
struct thermal_zone_device *tz = to_thermal_zone(dev);
-   u32 sustainable_power;
+   u32 sustainable_power, old_val;
 
if (!tz->tzp)
return -EIO;
@@ -916,8 +916,12 @@ sustainable_power_store(struct device *dev, struct 
device_attribute *devattr,
if (kstrtou32(buf, 10, _power))
return -EINVAL;
 
+   old_val = tz->tzp->sustainable_power;
+
tz->tzp->sustainable_power = sustainable_power;
 
+   tz->tzp->k_po = (tz->tzp->kpo * sustainable_power) / old_val;
+   tz->tzp->k_pu = (tz->tzp->kpu * sustainable_power) / old_val;
return count;
 }
 static DEVICE_ATTR(sustainable_power, S_IWUSR | S_IRUGO, 
sustainable_power_show,
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] thermal: re-calculate k_po/k_pu when update sustainable power

2015-12-29 Thread kbuild test robot
Hi Leo,

[auto build test ERROR on thermal/next]
[also build test ERROR on v4.4-rc7 next-20151223]
[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/Leo-Yan/thermal-re-calculate-k_po-k_pu-when-update-sustainable-power/20151230-141446
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux.git next
config: x86_64-randconfig-x007-12291635 (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All errors (new ones prefixed by >>):

   drivers/thermal/thermal_core.c:1007:33: sparse: no member 'kpo' in struct 
thermal_zone_params
   drivers/thermal/thermal_core.c:1008:33: sparse: no member 'kpu' in struct 
thermal_zone_params
   drivers/thermal/thermal_core.c: In function 'sustainable_power_store':
>> drivers/thermal/thermal_core.c:1007:26: error: 'struct thermal_zone_params' 
>> has no member named 'kpo'
 tz->tzp->k_po = (tz->tzp->kpo * sustainable_power) / old_val;
 ^
>> drivers/thermal/thermal_core.c:1008:26: error: 'struct thermal_zone_params' 
>> has no member named 'kpu'
 tz->tzp->k_pu = (tz->tzp->kpu * sustainable_power) / old_val;
 ^

vim +1007 drivers/thermal/thermal_core.c

  1001  return -EINVAL;
  1002  
  1003  old_val = tz->tzp->sustainable_power;
  1004  
  1005  tz->tzp->sustainable_power = sustainable_power;
  1006  
> 1007  tz->tzp->k_po = (tz->tzp->kpo * sustainable_power) / old_val;
> 1008  tz->tzp->k_pu = (tz->tzp->kpu * sustainable_power) / old_val;
  1009  return count;
  1010  }
  1011  static DEVICE_ATTR(sustainable_power, S_IWUSR | S_IRUGO, 
sustainable_power_show,

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


[PATCH] thermal: re-calculate k_po/k_pu when update sustainable power

2015-12-29 Thread Leo Yan
k_po/k_pu are in essence ratio values compared with sustainable power.
So when update sustainable power, we can recalculate k_po/k_pu simply
with below formula:

   sustainable_power(new)
k_p(new) = -- * k_p(old)
   sustainable_power(old)

Signed-off-by: Leo Yan 
---
 drivers/thermal/thermal_core.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index d9e525c..212688a 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -908,7 +908,7 @@ sustainable_power_store(struct device *dev, struct 
device_attribute *devattr,
const char *buf, size_t count)
 {
struct thermal_zone_device *tz = to_thermal_zone(dev);
-   u32 sustainable_power;
+   u32 sustainable_power, old_val;
 
if (!tz->tzp)
return -EIO;
@@ -916,8 +916,12 @@ sustainable_power_store(struct device *dev, struct 
device_attribute *devattr,
if (kstrtou32(buf, 10, _power))
return -EINVAL;
 
+   old_val = tz->tzp->sustainable_power;
+
tz->tzp->sustainable_power = sustainable_power;
 
+   tz->tzp->k_po = (tz->tzp->kpo * sustainable_power) / old_val;
+   tz->tzp->k_pu = (tz->tzp->kpu * sustainable_power) / old_val;
return count;
 }
 static DEVICE_ATTR(sustainable_power, S_IWUSR | S_IRUGO, 
sustainable_power_show,
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/