Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Dec 2013 13:20:32 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r259218 - in head/sys/dev/usb: . controller template
Message-ID:  <201312111320.rBBDKWDw076917@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Wed Dec 11 13:20:32 2013
New Revision: 259218
URL: http://svnweb.freebsd.org/changeset/base/259218

Log:
  USB method structures for USB controllers and USB pipes should be
  constant and does not need to be modified. This also saves a small
  amount of RAM.

Modified:
  head/sys/dev/usb/controller/at91dci.c
  head/sys/dev/usb/controller/atmegadci.c
  head/sys/dev/usb/controller/avr32dci.c
  head/sys/dev/usb/controller/dwc_otg.c
  head/sys/dev/usb/controller/ehci.c
  head/sys/dev/usb/controller/musb_otg.c
  head/sys/dev/usb/controller/ohci.c
  head/sys/dev/usb/controller/uhci.c
  head/sys/dev/usb/controller/uss820dci.c
  head/sys/dev/usb/controller/xhci.c
  head/sys/dev/usb/template/usb_template.c
  head/sys/dev/usb/usb_bus.h
  head/sys/dev/usb/usb_device.c
  head/sys/dev/usb/usb_device.h
  head/sys/dev/usb/usb_hub.c
  head/sys/dev/usb/usb_transfer.c
  head/sys/dev/usb/usbdi.h

