diff --git a/libraries/libstratosphere/source/i2c/driver/board/nintendo_nx/impl/i2c_i_allocator.hpp b/libraries/libstratosphere/source/i2c/driver/board/nintendo_nx/impl/i2c_i_allocator.hpp index 44e18b9ca..202838e94 100644 --- a/libraries/libstratosphere/source/i2c/driver/board/nintendo_nx/impl/i2c_i_allocator.hpp +++ b/libraries/libstratosphere/source/i2c/driver/board/nintendo_nx/impl/i2c_i_allocator.hpp @@ -30,8 +30,16 @@ namespace ams::i2c::driver::board::nintendo_nx::impl { IAllocator(ams::MemoryResource *mr) : memory_resource(mr), list(), list_lock() { /* ... */ } ~IAllocator() { - /* TODO: Remove all entries, etc */ - AMS_ABORT("BusAccessorManager not destructible"); + std::scoped_lock lk(this->list_lock); + + /* Remove all entries. */ + auto it = this->list.begin(); + while (it != this->list.end()) { + T *obj = std::addressof(*it); + it = this->list.erase(it); + + this->memory_resource->Deallocate(obj, sizeof(T)); + } } template diff --git a/libraries/libstratosphere/source/powctl/impl/board/nintendo_nx/powctl_board_impl.cpp b/libraries/libstratosphere/source/powctl/impl/board/nintendo_nx/powctl_board_impl.cpp index 4c8114312..c22f7ed81 100644 --- a/libraries/libstratosphere/source/powctl/impl/board/nintendo_nx/powctl_board_impl.cpp +++ b/libraries/libstratosphere/source/powctl/impl/board/nintendo_nx/powctl_board_impl.cpp @@ -42,6 +42,22 @@ namespace ams::powctl::impl::board::nintendo_nx { powctl::impl::RegisterDriver(std::addressof(*g_battery_driver)); } + void FinalizeChargerDriver() { + /* Unregister the driver. */ + powctl::impl::UnregisterDriver(std::addressof(*g_charger_driver)); + + /* Destroy the battery driver. */ + g_charger_driver = std::nullopt; + } + + void FinalizeBatteryDriver() { + /* Unregister the driver. */ + powctl::impl::UnregisterDriver(std::addressof(*g_battery_driver)); + + /* Destroy the battery driver. */ + g_battery_driver = std::nullopt; + } + } void Initialize(bool use_event_handlers) { @@ -50,8 +66,8 @@ namespace ams::powctl::impl::board::nintendo_nx { } void Finalize() { - /* TODO */ - AMS_ABORT(); + FinalizeBatteryDriver(); + FinalizeChargerDriver(); } } \ No newline at end of file diff --git a/libraries/libstratosphere/source/powctl/impl/powctl_device_management.cpp b/libraries/libstratosphere/source/powctl/impl/powctl_device_management.cpp index cacfdd3dd..cb75f5337 100644 --- a/libraries/libstratosphere/source/powctl/impl/powctl_device_management.cpp +++ b/libraries/libstratosphere/source/powctl/impl/powctl_device_management.cpp @@ -85,8 +85,16 @@ namespace ams::powctl::impl { os::WaitThread(std::addressof(g_interrupt_thread)); os::DestroyThread(std::addressof(g_interrupt_thread)); - /* TODO: What else? */ - AMS_ABORT(); + /* Reset all device code entries. */ + GetDeviceCodeEntryManager().Reset(); + + /* Finalize all registered drivers. */ + for (auto &driver : GetDriverList()) { + driver.SafeCastTo().FinalizeDriver(); + } + + /* Finalize the interrupt handler manager. */ + GetInterruptHandlerManager().Finalize(); } void RegisterDriver(IPowerControlDriver *driver) { diff --git a/libraries/libstratosphere/source/powctl/powctl_battery_api.cpp b/libraries/libstratosphere/source/powctl/powctl_battery_api.cpp index 0be40c083..1b83d5939 100644 --- a/libraries/libstratosphere/source/powctl/powctl_battery_api.cpp +++ b/libraries/libstratosphere/source/powctl/powctl_battery_api.cpp @@ -35,7 +35,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -49,7 +49,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -63,7 +63,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -77,7 +77,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -91,7 +91,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Write)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Write), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -105,7 +105,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Write)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Write), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -119,7 +119,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Write)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Write), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -133,7 +133,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -147,7 +147,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -161,7 +161,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -175,7 +175,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Write)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Write), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -189,7 +189,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -203,7 +203,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Write)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Write), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -217,7 +217,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -231,7 +231,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Write)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Write), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -245,7 +245,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -259,7 +259,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -273,7 +273,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Write)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Write), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -287,7 +287,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -301,7 +301,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -315,7 +315,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -329,7 +329,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Write)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Write), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -343,7 +343,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Write)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Write), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -357,7 +357,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -371,7 +371,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -385,7 +385,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -399,7 +399,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -413,7 +413,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Write)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Write), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -427,7 +427,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Write)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Write), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); diff --git a/libraries/libstratosphere/source/powctl/powctl_charger_api.cpp b/libraries/libstratosphere/source/powctl/powctl_charger_api.cpp index 3553a5bc6..cce1746a5 100644 --- a/libraries/libstratosphere/source/powctl/powctl_charger_api.cpp +++ b/libraries/libstratosphere/source/powctl/powctl_charger_api.cpp @@ -35,7 +35,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -49,7 +49,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Write)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Write), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -63,7 +63,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -77,7 +77,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Write)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Write), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -91,7 +91,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -105,7 +105,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Write)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Write), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -119,7 +119,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Write)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Write), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -133,7 +133,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -147,7 +147,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Write)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Write), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -161,7 +161,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -175,7 +175,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Write)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Write), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -189,7 +189,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Write)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Write), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -203,7 +203,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Write)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Write), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -217,7 +217,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -231,7 +231,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -245,7 +245,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Write)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Write), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -259,7 +259,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Write)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Write), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -275,7 +275,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -289,7 +289,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Write)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Write), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -303,7 +303,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); @@ -317,7 +317,7 @@ namespace ams::powctl { auto &impl = GetOpenSessionImpl(session); /* Check the access mode. */ - R_TRY(impl.CheckAccess(ddsf::AccessMode_Write)); + R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Write), ddsf::ResultPermissionDenied()); /* Get the device. */ auto &device = impl.GetDevice().SafeCastTo(); diff --git a/stratosphere/boot/source/boot_display.cpp b/stratosphere/boot/source/boot_display.cpp index f6c72b96c..126b20d17 100644 --- a/stratosphere/boot/source/boot_display.cpp +++ b/stratosphere/boot/source/boot_display.cpp @@ -530,7 +530,7 @@ namespace ams::boot { if (g_lcd_vendor == 0x2050) { EnableBacklightForVendor2050ForHardwareTypeFive(0); } else { - pwm::driver::SetEnabled(g_lcd_backlight_session, true); + pwm::driver::SetEnabled(g_lcd_backlight_session, false); pwm::driver::CloseSession(g_lcd_backlight_session); }