Fix high CPU usage noted with BMP280
The call to findCallOutPath() is really only needed if we have
encountered a read or write error.
Change-Id: I81136156ba3a42546a5e2cec85283a0082358853
Signed-off-by: Brandon Wyman <v2cib530@us.ibm.com>
diff --git a/sysfs.cpp b/sysfs.cpp
index bc94b12..e76c715 100644
--- a/sysfs.cpp
+++ b/sysfs.cpp
@@ -162,8 +162,6 @@
std::string fullPath = make_sysfs_path(instancePath,
type, id, sensor);
- auto callOutPath = findCalloutPath(fs::canonical(instancePath));
-
ifs.exceptions(std::ifstream::failbit
| std::ifstream::badbit
| std::ifstream::eofbit);
@@ -193,6 +191,7 @@
exit(0);
}
instancePath /= "device";
+ auto callOutPath = findCalloutPath(fs::canonical(instancePath));
using namespace sdbusplus::xyz::openbmc_project::Sensor::Device::Error;
report<ReadFailure>(
xyz::openbmc_project::Sensor::Device::
@@ -223,8 +222,6 @@
std::string fullPath = make_sysfs_path(instancePath,
type, id, sensor);
- auto callOutPath = findCalloutPath(fs::canonical(instancePath));
-
ofs.exceptions(std::ofstream::failbit
| std::ofstream::badbit
| std::ofstream::eofbit);
@@ -239,6 +236,7 @@
// or write system calls that got us here.
auto rc = errno;
instancePath /= "device";
+ auto callOutPath = findCalloutPath(fs::canonical(instancePath));
using namespace sdbusplus::xyz::openbmc_project::Control::Device::Error;
report<WriteFailure>(
xyz::openbmc_project::Control::Device::