pseq: Rename GPIO struct used for pgood status
In the phosphor-power-sequencer application, the Rail class has an
optional GPIO that provides the pgood status of the rail.
Currently the GPIO information is stored in a struct named 'GPIO'. This
structure is specific to reading the pgood status of a rail using a GPIO
on the power sequencer device.
A future commit will be creating a new GPIO class that represents an
arbitrary GPIO in the system. This class will support requesting,
reading, writing, and releasing the GPIO.
To avoid a name conflict, rename the struct to PgoodGPIO, which more
clearly represents its purpose.
Tested: Ran automated tests
Change-Id: Ie13d1c77faa96faf6839e77a84d1499f7c239148
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
diff --git a/phosphor-power-sequencer/src/config_file_parser.cpp b/phosphor-power-sequencer/src/config_file_parser.cpp
index 44c7877..2a5cc26 100644
--- a/phosphor-power-sequencer/src/config_file_parser.cpp
+++ b/phosphor-power-sequencer/src/config_file_parser.cpp
@@ -266,8 +266,8 @@
return chassisTemplates;
}
-GPIO parseGPIO(const json& element,
- const std::map<std::string, std::string>& variables)
+PgoodGPIO parseGPIO(const json& element,
+ const std::map<std::string, std::string>& variables)
{
verifyIsObject(element);
unsigned int propertyCount{0};
@@ -289,7 +289,7 @@
// Verify no invalid properties exist
verifyPropertyCount(element, propertyCount);
- return GPIO(line, activeLow);
+ return PgoodGPIO(line, activeLow);
}
std::tuple<uint8_t, uint16_t> parseI2CInterface(
@@ -449,7 +449,7 @@
}
// Optional gpio property
- std::optional<GPIO> gpio{};
+ std::optional<PgoodGPIO> gpio{};
auto gpioIt = element.find("gpio");
if (gpioIt != element.end())
{
diff --git a/phosphor-power-sequencer/src/config_file_parser.hpp b/phosphor-power-sequencer/src/config_file_parser.hpp
index b5b54fb..15fe7ce 100644
--- a/phosphor-power-sequencer/src/config_file_parser.hpp
+++ b/phosphor-power-sequencer/src/config_file_parser.hpp
@@ -182,18 +182,18 @@
const json& element);
/**
- * Parses a JSON element containing a GPIO.
+ * Parses a JSON element containing a gpio object.
*
- * Returns the corresponding C++ GPIO object.
+ * Returns the corresponding C++ PgoodGPIO object.
*
* Throws an exception if parsing fails.
*
* @param element JSON element
* @param variables variables map used to expand variables in element value
- * @return GPIO object
+ * @return PgoodGPIO object
*/
-GPIO parseGPIO(const json& element,
- const std::map<std::string, std::string>& variables);
+PgoodGPIO parseGPIO(const json& element,
+ const std::map<std::string, std::string>& variables);
/**
* Parses a JSON element containing an i2c_interface object.
diff --git a/phosphor-power-sequencer/src/rail.hpp b/phosphor-power-sequencer/src/rail.hpp
index 040eb81..d895b51 100644
--- a/phosphor-power-sequencer/src/rail.hpp
+++ b/phosphor-power-sequencer/src/rail.hpp
@@ -31,12 +31,12 @@
class PowerSequencerDevice;
/**
- * @struct GPIO
+ * @struct PgoodGPIO
*
* General Purpose Input/Output (GPIO) that can be read to obtain the pgood
* status of a voltage rail.
*/
-struct GPIO
+struct PgoodGPIO
{
/**
* The libgpiod line offset of the GPIO.
@@ -93,7 +93,7 @@
const std::optional<std::string>& presence,
const std::optional<uint8_t>& page, bool isPowerSupplyRail,
bool checkStatusVout, bool compareVoltageToLimit,
- const std::optional<GPIO>& gpio) :
+ const std::optional<PgoodGPIO>& gpio) :
name{name}, presence{presence}, page{page},
isPsuRail{isPowerSupplyRail}, checkStatusVout{checkStatusVout},
compareVoltageToLimit{compareVoltageToLimit}, gpio{gpio}
@@ -173,7 +173,7 @@
*
* @return GPIO
*/
- const std::optional<GPIO>& getGPIO() const
+ const std::optional<PgoodGPIO>& getGPIO() const
{
return gpio;
}
@@ -376,7 +376,7 @@
/**
* GPIO to read to determine the pgood status of the rail.
*/
- std::optional<GPIO> gpio{};
+ std::optional<PgoodGPIO> gpio{};
};
} // namespace phosphor::power::sequencer