Re: [Nouveau] [PATCH v3 4/5] nouveau_hwmon: Add support for auto_point attributes

2017-04-21 Thread kbuild test robot
Hi Oscar,

[auto build test WARNING on drm/drm-next]
[also build test WARNING on v4.11-rc7 next-20170421]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Oscar-Salvador/replace-hwmon_device_register-for-hwmon_device_register_with_info/20170422-064646
base:   git://people.freedesktop.org/~airlied/linux.git drm-next
config: arm64-defconfig (attached as .config)
compiler: aarch64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget 
https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm64 

All warnings (new ones prefixed by >>):

   In file included from include/linux/kobject.h:21:0,
from include/linux/device.h:17,
from include/linux/acpi.h:27,
from drivers/gpu/drm/nouveau/nouveau_hwmon.c:26:
   drivers/gpu/drm/nouveau/nouveau_hwmon.c:366:18: error: initialization from 
incompatible pointer type [-Werror=incompatible-pointer-types]
ATTRIBUTE_GROUPS(pwm_fan_sensor);
 ^
   include/linux/sysfs.h:148:11: note: in definition of macro 'ATTRIBUTE_GROUPS'
 .attrs = _name##_attrs, \
  ^
   drivers/gpu/drm/nouveau/nouveau_hwmon.c:366:18: note: (near initialization 
for 'pwm_fan_sensor_group.attrs')
ATTRIBUTE_GROUPS(pwm_fan_sensor);
 ^
   include/linux/sysfs.h:148:11: note: in definition of macro 'ATTRIBUTE_GROUPS'
 .attrs = _name##_attrs, \
  ^
   drivers/gpu/drm/nouveau/nouveau_hwmon.c:374:18: error: initialization from 
incompatible pointer type [-Werror=incompatible-pointer-types]
ATTRIBUTE_GROUPS(temp1_auto_point_sensor);
 ^
   include/linux/sysfs.h:148:11: note: in definition of macro 'ATTRIBUTE_GROUPS'
 .attrs = _name##_attrs, \
  ^
   drivers/gpu/drm/nouveau/nouveau_hwmon.c:374:18: note: (near initialization 
for 'temp1_auto_point_sensor_group.attrs')
ATTRIBUTE_GROUPS(temp1_auto_point_sensor);
 ^
   include/linux/sysfs.h:148:11: note: in definition of macro 'ATTRIBUTE_GROUPS'
 .attrs = _name##_attrs, \
  ^
   drivers/gpu/drm/nouveau/nouveau_hwmon.c: In function 'nouveau_read_string':
   drivers/gpu/drm/nouveau/nouveau_hwmon.c:754:8: warning: assignment discards 
'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  *buf = input_label;
   ^
   In file included from include/linux/kobject.h:21:0,
from include/linux/device.h:17,
from include/linux/acpi.h:27,
from drivers/gpu/drm/nouveau/nouveau_hwmon.c:26:
   At top level:
   drivers/gpu/drm/nouveau/nouveau_hwmon.c:374:18: warning: 
'temp1_auto_point_sensor_groups' defined but not used [-Wunused-variable]
ATTRIBUTE_GROUPS(temp1_auto_point_sensor);
 ^
   include/linux/sysfs.h:141:38: note: in definition of macro 
'__ATTRIBUTE_GROUPS'
static const struct attribute_group *_name##_groups[] = { \
 ^
>> drivers/gpu/drm/nouveau/nouveau_hwmon.c:374:1: note: in expansion of macro 
>> 'ATTRIBUTE_GROUPS'
ATTRIBUTE_GROUPS(temp1_auto_point_sensor);
^~~~
   drivers/gpu/drm/nouveau/nouveau_hwmon.c:366:18: warning: 
'pwm_fan_sensor_groups' defined but not used [-Wunused-variable]
ATTRIBUTE_GROUPS(pwm_fan_sensor);
 ^
   include/linux/sysfs.h:141:38: note: in definition of macro 
'__ATTRIBUTE_GROUPS'
static const struct attribute_group *_name##_groups[] = { \
 ^
   drivers/gpu/drm/nouveau/nouveau_hwmon.c:366:1: note: in expansion of macro 
'ATTRIBUTE_GROUPS'
ATTRIBUTE_GROUPS(pwm_fan_sensor);
^~~~
   cc1: some warnings being treated as errors

