From 4f90d0e43224cfb3aab21f76adce89da2b144bbb Mon Sep 17 00:00:00 2001 From: creatoy Date: Sun, 28 Jul 2024 00:37:20 +0800 Subject: [PATCH] Fix compile error and active github actions --- .github/workflows/dtoverlaycheck.yml | 2 +- .github/workflows/kernel-build.yml | 75 ++++++++++++++------------ drivers/i2c/busses/i2c_bcm2835_rust.rs | 6 +-- rust/kernel/clk_provider.rs | 10 ++-- 4 files changed, 50 insertions(+), 43 deletions(-) diff --git a/.github/workflows/dtoverlaycheck.yml b/.github/workflows/dtoverlaycheck.yml index 3d96814fe19f21..b0a59b234674d3 100644 --- a/.github/workflows/dtoverlaycheck.yml +++ b/.github/workflows/dtoverlaycheck.yml @@ -43,6 +43,6 @@ jobs: sudo make install cd ${{github.workspace}} pwd - make ARCH=arm KERNEL=kernel CROSS_COMPILE=arm-linux-gnueabihf- bcm2711_defconfig + make ARCH=arm KERNEL=kernel CROSS_COMPILE=arm-linux-gnueabihf- bcm2711_rust_defconfig make ARCH=arm KERNEL=kernel CROSS_COMPILE=arm-linux-gnueabihf- dtbs ${{env.UTILS_DIR}}/overlaycheck/overlaycheck diff --git a/.github/workflows/kernel-build.yml b/.github/workflows/kernel-build.yml index a7a581049ecec6..1da66ebe235e95 100644 --- a/.github/workflows/kernel-build.yml +++ b/.github/workflows/kernel-build.yml @@ -1,14 +1,14 @@ name: Pi kernel build tests on: - pull_request: - paths-ignore: - - '.github/**' - branches: [ "rpi-*" ] - push: - paths-ignore: - - '.github/**' - branches: [ "rpi-*" ] + # pull_request: + # paths-ignore: + # - '.github/**' + # branches: [ "rpi-*" ] + # push: + # paths-ignore: + # - '.github/**' + # branches: [ "rpi-*" ] workflow_dispatch: env: @@ -20,40 +20,45 @@ jobs: strategy: matrix: include: - - name: bcm2835 + - name: bcm2711_rust arch: arm - defconfig: bcm2835_defconfig - kernel: kernel + defconfig: bcm2711_rust_defconfig + kernel: kernel7l - - name: arm64 - arch: arm64 - defconfig: defconfig - kernel: kernel8 + # - name: bcm2835 + # arch: arm + # defconfig: bcm2835_defconfig + # kernel: kernel - - name: bcmrpi - arch: arm - defconfig: bcmrpi_defconfig - kernel: kernel + # - name: arm64 + # arch: arm64 + # defconfig: defconfig + # kernel: kernel8 - - name: bcm2709 - arch: arm - defconfig: bcm2709_defconfig - kernel: kernel7 + # - name: bcmrpi + # arch: arm + # defconfig: bcmrpi_defconfig + # kernel: kernel - - name: bcm2711 - arch: arm - defconfig: bcm2711_defconfig - kernel: kernel7l + # - name: bcm2709 + # arch: arm + # defconfig: bcm2709_defconfig + # kernel: kernel7 + + # - name: bcm2711 + # arch: arm + # defconfig: bcm2711_defconfig + # kernel: kernel7l - - name: bcm2711_arm64 - arch: arm64 - defconfig: bcm2711_defconfig - kernel: kernel8 + # - name: bcm2711_arm64 + # arch: arm64 + # defconfig: bcm2711_defconfig + # kernel: kernel8 - - name: bcm2712 - arch: arm64 - defconfig: bcm2712_defconfig - kernel: kernel_2712 + # - name: bcm2712 + # arch: arm64 + # defconfig: bcm2712_defconfig + # kernel: kernel_2712 steps: - name: Update install diff --git a/drivers/i2c/busses/i2c_bcm2835_rust.rs b/drivers/i2c/busses/i2c_bcm2835_rust.rs index 1e8781f8279a20..411f2a0c508a92 100644 --- a/drivers/i2c/busses/i2c_bcm2835_rust.rs +++ b/drivers/i2c/busses/i2c_bcm2835_rust.rs @@ -196,13 +196,13 @@ fn clk_bcm2835_i2c_set_rate(hw: &mut ClkHw, rate: u32, parent_rate: u32) -> Resu Ok(()) } -fn clk_bcm2835_i2c_round_rate(hw: &mut ClkHw, rate: u64, parent_rate: &mut u64) -> u64 { +fn clk_bcm2835_i2c_round_rate(hw: &mut ClkHw, rate: u32, parent_rate: &mut u32) -> u32 { let divider = clk_bcm2835_i2c_calc_divider(rate, *parent_rate).unwrap(); - *parent_rate.div_ceil(divider) + parent_rate.div_ceil(divider) } -fn clk_bcm2835_i2c_recalc_rate(hw: &mut ClkHw, parent_rate: u64) -> u64 { +fn clk_bcm2835_i2c_recalc_rate(hw: &mut ClkHw, parent_rate: u32) -> u32 { let div = to_clk_bcm2835_i2c(hw); let divider = bcm2835_i2c_readl(&mut div.i2c_dev, BCM2835_I2C_DIV); diff --git a/rust/kernel/clk_provider.rs b/rust/kernel/clk_provider.rs index 5dae216002d5bc..768c1e6b8fb445 100644 --- a/rust/kernel/clk_provider.rs +++ b/rust/kernel/clk_provider.rs @@ -7,6 +7,7 @@ use crate::{ bindings, error::{to_result, Result}, + str::CStr, types::Opaque, }; @@ -26,7 +27,7 @@ pub struct ClkDuty(bindings::clk_duty); /// # Invariants /// /// The pointer is valid. -pub struct ClkHw(bindings::clk_hw); +pub struct ClkHw(Opaque); impl ClkHw { /// Create ClkHw from raw ptr @@ -86,14 +87,15 @@ impl Drop for ClkHw { // unsafe fn devm_clk_hw_register() -> Result {} /// Represents `struct clk_ops` -pub struct ClkOps(bindings::clk_ops); +pub struct ClkOps(Opaque); // TODO: Create (new) from functions ptr impl ClkOps { // TODO! pub fn from_raw(ptr: *const bindings::clk_ops) -> Self { - let ptr = ptr.cast::(); - unsafe { &*ptr } + // let ptr = ptr.cast::(); + // unsafe { *ptr } + unimplemented!() } #[inline]