mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
drm/tyr: move clock cleanup into Clocks Drop impl
Currently Tyr disables its clocks from TyrDrmDeviceData::drop(), which causes them to be shut down before any other fields in TyrDrmDeviceData are dropped. This prevents us from using the clocks when dropping the other fields in TyrDrmDeviceData. In order to better control when the clocks are dropped, move this cleanup logic into a Drop implementation on the Clocks struct itself. Since it serves no further purpose, remove the PinnedDrop implementation for TyrDrmDeviceData. Also, while here, remove the #[pin_data] annotation from both the struct Clocks and struct Regulators since neither of these structs need this macro to create structurally pinned fields. Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com> Reviewed-by: Alice Ryhl <aliceryhl@google.com> Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com> Link: https://patch.msgid.link/20260428-fw-boot-prerequisites-v1-1-c69af9abe1af@collabora.com Signed-off-by: Alice Ryhl <aliceryhl@google.com>
This commit is contained in:
parent
11a63a5335
commit
6c82e66e5e
|
|
@ -52,7 +52,7 @@ pub(crate) struct TyrPlatformDriverData {
|
|||
_device: ARef<TyrDrmDevice>,
|
||||
}
|
||||
|
||||
#[pin_data(PinnedDrop)]
|
||||
#[pin_data]
|
||||
pub(crate) struct TyrDrmDeviceData {
|
||||
pub(crate) pdev: ARef<platform::Device>,
|
||||
|
||||
|
|
@ -157,17 +157,6 @@ impl PinnedDrop for TyrPlatformDriverData {
|
|||
fn drop(self: Pin<&mut Self>) {}
|
||||
}
|
||||
|
||||
#[pinned_drop]
|
||||
impl PinnedDrop for TyrDrmDeviceData {
|
||||
fn drop(self: Pin<&mut Self>) {
|
||||
// TODO: the type-state pattern for Clks will fix this.
|
||||
let clks = self.clks.lock();
|
||||
clks.core.disable_unprepare();
|
||||
clks.stacks.disable_unprepare();
|
||||
clks.coregroup.disable_unprepare();
|
||||
}
|
||||
}
|
||||
|
||||
// We need to retain the name "panthor" to achieve drop-in compatibility with
|
||||
// the C driver in the userspace stack.
|
||||
const INFO: drm::DriverInfo = drm::DriverInfo {
|
||||
|
|
@ -191,14 +180,20 @@ impl drm::Driver for TyrDrmDriver {
|
|||
}
|
||||
}
|
||||
|
||||
#[pin_data]
|
||||
struct Clocks {
|
||||
core: Clk,
|
||||
stacks: OptionalClk,
|
||||
coregroup: OptionalClk,
|
||||
}
|
||||
|
||||
#[pin_data]
|
||||
impl Drop for Clocks {
|
||||
fn drop(&mut self) {
|
||||
self.core.disable_unprepare();
|
||||
self.stacks.disable_unprepare();
|
||||
self.coregroup.disable_unprepare();
|
||||
}
|
||||
}
|
||||
|
||||
struct Regulators {
|
||||
_mali: Regulator<regulator::Enabled>,
|
||||
_sram: Regulator<regulator::Enabled>,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user