Retry on ENODEV errnos
This errno can be returned by certain device drivers
when they are in the process of being unbound.
Retrying will give the driver time to finish unbinding,
and phosphor-hwmon will then die off naturally as
phosphor-hwmon's lifetime is tied to the loaded driver's.
Resolves openbmc/openbmc#2401
Change-Id: Ife888f3b608d7694d22f95412a7d320377daefa4
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/sysfs.cpp b/sysfs.cpp
index 9cf1552..369d2e7 100644
--- a/sysfs.cpp
+++ b/sysfs.cpp
@@ -54,6 +54,14 @@
* eventually get ENOENT.
*/
ENXIO,
+
+ /*
+ * We can see this from some drivers when we try to do
+ * a read in the middle of them being unbound. The
+ * unbinding should complete before the retries are up
+ * and kill this process.
+ */
+ ENODEV,
};
static const auto emptyString = ""s;