drm/tyr: suppress unread field warnings
Subsystems (4)
PATCH v2 1/1 drm/tyr: suppress unread field warnings
Currently the rust compiler warns that certain fields in the TyrDriver are 'never read'. The fields are needed, but they are not read directly, they are only written into an 'impl PinInit' that is returned by probe.
When warnings are compiled as errors, these warnings prevent Tyr from building.
Suppress the warnings by adding underscores to the problematic variables. This allows Tyr to build again.
---
Changes in v2:
- Added better explanation to commit message
- Used underscores instead of lint attribute
- Link to v1: https://lore.kernel.org/rust-for-linux/[email protected]/
drivers/gpu/drm/tyr/driver.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/tyr/driver.rs +6 -6
@@ -34,7 +34,7 @@#[pin_data( PinnedDrop )] pub (crate )struct TyrDriver { - device:ARef <TyrDevice >, + _device:ARef <TyrDevice >, }#[pin_data( PinnedDrop )]
@@ -127,8 +127,8 @@ fn probe( coregroup: coregroup_clk, }), regulators <- new_mutex!(Regulators { - mali: mali_regulator, - sram: sram_regulator, + _mali: mali_regulator, + _sram: sram_regulator, }), gpu_info, });
@@ -136,7 +136,7 @@ fn probe(let tdev:ARef <TyrDevice > = drm::Device ::new (pdev.as_ref (), data)?; drm::driver::Registration ::new_foreign_owned (&tdev, pdev.as_ref (),0 )?; -let driver =TyrDriver { device: tdev }; +let driver =TyrDriver { _device: tdev };// We need this to be dev_info!() because dev_dbg!() does not work at // all in Rust for now, and we need to see whether probe succeeded.
@@ -193,6 +193,6 @@ struct Clocks {#[pin_data] struct Regulators { - mali:Regulator <regulator::Enabled >, - sram:Regulator <regulator::Enabled >, + _mali:Regulator <regulator::Enabled >, + _sram:Regulator <regulator::Enabled >, }
Signature · 1 line
2.52.0
Quoted 5 lines · Deborah Brouwer
Currently the rust compiler warns that certain fields in the TyrDriver are 'never read'. The fields are needed, but they are not read directly, they are only written into an 'impl PinInit' that is returned by probe.
Quoted 7 lines
When warnings are compiled as errors, these warnings prevent Tyr from building.
Suppress the warnings by adding underscores to the problematic variables. This allows Tyr to build again.
Signed-off-by Deborah Brouwer <[email protected]>
Applied to drm-rust-next. Thanks!
Quoted 5 lines · Deborah Brouwer
Currently the rust compiler warns that certain fields in the TyrDriver are 'never read'. The fields are needed, but they are not read directly, they are only written into an 'impl PinInit' that is returned by probe.
Quoted 7 lines
When warnings are compiled as errors, these warnings prevent Tyr from building.
Suppress the warnings by adding underscores to the problematic variables. This allows Tyr to build again.
Signed-off-by Deborah Brouwer <[email protected]>
In the future, please add the error message to the commit (it helps for matching it later).
Thanks!
Cheers,
Miguel