On Fri, Apr 08, 2022 at 09:30:49PM +0200, Christian Weisgerber wrote:
> This constifies the bus method and pipe method tables in our USB
> host controller drivers.
>
> dwctwo(4) only exists on octeon, which I don't have access to.
> Could somebody check that it builds?
>
> ok?
dwctwo(4) also exists on arm64. I've tested your diff on my Raspberry
Pi 3 Model B+. The Kernel builds, and the USB subsystem still works
fine.
> diff b5489662588c813212f71c840fa931535322293d
> 4df278d953b03573222cb39b422e005d4701614e
> blob - 9b9d1635f902afef00a4111dfba8f86d13f74b4e
> blob + 531b5ce59fdf62019b590df2868d57cc88912f31
> --- sys/dev/usb/dwc2/dwc2.c
> +++ sys/dev/usb/dwc2/dwc2.c
> @@ -146,7 +146,7 @@ dwc2_free_bus_bandwidth(struct dwc2_hsotg *hsotg, u16
>
> #define DWC2_INTR_ENDPT 1
>
> -STATIC struct usbd_bus_methods dwc2_bus_methods = {
> +STATIC const struct usbd_bus_methods dwc2_bus_methods = {
> .open_pipe = dwc2_open,
> .dev_setaddr = dwc2_setaddr,
> .soft_intr = dwc2_softintr,
> @@ -155,7 +155,7 @@ STATIC struct usbd_bus_methods dwc2_bus_methods = {
> .freex = dwc2_freex,
> };
>
> -STATIC struct usbd_pipe_methods dwc2_root_ctrl_methods = {
> +STATIC const struct usbd_pipe_methods dwc2_root_ctrl_methods = {
> .transfer = dwc2_root_ctrl_transfer,
> .start = dwc2_root_ctrl_start,
> .abort = dwc2_root_ctrl_abort,
> @@ -164,7 +164,7 @@ STATIC struct usbd_pipe_methods dwc2_root_ctrl_methods
> .done = dwc2_root_ctrl_done,
> };
>
> -STATIC struct usbd_pipe_methods dwc2_root_intr_methods = {
> +STATIC const struct usbd_pipe_methods dwc2_root_intr_methods = {
> .transfer = dwc2_root_intr_transfer,
> .start = dwc2_root_intr_start,
> .abort = dwc2_root_intr_abort,
> @@ -173,7 +173,7 @@ STATIC struct usbd_pipe_methods dwc2_root_intr_methods
> .done = dwc2_root_intr_done,
> };
>
> -STATIC struct usbd_pipe_methods dwc2_device_ctrl_methods = {
> +STATIC const struct usbd_pipe_methods dwc2_device_ctrl_methods = {
> .transfer = dwc2_device_ctrl_transfer,
> .start = dwc2_device_ctrl_start,
> .abort = dwc2_device_ctrl_abort,
> @@ -182,7 +182,7 @@ STATIC struct usbd_pipe_methods dwc2_device_ctrl_metho
> .done = dwc2_device_ctrl_done,
> };
>
> -STATIC struct usbd_pipe_methods dwc2_device_intr_methods = {
> +STATIC const struct usbd_pipe_methods dwc2_device_intr_methods = {
> .transfer = dwc2_device_intr_transfer,
> .start = dwc2_device_intr_start,
> .abort = dwc2_device_intr_abort,
> @@ -191,7 +191,7 @@ STATIC struct usbd_pipe_methods dwc2_device_intr_metho
> .done = dwc2_device_intr_done,
> };
>
> -STATIC struct usbd_pipe_methods dwc2_device_bulk_methods = {
> +STATIC const struct usbd_pipe_methods dwc2_device_bulk_methods = {
> .transfer = dwc2_device_bulk_transfer,
> .start = dwc2_device_bulk_start,
> .abort = dwc2_device_bulk_abort,
> @@ -200,7 +200,7 @@ STATIC struct usbd_pipe_methods dwc2_device_bulk_metho
> .done = dwc2_device_bulk_done,
> };
>
> -STATIC struct usbd_pipe_methods dwc2_device_isoc_methods = {
> +STATIC const struct usbd_pipe_methods dwc2_device_isoc_methods = {
> .transfer = dwc2_device_isoc_transfer,
> .start = dwc2_device_isoc_start,
> .abort = dwc2_device_isoc_abort,
> blob - 350580c00b30f8edcfd5edf8ad8d1734624462c6
> blob + 77c170f164432f7df92fe7dcd64b5df9fd079dd9
> --- sys/dev/usb/ehci.c
> +++ sys/dev/usb/ehci.c
> @@ -218,7 +218,7 @@ void ehci_dump_exfer(struct ehci_xfer *);
>
> #define EHCI_INTR_ENDPT 1
>
> -struct usbd_bus_methods ehci_bus_methods = {
> +const struct usbd_bus_methods ehci_bus_methods = {
> .open_pipe = ehci_open,
> .dev_setaddr = ehci_setaddr,
> .soft_intr = ehci_softintr,
> @@ -227,7 +227,7 @@ struct usbd_bus_methods ehci_bus_methods = {
> .freex = ehci_freex,
> };
>
> -struct usbd_pipe_methods ehci_root_ctrl_methods = {
> +const struct usbd_pipe_methods ehci_root_ctrl_methods = {
> .transfer = ehci_root_ctrl_transfer,
> .start = ehci_root_ctrl_start,
> .abort = ehci_root_ctrl_abort,
> @@ -235,7 +235,7 @@ struct usbd_pipe_methods ehci_root_ctrl_methods = {
> .done = ehci_root_ctrl_done,
> };
>
> -struct usbd_pipe_methods ehci_root_intr_methods = {
> +const struct usbd_pipe_methods ehci_root_intr_methods = {
> .transfer = ehci_root_intr_transfer,
> .start = ehci_root_intr_start,
> .abort = ehci_root_intr_abort,
> @@ -243,7 +243,7 @@ struct usbd_pipe_methods ehci_root_intr_methods = {
> .done = ehci_root_intr_done,
> };
>
> -struct usbd_pipe_methods ehci_device_ctrl_methods = {
> +const struct usbd_pipe_methods ehci_device_ctrl_methods = {
> .transfer = ehci_device_ctrl_transfer,
> .start = ehci_device_ctrl_start,
> .abort = ehci_device_ctrl_abort,
> @@ -251,7 +251,7 @@ struct usbd_pipe_methods ehci_device_ctrl_methods = {
> .done = ehci_device_ctrl_done,
> };
>
> -struct usbd_pipe_methods ehci_device_intr_methods = {
> +const struct usbd_pipe_methods ehci_device_intr_methods = {
> .transfer = ehci_device_intr_transfer,
> .start = ehci_device_intr_start,
> .abort = ehci_device_intr_abort,
> @@ -260,7 +260,7 @@ struct usbd_pipe_methods ehci_device_intr_methods = {
> .done = ehci_device_intr_done,
> };
>
> -struct usbd_pipe_methods ehci_device_bulk_methods = {
> +const struct usbd_pipe_methods ehci_device_bulk_methods = {
> .transfer = ehci_device_bulk_transfer,
> .start = ehci_device_bulk_start,
> .abort = ehci_device_bulk_abort,
> @@ -269,7 +269,7 @@ struct usbd_pipe_methods ehci_device_bulk_methods = {
> .done = ehci_device_bulk_done,
> };
>
> -struct usbd_pipe_methods ehci_device_isoc_methods = {
> +const struct usbd_pipe_methods ehci_device_isoc_methods = {
> .transfer = ehci_device_isoc_transfer,
> .start = ehci_device_isoc_start,
> .abort = ehci_device_isoc_abort,
> blob - 041e8328e9a0cd0a644eb45e50bc6ed478656640
> blob + 6ee11369912ccba3e46dc7bdd76d2ba5254b2727
> --- sys/dev/usb/ohci.c
> +++ sys/dev/usb/ohci.c
> @@ -229,7 +229,7 @@ struct ohci_pipe {
>
> #define OHCI_INTR_ENDPT 1
>
> -struct usbd_bus_methods ohci_bus_methods = {
> +const struct usbd_bus_methods ohci_bus_methods = {
> .open_pipe = ohci_open,
> .dev_setaddr = ohci_setaddr,
> .soft_intr = ohci_softintr,
> @@ -238,7 +238,7 @@ struct usbd_bus_methods ohci_bus_methods = {
> .freex = ohci_freex,
> };
>
> -struct usbd_pipe_methods ohci_root_ctrl_methods = {
> +const struct usbd_pipe_methods ohci_root_ctrl_methods = {
> .transfer = ohci_root_ctrl_transfer,
> .start = ohci_root_ctrl_start,
> .abort = ohci_root_ctrl_abort,
> @@ -246,7 +246,7 @@ struct usbd_pipe_methods ohci_root_ctrl_methods = {
> .done = ohci_root_ctrl_done,
> };
>
> -struct usbd_pipe_methods ohci_root_intr_methods = {
> +const struct usbd_pipe_methods ohci_root_intr_methods = {
> .transfer = ohci_root_intr_transfer,
> .start = ohci_root_intr_start,
> .abort = ohci_root_intr_abort,
> @@ -254,7 +254,7 @@ struct usbd_pipe_methods ohci_root_intr_methods = {
> .done = ohci_root_intr_done,
> };
>
> -struct usbd_pipe_methods ohci_device_ctrl_methods = {
> +const struct usbd_pipe_methods ohci_device_ctrl_methods = {
> .transfer = ohci_device_ctrl_transfer,
> .start = ohci_device_ctrl_start,
> .abort = ohci_device_ctrl_abort,
> @@ -262,7 +262,7 @@ struct usbd_pipe_methods ohci_device_ctrl_methods = {
> .done = ohci_device_ctrl_done,
> };
>
> -struct usbd_pipe_methods ohci_device_intr_methods = {
> +const struct usbd_pipe_methods ohci_device_intr_methods = {
> .transfer = ohci_device_intr_transfer,
> .start = ohci_device_intr_start,
> .abort = ohci_device_intr_abort,
> @@ -271,7 +271,7 @@ struct usbd_pipe_methods ohci_device_intr_methods = {
> .done = ohci_device_intr_done,
> };
>
> -struct usbd_pipe_methods ohci_device_bulk_methods = {
> +const struct usbd_pipe_methods ohci_device_bulk_methods = {
> .transfer = ohci_device_bulk_transfer,
> .start = ohci_device_bulk_start,
> .abort = ohci_device_bulk_abort,
> @@ -280,7 +280,7 @@ struct usbd_pipe_methods ohci_device_bulk_methods = {
> .done = ohci_device_bulk_done,
> };
>
> -struct usbd_pipe_methods ohci_device_isoc_methods = {
> +const struct usbd_pipe_methods ohci_device_isoc_methods = {
> .transfer = ohci_device_isoc_transfer,
> .start = ohci_device_isoc_start,
> .abort = ohci_device_isoc_abort,
> blob - 51fed2c96833b7b67f045db0b2cd938b99e7bec7
> blob + 70f8bcf24fa614216013b38d39a56d4b072302dd
> --- sys/dev/usb/uhci.c
> +++ sys/dev/usb/uhci.c
> @@ -246,7 +246,7 @@ UREAD4(struct uhci_softc *sc, bus_size_t r)
>
> #define UHCI_INTR_ENDPT 1
>
> -struct usbd_bus_methods uhci_bus_methods = {
> +const struct usbd_bus_methods uhci_bus_methods = {
> .open_pipe = uhci_open,
> .dev_setaddr = usbd_set_address,
> .soft_intr = uhci_softintr,
> @@ -255,7 +255,7 @@ struct usbd_bus_methods uhci_bus_methods = {
> .freex = uhci_freex,
> };
>
> -struct usbd_pipe_methods uhci_root_ctrl_methods = {
> +const struct usbd_pipe_methods uhci_root_ctrl_methods = {
> .transfer = uhci_root_ctrl_transfer,
> .start = uhci_root_ctrl_start,
> .abort = uhci_root_ctrl_abort,
> @@ -263,7 +263,7 @@ struct usbd_pipe_methods uhci_root_ctrl_methods = {
> .done = uhci_root_ctrl_done,
> };
>
> -struct usbd_pipe_methods uhci_root_intr_methods = {
> +const struct usbd_pipe_methods uhci_root_intr_methods = {
> .transfer = uhci_root_intr_transfer,
> .start = uhci_root_intr_start,
> .abort = uhci_root_intr_abort,
> @@ -271,7 +271,7 @@ struct usbd_pipe_methods uhci_root_intr_methods = {
> .done = uhci_root_intr_done,
> };
>
> -struct usbd_pipe_methods uhci_device_ctrl_methods = {
> +const struct usbd_pipe_methods uhci_device_ctrl_methods = {
> .transfer = uhci_device_ctrl_transfer,
> .start = uhci_device_ctrl_start,
> .abort = uhci_device_ctrl_abort,
> @@ -279,7 +279,7 @@ struct usbd_pipe_methods uhci_device_ctrl_methods = {
> .done = uhci_device_ctrl_done,
> };
>
> -struct usbd_pipe_methods uhci_device_intr_methods = {
> +const struct usbd_pipe_methods uhci_device_intr_methods = {
> .transfer = uhci_device_intr_transfer,
> .start = uhci_device_intr_start,
> .abort = uhci_device_intr_abort,
> @@ -288,7 +288,7 @@ struct usbd_pipe_methods uhci_device_intr_methods = {
> .done = uhci_device_intr_done,
> };
>
> -struct usbd_pipe_methods uhci_device_bulk_methods = {
> +const struct usbd_pipe_methods uhci_device_bulk_methods = {
> .transfer = uhci_device_bulk_transfer,
> .start = uhci_device_bulk_start,
> .abort = uhci_device_bulk_abort,
> @@ -297,7 +297,7 @@ struct usbd_pipe_methods uhci_device_bulk_methods = {
> .done = uhci_device_bulk_done,
> };
>
> -struct usbd_pipe_methods uhci_device_isoc_methods = {
> +const struct usbd_pipe_methods uhci_device_isoc_methods = {
> .transfer = uhci_device_isoc_transfer,
> .start = uhci_device_isoc_start,
> .abort = uhci_device_isoc_abort,
> blob - 5aa207818f7c956e06d63eaef50ec6d582b68b4f
> blob + 7e197ff71c69bab5269d9cf91854b642be3692dd
> --- sys/dev/usb/usbdivar.h
> +++ sys/dev/usb/usbdivar.h
> @@ -105,7 +105,7 @@ struct usbd_hub {
> struct usbd_bus {
> /* Filled by HC driver */
> struct device bdev; /* base device, host adapter */
> - struct usbd_bus_methods *methods;
> + const struct usbd_bus_methods *methods;
> #if NBPFILTER > 0
> void *bpfif;
> caddr_t bpf;
> @@ -194,7 +194,7 @@ struct usbd_pipe {
> int interval;
>
> /* Filled by HC driver. */
> - struct usbd_pipe_methods *methods;
> + const struct usbd_pipe_methods *methods;
> };
>
> struct usbd_xfer {
> blob - 71958b064a11d366a1f462b4a30fc2e61bba10e6
> blob + 5135a3f656a03391d16e9f62c5d48b2aa1199a6d
> --- sys/dev/usb/xhci.c
> +++ sys/dev/usb/xhci.c
> @@ -157,7 +157,7 @@ usbd_status xhci_device_isoc_start(struct
> usbd_xfer
>
> #define XHCI_INTR_ENDPT 1
>
> -struct usbd_bus_methods xhci_bus_methods = {
> +const struct usbd_bus_methods xhci_bus_methods = {
> .open_pipe = xhci_pipe_open,
> .dev_setaddr = xhci_setaddr,
> .soft_intr = xhci_softintr,
> @@ -166,7 +166,7 @@ struct usbd_bus_methods xhci_bus_methods = {
> .freex = xhci_freex,
> };
>
> -struct usbd_pipe_methods xhci_root_ctrl_methods = {
> +const struct usbd_pipe_methods xhci_root_ctrl_methods = {
> .transfer = xhci_root_ctrl_transfer,
> .start = xhci_root_ctrl_start,
> .abort = xhci_noop,
> @@ -174,7 +174,7 @@ struct usbd_pipe_methods xhci_root_ctrl_methods = {
> .done = xhci_noop,
> };
>
> -struct usbd_pipe_methods xhci_root_intr_methods = {
> +const struct usbd_pipe_methods xhci_root_intr_methods = {
> .transfer = xhci_root_intr_transfer,
> .start = xhci_root_intr_start,
> .abort = xhci_root_intr_abort,
> @@ -182,7 +182,7 @@ struct usbd_pipe_methods xhci_root_intr_methods = {
> .done = xhci_root_intr_done,
> };
>
> -struct usbd_pipe_methods xhci_device_ctrl_methods = {
> +const struct usbd_pipe_methods xhci_device_ctrl_methods = {
> .transfer = xhci_device_ctrl_transfer,
> .start = xhci_device_ctrl_start,
> .abort = xhci_device_ctrl_abort,
> @@ -190,7 +190,7 @@ struct usbd_pipe_methods xhci_device_ctrl_methods = {
> .done = xhci_noop,
> };
>
> -struct usbd_pipe_methods xhci_device_intr_methods = {
> +const struct usbd_pipe_methods xhci_device_intr_methods = {
> .transfer = xhci_device_generic_transfer,
> .start = xhci_device_generic_start,
> .abort = xhci_device_generic_abort,
> @@ -198,7 +198,7 @@ struct usbd_pipe_methods xhci_device_intr_methods = {
> .done = xhci_device_generic_done,
> };
>
> -struct usbd_pipe_methods xhci_device_bulk_methods = {
> +const struct usbd_pipe_methods xhci_device_bulk_methods = {
> .transfer = xhci_device_generic_transfer,
> .start = xhci_device_generic_start,
> .abort = xhci_device_generic_abort,
> @@ -206,7 +206,7 @@ struct usbd_pipe_methods xhci_device_bulk_methods = {
> .done = xhci_device_generic_done,
> };
>
> -struct usbd_pipe_methods xhci_device_isoc_methods = {
> +const struct usbd_pipe_methods xhci_device_isoc_methods = {
> .transfer = xhci_device_isoc_transfer,
> .start = xhci_device_isoc_start,
> .abort = xhci_device_generic_abort,
>
> --
> Christian "naddy" Weisgerber [email protected]
>
--
[ -- Marcus Glocker, [email protected], https://nazgul.ch ------------- ]