ams: globally prefer R_RETURN to return for ams::Result
This commit is contained in:
@@ -170,7 +170,7 @@ namespace ams::pwm::driver::board::nintendo::nx::impl {
|
||||
const int duty = static_cast<int>(((scale * 256.0) / 100.0) + 0.5);
|
||||
|
||||
/* Set the duty. */
|
||||
return this->SetDuty(device, duty);
|
||||
R_RETURN(this->SetDuty(device, duty));
|
||||
}
|
||||
|
||||
Result PwmDriverImpl::GetScale(double *out, IPwmDevice *device) {
|
||||
@@ -229,7 +229,7 @@ namespace ams::pwm::driver::board::nintendo::nx::impl {
|
||||
});
|
||||
|
||||
/* Disable clock to pwm. */
|
||||
return pcv::SetClockEnabled(pcv::Module_Pwm, false);
|
||||
R_RETURN(pcv::SetClockEnabled(pcv::Module_Pwm, false));
|
||||
}
|
||||
|
||||
void PwmDriverImpl::Resume() {
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace ams::pwm::driver::impl {
|
||||
IPwmDevice &device = this->GetDevice().SafeCastTo<IPwmDevice>();
|
||||
|
||||
/* Invoke the driver handler. */
|
||||
return device.GetDriver().SafeCastTo<IPwmDriver>().SetPeriod(std::addressof(device), period);
|
||||
R_RETURN(device.GetDriver().SafeCastTo<IPwmDriver>().SetPeriod(std::addressof(device), period));
|
||||
}
|
||||
|
||||
Result ChannelSessionImpl::GetPeriod(TimeSpan *out) {
|
||||
@@ -70,7 +70,7 @@ namespace ams::pwm::driver::impl {
|
||||
IPwmDevice &device = this->GetDevice().SafeCastTo<IPwmDevice>();
|
||||
|
||||
/* Invoke the driver handler. */
|
||||
return device.GetDriver().SafeCastTo<IPwmDriver>().GetPeriod(out, std::addressof(device));
|
||||
R_RETURN(device.GetDriver().SafeCastTo<IPwmDriver>().GetPeriod(out, std::addressof(device)));
|
||||
}
|
||||
|
||||
Result ChannelSessionImpl::SetDuty(int duty) {
|
||||
@@ -78,7 +78,7 @@ namespace ams::pwm::driver::impl {
|
||||
IPwmDevice &device = this->GetDevice().SafeCastTo<IPwmDevice>();
|
||||
|
||||
/* Invoke the driver handler. */
|
||||
return device.GetDriver().SafeCastTo<IPwmDriver>().SetDuty(std::addressof(device), duty);
|
||||
R_RETURN(device.GetDriver().SafeCastTo<IPwmDriver>().SetDuty(std::addressof(device), duty));
|
||||
}
|
||||
|
||||
Result ChannelSessionImpl::GetDuty(int *out) {
|
||||
@@ -86,7 +86,7 @@ namespace ams::pwm::driver::impl {
|
||||
IPwmDevice &device = this->GetDevice().SafeCastTo<IPwmDevice>();
|
||||
|
||||
/* Invoke the driver handler. */
|
||||
return device.GetDriver().SafeCastTo<IPwmDriver>().GetDuty(out, std::addressof(device));
|
||||
R_RETURN(device.GetDriver().SafeCastTo<IPwmDriver>().GetDuty(out, std::addressof(device)));
|
||||
}
|
||||
|
||||
Result ChannelSessionImpl::SetEnabled(bool en) {
|
||||
@@ -94,7 +94,7 @@ namespace ams::pwm::driver::impl {
|
||||
IPwmDevice &device = this->GetDevice().SafeCastTo<IPwmDevice>();
|
||||
|
||||
/* Invoke the driver handler. */
|
||||
return device.GetDriver().SafeCastTo<IPwmDriver>().SetEnabled(std::addressof(device), en);
|
||||
R_RETURN(device.GetDriver().SafeCastTo<IPwmDriver>().SetEnabled(std::addressof(device), en));
|
||||
}
|
||||
|
||||
Result ChannelSessionImpl::GetEnabled(bool *out) {
|
||||
@@ -102,7 +102,7 @@ namespace ams::pwm::driver::impl {
|
||||
IPwmDevice &device = this->GetDevice().SafeCastTo<IPwmDevice>();
|
||||
|
||||
/* Invoke the driver handler. */
|
||||
return device.GetDriver().SafeCastTo<IPwmDriver>().GetEnabled(out, std::addressof(device));
|
||||
R_RETURN(device.GetDriver().SafeCastTo<IPwmDriver>().GetEnabled(out, std::addressof(device)));
|
||||
}
|
||||
|
||||
Result ChannelSessionImpl::SetScale(double scale) {
|
||||
@@ -110,7 +110,7 @@ namespace ams::pwm::driver::impl {
|
||||
IPwmDevice &device = this->GetDevice().SafeCastTo<IPwmDevice>();
|
||||
|
||||
/* Invoke the driver handler. */
|
||||
return device.GetDriver().SafeCastTo<IPwmDriver>().SetScale(std::addressof(device), scale);
|
||||
R_RETURN(device.GetDriver().SafeCastTo<IPwmDriver>().SetScale(std::addressof(device), scale));
|
||||
}
|
||||
|
||||
Result ChannelSessionImpl::GetScale(double *out) {
|
||||
@@ -118,7 +118,7 @@ namespace ams::pwm::driver::impl {
|
||||
IPwmDevice &device = this->GetDevice().SafeCastTo<IPwmDevice>();
|
||||
|
||||
/* Invoke the driver handler. */
|
||||
return device.GetDriver().SafeCastTo<IPwmDriver>().GetScale(out, std::addressof(device));
|
||||
R_RETURN(device.GetDriver().SafeCastTo<IPwmDriver>().GetScale(out, std::addressof(device)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,14 +25,10 @@ namespace ams::pwm::driver {
|
||||
Result OpenSessionImpl(ChannelSession *out, IPwmDevice *device) {
|
||||
/* Construct the session. */
|
||||
auto *session = std::construct_at(std::addressof(impl::GetChannelSessionImpl(*out)));
|
||||
auto session_guard = SCOPE_GUARD { std::destroy_at(session); };
|
||||
ON_RESULT_FAILURE { std::destroy_at(session); };
|
||||
|
||||
/* Open the session. */
|
||||
R_TRY(session->Open(device, ddsf::AccessMode_ReadWrite));
|
||||
|
||||
/* We succeeded. */
|
||||
session_guard.Cancel();
|
||||
R_SUCCEED();
|
||||
R_RETURN(session->Open(device, ddsf::AccessMode_ReadWrite));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace ams::pwm::driver {
|
||||
}
|
||||
|
||||
Result RegisterDeviceCode(DeviceCode device_code, IPwmDevice *device) {
|
||||
return impl::RegisterDeviceCode(device_code, device);
|
||||
R_RETURN(impl::RegisterDeviceCode(device_code, device));
|
||||
}
|
||||
|
||||
bool UnregisterDeviceCode(DeviceCode device_code) {
|
||||
|
||||
Reference in New Issue
Block a user