Hi Marek,

On 2026-05-07T22:07:14, Marek Vasut <[email protected]> wrote:
> misc: cros_ec: Staticize and constify driver ops
>
> Set the ops structure as static const. The structure is not accessible
> from outside of this driver and is not going to be modified at runtime.
>
> Signed-off-by: Marek Vasut <[email protected]>
> Acked-by: Quentin Schulz <[email protected]>
>
> drivers/misc/cros_ec_sandbox.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Simon Glass <[email protected]>

> diff --git a/drivers/misc/cros_ec_sandbox.c b/drivers/misc/cros_ec_sandbox.c
> @@ -726,7 +726,7 @@ int cros_ec_probe(struct udevice *dev)
>       return cros_ec_register(dev);
>  }
>
> -struct dm_cros_ec_ops cros_ec_ops = {
> +static const struct dm_cros_ec_ops cros_ec_ops = {
>       .packet = cros_ec_sandbox_packet,
>       .get_switches = cros_ec_sandbox_get_switches,
>  };

Only the sandbox driver is touched - you could do cros_ec_i2c.c,
cros_ec_lpc.c and cros_ec_spi.c as well if you like.

BTW dm_cros_ec_get_ops() in include/cros_ec.h casts the ops pointer
back to non-const!

Regards,
Simon

Reply via email to