add .clang-format
Change-Id: I94ce26d595367e08d6fb3734535bcd855f1b1473
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/sysfs.cpp b/sysfs.cpp
index d7ad3a2..dd711e5 100644
--- a/sysfs.cpp
+++ b/sysfs.cpp
@@ -13,6 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#include "config.h"
+
+#include "sysfs.hpp"
+
#include <algorithm>
#include <cerrno>
#include <cstdlib>
@@ -21,20 +25,18 @@
#include <memory>
#include <phosphor-logging/log.hpp>
#include <thread>
-#include "config.h"
-#include "sysfs.hpp"
using namespace std::string_literals;
namespace fs = std::experimental::filesystem;
-namespace sysfs {
+namespace sysfs
+{
static const auto emptyString = ""s;
static constexpr auto ofRoot = "/sys/firmware/devicetree/base";
-std::string findPhandleMatch(
- const std::string& iochanneldir,
- const std::string& phandledir)
+std::string findPhandleMatch(const std::string& iochanneldir,
+ const std::string& phandledir)
{
// TODO: At the moment this method only supports device trees
// with iio-hwmon nodes with a single sensor. Typically
@@ -56,9 +58,8 @@
uint32_t ioChannelsValue;
std::ifstream ioChannelsFile(ioChannelsPath);
- ioChannelsFile.read(
- reinterpret_cast<char*>(&ioChannelsValue),
- sizeof(ioChannelsValue));
+ ioChannelsFile.read(reinterpret_cast<char*>(&ioChannelsValue),
+ sizeof(ioChannelsValue));
for (const auto& ofInst : fs::recursive_directory_iterator(phandledir))
{
@@ -70,9 +71,8 @@
std::ifstream pHandleFile(path);
uint32_t pHandleValue;
- pHandleFile.read(
- reinterpret_cast<char*>(&pHandleValue),
- sizeof(pHandleValue));
+ pHandleFile.read(reinterpret_cast<char*>(&pHandleValue),
+ sizeof(pHandleValue));
if (ioChannelsValue == pHandleValue)
{
@@ -128,7 +128,7 @@
// If a match is found, use the corresponding /sys/devices
// iio device as the callout device.
static constexpr auto iioDevices = "/sys/bus/iio/devices";
- for (const auto& iioDev: fs::recursive_directory_iterator(iioDevices))
+ for (const auto& iioDev : fs::recursive_directory_iterator(iioDevices))
{
p = iioDev.path();
p /= "of_node";
@@ -211,9 +211,9 @@
try
{
- //This path is also used as a filesystem path to an environment
- //file, and that has issues with ':'s in the path so they've
- //been converted to '--'s. Convert them back now.
+ // This path is also used as a filesystem path to an environment
+ // file, and that has issues with ':'s in the path so they've
+ // been converted to '--'s. Convert them back now.
size_t pos = 0;
std::string path = p;
while ((pos = path.find("--")) != std::string::npos)
@@ -224,7 +224,7 @@
for (const auto& hwmonInst : fs::directory_iterator(path))
{
if ((hwmonInst.path().filename().string().find("hwmon") !=
- std::string::npos))
+ std::string::npos))
{
return hwmonInst.path();
}
@@ -233,9 +233,8 @@
catch (const std::exception& e)
{
using namespace phosphor::logging;
- log<level::ERR>(
- "Unable to find hwmon directory from the dev path",
- entry("PATH=%s", devPath.c_str()));
+ log<level::ERR>("Unable to find hwmon directory from the dev path",
+ entry("PATH=%s", devPath.c_str()));
}
return emptyString;
}