On Thu, Jul 25, 2024 at 05:43:27PM -0700, Guenter Roeck wrote: > @@ -15,6 +16,7 @@ > #include <linux/jiffies.h> Should be able to drop. > #include <linux/module.h> > #include <linux/mutex.h> Should be able to drop too. > static ssize_t show_fault(struct device *dev, > struct device_attribute *devattr, char *buf) > { > int index = to_sensor_dev_attr(devattr)->index; > - struct max1668_data *data = max1668_update_device(dev); > + struct max1668_data *data = dev_get_drvdata(dev); > + struct regmap *regmap = data->regmap; > + u32 alarm, temp; > + int ret; > > - if (IS_ERR(data)) > - return PTR_ERR(data); > + ret = regmap_read(regmap, MAX1668_REG_STAT1, &alarm); > + if (ret) > + return ret; > > - return sprintf(buf, "%u\n", > - (data->alarms & BIT(12)) && data->temp[index] == 127); > + ret = regmap_read(regmap, MAX1668_REG_TEMP(index), &temp); > + if (ret) > + return ret; > + > + return sprintf(buf, "%u\n", (alarm & BIT(12)) && temp == 127); Should be BIT(12 & 7).