From 8944ca830f02606163fc1afb875f3edf69bc8a66 Mon Sep 17 00:00:00 2001
From: Pankaj Raghav
Date: Wed, 12 Apr 2023 22:55:20 +0200
Subject: [PATCH] Kernel: Remove is_sharing_with_others API from
GenericInterruptHandler
is_sharing_with_others API was never really put to use properly since
it was introduced. The only place where it is used in Interrupts.cpp is
in conjuction with is_shared_handler() which is only true for
SharedIRQHandler and is_sharing_with_others will always return false.
Remove that API.
---
Kernel/Arch/x86_64/Interrupts.cpp | 4 ++--
Kernel/Arch/x86_64/Interrupts/APIC.cpp | 2 --
Kernel/Interrupts/GenericInterruptHandler.h | 1 -
Kernel/Interrupts/IRQHandler.h | 1 -
Kernel/Interrupts/SharedIRQHandler.h | 1 -
Kernel/Interrupts/SpuriousInterruptHandler.h | 1 -
Kernel/Interrupts/UnhandledInterruptHandler.h | 1 -
Kernel/Time/HardwareTimer.h | 1 -
8 files changed, 2 insertions(+), 10 deletions(-)
diff --git a/Kernel/Arch/x86_64/Interrupts.cpp b/Kernel/Arch/x86_64/Interrupts.cpp
index e316dfda43..b736da7036 100644
--- a/Kernel/Arch/x86_64/Interrupts.cpp
+++ b/Kernel/Arch/x86_64/Interrupts.cpp
@@ -361,7 +361,7 @@ void register_generic_interrupt_handler(u8 interrupt_number, GenericInterruptHan
handler_slot = &handler;
return;
}
- if (handler_slot->is_shared_handler() && !handler_slot->is_sharing_with_others()) {
+ if (handler_slot->is_shared_handler()) {
VERIFY(handler_slot->type() == HandlerType::SharedIRQHandler);
static_cast(handler_slot)->register_handler(handler);
return;
@@ -390,7 +390,7 @@ void unregister_generic_interrupt_handler(u8 interrupt_number, GenericInterruptH
VERIFY(handler_slot != nullptr);
if (handler_slot->type() == HandlerType::UnhandledInterruptHandler)
return;
- if (handler_slot->is_shared_handler() && !handler_slot->is_sharing_with_others()) {
+ if (handler_slot->is_shared_handler()) {
VERIFY(handler_slot->type() == HandlerType::SharedIRQHandler);
auto* shared_handler = static_cast(handler_slot);
shared_handler->unregister_handler(handler);
diff --git a/Kernel/Arch/x86_64/Interrupts/APIC.cpp b/Kernel/Arch/x86_64/Interrupts/APIC.cpp
index 5cb99a8259..9fe4101c3c 100644
--- a/Kernel/Arch/x86_64/Interrupts/APIC.cpp
+++ b/Kernel/Arch/x86_64/Interrupts/APIC.cpp
@@ -84,7 +84,6 @@ public:
virtual size_t sharing_devices_count() const override { return 0; }
virtual bool is_shared_handler() const override { return false; }
- virtual bool is_sharing_with_others() const override { return false; }
private:
};
@@ -115,7 +114,6 @@ public:
virtual size_t sharing_devices_count() const override { return 0; }
virtual bool is_shared_handler() const override { return false; }
- virtual bool is_sharing_with_others() const override { return false; }
private:
};
diff --git a/Kernel/Interrupts/GenericInterruptHandler.h b/Kernel/Interrupts/GenericInterruptHandler.h
index ea1f648313..a7000b7e45 100644
--- a/Kernel/Interrupts/GenericInterruptHandler.h
+++ b/Kernel/Interrupts/GenericInterruptHandler.h
@@ -41,7 +41,6 @@ public:
virtual size_t sharing_devices_count() const = 0;
virtual bool is_shared_handler() const = 0;
- virtual bool is_sharing_with_others() const = 0;
virtual HandlerType type() const = 0;
virtual StringView purpose() const = 0;
diff --git a/Kernel/Interrupts/IRQHandler.h b/Kernel/Interrupts/IRQHandler.h
index f21a524b42..9e800c18e9 100644
--- a/Kernel/Interrupts/IRQHandler.h
+++ b/Kernel/Interrupts/IRQHandler.h
@@ -31,7 +31,6 @@ public:
virtual size_t sharing_devices_count() const override { return 0; }
virtual bool is_shared_handler() const override { return false; }
- virtual bool is_sharing_with_others() const override { return m_shared_with_others; }
void set_shared_with_others(bool status) { m_shared_with_others = status; }
protected:
diff --git a/Kernel/Interrupts/SharedIRQHandler.h b/Kernel/Interrupts/SharedIRQHandler.h
index 85741e77d1..79b642c94e 100644
--- a/Kernel/Interrupts/SharedIRQHandler.h
+++ b/Kernel/Interrupts/SharedIRQHandler.h
@@ -33,7 +33,6 @@ public:
return m_handlers.with([](auto& list) { return list.size_slow(); });
}
virtual bool is_shared_handler() const override { return true; }
- virtual bool is_sharing_with_others() const override { return false; }
virtual HandlerType type() const override { return HandlerType::SharedIRQHandler; }
virtual StringView purpose() const override { return "Shared IRQ Handler"sv; }
diff --git a/Kernel/Interrupts/SpuriousInterruptHandler.h b/Kernel/Interrupts/SpuriousInterruptHandler.h
index 348fa7265b..00352bb3bf 100644
--- a/Kernel/Interrupts/SpuriousInterruptHandler.h
+++ b/Kernel/Interrupts/SpuriousInterruptHandler.h
@@ -28,7 +28,6 @@ public:
virtual size_t sharing_devices_count() const override { return 1; }
virtual bool is_shared_handler() const override { return false; }
- virtual bool is_sharing_with_others() const override { return false; }
virtual HandlerType type() const override { return HandlerType::SpuriousInterruptHandler; }
virtual StringView purpose() const override;
diff --git a/Kernel/Interrupts/UnhandledInterruptHandler.h b/Kernel/Interrupts/UnhandledInterruptHandler.h
index 134ea32ec4..ae41437207 100644
--- a/Kernel/Interrupts/UnhandledInterruptHandler.h
+++ b/Kernel/Interrupts/UnhandledInterruptHandler.h
@@ -25,7 +25,6 @@ public:
virtual size_t sharing_devices_count() const override { return 0; }
virtual bool is_shared_handler() const override { return false; }
- virtual bool is_sharing_with_others() const override { return false; }
private:
};
diff --git a/Kernel/Time/HardwareTimer.h b/Kernel/Time/HardwareTimer.h
index b46fd39c62..537b393488 100644
--- a/Kernel/Time/HardwareTimer.h
+++ b/Kernel/Time/HardwareTimer.h
@@ -133,7 +133,6 @@ public:
virtual size_t sharing_devices_count() const override { return 0; }
virtual bool is_shared_handler() const override { return false; }
- virtual bool is_sharing_with_others() const override { return false; }
virtual HandlerType type() const override { return HandlerType::IRQHandler; }
virtual StringView controller() const override { return {}; }
virtual bool eoi() override;