* [PATCH] usb: Constify driver ops
@ 2026-11-16 17:44 Marek Vasut
2026-11-16 23:30 ` Sebastian Reichel
2026-11-17 15:43 ` Mattijs Korpershoek
0 siblings, 2 replies; 3+ messages in thread
From: Marek Vasut @ 2026-11-16 17:44 UTC (permalink / raw)
To: u-boot
Cc: Marek Vasut, Fabrice Gasnier, Lukasz Majewski,
Mattijs Korpershoek, Sebastian Reichel, 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: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Cc: Lukasz Majewski <lukma@nabladev.com>
Cc: Mattijs Korpershoek <mkorpershoek@kernel.org>
Cc: Sebastian Reichel <sebastian.reichel@collabora.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: u-boot@lists.u-boot-project.org
---
drivers/usb/gadget/dwc2_udc_otg.c | 2 +-
drivers/usb/musb-new/am35x.c | 2 +-
drivers/usb/musb-new/musb_core.c | 2 +-
drivers/usb/musb-new/musb_dsps.c | 2 +-
drivers/usb/tcpm/fusb302.c | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/usb/gadget/dwc2_udc_otg.c b/drivers/usb/gadget/dwc2_udc_otg.c
index 4dc049d64b1..e680cf6c64b 100644
--- a/drivers/usb/gadget/dwc2_udc_otg.c
+++ b/drivers/usb/gadget/dwc2_udc_otg.c
@@ -136,7 +136,7 @@ void *get_udc_gadget_private_data(struct usb_gadget *gadget)
return gadget->dev.device_data;
}
-static struct usb_ep_ops dwc2_ep_ops = {
+static const struct usb_ep_ops dwc2_ep_ops = {
.enable = dwc2_ep_enable,
.disable = dwc2_ep_disable,
diff --git a/drivers/usb/musb-new/am35x.c b/drivers/usb/musb-new/am35x.c
index ca4d798642e..572abd2b50d 100644
--- a/drivers/usb/musb-new/am35x.c
+++ b/drivers/usb/musb-new/am35x.c
@@ -666,7 +666,7 @@ static int am35x_resume(struct device *dev)
return 0;
}
-static struct dev_pm_ops am35x_pm_ops = {
+static const struct dev_pm_ops am35x_pm_ops = {
.suspend = am35x_suspend,
.resume = am35x_resume,
};
diff --git a/drivers/usb/musb-new/musb_core.c b/drivers/usb/musb-new/musb_core.c
index 17ec0d3acbd..7856af42ba9 100644
--- a/drivers/usb/musb-new/musb_core.c
+++ b/drivers/usb/musb-new/musb_core.c
@@ -205,7 +205,7 @@ out:
return ret;
}
-static struct usb_phy_io_ops musb_ulpi_access = {
+static const struct usb_phy_io_ops musb_ulpi_access = {
.read = musb_ulpi_read,
.write = musb_ulpi_write,
};
diff --git a/drivers/usb/musb-new/musb_dsps.c b/drivers/usb/musb-new/musb_dsps.c
index b73f3531ce2..41d1d3db586 100644
--- a/drivers/usb/musb-new/musb_dsps.c
+++ b/drivers/usb/musb-new/musb_dsps.c
@@ -508,7 +508,7 @@ static int dsps_musb_exit(struct musb *musb)
}
#ifndef __UBOOT__
-static struct musb_platform_ops dsps_ops = {
+static const struct musb_platform_ops dsps_ops = {
#else
struct musb_platform_ops musb_dsps_ops = {
#endif
diff --git a/drivers/usb/tcpm/fusb302.c b/drivers/usb/tcpm/fusb302.c
index fe93ff3d339..b77fe0fa204 100644
--- a/drivers/usb/tcpm/fusb302.c
+++ b/drivers/usb/tcpm/fusb302.c
@@ -1293,7 +1293,7 @@ static int fusb302_get_connector_node(struct udevice *dev, ofnode *connector_nod
return 0;
}
-static struct dm_tcpm_ops fusb302_ops = {
+static const struct dm_tcpm_ops fusb302_ops = {
.get_connector_node = fusb302_get_connector_node,
.init = fusb302_init,
.get_vbus = fusb302_get_vbus,
--
2.53.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] usb: Constify driver ops
2026-11-16 17:44 [PATCH] usb: Constify driver ops Marek Vasut
@ 2026-11-16 23:30 ` Sebastian Reichel
2026-11-17 15:43 ` Mattijs Korpershoek
1 sibling, 0 replies; 3+ messages in thread
From: Sebastian Reichel @ 2026-11-16 23:30 UTC (permalink / raw)
To: Marek Vasut
Cc: u-boot, Fabrice Gasnier, Lukasz Majewski, Mattijs Korpershoek,
Tom Rini
[-- Attachment #1: Type: text/plain, Size: 3410 bytes --]
Hi,
On Mon, Nov 16, 2026 at 06:44:42PM +0100, 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: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
> Cc: Lukasz Majewski <lukma@nabladev.com>
> Cc: Mattijs Korpershoek <mkorpershoek@kernel.org>
> Cc: Sebastian Reichel <sebastian.reichel@collabora.com>
> Cc: Tom Rini <trini@konsulko.com>
> Cc: u-boot@lists.u-boot-project.org
> ---
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Greetings,
-- Sebastian
> drivers/usb/gadget/dwc2_udc_otg.c | 2 +-
> drivers/usb/musb-new/am35x.c | 2 +-
> drivers/usb/musb-new/musb_core.c | 2 +-
> drivers/usb/musb-new/musb_dsps.c | 2 +-
> drivers/usb/tcpm/fusb302.c | 2 +-
> 5 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/usb/gadget/dwc2_udc_otg.c b/drivers/usb/gadget/dwc2_udc_otg.c
> index 4dc049d64b1..e680cf6c64b 100644
> --- a/drivers/usb/gadget/dwc2_udc_otg.c
> +++ b/drivers/usb/gadget/dwc2_udc_otg.c
> @@ -136,7 +136,7 @@ void *get_udc_gadget_private_data(struct usb_gadget *gadget)
> return gadget->dev.device_data;
> }
>
> -static struct usb_ep_ops dwc2_ep_ops = {
> +static const struct usb_ep_ops dwc2_ep_ops = {
> .enable = dwc2_ep_enable,
> .disable = dwc2_ep_disable,
>
> diff --git a/drivers/usb/musb-new/am35x.c b/drivers/usb/musb-new/am35x.c
> index ca4d798642e..572abd2b50d 100644
> --- a/drivers/usb/musb-new/am35x.c
> +++ b/drivers/usb/musb-new/am35x.c
> @@ -666,7 +666,7 @@ static int am35x_resume(struct device *dev)
> return 0;
> }
>
> -static struct dev_pm_ops am35x_pm_ops = {
> +static const struct dev_pm_ops am35x_pm_ops = {
> .suspend = am35x_suspend,
> .resume = am35x_resume,
> };
> diff --git a/drivers/usb/musb-new/musb_core.c b/drivers/usb/musb-new/musb_core.c
> index 17ec0d3acbd..7856af42ba9 100644
> --- a/drivers/usb/musb-new/musb_core.c
> +++ b/drivers/usb/musb-new/musb_core.c
> @@ -205,7 +205,7 @@ out:
> return ret;
> }
>
> -static struct usb_phy_io_ops musb_ulpi_access = {
> +static const struct usb_phy_io_ops musb_ulpi_access = {
> .read = musb_ulpi_read,
> .write = musb_ulpi_write,
> };
> diff --git a/drivers/usb/musb-new/musb_dsps.c b/drivers/usb/musb-new/musb_dsps.c
> index b73f3531ce2..41d1d3db586 100644
> --- a/drivers/usb/musb-new/musb_dsps.c
> +++ b/drivers/usb/musb-new/musb_dsps.c
> @@ -508,7 +508,7 @@ static int dsps_musb_exit(struct musb *musb)
> }
>
> #ifndef __UBOOT__
> -static struct musb_platform_ops dsps_ops = {
> +static const struct musb_platform_ops dsps_ops = {
> #else
> struct musb_platform_ops musb_dsps_ops = {
> #endif
> diff --git a/drivers/usb/tcpm/fusb302.c b/drivers/usb/tcpm/fusb302.c
> index fe93ff3d339..b77fe0fa204 100644
> --- a/drivers/usb/tcpm/fusb302.c
> +++ b/drivers/usb/tcpm/fusb302.c
> @@ -1293,7 +1293,7 @@ static int fusb302_get_connector_node(struct udevice *dev, ofnode *connector_nod
> return 0;
> }
>
> -static struct dm_tcpm_ops fusb302_ops = {
> +static const struct dm_tcpm_ops fusb302_ops = {
> .get_connector_node = fusb302_get_connector_node,
> .init = fusb302_init,
> .get_vbus = fusb302_get_vbus,
> --
> 2.53.0
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] usb: Constify driver ops
2026-11-16 17:44 [PATCH] usb: Constify driver ops Marek Vasut
2026-11-16 23:30 ` Sebastian Reichel
@ 2026-11-17 15:43 ` Mattijs Korpershoek
1 sibling, 0 replies; 3+ messages in thread
From: Mattijs Korpershoek @ 2026-11-17 15:43 UTC (permalink / raw)
To: Marek Vasut, u-boot
Cc: Marek Vasut, Fabrice Gasnier, Lukasz Majewski, Sebastian Reichel,
Tom Rini
Hi Marek,
Thank you for the patch.
On Mon, Nov 16, 2026 at 18:44, Marek Vasut <marek.vasut+renesas@mailbox.org> 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>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-17 15:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-16 17:44 [PATCH] usb: Constify driver ops Marek Vasut
2026-11-16 23:30 ` Sebastian Reichel
2026-11-17 15:43 ` Mattijs Korpershoek
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.