ams: globally prefer R_RETURN to return for ams::Result

This commit is contained in:
Michael Scire
2022-03-26 14:48:33 -07:00
parent dd78ede99f
commit bbf22b4c60
325 changed files with 1955 additions and 1993 deletions

View File

@@ -41,7 +41,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryChargePercentage(out_percent, std::addressof(device));
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryChargePercentage(out_percent, std::addressof(device)));
}
Result GetBatteryVoltageFuelGaugePercentage(float *out_percent, Session &session) {
@@ -55,7 +55,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryVoltageFuelGaugePercentage(out_percent, std::addressof(device));
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryVoltageFuelGaugePercentage(out_percent, std::addressof(device)));
}
Result GetBatteryFullCapacity(int *out_mah, Session &session) {
@@ -69,7 +69,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryFullCapacity(out_mah, std::addressof(device));
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryFullCapacity(out_mah, std::addressof(device)));
}
Result GetBatteryRemainingCapacity(int *out_mah, Session &session) {
@@ -83,7 +83,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryRemainingCapacity(out_mah, std::addressof(device));
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryRemainingCapacity(out_mah, std::addressof(device)));
}
Result SetBatteryChargePercentageMinimumAlertThreshold(Session &session, float percentage) {
@@ -97,7 +97,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryChargePercentageMinimumAlertThreshold(std::addressof(device), percentage);
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryChargePercentageMinimumAlertThreshold(std::addressof(device), percentage));
}
Result SetBatteryChargePercentageMaximumAlertThreshold(Session &session, float percentage) {
@@ -111,7 +111,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryChargePercentageMaximumAlertThreshold(std::addressof(device), percentage);
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryChargePercentageMaximumAlertThreshold(std::addressof(device), percentage));
}
Result SetBatteryVoltageFuelGaugePercentageMinimumAlertThreshold(Session &session, float percentage) {
@@ -125,7 +125,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryVoltageFuelGaugePercentageMinimumAlertThreshold(std::addressof(device), percentage);
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryVoltageFuelGaugePercentageMinimumAlertThreshold(std::addressof(device), percentage));
}
Result SetBatteryVoltageFuelGaugePercentageMaximumAlertThreshold(Session &session, float percentage) {
@@ -139,7 +139,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryVoltageFuelGaugePercentageMaximumAlertThreshold(std::addressof(device), percentage);
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryVoltageFuelGaugePercentageMaximumAlertThreshold(std::addressof(device), percentage));
}
Result SetBatteryFullChargeThreshold(Session &session, float percentage) {
@@ -153,7 +153,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryFullChargeThreshold(std::addressof(device), percentage);
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryFullChargeThreshold(std::addressof(device), percentage));
}
Result GetBatteryAverageCurrent(int *out_ma, Session &session) {
@@ -167,7 +167,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryAverageCurrent(out_ma, std::addressof(device));
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryAverageCurrent(out_ma, std::addressof(device)));
}
Result GetBatteryCurrent(int *out_ma, Session &session) {
@@ -181,7 +181,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryCurrent(out_ma, std::addressof(device));
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryCurrent(out_ma, std::addressof(device)));
}
Result GetBatteryInternalState(void *dst, size_t *out_size, Session &session, size_t dst_size) {
@@ -195,7 +195,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryInternalState(dst, out_size, std::addressof(device), dst_size);
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryInternalState(dst, out_size, std::addressof(device), dst_size));
}
Result SetBatteryInternalState(Session &session, const void *src, size_t src_size) {
@@ -209,7 +209,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryInternalState(std::addressof(device), src, src_size);
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryInternalState(std::addressof(device), src, src_size));
}
Result GetBatteryNeedToRestoreParameters(bool *out, Session &session) {
@@ -223,7 +223,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryNeedToRestoreParameters(out, std::addressof(device));
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryNeedToRestoreParameters(out, std::addressof(device)));
}
Result SetBatteryNeedToRestoreParameters(Session &session, bool en) {
@@ -237,7 +237,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryNeedToRestoreParameters(std::addressof(device), en);
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryNeedToRestoreParameters(std::addressof(device), en));
}
Result IsBatteryI2cShutdownEnabled(bool *out, Session &session) {
@@ -251,7 +251,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().IsBatteryI2cShutdownEnabled(out, std::addressof(device));
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().IsBatteryI2cShutdownEnabled(out, std::addressof(device)));
}
Result SetBatteryI2cShutdownEnabled(Session &session, bool en) {
@@ -265,7 +265,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryI2cShutdownEnabled(std::addressof(device), en);
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryI2cShutdownEnabled(std::addressof(device), en));
}
Result IsBatteryPresent(bool *out, Session &session) {
@@ -279,7 +279,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().IsBatteryPresent(out, std::addressof(device));
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().IsBatteryPresent(out, std::addressof(device)));
}
Result GetBatteryCycles(int *out, Session &session) {
@@ -293,7 +293,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryCycles(out, std::addressof(device));
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryCycles(out, std::addressof(device)));
}
Result SetBatteryCycles(Session &session, int cycles) {
@@ -307,7 +307,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryCycles(std::addressof(device), cycles);
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryCycles(std::addressof(device), cycles));
}
Result GetBatteryAge(float *out_percent, Session &session) {
@@ -321,7 +321,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryAge(out_percent, std::addressof(device));
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryAge(out_percent, std::addressof(device)));
}
Result GetBatteryTemperature(float *out_c, Session &session) {
@@ -335,7 +335,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryTemperature(out_c, std::addressof(device));
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryTemperature(out_c, std::addressof(device)));
}
Result GetBatteryMaximumTemperature(float *out_c, Session &session) {
@@ -349,7 +349,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryMaximumTemperature(out_c, std::addressof(device));
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryMaximumTemperature(out_c, std::addressof(device)));
}
Result SetBatteryTemperatureMinimumAlertThreshold(Session &session, float c) {
@@ -363,7 +363,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryTemperatureMinimumAlertThreshold(std::addressof(device), c);
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryTemperatureMinimumAlertThreshold(std::addressof(device), c));
}
Result SetBatteryTemperatureMaximumAlertThreshold(Session &session, float c) {
@@ -377,7 +377,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryTemperatureMaximumAlertThreshold(std::addressof(device), c);
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryTemperatureMaximumAlertThreshold(std::addressof(device), c));
}
Result GetBatteryVCell(int *out_mv, Session &session) {
@@ -391,7 +391,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryVCell(out_mv, std::addressof(device));
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryVCell(out_mv, std::addressof(device)));
}
Result GetBatteryAverageVCell(int *out_mv, Session &session) {
@@ -405,7 +405,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryAverageVCell(out_mv, std::addressof(device));
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryAverageVCell(out_mv, std::addressof(device)));
}
Result GetBatteryAverageVCellTime(TimeSpan *out, Session &session) {
@@ -419,7 +419,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryAverageVCellTime(out, std::addressof(device));
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryAverageVCellTime(out, std::addressof(device)));
}
Result GetBatteryOpenCircuitVoltage(int *out_mv, Session &session) {
@@ -433,7 +433,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryOpenCircuitVoltage(out_mv, std::addressof(device));
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryOpenCircuitVoltage(out_mv, std::addressof(device)));
}
Result SetBatteryVoltageMinimumAlertThreshold(Session &session, int mv) {
@@ -447,7 +447,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryVoltageMinimumAlertThreshold(std::addressof(device), mv);
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryVoltageMinimumAlertThreshold(std::addressof(device), mv));
}
Result SetBatteryVoltageMaximumAlertThreshold(Session &session, int mv) {
@@ -461,7 +461,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryVoltageMaximumAlertThreshold(std::addressof(device), mv);
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryVoltageMaximumAlertThreshold(std::addressof(device), mv));
}
}