Skip to contentSkip to conversation

hwmon: (tmp401) Drop unused defines, use BIT for bit masks

PATCH Superseded Guenter Roeck 2 participants 3 messages Apr 6, 2013 – Apr 14, 2013 Hardware monitoring

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Guenter Roeck

author maintainer
#0 lore raw

PATCH 1/5 hwmon: (tmp401) Drop unused defines, use BIT for bit masks

---
 drivers/hwmon/tmp401.c |   20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)
drivers/hwmon/tmp401.c +9 -11
index be71a3e..ef04cf8 100644
@@ -54,10 +54,8 @@ enum chips { tmp401, tmp411, tmp431 };
 #define TMP401_CONVERSION_RATE_READ		0x04
 #define TMP401_CONVERSION_RATE_WRITE		0x0A
 #define TMP401_TEMP_CRIT_HYST			0x21
-#define TMP401_CONSECUTIVE_ALERT		0x22
 #define TMP401_MANUFACTURER_ID_REG		0xFE
 #define TMP401_DEVICE_ID_REG			0xFF
-#define TMP411_N_FACTOR_REG			0x18
 
 static const u8 TMP401_TEMP_MSB[2]			= { 0x00, 0x01 };
 static const u8 TMP401_TEMP_LSB[2]			= { 0x15, 0x10 };
@@ -76,15 +74,15 @@ static const u8 TMP411_TEMP_HIGHEST_MSB[2]		= { 0x32, 0x36 };
 static const u8 TMP411_TEMP_HIGHEST_LSB[2]		= { 0x33, 0x37 };
 
 /* Flags */
-#define TMP401_CONFIG_RANGE		0x04
-#define TMP401_CONFIG_SHUTDOWN		0x40
-#define TMP401_STATUS_LOCAL_CRIT		0x01
-#define TMP401_STATUS_REMOTE_CRIT		0x02
-#define TMP401_STATUS_REMOTE_OPEN		0x04
-#define TMP401_STATUS_REMOTE_LOW		0x08
-#define TMP401_STATUS_REMOTE_HIGH		0x10
-#define TMP401_STATUS_LOCAL_LOW		0x20
-#define TMP401_STATUS_LOCAL_HIGH		0x40
+#define TMP401_CONFIG_RANGE			BIT(2)
+#define TMP401_CONFIG_SHUTDOWN			BIT(6)
+#define TMP401_STATUS_LOCAL_CRIT		BIT(0)
+#define TMP401_STATUS_REMOTE_CRIT		BIT(1)
+#define TMP401_STATUS_REMOTE_OPEN		BIT(2)
+#define TMP401_STATUS_REMOTE_LOW		BIT(3)
+#define TMP401_STATUS_REMOTE_HIGH		BIT(4)
+#define TMP401_STATUS_LOCAL_LOW			BIT(5)
+#define TMP401_STATUS_LOCAL_HIGH		BIT(6)
 
 /* Manufacturer / Device ID's */
 #define TMP401_MANUFACTURER_ID			0x55
Signature · 7 lines
1.7.9.7


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Acked-by on v1 1/5
#1 lore raw

Hi Guenter,

Quoted 32 lines · Guenter Roeck
---
 drivers/hwmon/tmp401.c |   20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)
drivers/hwmon/tmp401.c +0 -10
index be71a3e..ef04cf8 100644
@@ -54,10 +54,8 @@ enum chips { tmp401, tmp411, tmp431 };
 #define TMP401_CONVERSION_RATE_READ		0x04
 #define TMP401_CONVERSION_RATE_WRITE		0x0A
 #define TMP401_TEMP_CRIT_HYST			0x21
-#define TMP401_CONSECUTIVE_ALERT		0x22
 #define TMP401_MANUFACTURER_ID_REG		0xFE
 #define TMP401_DEVICE_ID_REG			0xFF
-#define TMP411_N_FACTOR_REG			0x18
 
 static const u8 TMP401_TEMP_MSB[2]			= { 0x00, 0x01 };
 static const u8 TMP401_TEMP_LSB[2]			= { 0x15, 0x10 };
@@ -76,15 +74,15 @@ static const u8 TMP411_TEMP_HIGHEST_MSB[2]		= { 0x32, 0x36 };
 static const u8 TMP411_TEMP_HIGHEST_LSB[2]		= { 0x33, 0x37 };
 
 /* Flags */
-#define TMP401_CONFIG_RANGE		0x04
-#define TMP401_CONFIG_SHUTDOWN		0x40
-#define TMP401_STATUS_LOCAL_CRIT		0x01
-#define TMP401_STATUS_REMOTE_CRIT		0x02
-#define TMP401_STATUS_REMOTE_OPEN		0x04
-#define TMP401_STATUS_REMOTE_LOW		0x08
-#define TMP401_STATUS_REMOTE_HIGH		0x10
-#define TMP401_STATUS_LOCAL_LOW		0x20

drivers/hwmon/tmp401.c static const u8 TMP411_TEMP_HIGHEST_MSB[2] = { 0x32, 0x36 }; · line 85

Quoted 10 lines
drivers/hwmon/tmp401.c +9 -1
-#define TMP401_STATUS_LOCAL_HIGH		0x40
+#define TMP401_CONFIG_RANGE			BIT(2)
+#define TMP401_CONFIG_SHUTDOWN			BIT(6)
+#define TMP401_STATUS_LOCAL_CRIT		BIT(0)
+#define TMP401_STATUS_REMOTE_CRIT		BIT(1)
+#define TMP401_STATUS_REMOTE_OPEN		BIT(2)
+#define TMP401_STATUS_REMOTE_LOW		BIT(3)
+#define TMP401_STATUS_REMOTE_HIGH		BIT(4)
+#define TMP401_STATUS_LOCAL_LOW			BIT(5)
+#define TMP401_STATUS_LOCAL_HIGH		BIT(6)

Aren't you supposed to include either <linux/kernel.h> or <linux/bitops.h> directly if you use BIT()?

drivers/hwmon/tmp401.c static const u8 TMP411_TEMP_HIGHEST_MSB[2] = { 0x32, 0x36 }; · line 88

Quoted 2 lines
drivers/hwmon/tmp401.c +0 -0
 /* Manufacturer / Device ID's */
 #define TMP401_MANUFACTURER_ID			0x55

Other than this, this change looks reasonable.

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
author maintainer
#2 lore raw
In reply to Guenter Roeck

Hi Jean,

Quoted 40 lines · Jean Delvare

Hi Guenter,

Quoted 37 lines · Guenter Roeck
---
 drivers/hwmon/tmp401.c |   20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)
drivers/hwmon/tmp401.c +4 -11
index be71a3e..ef04cf8 100644
@@ -54,10 +54,8 @@ enum chips { tmp401, tmp411, tmp431 };
 #define TMP401_CONVERSION_RATE_READ		0x04
 #define TMP401_CONVERSION_RATE_WRITE		0x0A
 #define TMP401_TEMP_CRIT_HYST			0x21
-#define TMP401_CONSECUTIVE_ALERT		0x22
 #define TMP401_MANUFACTURER_ID_REG		0xFE
 #define TMP401_DEVICE_ID_REG			0xFF
-#define TMP411_N_FACTOR_REG			0x18
 
 static const u8 TMP401_TEMP_MSB[2]			= { 0x00, 0x01 };
 static const u8 TMP401_TEMP_LSB[2]			= { 0x15, 0x10 };
@@ -76,15 +74,15 @@ static const u8 TMP411_TEMP_HIGHEST_MSB[2]		= { 0x32, 0x36 };
 static const u8 TMP411_TEMP_HIGHEST_LSB[2]		= { 0x33, 0x37 };
 
 /* Flags */
-#define TMP401_CONFIG_RANGE		0x04
-#define TMP401_CONFIG_SHUTDOWN		0x40
-#define TMP401_STATUS_LOCAL_CRIT		0x01
-#define TMP401_STATUS_REMOTE_CRIT		0x02
-#define TMP401_STATUS_REMOTE_OPEN		0x04
-#define TMP401_STATUS_REMOTE_LOW		0x08
-#define TMP401_STATUS_REMOTE_HIGH		0x10
-#define TMP401_STATUS_LOCAL_LOW		0x20
-#define TMP401_STATUS_LOCAL_HIGH		0x40
+#define TMP401_CONFIG_RANGE			BIT(2)
+#define TMP401_CONFIG_SHUTDOWN			BIT(6)
+#define TMP401_STATUS_LOCAL_CRIT		BIT(0)
+#define TMP401_STATUS_REMOTE_CRIT		BIT(1)
Quoted 9 lines

drivers/hwmon/tmp401.c static const u8 TMP411_TEMP_HIGHEST_MSB[2] = { 0x32, 0x36 }; · line 85

Quoted 5 lines
drivers/hwmon/tmp401.c +5 -0
+#define TMP401_STATUS_REMOTE_OPEN		BIT(2)
+#define TMP401_STATUS_REMOTE_LOW		BIT(3)
+#define TMP401_STATUS_REMOTE_HIGH		BIT(4)
+#define TMP401_STATUS_LOCAL_LOW			BIT(5)
+#define TMP401_STATUS_LOCAL_HIGH		BIT(6)

Aren't you supposed to include either <linux/kernel.h> or <linux/bitops.h> directly if you use BIT()?

Added.

Quoted 7 lines

drivers/hwmon/tmp401.c static const u8 TMP411_TEMP_HIGHEST_MSB[2] = { 0x32, 0x36 }; · line 88

Quoted 2 lines
drivers/hwmon/tmp401.c +0 -0
 /* Manufacturer / Device ID's */
 #define TMP401_MANUFACTURER_ID			0x55

Other than this, this change looks reasonable.

Thanks a lot for the review!

Guenter

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors