All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/nouveau/hwmon: use simplified HWMON_CHANNEL_INFO macro
@ 2022-08-15 10:40 ` Beniamin Sandu
  0 siblings, 0 replies; 4+ messages in thread
From: Beniamin Sandu @ 2022-08-15 10:40 UTC (permalink / raw)
  To: bskeggs, kherbst, lyude, airlied, daniel
  Cc: nouveau, Beniamin Sandu, dri-devel

This makes the code look cleaner and easier to read.

Signed-off-by: Beniamin Sandu <beniaminsandu@gmail.com>
---
 drivers/gpu/drm/nouveau/nouveau_hwmon.c | 85 +++++--------------------
 1 file changed, 17 insertions(+), 68 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_hwmon.c b/drivers/gpu/drm/nouveau/nouveau_hwmon.c
index 1c3104d20571..a7db7c31064b 100644
--- a/drivers/gpu/drm/nouveau/nouveau_hwmon.c
+++ b/drivers/gpu/drm/nouveau/nouveau_hwmon.c
@@ -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
 };
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Nouveau] [PATCH] drm/nouveau/hwmon: use simplified HWMON_CHANNEL_INFO macro
@ 2022-08-15 10:40 ` Beniamin Sandu
  0 siblings, 0 replies; 4+ messages in thread
From: Beniamin Sandu @ 2022-08-15 10:40 UTC (permalink / raw)
  To: bskeggs, kherbst, lyude, airlied, daniel
  Cc: nouveau, Beniamin Sandu, dri-devel

This makes the code look cleaner and easier to read.

Signed-off-by: Beniamin Sandu <beniaminsandu@gmail.com>
---
 drivers/gpu/drm/nouveau/nouveau_hwmon.c | 85 +++++--------------------
 1 file changed, 17 insertions(+), 68 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_hwmon.c b/drivers/gpu/drm/nouveau/nouveau_hwmon.c
index 1c3104d20571..a7db7c31064b 100644
--- a/drivers/gpu/drm/nouveau/nouveau_hwmon.c
+++ b/drivers/gpu/drm/nouveau/nouveau_hwmon.c
@@ -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
 };
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Nouveau] [PATCH] drm/nouveau/hwmon: use simplified HWMON_CHANNEL_INFO macro
  2022-08-15 10:40 ` [Nouveau] " Beniamin Sandu
@ 2022-08-22 21:58   ` Lyude Paul
  -1 siblings, 0 replies; 4+ messages in thread
From: Lyude Paul @ 2022-08-22 21:58 UTC (permalink / raw)
  To: Beniamin Sandu, bskeggs, kherbst, airlied, daniel; +Cc: nouveau, dri-devel

Reviewed-by: Lyude Paul <lyude@redhat.com>

Thanks! I will push this upstream in a moment

On Mon, 2022-08-15 at 13:40 +0300, Beniamin Sandu wrote:
> This makes the code look cleaner and easier to read.
> 
> Signed-off-by: Beniamin Sandu <beniaminsandu@gmail.com>
> ---
>  drivers/gpu/drm/nouveau/nouveau_hwmon.c | 85 +++++--------------------
>  1 file changed, 17 insertions(+), 68 deletions(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nouveau_hwmon.c b/drivers/gpu/drm/nouveau/nouveau_hwmon.c
> index 1c3104d20571..a7db7c31064b 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_hwmon.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_hwmon.c
> @@ -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
>  };
>  

-- 
Cheers,
 Lyude Paul (she/her)
 Software Engineer at Red Hat


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/nouveau/hwmon: use simplified HWMON_CHANNEL_INFO macro
@ 2022-08-22 21:58   ` Lyude Paul
  0 siblings, 0 replies; 4+ messages in thread
From: Lyude Paul @ 2022-08-22 21:58 UTC (permalink / raw)
  To: Beniamin Sandu, bskeggs, kherbst, airlied, daniel; +Cc: nouveau, dri-devel

Reviewed-by: Lyude Paul <lyude@redhat.com>

Thanks! I will push this upstream in a moment

On Mon, 2022-08-15 at 13:40 +0300, Beniamin Sandu wrote:
> This makes the code look cleaner and easier to read.
> 
> Signed-off-by: Beniamin Sandu <beniaminsandu@gmail.com>
> ---
>  drivers/gpu/drm/nouveau/nouveau_hwmon.c | 85 +++++--------------------
>  1 file changed, 17 insertions(+), 68 deletions(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nouveau_hwmon.c b/drivers/gpu/drm/nouveau/nouveau_hwmon.c
> index 1c3104d20571..a7db7c31064b 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_hwmon.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_hwmon.c
> @@ -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
>  };
>  

-- 
Cheers,
 Lyude Paul (she/her)
 Software Engineer at Red Hat


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-08-22 21:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-15 10:40 [PATCH] drm/nouveau/hwmon: use simplified HWMON_CHANNEL_INFO macro Beniamin Sandu
2022-08-15 10:40 ` [Nouveau] " Beniamin Sandu
2022-08-22 21:58 ` Lyude Paul
2022-08-22 21:58   ` Lyude Paul

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.