mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-31 06:48:22 -04:00
ams: globally prefer R_RETURN to return for ams::Result
This commit is contained in:
parent
dd78ede99f
commit
bbf22b4c60
325 changed files with 1955 additions and 1993 deletions
|
@ -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) {
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace ams::pwm::server {
|
|||
}
|
||||
|
||||
Result ManagerImpl::OpenSession(ams::sf::Out<ams::sf::SharedPointer<pwm::sf::IChannelSession>> out, pwm::ChannelName channel_name) {
|
||||
return this->OpenSession2(out, ConvertToDeviceCode(channel_name));
|
||||
R_RETURN(this->OpenSession2(out, ConvertToDeviceCode(channel_name)));
|
||||
}
|
||||
|
||||
Result ManagerImpl::OpenSession2(ams::sf::Out<ams::sf::SharedPointer<pwm::sf::IChannelSession>> out, DeviceCode device_code) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue