Thread (9 messages) 9 messages, 5 authors, 2026-01-19

Re: [PATCH v4 2/3] hwmon: (tmp108) Add support for P3T1035 and P3T2030

From: Guenter Roeck <linux@roeck-us.net>
Date: 2026-01-19 01:45:04
Also in: linux-devicetree, linux-hwmon, lkml

Frank,

On 1/18/26 09:30, Frank Li wrote:
...
quoted
quoted
quoted
@@ -101,21 +120,7 @@ static int tmp108_read(struct device *dev, enum hwmon_sensor_types type,
   					  &regval);
   			if (err < 0)
   				return err;
-			switch (regval & TMP108_CONF_CONVRATE_MASK) {
-			case TMP108_CONVRATE_0P25HZ:
-			default:
-				*temp = 4000;
-				break;
-			case TMP108_CONVRATE_1HZ:
-				*temp = 1000;
-				break;
-			case TMP108_CONVRATE_4HZ:
-				*temp = 250;
-				break;
-			case TMP108_CONVRATE_16HZ:
-				*temp = 63;
-				break;
-			}
+			*temp = tmp108->sample_times[FIELD_GET(TMP108_CONF_CONVRATE_FLD, regval)];
This code optimation need seperate patch.
No, There are now two ranges, not just one.
Previous code use swtich case to handle sample. now convert to use a map
array tmp108_sample_times[].

My means use a small patch convert existed switch case to map array firstly
, then add second range, which make code easy to review.
You are not signed up as reviewer of this driver. I am, and I don't want to see
a separate patch just for this because it means extra work for me.

Thanks,
Guenter
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help