Zepp-Hanzj opened a new pull request, #19168: URL: https://github.com/apache/nuttx/pull/19168
## Summary Change the `reg` field type from `uint32_t` to `uintptr_t` in all clock provider structs and their `clk_register_*()` function prototypes. Update `clk_write()` / `clk_read()` inline helpers accordingly. Fixes #16896 (sub-item: `drivers/clk/clk.h` int-to-pointer cast warning). ## Changes **`drivers/clk/clk.h`** (2 functions): - `clk_write(uint32_t reg, ...)` → `clk_write(uintptr_t reg, ...)` - `clk_read(uint32_t reg)` → `clk_read(uintptr_t reg)` - Remove redundant `(uintptr_t)` cast in function bodies **`include/nuttx/clk/clk_provider.h`** (6 structs + 6 prototypes): - `uint32_t reg` → `uintptr_t reg` in: `clk_gate_s`, `clk_divider_s`, `clk_phase_s`, `clk_fractional_divider_s`, `clk_multiplier_s`, `clk_mux_s` - Matching change in all `clk_register_gate/divider/phase/fractional_divider/multiplier/mux()` prototypes ## Impact - **Build**: Fixes `-Wint-to-pointer-cast` warning on 64-bit targets (e.g. `sim`). GCC15 promotes this warning to an error. - **User**: No functional change on 32-bit embedded targets (`uintptr_t == uint32_t`). - **Hardware**: No change. - **Documentation**: No change. - **Security**: No change. - **Compatibility**: ABI-compatible on all 32-bit targets. On 64-bit targets the struct layout changes (field width 4→8 bytes) but the clock framework is not used on 64-bit hardware. ## Why `uintptr_t` The `reg` field holds a memory-mapped register address. Using `uintptr_t` is the semantically correct type for storing addresses in C. All callers pass address values, and the inline functions already cast through `(uintptr_t)` before dereferencing. ## Testing Verified with `sim:nsh` build (the primary 64-bit target that triggers the warning): ```bash ./tools/configure.sh sim:nsh make -j$(nproc) # Before: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] # After: clean build, no warnings from clk.h ``` Also verified ARM cross-compilation has no regression: ```bash ./tools/configure.sh stm32f4discovery:nsh make -j$(nproc) # clean build ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