Modified: head/sys/dev/usb/controller/at91dci.c
==============================================================================
--- head/sys/dev/usb/controller/at91dci.c	Wed Dec 11 08:46:18 2013	(r259217)
+++ head/sys/dev/usb/controller/at91dci.c	Wed Dec 11 13:20:32 2013	(r259218)
@@ -103,11 +103,11 @@ SYSCTL_INT(_hw_usb_at91dci, OID_AUTO, de
 
 /* prototypes */
 
-struct usb_bus_methods at91dci_bus_methods;
-struct usb_pipe_methods at91dci_device_bulk_methods;
-struct usb_pipe_methods at91dci_device_ctrl_methods;
-struct usb_pipe_methods at91dci_device_intr_methods;
-struct usb_pipe_methods at91dci_device_isoc_fs_methods;
+static const struct usb_bus_methods at91dci_bus_methods;
+static const struct usb_pipe_methods at91dci_device_bulk_methods;
+static const struct usb_pipe_methods at91dci_device_ctrl_methods;
+static const struct usb_pipe_methods at91dci_device_intr_methods;
+static const struct usb_pipe_methods at91dci_device_isoc_fs_methods;
 
 static at91dci_cmd_t at91dci_setup_rx;
 static at91dci_cmd_t at91dci_data_rx;
@@ -1515,7 +1515,7 @@ at91dci_device_bulk_start(struct usb_xfe
 	at91dci_start_standard_chain(xfer);
 }
 
-struct usb_pipe_methods at91dci_device_bulk_methods =
+static const struct usb_pipe_methods at91dci_device_bulk_methods =
 {
 	.open = at91dci_device_bulk_open,
 	.close = at91dci_device_bulk_close,
@@ -1552,7 +1552,7 @@ at91dci_device_ctrl_start(struct usb_xfe
 	at91dci_start_standard_chain(xfer);
 }
 
-struct usb_pipe_methods at91dci_device_ctrl_methods =
+static const struct usb_pipe_methods at91dci_device_ctrl_methods =
 {
 	.open = at91dci_device_ctrl_open,
 	.close = at91dci_device_ctrl_close,
@@ -1589,7 +1589,7 @@ at91dci_device_intr_start(struct usb_xfe
 	at91dci_start_standard_chain(xfer);
 }
 
-struct usb_pipe_methods at91dci_device_intr_methods =
+static const struct usb_pipe_methods at91dci_device_intr_methods =
 {
 	.open = at91dci_device_intr_open,
 	.close = at91dci_device_intr_close,
@@ -1671,7 +1671,7 @@ at91dci_device_isoc_fs_start(struct usb_
 	at91dci_start_standard_chain(xfer);
 }
 
-struct usb_pipe_methods at91dci_device_isoc_fs_methods =
+static const struct usb_pipe_methods at91dci_device_isoc_fs_methods =
 {
 	.open = at91dci_device_isoc_fs_open,
 	.close = at91dci_device_isoc_fs_close,
@@ -2318,7 +2318,7 @@ at91dci_set_hw_power_sleep(struct usb_bu
 	}
 }
 
-struct usb_bus_methods at91dci_bus_methods =
+static const struct usb_bus_methods at91dci_bus_methods =
 {
 	.endpoint_init = &at91dci_ep_init,
 	.xfer_setup = &at91dci_xfer_setup,

Modified: head/sys/dev/usb/controller/atmegadci.c
==============================================================================
--- head/sys/dev/usb/controller/atmegadci.c	Wed Dec 11 08:46:18 2013	(r259217)
+++ head/sys/dev/usb/controller/atmegadci.c	Wed Dec 11 13:20:32 2013	(r259218)
@@ -96,9 +96,9 @@ SYSCTL_INT(_hw_usb_atmegadci, OID_AUTO, 
 
 /* prototypes */
 
-struct usb_bus_methods atmegadci_bus_methods;
-struct usb_pipe_methods atmegadci_device_non_isoc_methods;
-struct usb_pipe_methods atmegadci_device_isoc_fs_methods;
+static const struct usb_bus_methods atmegadci_bus_methods;
+static const struct usb_pipe_methods atmegadci_device_non_isoc_methods;
+static const struct usb_pipe_methods atmegadci_device_isoc_fs_methods;
 
 static atmegadci_cmd_t atmegadci_setup_rx;
 static atmegadci_cmd_t atmegadci_data_rx;
@@ -1410,7 +1410,7 @@ atmegadci_device_non_isoc_start(struct u
 	atmegadci_start_standard_chain(xfer);
 }
 
-struct usb_pipe_methods atmegadci_device_non_isoc_methods =
+static const struct usb_pipe_methods atmegadci_device_non_isoc_methods =
 {
 	.open = atmegadci_device_non_isoc_open,
 	.close = atmegadci_device_non_isoc_close,
@@ -1496,7 +1496,7 @@ atmegadci_device_isoc_fs_start(struct us
 	atmegadci_start_standard_chain(xfer);
 }
 
-struct usb_pipe_methods atmegadci_device_isoc_fs_methods =
+static const struct usb_pipe_methods atmegadci_device_isoc_fs_methods =
 {
 	.open = atmegadci_device_isoc_fs_open,
 	.close = atmegadci_device_isoc_fs_close,
@@ -2140,7 +2140,7 @@ atmegadci_set_hw_power_sleep(struct usb_
 	}
 }
 
-struct usb_bus_methods atmegadci_bus_methods =
+static const struct usb_bus_methods atmegadci_bus_methods =
 {
 	.endpoint_init = &atmegadci_ep_init,
 	.xfer_setup = &atmegadci_xfer_setup,

Modified: head/sys/dev/usb/controller/avr32dci.c
==============================================================================
--- head/sys/dev/usb/controller/avr32dci.c	Wed Dec 11 08:46:18 2013	(r259217)
+++ head/sys/dev/usb/controller/avr32dci.c	Wed Dec 11 13:20:32 2013	(r259218)
@@ -94,9 +94,9 @@ SYSCTL_INT(_hw_usb_avr32dci, OID_AUTO, d
 
 /* prototypes */
 
-struct usb_bus_methods avr32dci_bus_methods;
-struct usb_pipe_methods avr32dci_device_non_isoc_methods;
-struct usb_pipe_methods avr32dci_device_isoc_fs_methods;
+static const struct usb_bus_methods avr32dci_bus_methods;
+static const struct usb_pipe_methods avr32dci_device_non_isoc_methods;
+static const struct usb_pipe_methods avr32dci_device_isoc_fs_methods;
 
 static avr32dci_cmd_t avr32dci_setup_rx;
 static avr32dci_cmd_t avr32dci_data_rx;
@@ -1340,7 +1340,7 @@ avr32dci_device_non_isoc_start(struct us
 	avr32dci_start_standard_chain(xfer);
 }
 
-struct usb_pipe_methods avr32dci_device_non_isoc_methods =
+static const struct usb_pipe_methods avr32dci_device_non_isoc_methods =
 {
 	.open = avr32dci_device_non_isoc_open,
 	.close = avr32dci_device_non_isoc_close,
@@ -1425,7 +1425,7 @@ avr32dci_device_isoc_fs_start(struct usb
 	avr32dci_start_standard_chain(xfer);
 }
 
-struct usb_pipe_methods avr32dci_device_isoc_fs_methods =
+static const struct usb_pipe_methods avr32dci_device_isoc_fs_methods =
 {
 	.open = avr32dci_device_isoc_fs_open,
 	.close = avr32dci_device_isoc_fs_close,
@@ -2084,7 +2084,7 @@ avr32dci_set_hw_power_sleep(struct usb_b
 	}
 }
 
-struct usb_bus_methods avr32dci_bus_methods =
+static const struct usb_bus_methods avr32dci_bus_methods =
 {
 	.endpoint_init = &avr32dci_ep_init,
 	.xfer_setup = &avr32dci_xfer_setup,

Modified: head/sys/dev/usb/controller/dwc_otg.c
==============================================================================
--- head/sys/dev/usb/controller/dwc_otg.c	Wed Dec 11 08:46:18 2013	(r259217)
+++ head/sys/dev/usb/controller/dwc_otg.c	Wed Dec 11 13:20:32 2013	(r259218)
@@ -122,9 +122,9 @@ SYSCTL_INT(_hw_usb_dwc_otg, OID_AUTO, de
 
 /* prototypes */
 
-struct usb_bus_methods dwc_otg_bus_methods;
-struct usb_pipe_methods dwc_otg_device_non_isoc_methods;
-struct usb_pipe_methods dwc_otg_device_isoc_methods;
+static const struct usb_bus_methods dwc_otg_bus_methods;
+static const struct usb_pipe_methods dwc_otg_device_non_isoc_methods;
+static const struct usb_pipe_methods dwc_otg_device_isoc_methods;
 
 static dwc_otg_cmd_t dwc_otg_setup_rx;
 static dwc_otg_cmd_t dwc_otg_data_rx;
@@ -3327,7 +3327,7 @@ dwc_otg_device_non_isoc_start(struct usb
 	dwc_otg_start_standard_chain(xfer);
 }
 
-struct usb_pipe_methods dwc_otg_device_non_isoc_methods =
+static const struct usb_pipe_methods dwc_otg_device_non_isoc_methods =
 {
 	.open = dwc_otg_device_non_isoc_open,
 	.close = dwc_otg_device_non_isoc_close,
@@ -3422,7 +3422,7 @@ dwc_otg_device_isoc_start(struct usb_xfe
 	dwc_otg_start_standard_chain(xfer);
 }
 
-struct usb_pipe_methods dwc_otg_device_isoc_methods =
+static const struct usb_pipe_methods dwc_otg_device_isoc_methods =
 {
 	.open = dwc_otg_device_isoc_open,
 	.close = dwc_otg_device_isoc_close,
@@ -4201,7 +4201,7 @@ dwc_otg_device_suspend(struct usb_device
 	USB_BUS_UNLOCK(udev->bus);
 }
 
-struct usb_bus_methods dwc_otg_bus_methods =
+static const struct usb_bus_methods dwc_otg_bus_methods =
 {
 	.endpoint_init = &dwc_otg_ep_init,
 	.xfer_setup = &dwc_otg_xfer_setup,

Modified: head/sys/dev/usb/controller/ehci.c
==============================================================================
--- head/sys/dev/usb/controller/ehci.c	Wed Dec 11 08:46:18 2013	(r259217)
+++ head/sys/dev/usb/controller/ehci.c	Wed Dec 11 13:20:32 2013	(r259218)
@@ -119,12 +119,12 @@ static void ehci_dump_sqh(ehci_softc_t *
 
 #define	EHCI_INTR_ENDPT 1
 
-extern struct usb_bus_methods ehci_bus_methods;
-extern struct usb_pipe_methods ehci_device_bulk_methods;
-extern struct usb_pipe_methods ehci_device_ctrl_methods;
-extern struct usb_pipe_methods ehci_device_intr_methods;
-extern struct usb_pipe_methods ehci_device_isoc_fs_methods;
-extern struct usb_pipe_methods ehci_device_isoc_hs_methods;
+static const struct usb_bus_methods ehci_bus_methods;
+static const struct usb_pipe_methods ehci_device_bulk_methods;
+static const struct usb_pipe_methods ehci_device_ctrl_methods;
+static const struct usb_pipe_methods ehci_device_intr_methods;
+static const struct usb_pipe_methods ehci_device_isoc_fs_methods;
+static const struct usb_pipe_methods ehci_device_isoc_hs_methods;
 
 static void ehci_do_poll(struct usb_bus *);
 static void ehci_device_done(struct usb_xfer *, usb_error_t);
@@ -1275,7 +1275,7 @@ done:
 static uint8_t
 ehci_check_transfer(struct usb_xfer *xfer)
 {
-	struct usb_pipe_methods *methods = xfer->endpoint->methods;
+	const struct usb_pipe_methods *methods = xfer->endpoint->methods;
 	ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus);
 
 	uint32_t status;
@@ -1756,7 +1756,7 @@ static void
 ehci_setup_standard_chain(struct usb_xfer *xfer, ehci_qh_t **qh_last)
 {
 	struct ehci_std_temp temp;
-	struct usb_pipe_methods *methods;
+	const struct usb_pipe_methods *methods;
 	ehci_qh_t *qh;
 	ehci_qtd_t *td;
 	uint32_t qh_endp;
@@ -2164,7 +2164,7 @@ ehci_isoc_hs_done(ehci_softc_t *sc, stru
 static void
 ehci_device_done(struct usb_xfer *xfer, usb_error_t error)
 {
-	struct usb_pipe_methods *methods = xfer->endpoint->methods;
+	const struct usb_pipe_methods *methods = xfer->endpoint->methods;
 	ehci_softc_t *sc = EHCI_BUS2SC(xfer->xroot->bus);
 
 	USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED);
@@ -2258,7 +2258,7 @@ ehci_device_bulk_start(struct usb_xfer *
 		EOWRITE4(sc, EHCI_USBCMD, temp | EHCI_CMD_IAAD);
 }
 
-struct usb_pipe_methods ehci_device_bulk_methods =
+static const struct usb_pipe_methods ehci_device_bulk_methods =
 {
 	.open = ehci_device_bulk_open,
 	.close = ehci_device_bulk_close,
@@ -2299,7 +2299,7 @@ ehci_device_ctrl_start(struct usb_xfer *
 	ehci_transfer_intr_enqueue(xfer);
 }
 
-struct usb_pipe_methods ehci_device_ctrl_methods =
+static const struct usb_pipe_methods ehci_device_ctrl_methods =
 {
 	.open = ehci_device_ctrl_open,
 	.close = ehci_device_ctrl_close,
@@ -2380,7 +2380,7 @@ ehci_device_intr_start(struct usb_xfer *
 	ehci_transfer_intr_enqueue(xfer);
 }
 
-struct usb_pipe_methods ehci_device_intr_methods =
+static const struct usb_pipe_methods ehci_device_intr_methods =
 {
 	.open = ehci_device_intr_open,
 	.close = ehci_device_intr_close,
@@ -2672,7 +2672,7 @@ ehci_device_isoc_fs_start(struct usb_xfe
 	ehci_transfer_intr_enqueue(xfer);
 }
 
-struct usb_pipe_methods ehci_device_isoc_fs_methods =
+static const struct usb_pipe_methods ehci_device_isoc_fs_methods =
 {
 	.open = ehci_device_isoc_fs_open,
 	.close = ehci_device_isoc_fs_close,
@@ -2952,7 +2952,7 @@ ehci_device_isoc_hs_start(struct usb_xfe
 	ehci_transfer_intr_enqueue(xfer);
 }
 
-struct usb_pipe_methods ehci_device_isoc_hs_methods =
+static const struct usb_pipe_methods ehci_device_isoc_hs_methods =
 {
 	.open = ehci_device_isoc_hs_open,
 	.close = ehci_device_isoc_hs_close,
@@ -3759,7 +3759,7 @@ ehci_device_resume(struct usb_device *ud
 {
 	ehci_softc_t *sc = EHCI_BUS2SC(udev->bus);
 	struct usb_xfer *xfer;
-	struct usb_pipe_methods *methods;
+	const struct usb_pipe_methods *methods;
 
 	DPRINTF("\n");
 
@@ -3793,7 +3793,7 @@ ehci_device_suspend(struct usb_device *u
 {
 	ehci_softc_t *sc = EHCI_BUS2SC(udev->bus);
 	struct usb_xfer *xfer;
-	struct usb_pipe_methods *methods;
+	const struct usb_pipe_methods *methods;
 
 	DPRINTF("\n");
 
@@ -3872,7 +3872,7 @@ ehci_set_hw_power(struct usb_bus *bus)
 	return;
 }
 
-struct usb_bus_methods ehci_bus_methods =
+static const struct usb_bus_methods ehci_bus_methods =
 {
 	.endpoint_init = ehci_ep_init,
 	.xfer_setup = ehci_xfer_setup,

Modified: head/sys/dev/usb/controller/musb_otg.c
==============================================================================
--- head/sys/dev/usb/controller/musb_otg.c	Wed Dec 11 08:46:18 2013	(r259217)
+++ head/sys/dev/usb/controller/musb_otg.c	Wed Dec 11 13:20:32 2013	(r259218)
@@ -99,11 +99,11 @@ SYSCTL_INT(_hw_usb_musbotg, OID_AUTO, de
 
 /* prototypes */
 
-struct usb_bus_methods musbotg_bus_methods;
-struct usb_pipe_methods musbotg_device_bulk_methods;
-struct usb_pipe_methods musbotg_device_ctrl_methods;
-struct usb_pipe_methods musbotg_device_intr_methods;
-struct usb_pipe_methods musbotg_device_isoc_methods;
+static const struct usb_bus_methods musbotg_bus_methods;
+static const struct usb_pipe_methods musbotg_device_bulk_methods;
+static const struct usb_pipe_methods musbotg_device_ctrl_methods;
+static const struct usb_pipe_methods musbotg_device_intr_methods;
+static const struct usb_pipe_methods musbotg_device_isoc_methods;
 
 /* Control transfers: Device mode */
 static musbotg_cmd_t musbotg_dev_ctrl_setup_rx;
@@ -3335,7 +3335,7 @@ musbotg_device_bulk_start(struct usb_xfe
 	musbotg_start_standard_chain(xfer);
 }
 
-struct usb_pipe_methods musbotg_device_bulk_methods =
+static const struct usb_pipe_methods musbotg_device_bulk_methods =
 {
 	.open = musbotg_device_bulk_open,
 	.close = musbotg_device_bulk_close,
@@ -3372,7 +3372,7 @@ musbotg_device_ctrl_start(struct usb_xfe
 	musbotg_start_standard_chain(xfer);
 }
 
-struct usb_pipe_methods musbotg_device_ctrl_methods =
+static const struct usb_pipe_methods musbotg_device_ctrl_methods =
 {
 	.open = musbotg_device_ctrl_open,
 	.close = musbotg_device_ctrl_close,
@@ -3409,7 +3409,7 @@ musbotg_device_intr_start(struct usb_xfe
 	musbotg_start_standard_chain(xfer);
 }
 
-struct usb_pipe_methods musbotg_device_intr_methods =
+static const struct usb_pipe_methods musbotg_device_intr_methods =
 {
 	.open = musbotg_device_intr_open,
 	.close = musbotg_device_intr_close,
@@ -3498,7 +3498,7 @@ musbotg_device_isoc_start(struct usb_xfe
 	musbotg_start_standard_chain(xfer);
 }
 
-struct usb_pipe_methods musbotg_device_isoc_methods =
+static const struct usb_pipe_methods musbotg_device_isoc_methods =
 {
 	.open = musbotg_device_isoc_open,
 	.close = musbotg_device_isoc_close,
@@ -4218,7 +4218,7 @@ musbotg_set_hw_power_sleep(struct usb_bu
 	}
 }
 
-struct usb_bus_methods musbotg_bus_methods =
+static const struct usb_bus_methods musbotg_bus_methods =
 {
 	.endpoint_init = &musbotg_ep_init,
 	.get_dma_delay = &musbotg_get_dma_delay,

Modified: head/sys/dev/usb/controller/ohci.c
==============================================================================
--- head/sys/dev/usb/controller/ohci.c	Wed Dec 11 08:46:18 2013	(r259217)
+++ head/sys/dev/usb/controller/ohci.c	Wed Dec 11 13:20:32 2013	(r259218)
@@ -111,11 +111,11 @@ static void ohci_dump_itds(ohci_itd_t *)
 
 #define	OHCI_INTR_ENDPT 1
 
-extern struct usb_bus_methods ohci_bus_methods;
-extern struct usb_pipe_methods ohci_device_bulk_methods;
-extern struct usb_pipe_methods ohci_device_ctrl_methods;
-extern struct usb_pipe_methods ohci_device_intr_methods;
-extern struct usb_pipe_methods ohci_device_isoc_methods;
+static const struct usb_bus_methods ohci_bus_methods;
+static const struct usb_pipe_methods ohci_device_bulk_methods;
+static const struct usb_pipe_methods ohci_device_ctrl_methods;
+static const struct usb_pipe_methods ohci_device_intr_methods;
+static const struct usb_pipe_methods ohci_device_isoc_methods;
 
 static void ohci_do_poll(struct usb_bus *bus);
 static void ohci_device_done(struct usb_xfer *xfer, usb_error_t error);
@@ -1393,7 +1393,7 @@ static void
 ohci_setup_standard_chain(struct usb_xfer *xfer, ohci_ed_t **ed_last)
 {
 	struct ohci_std_temp temp;
-	struct usb_pipe_methods *methods;
+	const struct usb_pipe_methods *methods;
 	ohci_ed_t *ed;
 	ohci_td_t *td;
 	uint32_t ed_flags;
@@ -1632,7 +1632,7 @@ ohci_root_intr(ohci_softc_t *sc)
 static void
 ohci_device_done(struct usb_xfer *xfer, usb_error_t error)
 {
-	struct usb_pipe_methods *methods = xfer->endpoint->methods;
+	const struct usb_pipe_methods *methods = xfer->endpoint->methods;
 	ohci_softc_t *sc = OHCI_BUS2SC(xfer->xroot->bus);
 	ohci_ed_t *ed;
 
@@ -1698,7 +1698,7 @@ ohci_device_bulk_start(struct usb_xfer *
 	ohci_transfer_intr_enqueue(xfer);
 }
 
-struct usb_pipe_methods ohci_device_bulk_methods =
+static const struct usb_pipe_methods ohci_device_bulk_methods =
 {
 	.open = ohci_device_bulk_open,
 	.close = ohci_device_bulk_close,
@@ -1739,7 +1739,7 @@ ohci_device_ctrl_start(struct usb_xfer *
 	ohci_transfer_intr_enqueue(xfer);
 }
 
-struct usb_pipe_methods ohci_device_ctrl_methods =
+static const struct usb_pipe_methods ohci_device_ctrl_methods =
 {
 	.open = ohci_device_ctrl_open,
 	.close = ohci_device_ctrl_close,
@@ -1811,7 +1811,7 @@ ohci_device_intr_start(struct usb_xfer *
 	ohci_transfer_intr_enqueue(xfer);
 }
 
-struct usb_pipe_methods ohci_device_intr_methods =
+static const struct usb_pipe_methods ohci_device_intr_methods =
 {
 	.open = ohci_device_intr_open,
 	.close = ohci_device_intr_close,
@@ -2019,7 +2019,7 @@ ohci_device_isoc_start(struct usb_xfer *
 	ohci_transfer_intr_enqueue(xfer);
 }
 
-struct usb_pipe_methods ohci_device_isoc_methods =
+static const struct usb_pipe_methods ohci_device_isoc_methods =
 {
 	.open = ohci_device_isoc_open,
 	.close = ohci_device_isoc_close,
@@ -2598,7 +2598,7 @@ ohci_device_resume(struct usb_device *ud
 {
 	struct ohci_softc *sc = OHCI_BUS2SC(udev->bus);
 	struct usb_xfer *xfer;
-	struct usb_pipe_methods *methods;
+	const struct usb_pipe_methods *methods;
 	ohci_ed_t *ed;
 
 	DPRINTF("\n");
@@ -2636,7 +2636,7 @@ ohci_device_suspend(struct usb_device *u
 {
 	struct ohci_softc *sc = OHCI_BUS2SC(udev->bus);
 	struct usb_xfer *xfer;
-	struct usb_pipe_methods *methods;
+	const struct usb_pipe_methods *methods;
 	ohci_ed_t *ed;
 
 	DPRINTF("\n");
@@ -2720,7 +2720,7 @@ ohci_set_hw_power(struct usb_bus *bus)
 	return;
 }
 
-struct usb_bus_methods ohci_bus_methods =
+static const struct usb_bus_methods ohci_bus_methods =
 {
 	.endpoint_init = ohci_ep_init,
 	.xfer_setup = ohci_xfer_setup,

Modified: head/sys/dev/usb/controller/uhci.c
==============================================================================
--- head/sys/dev/usb/controller/uhci.c	Wed Dec 11 08:46:18 2013	(r259217)
+++ head/sys/dev/usb/controller/uhci.c	Wed Dec 11 13:20:32 2013	(r259218)
@@ -151,11 +151,11 @@ struct uhci_std_temp {
 	uint8_t	last_frame;
 };
 
-extern struct usb_bus_methods uhci_bus_methods;
-extern struct usb_pipe_methods uhci_device_bulk_methods;
-extern struct usb_pipe_methods uhci_device_ctrl_methods;
-extern struct usb_pipe_methods uhci_device_intr_methods;
-extern struct usb_pipe_methods uhci_device_isoc_methods;
+static const struct usb_bus_methods uhci_bus_methods;
+static const struct usb_pipe_methods uhci_device_bulk_methods;
+static const struct usb_pipe_methods uhci_device_ctrl_methods;
+static const struct usb_pipe_methods uhci_device_intr_methods;
+static const struct usb_pipe_methods uhci_device_isoc_methods;
 
 static uint8_t	uhci_restart(uhci_softc_t *sc);
 static void	uhci_do_poll(struct usb_bus *);
@@ -1840,7 +1840,7 @@ uhci_setup_standard_chain(struct usb_xfe
 static void
 uhci_device_done(struct usb_xfer *xfer, usb_error_t error)
 {
-	struct usb_pipe_methods *methods = xfer->endpoint->methods;
+	const struct usb_pipe_methods *methods = xfer->endpoint->methods;
 	uhci_softc_t *sc = UHCI_BUS2SC(xfer->xroot->bus);
 	uhci_qh_t *qh;
 
@@ -1935,7 +1935,7 @@ uhci_device_bulk_start(struct usb_xfer *
 	uhci_transfer_intr_enqueue(xfer);
 }
 
-struct usb_pipe_methods uhci_device_bulk_methods =
+static const struct usb_pipe_methods uhci_device_bulk_methods =
 {
 	.open = uhci_device_bulk_open,
 	.close = uhci_device_bulk_close,
@@ -1997,7 +1997,7 @@ uhci_device_ctrl_start(struct usb_xfer *
 	uhci_transfer_intr_enqueue(xfer);
 }
 
-struct usb_pipe_methods uhci_device_ctrl_methods =
+static const struct usb_pipe_methods uhci_device_ctrl_methods =
 {
 	.open = uhci_device_ctrl_open,
 	.close = uhci_device_ctrl_close,
@@ -2084,7 +2084,7 @@ uhci_device_intr_start(struct usb_xfer *
 	uhci_transfer_intr_enqueue(xfer);
 }
 
-struct usb_pipe_methods uhci_device_intr_methods =
+static const struct usb_pipe_methods uhci_device_intr_methods =
 {
 	.open = uhci_device_intr_open,
 	.close = uhci_device_intr_close,
@@ -2292,7 +2292,7 @@ uhci_device_isoc_start(struct usb_xfer *
 	uhci_transfer_intr_enqueue(xfer);
 }
 
-struct usb_pipe_methods uhci_device_isoc_methods =
+static const struct usb_pipe_methods uhci_device_isoc_methods =
 {
 	.open = uhci_device_isoc_open,
 	.close = uhci_device_isoc_close,
@@ -3076,7 +3076,7 @@ uhci_device_resume(struct usb_device *ud
 {
 	struct uhci_softc *sc = UHCI_BUS2SC(udev->bus);
 	struct usb_xfer *xfer;
-	struct usb_pipe_methods *methods;
+	const struct usb_pipe_methods *methods;
 	uhci_qh_t *qh;
 
 	DPRINTF("\n");
@@ -3118,7 +3118,7 @@ uhci_device_suspend(struct usb_device *u
 {
 	struct uhci_softc *sc = UHCI_BUS2SC(udev->bus);
 	struct usb_xfer *xfer;
-	struct usb_pipe_methods *methods;
+	const struct usb_pipe_methods *methods;
 	uhci_qh_t *qh;
 
 	DPRINTF("\n");
@@ -3213,7 +3213,7 @@ uhci_set_hw_power(struct usb_bus *bus)
 }
 
 
-struct usb_bus_methods uhci_bus_methods =
+static const struct usb_bus_methods uhci_bus_methods =
 {
 	.endpoint_init = uhci_ep_init,
 	.xfer_setup = uhci_xfer_setup,

Modified: head/sys/dev/usb/controller/uss820dci.c
==============================================================================
--- head/sys/dev/usb/controller/uss820dci.c	Wed Dec 11 08:46:18 2013	(r259217)
+++ head/sys/dev/usb/controller/uss820dci.c	Wed Dec 11 13:20:32 2013	(r259218)
@@ -94,11 +94,11 @@ SYSCTL_INT(_hw_usb_uss820dci, OID_AUTO, 
 
 /* prototypes */
 
-struct usb_bus_methods uss820dci_bus_methods;
-struct usb_pipe_methods uss820dci_device_bulk_methods;
-struct usb_pipe_methods uss820dci_device_ctrl_methods;
-struct usb_pipe_methods uss820dci_device_intr_methods;
-struct usb_pipe_methods uss820dci_device_isoc_fs_methods;
+static const struct usb_bus_methods uss820dci_bus_methods;
+static const struct usb_pipe_methods uss820dci_device_bulk_methods;
+static const struct usb_pipe_methods uss820dci_device_ctrl_methods;
+static const struct usb_pipe_methods uss820dci_device_intr_methods;
+static const struct usb_pipe_methods uss820dci_device_isoc_fs_methods;
 
 static uss820dci_cmd_t uss820dci_setup_rx;
 static uss820dci_cmd_t uss820dci_data_rx;
@@ -1571,7 +1571,7 @@ uss820dci_device_bulk_start(struct usb_x
 	uss820dci_start_standard_chain(xfer);
 }
 
-struct usb_pipe_methods uss820dci_device_bulk_methods =
+static const struct usb_pipe_methods uss820dci_device_bulk_methods =
 {
 	.open = uss820dci_device_bulk_open,
 	.close = uss820dci_device_bulk_close,
@@ -1608,7 +1608,7 @@ uss820dci_device_ctrl_start(struct usb_x
 	uss820dci_start_standard_chain(xfer);
 }
 
-struct usb_pipe_methods uss820dci_device_ctrl_methods =
+static const struct usb_pipe_methods uss820dci_device_ctrl_methods =
 {
 	.open = uss820dci_device_ctrl_open,
 	.close = uss820dci_device_ctrl_close,
@@ -1645,7 +1645,7 @@ uss820dci_device_intr_start(struct usb_x
 	uss820dci_start_standard_chain(xfer);
 }
 
-struct usb_pipe_methods uss820dci_device_intr_methods =
+static const struct usb_pipe_methods uss820dci_device_intr_methods =
 {
 	.open = uss820dci_device_intr_open,
 	.close = uss820dci_device_intr_close,
@@ -1727,7 +1727,7 @@ uss820dci_device_isoc_fs_start(struct us
 	uss820dci_start_standard_chain(xfer);
 }
 
-struct usb_pipe_methods uss820dci_device_isoc_fs_methods =
+static const struct usb_pipe_methods uss820dci_device_isoc_fs_methods =
 {
 	.open = uss820dci_device_isoc_fs_open,
 	.close = uss820dci_device_isoc_fs_close,
@@ -2376,7 +2376,7 @@ uss820dci_set_hw_power_sleep(struct usb_
 	}
 }
 
-struct usb_bus_methods uss820dci_bus_methods =
+static const struct usb_bus_methods uss820dci_bus_methods =
 {
 	.endpoint_init = &uss820dci_ep_init,
 	.xfer_setup = &uss820dci_xfer_setup,

Modified: head/sys/dev/usb/controller/xhci.c
==============================================================================
--- head/sys/dev/usb/controller/xhci.c	Wed Dec 11 08:46:18 2013	(r259217)
+++ head/sys/dev/usb/controller/xhci.c	Wed Dec 11 13:20:32 2013	(r259218)
@@ -160,7 +160,7 @@ static void xhci_ctx_set_le64(struct xhc
 static uint64_t xhci_ctx_get_le64(struct xhci_softc *sc, volatile uint64_t *ptr);
 #endif
 
-extern struct usb_bus_methods xhci_bus_methods;
+static const struct usb_bus_methods xhci_bus_methods;
 
 #ifdef USB_DEBUG
 static void
@@ -3069,7 +3069,7 @@ xhci_device_generic_start(struct usb_xfe
 		usbd_transfer_timeout_ms(xfer, &xhci_timeout, xfer->timeout);
 }
 
-struct usb_pipe_methods xhci_device_generic_methods =
+static const struct usb_pipe_methods xhci_device_generic_methods =
 {
 	.open = xhci_device_generic_open,
 	.close = xhci_device_generic_close,
@@ -4235,7 +4235,7 @@ xhci_set_endpoint_mode(struct usb_device
 	}
 }
 
-struct usb_bus_methods xhci_bus_methods = {
+static const struct usb_bus_methods xhci_bus_methods = {
 	.endpoint_init = xhci_ep_init,
 	.endpoint_uninit = xhci_ep_uninit,
 	.xfer_setup = xhci_xfer_setup,

Modified: head/sys/dev/usb/template/usb_template.c
==============================================================================
--- head/sys/dev/usb/template/usb_template.c	Wed Dec 11 08:46:18 2013	(r259217)
+++ head/sys/dev/usb/template/usb_template.c	Wed Dec 11 13:20:32 2013	(r259218)
@@ -846,7 +846,7 @@ usb_hw_ep_resolve(struct usb_device *ude
 	struct usb_hw_ep_scratch *ues;
 	struct usb_hw_ep_scratch_sub *ep;
 	const struct usb_hw_ep_profile *pf;
-	struct usb_bus_methods *methods;
+	const struct usb_bus_methods *methods;
 	struct usb_device_descriptor *dd;
 	uint16_t mps;
 

Modified: head/sys/dev/usb/usb_bus.h
==============================================================================
--- head/sys/dev/usb/usb_bus.h	Wed Dec 11 08:46:18 2013	(r259217)
+++ head/sys/dev/usb/usb_bus.h	Wed Dec 11 13:20:32 2013	(r259218)
@@ -97,7 +97,7 @@ struct usb_bus {
 	struct usb_dma_parent_tag dma_parent_tag[1];
 	struct usb_dma_tag dma_tags[USB_BUS_DMA_TAG_MAX];
 #endif
-	struct usb_bus_methods *methods;	/* filled by HC driver */
+	const struct usb_bus_methods *methods;	/* filled by HC driver */
 	struct usb_device **devices;
 
 	struct ifnet *ifp;	/* only for USB Packet Filter */

Modified: head/sys/dev/usb/usb_device.c
==============================================================================
--- head/sys/dev/usb/usb_device.c	Wed Dec 11 08:46:18 2013	(r259217)
+++ head/sys/dev/usb/usb_device.c	Wed Dec 11 13:20:32 2013	(r259218)
@@ -376,7 +376,7 @@ usb_init_endpoint(struct usb_device *ude
     struct usb_endpoint_ss_comp_descriptor *ecomp,
     struct usb_endpoint *ep)
 {
-	struct usb_bus_methods *methods;
+	const struct usb_bus_methods *methods;
 	usb_stream_t x;
 
 	methods = udev->bus->methods;

Modified: head/sys/dev/usb/usb_device.h
==============================================================================
--- head/sys/dev/usb/usb_device.h	Wed Dec 11 08:46:18 2013	(r259217)
+++ head/sys/dev/usb/usb_device.h	Wed Dec 11 13:20:32 2013	(r259218)
@@ -139,7 +139,7 @@ struct usb_hw_ep_scratch {
 	struct usb_hw_ep_scratch_sub *ep_max;
 	struct usb_config_descriptor *cd;
 	struct usb_device *udev;
-	struct usb_bus_methods *methods;
+	const struct usb_bus_methods *methods;
 	uint8_t	bmOutAlloc[(USB_EP_MAX + 15) / 16];
 	uint8_t	bmInAlloc[(USB_EP_MAX + 15) / 16];
 };

Modified: head/sys/dev/usb/usb_hub.c
==============================================================================
--- head/sys/dev/usb/usb_hub.c	Wed Dec 11 08:46:18 2013	(r259217)
+++ head/sys/dev/usb/usb_hub.c	Wed Dec 11 13:20:32 2013	(r259218)
@@ -2541,7 +2541,7 @@ usbd_set_power_mode(struct usb_device *u
 uint8_t
 usbd_filter_power_mode(struct usb_device *udev, uint8_t power_mode)
 {
-	struct usb_bus_methods *mtod;
+	const struct usb_bus_methods *mtod;
 	int8_t temp;
 
 	mtod = udev->bus->methods;

Modified: head/sys/dev/usb/usb_transfer.c
==============================================================================
--- head/sys/dev/usb/usb_transfer.c	Wed Dec 11 08:46:18 2013	(r259217)
+++ head/sys/dev/usb/usb_transfer.c	Wed Dec 11 13:20:32 2013	(r259218)
@@ -160,7 +160,7 @@ usbd_update_max_frame_size(struct usb_xf
 usb_timeout_t
 usbd_get_dma_delay(struct usb_device *udev)
 {
-	struct usb_bus_methods *mtod;
+	const struct usb_bus_methods *mtod;
 	uint32_t temp;
 
 	mtod = udev->bus->methods;

Modified: head/sys/dev/usb/usbdi.h
==============================================================================
--- head/sys/dev/usb/usbdi.h	Wed Dec 11 08:46:18 2013	(r259217)
+++ head/sys/dev/usb/usbdi.h	Wed Dec 11 13:20:32 2013	(r259218)
@@ -140,7 +140,7 @@ struct usb_endpoint {
 
 	struct usb_endpoint_descriptor *edesc;
 	struct usb_endpoint_ss_comp_descriptor *ecomp;
-	struct usb_pipe_methods *methods;	/* set by HC driver */
+	const struct usb_pipe_methods *methods;	/* set by HC driver */
 
 	uint16_t isoc_next;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201312111320.rBBDKWDw076917>