Use Common.Device.Error for device failures

The ReadFailure and WriteFailure errors are now
available in Common.Device, and code will now use
those instead of the ones in Sensor.Device and
Control.Device, which were meant for sensor errors.

Change-Id: Id15b56ab56f3ee4acee024941840a17b9f5bf9c6
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/pmbus.cpp b/pmbus.cpp
index 12b8aa8..47560a0 100644
--- a/pmbus.cpp
+++ b/pmbus.cpp
@@ -18,8 +18,7 @@
 #include <phosphor-logging/elog.hpp>
 #include <phosphor-logging/elog-errors.hpp>
 #include <xyz/openbmc_project/Common/error.hpp>
-#include <xyz/openbmc_project/Control/Device/error.hpp>
-#include <xyz/openbmc_project/Sensor/Device/error.hpp>
+#include <xyz/openbmc_project/Common/Device/error.hpp>
 #include "pmbus.hpp"
 
 namespace witherspoon
@@ -29,8 +28,7 @@
 
 using namespace phosphor::logging;
 using namespace sdbusplus::xyz::openbmc_project::Common::Error;
-using namespace sdbusplus::xyz::openbmc_project::Control::Device::Error;
-using namespace sdbusplus::xyz::openbmc_project::Sensor::Device::Error;
+using namespace sdbusplus::xyz::openbmc_project::Common::Device::Error;
 namespace fs = std::experimental::filesystem;
 
 std::string PMBus::insertPageNum(const std::string& templateName,
@@ -117,11 +115,11 @@
         log<level::ERR>("Failed to read sysfs file",
                         entry("FILENAME=%s", path.c_str()));
 
-        elog<ReadFailure>(xyz::openbmc_project::Sensor::Device::
-                          ReadFailure::CALLOUT_ERRNO(rc),
-                          xyz::openbmc_project::Sensor::Device::
-                          ReadFailure::CALLOUT_DEVICE_PATH(
-                              fs::canonical(basePath).c_str()));
+        using metadata = xyz::openbmc_project::Common::Device::ReadFailure;
+
+        elog<ReadFailure>(metadata::CALLOUT_ERRNO(rc),
+                          metadata::CALLOUT_DEVICE_PATH(
+                                  fs::canonical(basePath).c_str()));
     }
 
     return value != 0;
@@ -156,7 +154,7 @@
         log<level::ERR>("Failed to read sysfs file",
                         entry("FILENAME=%s", path.c_str()));
 
-        using metadata = xyz::openbmc_project::Sensor::Device::ReadFailure;
+        using metadata = xyz::openbmc_project::Common::Device::ReadFailure;
 
         elog<ReadFailure>(metadata::CALLOUT_ERRNO(rc),
                           metadata::CALLOUT_DEVICE_PATH(
@@ -189,11 +187,11 @@
         log<level::ERR>("Failed to write sysfs file",
                         entry("FILENAME=%s", path.c_str()));
 
-        elog<WriteFailure>(xyz::openbmc_project::Control::Device::
-                           WriteFailure::CALLOUT_ERRNO(rc),
-                           xyz::openbmc_project::Control::Device::
-                           WriteFailure::CALLOUT_DEVICE_PATH(
-                               fs::canonical(basePath).c_str()));
+        using metadata = xyz::openbmc_project::Common::Device::WriteFailure;
+
+        elog<WriteFailure>(metadata::CALLOUT_ERRNO(rc),
+                           metadata::CALLOUT_DEVICE_PATH(
+                                   fs::canonical(basePath).c_str()));
     }
 }