diff options
| author | Patrick Venture <venture@google.com> | 2018-11-01 15:39:53 -0700 |
|---|---|---|
| committer | Patrick Venture <venture@google.com> | 2018-11-02 07:44:49 -0700 |
| commit | f78d90420967100233cc9c2a5e0834e9789e2637 (patch) | |
| tree | a2acee81dcaa830217753a84acf5af7c92a9c3f5 /targeting.cpp | |
| parent | e84b4ddb671d97cb4725ee2de18979c69e42b971 (diff) | |
| download | openpower-proc-control-f78d90420967100233cc9c2a5e0834e9789e2637.tar.gz openpower-proc-control-f78d90420967100233cc9c2a5e0834e9789e2637.zip | |
add .clang-format
Add .clang-format for automatic style.
Change-Id: I6d240009370179b5b8f1f646b0476a059ec6aa85
Signed-off-by: Patrick Venture <venture@google.com>
Diffstat (limited to 'targeting.cpp')
| -rw-r--r-- | targeting.cpp | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/targeting.cpp b/targeting.cpp index 5d55ac9..7dd68ef 100644 --- a/targeting.cpp +++ b/targeting.cpp @@ -14,15 +14,16 @@ * limitations under the License. */ +#include "targeting.hpp" + #include <endian.h> + #include <experimental/filesystem> -#include <phosphor-logging/elog.hpp> #include <phosphor-logging/elog-errors.hpp> +#include <phosphor-logging/elog.hpp> #include <phosphor-logging/log.hpp> #include <regex> #include <xyz/openbmc_project/Common/File/error.hpp> -#include "targeting.hpp" - namespace openpower { @@ -37,8 +38,8 @@ int Target::getCFAMFD() { if (cfamFD.get() == nullptr) { - cfamFD = std::make_unique< - openpower::util::FileDescriptor>(getCFAMPath()); + cfamFD = + std::make_unique<openpower::util::FileDescriptor>(getCFAMPath()); } return cfamFD->get(); @@ -46,10 +47,7 @@ int Target::getCFAMFD() std::unique_ptr<Target>& Targeting::getTarget(size_t pos) { - auto search = [pos](const auto& t) - { - return t->getPos() == pos; - }; + auto search = [pos](const auto& t) { return t->getPos() == pos; }; auto target = find_if(targets.begin(), targets.end(), search); if (target == targets.end()) @@ -62,7 +60,6 @@ std::unique_ptr<Target>& Targeting::getTarget(size_t pos) } } - static uint32_t noEndianSwap(uint32_t data) { return data; @@ -85,20 +82,20 @@ Targeting::Targeting(const std::string& fsiMasterDev, { std::regex expOld{"hub@00/slave@([0-9]{2}):00", std::regex::extended}; - //Fall back to old (4.7) path + // Fall back to old (4.7) path exp = expOld; fsiMasterPath = fsiMasterDevPathOld; fsiSlaveBasePath = fsiSlaveBaseDirOld; - //And don't swap the endianness of CFAM data + // And don't swap the endianness of CFAM data swapper = noEndianSwap; } - //Always create P0, the FSI master. + // Always create P0, the FSI master. targets.push_back(std::make_unique<Target>(0, fsiMasterPath, swapper)); try { - //Find the the remaining P9s dynamically based on which files show up + // Find the the remaining P9s dynamically based on which files show up for (auto& file : fs::directory_iterator(fsiSlaveBasePath)) { std::smatch match; @@ -123,18 +120,16 @@ Targeting::Targeting(const std::string& fsiMasterDev, { using metadata = xyz::openbmc_project::Common::File::Open; - elog<file_error::Open>( - metadata::ERRNO(e.code().value()), - metadata::PATH(e.path1().c_str())); + elog<file_error::Open>(metadata::ERRNO(e.code().value()), + metadata::PATH(e.path1().c_str())); } auto sortTargets = [](const std::unique_ptr<Target>& left, - const std::unique_ptr<Target>& right) - { + const std::unique_ptr<Target>& right) { return left->getPos() < right->getPos(); }; std::sort(targets.begin(), targets.end(), sortTargets); } -} -} +} // namespace targeting +} // namespace openpower |

