thermal/drivers/sun8i: Don't fail probe due to zone registration failure
[linux-2.6-microblaze.git] / drivers / thermal / sun8i_thermal.c
index 63a7d2d..3203d8b 100644 (file)
@@ -195,6 +195,9 @@ static irqreturn_t sun8i_irq_thread(int irq, void *data)
        int i;
 
        for_each_set_bit(i, &irq_bitmap, tmdev->chip->sensor_num) {
+               /* We allow some zones to not register. */
+               if (IS_ERR(tmdev->sensor[i].tzd))
+                       continue;
                thermal_zone_device_update(tmdev->sensor[i].tzd,
                                           THERMAL_EVENT_UNSPECIFIED);
        }
@@ -531,8 +534,17 @@ static int sun8i_ths_register(struct ths_device *tmdev)
                                                      i,
                                                      &tmdev->sensor[i],
                                                      &ths_ops);
-               if (IS_ERR(tmdev->sensor[i].tzd))
-                       return PTR_ERR(tmdev->sensor[i].tzd);
+
+               /*
+                * If an individual zone fails to register for reasons
+                * other than probe deferral (eg, a bad DT) then carry
+                * on, other zones might register successfully.
+                */
+               if (IS_ERR(tmdev->sensor[i].tzd)) {
+                       if (PTR_ERR(tmdev->sensor[i].tzd) == -EPROBE_DEFER)
+                               return PTR_ERR(tmdev->sensor[i].tzd);
+                       continue;
+               }
 
                devm_thermal_add_hwmon_sysfs(tmdev->dev, tmdev->sensor[i].tzd);
        }