On Sun, May 10, 2026 at 07:17:53PM +0200, Marek Vasut wrote:

> 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]>
> ---
> Cc: "Christian Pötzsch" <[email protected]>
> Cc: Adam Lackorzynski <[email protected]>
> Cc: Bin Meng <[email protected]>
> Cc: Heinrich Schuchardt <[email protected]>
> Cc: Tom Rini <[email protected]>
> Cc: [email protected]
> ---
>  drivers/virtio/virtio-uclass.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/virtio/virtio-uclass.c b/drivers/virtio/virtio-uclass.c
> index c36e9e9b3a7..6e4a3d7a7c1 100644
> --- a/drivers/virtio/virtio-uclass.c
> +++ b/drivers/virtio/virtio-uclass.c
> @@ -400,7 +400,7 @@ UCLASS_DRIVER(virtio) = {
>       .per_device_auto        = sizeof(struct virtio_dev_priv),
>  };
>  
> -struct bootdev_ops virtio_bootdev_ops = {
> +static const struct bootdev_ops virtio_bootdev_ops = {
>  };
>  
>  static const struct udevice_id virtio_bootdev_ids[] = {

So, this shows off a problem that needs to be handled differently. In
boot/bootdev-uclass.c we can't have ops be null. And moving this to
static const leads to size growth due to the compiler no longer being
able to play some game that it used to do. I'll post a patch shortly
that reworks the function in boot/bootdev-uclass.c and then drops these
empty structs.

-- 
Tom

Attachment: signature.asc
Description: PGP signature

Reply via email to