[v2,1/2] hwmon: (aquacomputer_d5next) Rename AQC_TEMP_SENSOR_DISCONNECTED

Message ID 20230520095447.509287-2-savicaleksa83@gmail.com
State New
Headers
Series hwmon: (aquacomputer_d5next) Support for Aquacomputer Leakshield |

Commit Message

Aleksa Savic May 20, 2023, 9:54 a.m. UTC
  Rename the macro in question to AQC_SENSOR_NA because
more than just temperature sensors use this value to
indicate that they don't have a reading. Implemented by
Noah Bergbauer [1].

[1] https://github.com/aleksamagicka/aquacomputer_d5next-hwmon/pull/41

Originally-from: Noah Bergbauer <main@ehvag.de>
Signed-off-by: Aleksa Savic <savicaleksa83@gmail.com>
---
Changes in v2:
- Introduced this patch
---
 drivers/hwmon/aquacomputer_d5next.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
  

Comments

Guenter Roeck May 20, 2023, 12:54 p.m. UTC | #1
On Sat, May 20, 2023 at 11:54:46AM +0200, Aleksa Savic wrote:
> Rename the macro in question to AQC_SENSOR_NA because
> more than just temperature sensors use this value to
> indicate that they don't have a reading. Implemented by
> Noah Bergbauer [1].
> 
> [1] https://github.com/aleksamagicka/aquacomputer_d5next-hwmon/pull/41
> 
> Originally-from: Noah Bergbauer <main@ehvag.de>
> Signed-off-by: Aleksa Savic <savicaleksa83@gmail.com>

Applied.

Thanks,
Guenter

> ---
> Changes in v2:
> - Introduced this patch
> ---
>  drivers/hwmon/aquacomputer_d5next.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/hwmon/aquacomputer_d5next.c b/drivers/hwmon/aquacomputer_d5next.c
> index a4fcd4ebf76c..834d011e220f 100644
> --- a/drivers/hwmon/aquacomputer_d5next.c
> +++ b/drivers/hwmon/aquacomputer_d5next.c
> @@ -93,7 +93,7 @@ static u8 aquaero_secondary_ctrl_report[] = {
>  #define AQC_FIRMWARE_VERSION		0xD
>  
>  #define AQC_SENSOR_SIZE			0x02
> -#define AQC_TEMP_SENSOR_DISCONNECTED	0x7FFF
> +#define AQC_SENSOR_NA			0x7FFF
>  #define AQC_FAN_PERCENT_OFFSET		0x00
>  #define AQC_FAN_VOLTAGE_OFFSET		0x02
>  #define AQC_FAN_CURRENT_OFFSET		0x04
> @@ -1224,7 +1224,7 @@ static int aqc_raw_event(struct hid_device *hdev, struct hid_report *report, u8
>  		sensor_value = get_unaligned_be16(data +
>  						  priv->temp_sensor_start_offset +
>  						  i * AQC_SENSOR_SIZE);
> -		if (sensor_value == AQC_TEMP_SENSOR_DISCONNECTED)
> +		if (sensor_value == AQC_SENSOR_NA)
>  			priv->temp_input[i] = -ENODATA;
>  		else
>  			priv->temp_input[i] = sensor_value * 10;
> @@ -1235,7 +1235,7 @@ static int aqc_raw_event(struct hid_device *hdev, struct hid_report *report, u8
>  		sensor_value = get_unaligned_be16(data +
>  						  priv->virtual_temp_sensor_start_offset +
>  						  j * AQC_SENSOR_SIZE);
> -		if (sensor_value == AQC_TEMP_SENSOR_DISCONNECTED)
> +		if (sensor_value == AQC_SENSOR_NA)
>  			priv->temp_input[i] = -ENODATA;
>  		else
>  			priv->temp_input[i] = sensor_value * 10;
> @@ -1277,7 +1277,7 @@ static int aqc_raw_event(struct hid_device *hdev, struct hid_report *report, u8
>  			sensor_value = get_unaligned_be16(data +
>  					priv->calc_virt_temp_sensor_start_offset +
>  					j * AQC_SENSOR_SIZE);
> -			if (sensor_value == AQC_TEMP_SENSOR_DISCONNECTED)
> +			if (sensor_value == AQC_SENSOR_NA)
>  				priv->temp_input[i] = -ENODATA;
>  			else
>  				priv->temp_input[i] = sensor_value * 10;
  

Patch

diff --git a/drivers/hwmon/aquacomputer_d5next.c b/drivers/hwmon/aquacomputer_d5next.c
index a4fcd4ebf76c..834d011e220f 100644
--- a/drivers/hwmon/aquacomputer_d5next.c
+++ b/drivers/hwmon/aquacomputer_d5next.c
@@ -93,7 +93,7 @@  static u8 aquaero_secondary_ctrl_report[] = {
 #define AQC_FIRMWARE_VERSION		0xD
 
 #define AQC_SENSOR_SIZE			0x02
-#define AQC_TEMP_SENSOR_DISCONNECTED	0x7FFF
+#define AQC_SENSOR_NA			0x7FFF
 #define AQC_FAN_PERCENT_OFFSET		0x00
 #define AQC_FAN_VOLTAGE_OFFSET		0x02
 #define AQC_FAN_CURRENT_OFFSET		0x04
@@ -1224,7 +1224,7 @@  static int aqc_raw_event(struct hid_device *hdev, struct hid_report *report, u8
 		sensor_value = get_unaligned_be16(data +
 						  priv->temp_sensor_start_offset +
 						  i * AQC_SENSOR_SIZE);
-		if (sensor_value == AQC_TEMP_SENSOR_DISCONNECTED)
+		if (sensor_value == AQC_SENSOR_NA)
 			priv->temp_input[i] = -ENODATA;
 		else
 			priv->temp_input[i] = sensor_value * 10;
@@ -1235,7 +1235,7 @@  static int aqc_raw_event(struct hid_device *hdev, struct hid_report *report, u8
 		sensor_value = get_unaligned_be16(data +
 						  priv->virtual_temp_sensor_start_offset +
 						  j * AQC_SENSOR_SIZE);
-		if (sensor_value == AQC_TEMP_SENSOR_DISCONNECTED)
+		if (sensor_value == AQC_SENSOR_NA)
 			priv->temp_input[i] = -ENODATA;
 		else
 			priv->temp_input[i] = sensor_value * 10;
@@ -1277,7 +1277,7 @@  static int aqc_raw_event(struct hid_device *hdev, struct hid_report *report, u8
 			sensor_value = get_unaligned_be16(data +
 					priv->calc_virt_temp_sensor_start_offset +
 					j * AQC_SENSOR_SIZE);
-			if (sensor_value == AQC_TEMP_SENSOR_DISCONNECTED)
+			if (sensor_value == AQC_SENSOR_NA)
 				priv->temp_input[i] = -ENODATA;
 			else
 				priv->temp_input[i] = sensor_value * 10;