All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: gadget: tegra-xudc: Constify static structs
@ 2021-05-13 20:09 Rikard Falkeborn
  2021-05-14  7:22 ` Felipe Balbi
  0 siblings, 1 reply; 2+ messages in thread
From: Rikard Falkeborn @ 2021-05-13 20:09 UTC (permalink / raw)
  To: Felipe Balbi, Greg Kroah-Hartman
  Cc: Thierry Reding, Jonathan Hunter, linux-usb, linux-tegra,
	linux-kernel, Rikard Falkeborn

Constify a couple of ops-structs that are never modified, to let the
compiler put them in read-only memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
 drivers/usb/gadget/udc/tegra-xudc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/gadget/udc/tegra-xudc.c b/drivers/usb/gadget/udc/tegra-xudc.c
index 2319c9737c2b..66b19db4c6e6 100644
--- a/drivers/usb/gadget/udc/tegra-xudc.c
+++ b/drivers/usb/gadget/udc/tegra-xudc.c
@@ -1907,7 +1907,7 @@ static void tegra_xudc_ep_free_request(struct usb_ep *usb_ep,
 	kfree(req);
 }
 
-static struct usb_ep_ops tegra_xudc_ep_ops = {
+static const struct usb_ep_ops tegra_xudc_ep_ops = {
 	.enable = tegra_xudc_ep_enable,
 	.disable = tegra_xudc_ep_disable,
 	.alloc_request = tegra_xudc_ep_alloc_request,
@@ -1928,7 +1928,7 @@ static int tegra_xudc_ep0_disable(struct usb_ep *usb_ep)
 	return -EBUSY;
 }
 
-static struct usb_ep_ops tegra_xudc_ep0_ops = {
+static const struct usb_ep_ops tegra_xudc_ep0_ops = {
 	.enable = tegra_xudc_ep0_enable,
 	.disable = tegra_xudc_ep0_disable,
 	.alloc_request = tegra_xudc_ep_alloc_request,
@@ -2168,7 +2168,7 @@ static int tegra_xudc_set_selfpowered(struct usb_gadget *gadget, int is_on)
 	return 0;
 }
 
-static struct usb_gadget_ops tegra_xudc_gadget_ops = {
+static const struct usb_gadget_ops tegra_xudc_gadget_ops = {
 	.get_frame = tegra_xudc_gadget_get_frame,
 	.wakeup = tegra_xudc_gadget_wakeup,
 	.pullup = tegra_xudc_gadget_pullup,
-- 
2.31.1


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

* Re: [PATCH] usb: gadget: tegra-xudc: Constify static structs
  2021-05-13 20:09 [PATCH] usb: gadget: tegra-xudc: Constify static structs Rikard Falkeborn
@ 2021-05-14  7:22 ` Felipe Balbi
  0 siblings, 0 replies; 2+ messages in thread
From: Felipe Balbi @ 2021-05-14  7:22 UTC (permalink / raw)
  To: Rikard Falkeborn, Greg Kroah-Hartman
  Cc: Thierry Reding, Jonathan Hunter, linux-usb, linux-tegra,
	linux-kernel, Rikard Falkeborn

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

Rikard Falkeborn <rikard.falkeborn@gmail.com> writes:

> Constify a couple of ops-structs that are never modified, to let the
> compiler put them in read-only memory.
>
> Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>

Acked-by: Felipe Balbi <balbi@kernel.org>

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 511 bytes --]

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

end of thread, other threads:[~2021-05-14  7:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-13 20:09 [PATCH] usb: gadget: tegra-xudc: Constify static structs Rikard Falkeborn
2021-05-14  7:22 ` Felipe Balbi

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.