summaryrefslogtreecommitdiffstats
path: root/sysfs.cpp
diff options
context:
space:
mode:
authorBrandon Wyman <v2cib530@us.ibm.com>2017-06-21 13:17:35 -0500
committerPatrick Williams <patrick@stwcx.xyz>2017-06-26 01:28:17 +0000
commit2f370c4e351adb90dc218d719b962cb841a399eb (patch)
treeeb4e2e78fb47bc118fa9148fe4c0d016f3e42a98 /sysfs.cpp
parentac8b7c6b71f089a9054e34d555c14ad14dd501b4 (diff)
downloadphosphor-hwmon-2f370c4e351adb90dc218d719b962cb841a399eb.tar.gz
phosphor-hwmon-2f370c4e351adb90dc218d719b962cb841a399eb.zip
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>
Diffstat (limited to 'sysfs.cpp')
-rw-r--r--sysfs.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/sysfs.cpp b/sysfs.cpp
index bc94b12..e76c715 100644
--- a/sysfs.cpp
+++ b/sysfs.cpp
@@ -162,8 +162,6 @@ int readSysfsWithCallout(const std::string& root,
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 @@ int readSysfsWithCallout(const std::string& root,
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 @@ uint64_t writeSysfsWithCallout(const uint64_t& value,
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 @@ uint64_t writeSysfsWithCallout(const uint64_t& value,
// 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::
OpenPOWER on IntegriCloud