psu-ng: Need driver to bind before updateInventory

If the power supply is present, we need to bind the device driver before
we attempt to read the VPD and other properties from it.

If we are binding the device driver, we need to ensure we find or update
the directory/path we are using for sysfs files we will read.

Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
Change-Id: I2a0b2b3b76c77600ee34c847b62daf4eff40f39a
diff --git a/phosphor-power-supply/power_supply.cpp b/phosphor-power-supply/power_supply.cpp
index af0af69..7bc1cda 100644
--- a/phosphor-power-supply/power_supply.cpp
+++ b/phosphor-power-supply/power_supply.cpp
@@ -175,23 +175,27 @@
                               .c_str());
 
         auto invpath = inventoryPath.substr(strlen(INVENTORY_OBJ_PATH));
+
+        bindOrUnbindDriver(present);
+        if (present)
+        {
+            // If the power supply was present, then missing, and present again,
+            // the hwmon path may have changed. We will need the correct/updated
+            // path before any reads or writes are attempted.
+            pmbusIntf->findHwmonDir();
+        }
+
         setPresence(bus, invpath, present, shortName);
         updateInventory();
 
-        // Need Functional to already be correct before calling this
+        // Need Functional to already be correct before calling this.
         checkAvailability();
 
         if (present)
         {
-            bindOrUnbindDriver(present);
-            pmbusIntf->findHwmonDir();
             onOffConfig(phosphor::pmbus::ON_OFF_CONFIG_CONTROL_PIN_ONLY);
             clearFaults();
         }
-        else
-        {
-            bindOrUnbindDriver(present);
-        }
     }
 }