Re: [PATCH 1/2] gpu: nova-core: add initial driver stub
From: Danilo Krummrich <dakr@kernel.org>
Date: 2025-02-01 12:08:46
Also in:
dri-devel, lkml, nouveau, rust-for-linux
From: Danilo Krummrich <dakr@kernel.org>
Date: 2025-02-01 12:08:46
Also in:
dri-devel, lkml, nouveau, rust-for-linux
On Sat, Feb 01, 2025 at 09:14:48AM +0100, Karol Herbst wrote:
On Fri, Jan 31, 2025 at 11:04 PM Danilo Krummrich [off-list ref] wrote:quoted
+impl pci::Driver for NovaCore { + type IdInfo = (); + const ID_TABLE: pci::IdTable<Self::IdInfo> = &PCI_TABLE; + + fn probe(pdev: &mut pci::Device, _info: &Self::IdInfo) -> Result<Pin<KBox<Self>>> { + dev_dbg!(pdev.as_ref(), "Probe Nova Core GPU driver.\n"); + + pdev.enable_device_mem()?; + pdev.set_master(); + + let bar = pdev.iomap_region_sized::<BAR0_SIZE>(0, c_str!("nova-core"))?;I'm curious about the c_str! macro here. Since rust 1.78 one can do c"nova-core" to get a &CStr, is this not available in the r4l project yet or other reasons why this can't be used?
The kernel is still using kernel::str::CStr instead of core::ffi::CStr.
Might make sense to clean it up kernel wide (outside this patch set) if it's guaranteed to be available.
Indeed, there's already an entry in the R4L issue tracker about this [1]. There's also a patch series [2] addressing it, but it seems that the series didn't get an update for quite a while. [1] https://github.com/Rust-for-Linux/linux/issues/1075 [2] https://lore.kernel.org/rust-for-linux/20240819153656.28807-2-vadorovsky@protonmail.com/ (local)