Update hwmon fan target sysfs entries

Override the default FanSpeed.Target set implementation so when a target
value is written to the FanSpeed interface it is also updated in the
related fan target sysfs file. This sets a particular fan to the given
target speed.

Resolves openbmc/openbmc#962
Resolves openbmc/phosphor-hwmon#1

Change-Id: I867811737269b3f42d2a0dc15b37782a74f147b8
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/targets.hpp b/targets.hpp
index 2b0feb3..381ba75 100644
--- a/targets.hpp
+++ b/targets.hpp
@@ -1,6 +1,7 @@
 #pragma once
 
 #include <experimental/filesystem>
+#include "fan_speed.hpp"
 
 /** @class Targets
  *  @brief Target type traits.
@@ -18,11 +19,9 @@
 
 /**@brief Targets specialization for fan speed. */
 template <>
-struct Targets<FanSpeedObject>
+struct Targets<hwmon::FanSpeed>
 {
     static constexpr InterfaceType type = InterfaceType::FAN_SPEED;
-    static uint64_t (FanSpeedObject::*const setTarget)(uint64_t);
-    static uint64_t (FanSpeedObject::*const getTarget)() const;
 };
 
 /** @brief addTarget
@@ -51,13 +50,18 @@
 
     // Check if target sysfs file exists
     auto targetPath = hwmonRoot + '/' + instance;
-    auto sysfsFile = make_sysfs_path(targetPath,
-                                     sensor.first,
-                                     sensor.second,
-                                     hwmon::entry::target);
-    if (fs::exists(sysfsFile))
+    auto sysfsFullPath = make_sysfs_path(targetPath,
+                                         sensor.first,
+                                         sensor.second,
+                                         hwmon::entry::target);
+    if (fs::exists(sysfsFullPath))
     {
-        auto iface = std::make_shared<T>(bus, objPath.c_str(), deferSignals);
+        auto iface = std::make_shared<T>(hwmonRoot,
+                                         instance,
+                                         sensor.second,
+                                         bus,
+                                         objPath.c_str(),
+                                         deferSignals);
         auto type = Targets<T>::type;
         obj[type] = iface;
     }