Merge tag 'media/v6.12-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab...
[sfrench/cifs-2.6.git] / drivers / hwmon / ltc2991.c
index 06750bb93c236795f6db825c82607a7d9abd6f1c..7ca139e4b6aff0b6c3024183e19970b36f927f6e 100644 (file)
@@ -42,9 +42,9 @@
 #define LTC2991_V7_V8_FILT_EN          BIT(7)
 #define LTC2991_V7_V8_TEMP_EN          BIT(5)
 #define LTC2991_V7_V8_DIFF_EN          BIT(4)
-#define LTC2991_V5_V6_FILT_EN          BIT(7)
-#define LTC2991_V5_V6_TEMP_EN          BIT(5)
-#define LTC2991_V5_V6_DIFF_EN          BIT(4)
+#define LTC2991_V5_V6_FILT_EN          BIT(3)
+#define LTC2991_V5_V6_TEMP_EN          BIT(1)
+#define LTC2991_V5_V6_DIFF_EN          BIT(0)
 
 #define LTC2991_REPEAT_ACQ_EN          BIT(4)
 #define LTC2991_T_INT_FILT_EN          BIT(3)
@@ -225,8 +225,8 @@ static umode_t ltc2991_is_visible(const void *data,
        case hwmon_temp:
                switch (attr) {
                case hwmon_temp_input:
-                       if (st->temp_en[channel] ||
-                           channel == LTC2991_T_INT_CH_NR)
+                       if (channel == LTC2991_T_INT_CH_NR ||
+                           st->temp_en[channel])
                                return 0444;
                        break;
                }
@@ -284,7 +284,6 @@ static const struct regmap_config ltc2991_regmap_config = {
 
 static int ltc2991_init(struct ltc2991_state *st, struct device *dev)
 {
-       struct fwnode_handle *child;
        int ret;
        u32 val, addr;
        u8 v5_v8_reg_data = 0, v1_v4_reg_data = 0;
@@ -294,17 +293,13 @@ static int ltc2991_init(struct ltc2991_state *st, struct device *dev)
                return dev_err_probe(dev, ret,
                                     "failed to enable regulator\n");
 
-       device_for_each_child_node(dev, child) {
+       device_for_each_child_node_scoped(dev, child) {
                ret = fwnode_property_read_u32(child, "reg", &addr);
-               if (ret < 0) {
-                       fwnode_handle_put(child);
+               if (ret < 0)
                        return ret;
-               }
 
-               if (addr > 3) {
-                       fwnode_handle_put(child);
+               if (addr > 3)
                        return -EINVAL;
-               }
 
                ret = fwnode_property_read_u32(child,
                                               "shunt-resistor-micro-ohms",