All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] virtio: Staticize and constify driver ops
@ 2026-05-10 17:17 Marek Vasut
  2026-05-11 13:07 ` Simon Glass
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Marek Vasut @ 2026-05-10 17:17 UTC (permalink / raw)
  To: u-boot
  Cc: Marek Vasut, Christian Pötzsch, Adam Lackorzynski, Bin Meng,
	Heinrich Schuchardt, Tom Rini

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 <marek.vasut+renesas@mailbox.org>
---
Cc: "Christian Pötzsch" <christian.poetzsch@kernkonzept.com>
Cc: Adam Lackorzynski <adam@l4re.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Tom Rini <trini@konsulko.com>
Cc: u-boot@lists.denx.de
---
 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[] = {
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] virtio: Staticize and constify driver ops
  2026-05-10 17:17 [PATCH] virtio: Staticize and constify driver ops Marek Vasut
@ 2026-05-11 13:07 ` Simon Glass
  2026-05-11 15:29 ` Kuan-Wei Chiu
  2026-05-18 22:50 ` Tom Rini
  2 siblings, 0 replies; 4+ messages in thread
From: Simon Glass @ 2026-05-11 13:07 UTC (permalink / raw)
  To: marek.vasut+renesas
  Cc: u-boot, Christian Pötzsch, Adam Lackorzynski, Bin Meng,
	Heinrich Schuchardt, Tom Rini

On 2026-05-10T17:17:53, Marek Vasut <marek.vasut+renesas@mailbox.org> wrote:
> virtio: 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 <marek.vasut+renesas@mailbox.org>
>
> drivers/virtio/virtio-uclass.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] virtio: Staticize and constify driver ops
  2026-05-10 17:17 [PATCH] virtio: Staticize and constify driver ops Marek Vasut
  2026-05-11 13:07 ` Simon Glass
@ 2026-05-11 15:29 ` Kuan-Wei Chiu
  2026-05-18 22:50 ` Tom Rini
  2 siblings, 0 replies; 4+ messages in thread
From: Kuan-Wei Chiu @ 2026-05-11 15:29 UTC (permalink / raw)
  To: Marek Vasut
  Cc: u-boot, Christian Pötzsch, Adam Lackorzynski, Bin Meng,
	Heinrich Schuchardt, Tom Rini

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 <marek.vasut+renesas@mailbox.org>

FWIW

Reviewed-by: Kuan-Wei Chiu <visitorckw@gmail.com>

Regards,
Kuan-Wei

> ---
> Cc: "Christian Pötzsch" <christian.poetzsch@kernkonzept.com>
> Cc: Adam Lackorzynski <adam@l4re.org>
> Cc: Bin Meng <bmeng.cn@gmail.com>
> Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
> Cc: Tom Rini <trini@konsulko.com>
> Cc: u-boot@lists.denx.de
> ---
>  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[] = {
> -- 
> 2.53.0
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] virtio: Staticize and constify driver ops
  2026-05-10 17:17 [PATCH] virtio: Staticize and constify driver ops Marek Vasut
  2026-05-11 13:07 ` Simon Glass
  2026-05-11 15:29 ` Kuan-Wei Chiu
@ 2026-05-18 22:50 ` Tom Rini
  2 siblings, 0 replies; 4+ messages in thread
From: Tom Rini @ 2026-05-18 22:50 UTC (permalink / raw)
  To: Marek Vasut
  Cc: u-boot, Christian Pötzsch, Adam Lackorzynski, Bin Meng,
	Heinrich Schuchardt

[-- Attachment #1: Type: text/plain, Size: 1525 bytes --]

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 <marek.vasut+renesas@mailbox.org>
> ---
> Cc: "Christian Pötzsch" <christian.poetzsch@kernkonzept.com>
> Cc: Adam Lackorzynski <adam@l4re.org>
> Cc: Bin Meng <bmeng.cn@gmail.com>
> Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
> Cc: Tom Rini <trini@konsulko.com>
> Cc: u-boot@lists.denx.de
> ---
>  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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-05-18 22:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-10 17:17 [PATCH] virtio: Staticize and constify driver ops Marek Vasut
2026-05-11 13:07 ` Simon Glass
2026-05-11 15:29 ` Kuan-Wei Chiu
2026-05-18 22:50 ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.