Skip to content

Commit 5c5368d

Browse files
committed
drm/asahi: fw.channels: Add static assertions for message sizes
Signed-off-by: Asahi Lina <lina@asahilina.net>
1 parent d1d0846 commit 5c5368d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/gpu/drm/asahi/fw/channels.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use super::types::*;
66
use crate::default_zeroed;
77
use core::sync::atomic::Ordering;
8+
use kernel::static_assert;
89

910
pub(crate) mod raw {
1011
use super::*;
@@ -215,6 +216,9 @@ pub(crate) enum DeviceControlMsg {
215216
Initialize(Pad<DEVICECONTROL_SZ::ver>), // Update RegionC
216217
}
217218

219+
#[versions(AGX)]
220+
static_assert!(core::mem::size_of::<DeviceControlMsg::ver>() == 4 + DEVICECONTROL_SZ::ver);
221+
218222
#[versions(AGX)]
219223
default_zeroed!(DeviceControlMsg::ver);
220224

@@ -256,6 +260,8 @@ pub(crate) enum EventMsg {
256260
}, // Max discriminant: 0x7
257261
}
258262

263+
static_assert!(core::mem::size_of::<EventMsg>() == 4 + EVENT_SZ);
264+
259265
pub(crate) const EVENT_MAX: u32 = 0x7;
260266

261267
#[derive(Copy, Clone)]
@@ -392,6 +398,9 @@ pub(crate) enum StatsMsg {
392398
}, // Max discriminant: 0xe
393399
}
394400

401+
#[versions(AGX)]
402+
static_assert!(core::mem::size_of::<StatsMsg::ver>() == 4 + STATS_SZ::ver);
403+
395404
#[versions(AGX)]
396405
pub(crate) const STATS_MAX: u32 = 0xe;
397406

0 commit comments

Comments
 (0)