Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

USB: gadget: fix up const issue with struct usb_function_instance

In struct usb_function, the struct usb_function_instance pointer
variable "fi" is listed as const, but it is written to in numerous
places, making the const marking of it a total lie. Fix this up by just
removing the const pointer attribute as this is modified in numerous
places.

Link: https://lore.kernel.org/r/2025052145-undress-puma-f7cf@gregkh
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

+2 -2
+1 -1
drivers/usb/gadget/function/f_mass_storage.h
··· 110 110 }; 111 111 112 112 static inline struct fsg_opts * 113 - fsg_opts_from_func_inst(const struct usb_function_instance *fi) 113 + fsg_opts_from_func_inst(struct usb_function_instance *fi) 114 114 { 115 115 return container_of(fi, struct fsg_opts, func_inst); 116 116 }
+1 -1
include/linux/usb/composite.h
··· 237 237 /* internals */ 238 238 struct list_head list; 239 239 DECLARE_BITMAP(endpoints, 32); 240 - const struct usb_function_instance *fi; 240 + struct usb_function_instance *fi; 241 241 242 242 unsigned int bind_deactivated:1; 243 243 };