Re: [PATCH v4 2/3] hwmon: (tmp108) Add support for P3T1035 and P3T2030
From: Guenter Roeck
Date: Sun Jan 18 2026 - 20:45:04 EST
Frank,
On 1/18/26 09:30, Frank Li wrote:
...
No, There are now two ranges, not just one.@@ -101,21 +120,7 @@ static int tmp108_read(struct device *dev, enum hwmon_sensor_types type,
®val);
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.
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