1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:07:35 +00:00

Kernel: Remove AK::String usage from Storage/IDEChannel.cpp

This commit is contained in:
Brian Gianforcaro 2021-10-02 15:08:15 -07:00 committed by Andreas Kling
parent 4302e7ac26
commit 7f88d5058e
2 changed files with 9 additions and 9 deletions

View file

@ -284,21 +284,21 @@ bool IDEChannel::wait_until_not_busy(size_t milliseconds_timeout)
return time_elapsed <= milliseconds_timeout; return time_elapsed <= milliseconds_timeout;
} }
String IDEChannel::channel_type_string() const StringView IDEChannel::channel_type_string() const
{ {
if (m_channel_type == ChannelType::Primary) if (m_channel_type == ChannelType::Primary)
return "Primary"; return "Primary"sv;
return "Secondary"; return "Secondary"sv;
} }
UNMAP_AFTER_INIT void IDEChannel::detect_disks() UNMAP_AFTER_INIT void IDEChannel::detect_disks()
{ {
auto channel_string = [](u8 i) -> const char* { auto channel_string = [](u8 i) -> StringView {
if (i == 0) if (i == 0)
return "master"; return "master"sv;
return "slave"; return "slave"sv;
}; };
// There are only two possible disks connected to a channel // There are only two possible disks connected to a channel
@ -310,7 +310,7 @@ UNMAP_AFTER_INIT void IDEChannel::detect_disks()
auto status = m_io_group.control_base().in<u8>(); auto status = m_io_group.control_base().in<u8>();
if (status == 0x0) { if (status == 0x0) {
dbgln_if(PATA_DEBUG, "IDEChannel: No {} {} disk detected!", channel_type_string().to_lowercase(), channel_string(i)); dbgln_if(PATA_DEBUG, "IDEChannel: No {} {} disk detected!", channel_type_string(), channel_string(i));
continue; continue;
} }
@ -322,7 +322,7 @@ UNMAP_AFTER_INIT void IDEChannel::detect_disks()
// Wait 10 second for the BSY flag to clear // Wait 10 second for the BSY flag to clear
if (!wait_until_not_busy(2000)) { if (!wait_until_not_busy(2000)) {
dbgln_if(PATA_DEBUG, "IDEChannel: No {} {} disk detected, BSY flag was not reset!", channel_type_string().to_lowercase(), channel_string(i)); dbgln_if(PATA_DEBUG, "IDEChannel: No {} {} disk detected, BSY flag was not reset!", channel_type_string(), channel_string(i));
continue; continue;
} }

View file

@ -130,7 +130,7 @@ protected:
virtual void ata_write_sectors(bool, u16); virtual void ata_write_sectors(bool, u16);
void detect_disks(); void detect_disks();
String channel_type_string() const; StringView channel_type_string() const;
void try_disambiguate_error(); void try_disambiguate_error();
bool wait_until_not_busy(bool slave, size_t milliseconds_timeout); bool wait_until_not_busy(bool slave, size_t milliseconds_timeout);