ams: use R_SUCCEED, R_THROW globally

This commit is contained in:
Michael Scire 2022-03-26 00:14:36 -07:00
parent e5b1739f65
commit dd78ede99f
370 changed files with 2107 additions and 2107 deletions

View file

@ -60,7 +60,7 @@ namespace ams::pwm::driver::board::nintendo::nx::impl {
R_ABORT_UNLESS(pwm::driver::RegisterDeviceCode(entry.device_code, device));
}
return ResultSuccess();
R_SUCCEED();
}
}

View file

@ -81,7 +81,7 @@ namespace ams::pwm::driver::board::nintendo::nx::impl {
this->SetEnabled(device, false);
this->SetDuty(device, 0);
this->SetPeriod(device, DefaultChannelPeriod);
return ResultSuccess();
R_SUCCEED();
}
void PwmDriverImpl::FinalizeDevice(IPwmDevice *device) {
@ -113,7 +113,7 @@ namespace ams::pwm::driver::board::nintendo::nx::impl {
/* Update the period. */
reg::ReadWrite(this->GetRegistersFor(device) + PWM_CONTROLLER_PWM_CSR, PWM_REG_BITS_VALUE(PWM_CSR_PFM, pfm));
return ResultSuccess();
R_SUCCEED();
}
Result PwmDriverImpl::GetPeriod(TimeSpan *out, IPwmDevice *device) {
@ -133,7 +133,7 @@ namespace ams::pwm::driver::board::nintendo::nx::impl {
/* Set the output. */
*out = TimeSpan::FromNanoSeconds(ns);
return ResultSuccess();
R_SUCCEED();
}
Result PwmDriverImpl::SetDuty(IPwmDevice *device, int duty) {
@ -149,7 +149,7 @@ namespace ams::pwm::driver::board::nintendo::nx::impl {
/* Update the duty. */
reg::ReadWrite(this->GetRegistersFor(device) + PWM_CONTROLLER_PWM_CSR, PWM_REG_BITS_VALUE(PWM_CSR_PWM, static_cast<u32>(duty)));
return ResultSuccess();
R_SUCCEED();
}
Result PwmDriverImpl::GetDuty(int *out, IPwmDevice *device) {
@ -159,7 +159,7 @@ namespace ams::pwm::driver::board::nintendo::nx::impl {
/* Get the duty. */
*out = static_cast<int>(reg::GetValue(this->GetRegistersFor(device) + PWM_CONTROLLER_PWM_CSR, PWM_REG_BITS_MASK(PWM_CSR_PWM)));
return ResultSuccess();
R_SUCCEED();
}
Result PwmDriverImpl::SetScale(IPwmDevice *device, double scale) {
@ -183,7 +183,7 @@ namespace ams::pwm::driver::board::nintendo::nx::impl {
/* Convert to scale. */
*out = (static_cast<double>(duty) * 100.0) / 256.0;
return ResultSuccess();
R_SUCCEED();
}
Result PwmDriverImpl::SetEnabled(IPwmDevice *device, bool en) {
@ -196,7 +196,7 @@ namespace ams::pwm::driver::board::nintendo::nx::impl {
/* Update the enable. */
reg::ReadWrite(this->GetRegistersFor(device) + PWM_CONTROLLER_PWM_CSR, PWM_REG_BITS_ENUM_SEL(PWM_CSR_ENB, en, ENABLE, DISABLE));
return ResultSuccess();
R_SUCCEED();
}
Result PwmDriverImpl::GetEnabled(bool *out, IPwmDevice *device) {
@ -206,7 +206,7 @@ namespace ams::pwm::driver::board::nintendo::nx::impl {
/* Get the enable. */
*out = reg::HasValue(this->GetRegistersFor(device) + PWM_CONTROLLER_PWM_CSR, PWM_REG_BITS_ENUM(PWM_CSR_ENB, ENABLE));
return ResultSuccess();
R_SUCCEED();
}
Result PwmDriverImpl::Suspend() {

View file

@ -36,7 +36,7 @@ namespace ams::pwm::driver::impl {
/* We're opened. */
guard.Cancel();
return ResultSuccess();
R_SUCCEED();
}
void ChannelSessionImpl::Close() {

View file

@ -79,7 +79,7 @@ namespace ams::pwm::driver::impl {
Result RegisterDeviceCode(DeviceCode device_code, IPwmDevice *device) {
AMS_ASSERT(device != nullptr);
R_TRY(GetDeviceCodeEntryManager().Add(device_code, device));
return ResultSuccess();
R_SUCCEED();
}
bool UnregisterDeviceCode(DeviceCode device_code) {
@ -96,7 +96,7 @@ namespace ams::pwm::driver::impl {
/* Set output. */
*out = device->SafeCastToPointer<IPwmDevice>();
return ResultSuccess();
R_SUCCEED();
}
Result FindDeviceByChannelIndex(IPwmDevice **out, int channel) {
@ -121,7 +121,7 @@ namespace ams::pwm::driver::impl {
/* Check that we found the pad. */
R_UNLESS(found, ddsf::ResultDeviceCodeNotFound());
return ResultSuccess();
R_SUCCEED();
}
}

View file

@ -32,7 +32,7 @@ namespace ams::pwm::driver {
/* We succeeded. */
session_guard.Cancel();
return ResultSuccess();
R_SUCCEED();
}
}
@ -48,7 +48,7 @@ namespace ams::pwm::driver {
/* Open the session. */
R_TRY(OpenSessionImpl(out, device));
return ResultSuccess();
R_SUCCEED();
}
void CloseSession(ChannelSession &session) {

View file

@ -65,7 +65,7 @@ namespace ams::pwm {
out->_session = session.Detach();
/* We succeeded. */
return ResultSuccess();
R_SUCCEED();
}
void CloseSession(ChannelSession &session) {

View file

@ -39,48 +39,48 @@ namespace ams::pwm::server {
R_TRY(pwm::driver::OpenSession(std::addressof(m_internal_session), device_code));
m_has_session = true;
return ResultSuccess();
R_SUCCEED();
}
public:
/* Actual commands. */
Result SetPeriod(TimeSpanType period) {
pwm::driver::SetPeriod(m_internal_session, period);
return ResultSuccess();
R_SUCCEED();
}
Result GetPeriod(ams::sf::Out<TimeSpanType> out) {
out.SetValue(pwm::driver::GetPeriod(m_internal_session));
return ResultSuccess();
R_SUCCEED();
}
Result SetDuty(int duty) {
pwm::driver::SetDuty(m_internal_session, duty);
return ResultSuccess();
R_SUCCEED();
}
Result GetDuty(ams::sf::Out<int> out) {
out.SetValue(pwm::driver::GetDuty(m_internal_session));
return ResultSuccess();
R_SUCCEED();
}
Result SetEnabled(bool enabled) {
pwm::driver::SetEnabled(m_internal_session, enabled);
return ResultSuccess();
R_SUCCEED();
}
Result GetEnabled(ams::sf::Out<bool> out) {
out.SetValue(pwm::driver::GetEnabled(m_internal_session));
return ResultSuccess();
R_SUCCEED();
}
Result SetScale(double scale) {
pwm::driver::SetScale(m_internal_session, scale);
return ResultSuccess();
R_SUCCEED();
}
Result GetScale(ams::sf::Out<double> out) {
out.SetValue(pwm::driver::GetScale(m_internal_session));
return ResultSuccess();
R_SUCCEED();
}
};
static_assert(pwm::sf::IsIChannelSession<ChannelSessionImpl>);

View file

@ -46,7 +46,7 @@ namespace ams::pwm::server {
/* We succeeded. */
*out = std::move(session);
return ResultSuccess();
R_SUCCEED();
}
}