common: i2c: Add non-coroutine sendReceive()
This commit introduces a non-coroutine version of `sendReceive()` in the
common I2C module. The new implementation avoids potential stack buffer
issues by ensuring synchronous execution.
Change-Id: I1d308f24fafa6e0d68ffcc67073e0a2e67a6b419
Signed-off-by: Daniel Hsu <Daniel-Hsu@quantatw.com>
diff --git a/cpld/cpld_software_manager.cpp b/cpld/cpld_software_manager.cpp
index faf14a5..6303135 100644
--- a/cpld/cpld_software_manager.cpp
+++ b/cpld/cpld_software_manager.cpp
@@ -16,17 +16,14 @@
std::string configIface =
"xyz.openbmc_project.Configuration." + config.configType;
- std::optional<uint64_t> busNo = co_await dbusGetRequiredProperty<uint64_t>(
+ auto busNo = co_await dbusGetRequiredProperty<uint64_t>(
ctx, service, path, configIface, "Bus");
- std::optional<uint64_t> address =
- co_await dbusGetRequiredProperty<uint64_t>(ctx, service, path,
- configIface, "Address");
- std::optional<std::string> chipType =
- co_await dbusGetRequiredProperty<std::string>(ctx, service, path,
- configIface, "Type");
- std::optional<std::string> chipName =
- co_await dbusGetRequiredProperty<std::string>(ctx, service, path,
- configIface, "Name");
+ auto address = co_await dbusGetRequiredProperty<uint64_t>(
+ ctx, service, path, configIface, "Address");
+ auto chipType = co_await dbusGetRequiredProperty<std::string>(
+ ctx, service, path, configIface, "Type");
+ auto chipName = co_await dbusGetRequiredProperty<std::string>(
+ ctx, service, path, configIface, "Name");
if (!busNo.has_value() || !address.has_value() || !chipType.has_value() ||
!chipName.has_value())