From: Sebastian Reichel <sebastian.reichel@collabora.com>
To: Marek Vasut <marek.vasut+renesas@mailbox.org>
Cc: u-boot@lists.u-boot-project.org,
Fabrice Gasnier <fabrice.gasnier@foss.st.com>,
Lukasz Majewski <lukma@nabladev.com>,
Mattijs Korpershoek <mkorpershoek@kernel.org>,
Tom Rini <trini@konsulko.com>
Subject: Re: [PATCH] usb: Constify driver ops
Date: Tue, 17 Nov 2026 00:30:11 +0100 [thread overview]
Message-ID: <avuR5ZsHaidTXR2T@venus> (raw)
In-Reply-To: <20261116174446.3488393-1-marek.vasut+renesas@mailbox.org>
[-- 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 --]
next prev parent reply other threads:[~2026-11-16 23:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 17:44 [PATCH] usb: Constify driver ops Marek Vasut
2026-11-16 23:30 ` Sebastian Reichel [this message]
2026-11-17 15:43 ` Mattijs Korpershoek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=avuR5ZsHaidTXR2T@venus \
--to=sebastian.reichel@collabora.com \
--cc=fabrice.gasnier@foss.st.com \
--cc=lukma@nabladev.com \
--cc=marek.vasut+renesas@mailbox.org \
--cc=mkorpershoek@kernel.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.u-boot-project.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.