vim +/ATTRIBUTE_GROUPS +374 drivers/gpu/drm/nouveau/nouveau_hwmon.c

   358  return iccsense->power_w_crit;
   359  }
   360  
   361  static const struct attribute *pwm_fan_sensor_attrs[] = {
   362  &sensor_dev_attr_pwm1_min.dev_attr.attr,
   363  &sensor_dev_attr_pwm1_max.dev_attr.attr,
   364  NULL
   365  };
   366  ATTRIBUTE_GROUPS(pwm_fan_sensor);
   367  
   368  static const struct attribute *temp1_auto_point_sensor_attrs[] = {
   369  &sensor_dev_attr_temp1_auto_point1_pwm.dev_attr.attr,
   370  &sensor_dev_attr_temp1_auto_point1_temp.dev_attr.attr,
   371  &sensor_dev_attr_temp1_auto_point1_temp_hyst.dev_attr.attr,
   372  NULL
   373  };
 > 374  ATTRIBUTE_GROUPS(temp1_auto_point_sensor);
   375  
   376  #define N_ATTR_GROUPS   3
   377  
   378  
   379  static const u32 nouveau_config_chip[] = {
   380  HWMON_C_UPDATE_INTERVAL,
   381  0
   382  };

---
0-DAY kernel 

[Nouveau] [PATCH v3 4/5] nouveau_hwmon: Add support for auto_point attributes

2017-04-21 Thread Oscar Salvador
This patch creates a special group attributes for attrs like "*auto_point*".
We check if we have support for them, and if we do, we gather them all in
an attribute_group's structure which is the parameter regarding special groups
of hwmon_device_register_with_info.

Signed-off-by: Oscar Salvador 
---
 drivers/gpu/drm/nouveau/nouveau_hwmon.c | 30 +-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_hwmon.c 
b/drivers/gpu/drm/nouveau/nouveau_hwmon.c
index 57296cb..b9efc29 100644
--- a/drivers/gpu/drm/nouveau/nouveau_hwmon.c
+++ b/drivers/gpu/drm/nouveau/nouveau_hwmon.c
@@ -358,6 +358,24 @@ nouveau_hwmon_get_power1_crit(struct nouveau_drm *drm)
return iccsense->power_w_crit;
 }
 
+static const struct attribute *pwm_fan_sensor_attrs[] = {
+   &sensor_dev_attr_pwm1_min.dev_attr.attr,
+   &sensor_dev_attr_pwm1_max.dev_attr.attr,
+   NULL
+};
+ATTRIBUTE_GROUPS(pwm_fan_sensor);
+
+static const struct attribute *temp1_auto_point_sensor_attrs[] = {
+   &sensor_dev_attr_temp1_auto_point1_pwm.dev_attr.attr,
+   &sensor_dev_attr_temp1_auto_point1_temp.dev_attr.attr,
+   &sensor_dev_attr_temp1_auto_point1_temp_hyst.dev_attr.attr,
+   NULL
+};
+ATTRIBUTE_GROUPS(temp1_auto_point_sensor);
+
+#define N_ATTR_GROUPS   3
+
+
 static const u32 nouveau_config_chip[] = {
HWMON_C_UPDATE_INTERVAL,
0
@@ -793,17 +811,27 @@ nouveau_hwmon_init(struct drm_device *dev)
 #if defined(CONFIG_HWMON) || (defined(MODULE) && defined(CONFIG_HWMON_MODULE))
struct nouveau_drm *drm = nouveau_drm(dev);
struct nvkm_therm *therm = nvxx_therm(&drm->client.device);
+   const struct attribute_group *special_groups[N_ATTR_GROUPS];
struct nouveau_hwmon *hwmon;
struct device *hwmon_dev;
int ret = 0;
+   int i = 0;
 
hwmon = drm->hwmon = kzalloc(sizeof(*hwmon), GFP_KERNEL);
if (!hwmon)
return -ENOMEM;
hwmon->dev = dev;
 
+   if (therm && therm->attr_get && therm->attr_set) {
+   if (nvkm_therm_temp_get(therm) >= 0)
+   special_groups[i++] = &temp1_auto_point_sensor_group;
+   if (therm->fan_get && therm->fan_get(therm) >= 0)
+   special_groups[i++] = &pwm_fan_sensor_group;
+   }
+
+   special_groups[i] = 0;
hwmon_dev = hwmon_device_register_with_info(dev->dev, "nouveau", dev,
-   &nouveau_chip_info, NULL);
+   &nouveau_chip_info, special_groups);
if (IS_ERR(hwmon_dev)) {
ret = PTR_ERR(hwmon_dev);
NV_ERROR(drm, "Unable to register hwmon device: %d\n", ret);
-- 
2.1.4

___
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau