]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/nouveau/hwmon: use simplified HWMON_CHANNEL_INFO macro
authorBeniamin Sandu <beniaminsandu@gmail.com>
Mon, 15 Aug 2022 10:40:28 +0000 (13:40 +0300)
committerLyude Paul <lyude@redhat.com>
Tue, 23 Aug 2022 02:50:57 +0000 (22:50 -0400)
This makes the code look cleaner and easier to read.

Signed-off-by: Beniamin Sandu <beniaminsandu@gmail.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220815104028.381271-1-beniaminsandu@gmail.com
drivers/gpu/drm/nouveau/nouveau_hwmon.c

index 1c3104d205713f78796e66a7744241639b28a572..a7db7c31064b2545af80851d70fb05d9b36815ef 100644 (file)
@@ -211,75 +211,24 @@ static const struct attribute_group temp1_auto_point_sensor_group = {
 
 #define N_ATTR_GROUPS   3
 
-static const u32 nouveau_config_chip[] = {
-       HWMON_C_UPDATE_INTERVAL,
-       0
-};
-
-static const u32 nouveau_config_in[] = {
-       HWMON_I_INPUT | HWMON_I_MIN | HWMON_I_MAX | HWMON_I_LABEL,
-       0
-};
-
-static const u32 nouveau_config_temp[] = {
-       HWMON_T_INPUT | HWMON_T_MAX | HWMON_T_MAX_HYST |
-       HWMON_T_CRIT | HWMON_T_CRIT_HYST | HWMON_T_EMERGENCY |
-       HWMON_T_EMERGENCY_HYST,
-       0
-};
-
-static const u32 nouveau_config_fan[] = {
-       HWMON_F_INPUT,
-       0
-};
-
-static const u32 nouveau_config_pwm[] = {
-       HWMON_PWM_INPUT | HWMON_PWM_ENABLE,
-       0
-};
-
-static const u32 nouveau_config_power[] = {
-       HWMON_P_INPUT | HWMON_P_CAP_MAX | HWMON_P_CRIT,
-       0
-};
-
-static const struct hwmon_channel_info nouveau_chip = {
-       .type = hwmon_chip,
-       .config = nouveau_config_chip,
-};
-
-static const struct hwmon_channel_info nouveau_temp = {
-       .type = hwmon_temp,
-       .config = nouveau_config_temp,
-};
-
-static const struct hwmon_channel_info nouveau_fan = {
-       .type = hwmon_fan,
-       .config = nouveau_config_fan,
-};
-
-static const struct hwmon_channel_info nouveau_in = {
-       .type = hwmon_in,
-       .config = nouveau_config_in,
-};
-
-static const struct hwmon_channel_info nouveau_pwm = {
-       .type = hwmon_pwm,
-       .config = nouveau_config_pwm,
-};
-
-static const struct hwmon_channel_info nouveau_power = {
-       .type = hwmon_power,
-       .config = nouveau_config_power,
-};
-
 static const struct hwmon_channel_info *nouveau_info[] = {
-       &nouveau_chip,
-       &nouveau_temp,
-       &nouveau_fan,
-       &nouveau_in,
-       &nouveau_pwm,
-       &nouveau_power,
+       HWMON_CHANNEL_INFO(chip,
+                          HWMON_C_UPDATE_INTERVAL),
+       HWMON_CHANNEL_INFO(temp,
+                          HWMON_T_INPUT |
+                          HWMON_T_MAX | HWMON_T_MAX_HYST |
+                          HWMON_T_CRIT | HWMON_T_CRIT_HYST |
+                          HWMON_T_EMERGENCY | HWMON_T_EMERGENCY_HYST),
+       HWMON_CHANNEL_INFO(fan,
+                          HWMON_F_INPUT),
+       HWMON_CHANNEL_INFO(in,
+                          HWMON_I_INPUT |
+                          HWMON_I_MIN | HWMON_I_MAX |
+                          HWMON_I_LABEL),
+       HWMON_CHANNEL_INFO(pwm,
+                          HWMON_PWM_INPUT | HWMON_PWM_ENABLE),
+       HWMON_CHANNEL_INFO(power,
+                          HWMON_P_INPUT | HWMON_P_CAP_MAX | HWMON_P_CRIT),
        NULL
 };