bmc: firmware-handler: lpc: minor cleanup
Moves the setInitializedAndReturn method to the source file to remove
the exception dependency from the header.
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I17ad9a116f47e729dd5b12b6279ea6986529e6ca
diff --git a/bmc/firmware-handler/lpc_handler.cpp b/bmc/firmware-handler/lpc_handler.cpp
index e3a5e08..c27bbe6 100644
--- a/bmc/firmware-handler/lpc_handler.cpp
+++ b/bmc/firmware-handler/lpc_handler.cpp
@@ -16,13 +16,36 @@
#include "lpc_handler.hpp"
+#include "mapper_errors.hpp"
+
#include <cstdint>
+#include <cstdio>
#include <cstring>
#include <vector>
namespace ipmi_flash
{
+bool LpcDataHandler::setInitializedAndReturn(bool value)
+{
+ if (value)
+ {
+ try
+ {
+ /* Try really opening the map. */
+ memory = mapper->open();
+ }
+ catch (const MapperException& e)
+ {
+ std::fprintf(stderr, "received mapper exception: %s\n", e.what());
+ return false;
+ }
+ }
+
+ initialized = value;
+ return value;
+}
+
bool LpcDataHandler::open()
{
/* For the ASPEED LPC CTRL driver, the ioctl is required to set up the
diff --git a/bmc/firmware-handler/lpc_handler.hpp b/bmc/firmware-handler/lpc_handler.hpp
index cc04433..ec974ca 100644
--- a/bmc/firmware-handler/lpc_handler.hpp
+++ b/bmc/firmware-handler/lpc_handler.hpp
@@ -1,7 +1,6 @@
#pragma once
#include "data_handler.hpp"
-#include "mapper_errors.hpp"
#include "window_hw_interface.hpp"
#include <cstdint>
@@ -43,26 +42,7 @@
std::vector<std::uint8_t> readMeta() override;
private:
- bool setInitializedAndReturn(bool value)
- {
- if (value)
- {
- try
- {
- /* Try really opening the map. */
- memory = mapper->open();
- }
- catch (const MapperException& e)
- {
- std::fprintf(stderr, "received mapper exception: %s\n",
- e.what());
- return false;
- }
- }
-
- initialized = value;
- return value;
- }
+ bool setInitializedAndReturn(bool value);
std::unique_ptr<HardwareMapperInterface> mapper;
bool initialized;