[PATCH 00/14] pinctrl: rockchip: fix editing const struct + constify rockchip_pin_ctrl

Jonas Karlman jonas at kwiboo.se
Wed Jan 29 15:20:19 CET 2025


Hi Quentin,

On 2025-01-29 13:42, Quentin Schulz wrote:
> While testing some WIP work done by Ilias Apalodimas on guaranteeing
> read-only memory areas truly are handled as read-only[1], my RK3588
> Tiger couldn't reach U-Boot CLI anymore because of the pinctrl driver
> modifying a const struct rockchip_pin_ctrl, triggering a CPU abort.
> 
> Instead of going the lazy way and unconstify it, let's fix the actual
> issue in play.
> 
> The member modified in the const is only ever used for setting a member
> from another struct (not const that one). However this other member is
> never read! Therefore we can simply afford to remove it which means the
> sole reader of the member in the const is now gone, thus making it
> possible to remove the member from the const struct as well.
> 
> This also means we should be able to constify the private data of the
> controller device for all Rockchip devices, instead of having those only
> for RK356x, RK3588 and RV1126. With the constify done on top of Ilias
> branch[1], my PX30 Ringneck, RK3399 Puma and RK3588 Tiger all reach
> U-Boot CLI. No further test (like booting into Linux userspace) was
> done.
> 
> [1] https://source.denx.de/u-boot/custodians/u-boot-tpm/-/tree/fix_memory_permissions
> 
> Signed-off-by: Quentin Schulz <quentin.schulz at cherry.de>
> ---
> Quentin Schulz (14):
>       pinctrl: rockchip: remove unused base_pin bank member
>       pinctrl: rockchip: remove unused nr_pins controller member

pin_base and nr_pins is used after my "rockchip: pinctrl: Add support
for pinmux status cmd" series [1].

The pin_base should probably be moved to udevice priv data or similar.
nr_pins can probably also be moved to udevice priv data or constify in
driver data.

Do you want me to re-work/re-store these fields in a different way once
I finally send a v3 of that series?

[1] https://patchwork.ozlabs.org/project/uboot/cover/20240802225705.2640999-1-jonas@kwiboo.se/

Regards,
Jonas

>       pinctrl: rockchip: constify rockchip_pin_ctrl for PX30
>       pinctrl: rockchip: constify rockchip_pin_ctrl for RK3036
>       pinctrl: rockchip: constify rockchip_pin_ctrl for RK3066
>       pinctrl: rockchip: constify rockchip_pin_ctrl for RK3128
>       pinctrl: rockchip: constify rockchip_pin_ctrl for RK3188
>       pinctrl: rockchip: constify rockchip_pin_ctrl for RK3228
>       pinctrl: rockchip: constify rockchip_pin_ctrl for RK3288
>       pinctrl: rockchip: constify rockchip_pin_ctrl for RK3308
>       pinctrl: rockchip: constify rockchip_pin_ctrl for RK3328
>       pinctrl: rockchip: constify rockchip_pin_ctrl for RK3368
>       pinctrl: rockchip: constify rockchip_pin_ctrl for RK3399
>       pinctrl: rockchip: constify rockchip_pin_ctrl for RV1108
> 
>  drivers/pinctrl/rockchip/pinctrl-px30.c          | 2 +-
>  drivers/pinctrl/rockchip/pinctrl-rk3036.c        | 2 +-
>  drivers/pinctrl/rockchip/pinctrl-rk3066.c        | 2 +-
>  drivers/pinctrl/rockchip/pinctrl-rk3128.c        | 2 +-
>  drivers/pinctrl/rockchip/pinctrl-rk3188.c        | 2 +-
>  drivers/pinctrl/rockchip/pinctrl-rk322x.c        | 2 +-
>  drivers/pinctrl/rockchip/pinctrl-rk3288.c        | 2 +-
>  drivers/pinctrl/rockchip/pinctrl-rk3308.c        | 2 +-
>  drivers/pinctrl/rockchip/pinctrl-rk3328.c        | 2 +-
>  drivers/pinctrl/rockchip/pinctrl-rk3368.c        | 2 +-
>  drivers/pinctrl/rockchip/pinctrl-rk3399.c        | 2 +-
>  drivers/pinctrl/rockchip/pinctrl-rk3568.c        | 1 -
>  drivers/pinctrl/rockchip/pinctrl-rk3588.c        | 1 -
>  drivers/pinctrl/rockchip/pinctrl-rockchip-core.c | 2 --
>  drivers/pinctrl/rockchip/pinctrl-rockchip.h      | 3 ---
>  drivers/pinctrl/rockchip/pinctrl-rv1108.c        | 2 +-
>  drivers/pinctrl/rockchip/pinctrl-rv1126.c        | 1 -
>  17 files changed, 12 insertions(+), 20 deletions(-)
> ---
> base-commit: a2b489b170f8382f746202c36616eaf2bc38fe86
> change-id: 20250129-rockchip-pinctrl-const-f4123019a584
> 
> Best regards,



More information about the U-Boot mailing list