dbushelper: avoid new bus connections

The dbushelper required a new bus connection, for what was often a
single dbus access.  Switch the helper class to take a reference to
a bus instead so that the same bus connections can be reused.

Fixes openbmc/phosphor-pid-control#44

Tested: Significant decrease in the number of dbus connections
observed.

```
:1.510                                                 8025 swampd          root             :1.510        phosphor-pid-control.service                                                                   -       -
:1.511                                                 8025 swampd          root             :1.511        phosphor-pid-control.service                                                                   -       -
:1.512                                                 8025 swampd          root             :1.512        phosphor-pid-control.service                                                                   -       -
xyz.openbmc_project.Hwmon.external                     8025 swampd          root             :1.511        phosphor-pid-control.service                                                                   -       -
xyz.openbmc_project.State.FanCtrl                      8025 swampd          root             :1.510        phosphor-pid-control.service
```

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ifbbfe10cbd533aa95e35db2800dfb9e83e37a5e0
diff --git a/dbus/dbusconfiguration.cpp b/dbus/dbusconfiguration.cpp
index 9de25ad..7e34b55 100644
--- a/dbus/dbusconfiguration.cpp
+++ b/dbus/dbusconfiguration.cpp
@@ -303,7 +303,7 @@
 }
 
 void populatePidInfo(
-    [[maybe_unused]] sdbusplus::bus_t& bus,
+    sdbusplus::bus_t& bus,
     const std::unordered_map<std::string, DbusVariantType>& base,
     conf::ControllerInfo& info, const std::string* thresholdProperty,
     const std::map<std::string, conf::SensorConfig>& sensorConfig)
@@ -348,7 +348,7 @@
         const std::string& path =
             sensorConfig.at(info.inputs.front().name).readPath;
 
-        DbusHelper helper(sdbusplus::bus::new_system());
+        DbusHelper helper(bus);
         std::string service = helper.getService(interface, path);
         double reading = 0;
         try
diff --git a/dbus/dbushelper.hpp b/dbus/dbushelper.hpp
index 7d2be2d..9b73194 100644
--- a/dbus/dbushelper.hpp
+++ b/dbus/dbushelper.hpp
@@ -23,7 +23,8 @@
     static constexpr char availabilityIntf[] =
         "xyz.openbmc_project.State.Decorator.Availability";
 
-    explicit DbusHelper(sdbusplus::bus_t bus) : _bus(std::move(bus)) {}
+    explicit DbusHelper(sdbusplus::bus_t& bus) : _bus(bus) {}
+    DbusHelper() = delete;
     ~DbusHelper() = default;
 
     DbusHelper(const DbusHelper&) = delete;
@@ -70,7 +71,7 @@
     }
 
   private:
-    sdbusplus::bus_t _bus;
+    sdbusplus::bus_t& _bus;
 };
 
 } // namespace pid_control