No retries when adding a purposely removed sensor

When a sensor is removed due to a removal return code being received
during a read, no read retries should be done when attempting to re-add
it. This requires the sensor to be successful in its first read
attempted when being re-added and keeps the re-adding of purposely
removed sensors from consuming up to 1 second during the re-add attempt.

Tested:
    A removed sensor is attempted to be read once on re-add

Change-Id: Ia7eb463deb569c9d10883632e017b4dd05413854
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/mainloop.cpp b/mainloop.cpp
index 8a804f7..c93beb8 100644
--- a/mainloop.cpp
+++ b/mainloop.cpp
@@ -207,7 +207,7 @@
 }
 
 auto addValue(const SensorSet::key_type& sensor,
-              const std::string& devPath,
+              const RetryIO& retryIO,
               sysfs::hwmonio::HwmonIO& ioAccess,
               ObjectInfo& info,
               bool isOCC = false)
@@ -232,8 +232,8 @@
             sensor.first,
             sensor.second,
             hwmon::entry::cinput,
-            sysfs::hwmonio::retries,
-            sysfs::hwmonio::delay,
+            std::get<size_t>(retryIO),
+            std::get<std::chrono::milliseconds>(retryIO),
             isOCC);
 
     auto gain = getEnv("GAIN", sensor);
@@ -346,11 +346,18 @@
     objectPath.append(label);
 
     ObjectInfo info(&_bus, std::move(objectPath), Object());
+    RetryIO retryIO(sysfs::hwmonio::retries, sysfs::hwmonio::delay);
+    if (rmSensors.find(sensor.first) != rmSensors.end())
+    {
+        // When adding a sensor that was purposely removed,
+        // don't retry on errors when reading its value
+        std::get<size_t>(retryIO) = 0;
+    }
     auto valueInterface = static_cast<
             std::shared_ptr<ValueObject>>(nullptr);
     try
     {
-        valueInterface = addValue(sensor.first, _devPath, ioAccess, info,
+        valueInterface = addValue(sensor.first, retryIO, ioAccess, info,
                 _isOCC);
     }
     catch (const std::system_error& e)