summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/controller
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/usb/controller')
-rw-r--r--sys/dev/usb/controller/at91dci.c7
-rw-r--r--sys/dev/usb/controller/atmegadci.c7
-rw-r--r--sys/dev/usb/controller/avr32dci.c7
-rw-r--r--sys/dev/usb/controller/dwc_otg.c7
-rw-r--r--sys/dev/usb/controller/ehci.c9
-rw-r--r--sys/dev/usb/controller/musb_otg.c7
-rw-r--r--sys/dev/usb/controller/ohci.c9
-rw-r--r--sys/dev/usb/controller/uhci.c12
-rw-r--r--sys/dev/usb/controller/uss820dci.c7
-rw-r--r--sys/dev/usb/controller/xhci.c7
10 files changed, 30 insertions, 49 deletions
diff --git a/sys/dev/usb/controller/at91dci.c b/sys/dev/usb/controller/at91dci.c
index d325812..e7d5e6e 100644
--- a/sys/dev/usb/controller/at91dci.c
+++ b/sys/dev/usb/controller/at91dci.c
@@ -1725,14 +1725,13 @@ static const struct at91dci_config_desc at91dci_confd = {
},
};
+#define HSETW(ptr, val) ptr = { (uint8_t)(val), (uint8_t)((val) >> 8) }
+
static const struct usb_hub_descriptor_min at91dci_hubd = {
.bDescLength = sizeof(at91dci_hubd),
.bDescriptorType = UDESC_HUB,
.bNbrPorts = 1,
- .wHubCharacteristics[0] =
- (UHD_PWR_NO_SWITCH | UHD_OC_INDIVIDUAL) & 0xFF,
- .wHubCharacteristics[1] =
- (UHD_PWR_NO_SWITCH | UHD_OC_INDIVIDUAL) >> 8,
+ HSETW(.wHubCharacteristics, (UHD_PWR_NO_SWITCH | UHD_OC_INDIVIDUAL)),
.bPwrOn2PwrGood = 50,
.bHubContrCurrent = 0,
.DeviceRemovable = {0}, /* port is removable */
diff --git a/sys/dev/usb/controller/atmegadci.c b/sys/dev/usb/controller/atmegadci.c
index 7db3bdb..700ca8f 100644
--- a/sys/dev/usb/controller/atmegadci.c
+++ b/sys/dev/usb/controller/atmegadci.c
@@ -1548,14 +1548,13 @@ static const struct atmegadci_config_desc atmegadci_confd = {
},
};
+#define HSETW(ptr, val) ptr = { (uint8_t)(val), (uint8_t)((val) >> 8) }
+
static const struct usb_hub_descriptor_min atmegadci_hubd = {
.bDescLength = sizeof(atmegadci_hubd),
.bDescriptorType = UDESC_HUB,
.bNbrPorts = 1,
- .wHubCharacteristics[0] =
- (UHD_PWR_NO_SWITCH | UHD_OC_INDIVIDUAL) & 0xFF,
- .wHubCharacteristics[1] =
- (UHD_PWR_NO_SWITCH | UHD_OC_INDIVIDUAL) >> 8,
+ HSETW(.wHubCharacteristics, (UHD_PWR_NO_SWITCH | UHD_OC_INDIVIDUAL)),
.bPwrOn2PwrGood = 50,
.bHubContrCurrent = 0,
.DeviceRemovable = {0}, /* port is removable */
diff --git a/sys/dev/usb/controller/avr32dci.c b/sys/dev/usb/controller/avr32dci.c
index 9494c30..9f9cd5d 100644
--- a/sys/dev/usb/controller/avr32dci.c
+++ b/sys/dev/usb/controller/avr32dci.c
@@ -1489,14 +1489,13 @@ static const struct avr32dci_config_desc avr32dci_confd = {
},
};
+#define HSETW(ptr, val) ptr = { (uint8_t)(val), (uint8_t)((val) >> 8) }
+
static const struct usb_hub_descriptor_min avr32dci_hubd = {
.bDescLength = sizeof(avr32dci_hubd),
.bDescriptorType = UDESC_HUB,
.bNbrPorts = 1,
- .wHubCharacteristics[0] =
- (UHD_PWR_NO_SWITCH | UHD_OC_INDIVIDUAL) & 0xFF,
- .wHubCharacteristics[1] =
- (UHD_PWR_NO_SWITCH | UHD_OC_INDIVIDUAL) >> 8,
+ HSETW(.wHubCharacteristics, (UHD_PWR_NO_SWITCH | UHD_OC_INDIVIDUAL)),
.bPwrOn2PwrGood = 50,
.bHubContrCurrent = 0,
.DeviceRemovable = {0}, /* port is removable */
diff --git a/sys/dev/usb/controller/dwc_otg.c b/sys/dev/usb/controller/dwc_otg.c
index fee1207..f3ef19a 100644
--- a/sys/dev/usb/controller/dwc_otg.c
+++ b/sys/dev/usb/controller/dwc_otg.c
@@ -2057,14 +2057,13 @@ static const struct dwc_otg_config_desc dwc_otg_confd = {
},
};
+#define HSETW(ptr, val) ptr = { (uint8_t)(val), (uint8_t)((val) >> 8) }
+
static const struct usb_hub_descriptor_min dwc_otg_hubd = {
.bDescLength = sizeof(dwc_otg_hubd),
.bDescriptorType = UDESC_HUB,
.bNbrPorts = 1,
- .wHubCharacteristics[0] =
- (UHD_PWR_NO_SWITCH | UHD_OC_INDIVIDUAL) & 0xFF,
- .wHubCharacteristics[1] =
- (UHD_PWR_NO_SWITCH | UHD_OC_INDIVIDUAL) >> 8,
+ HSETW(.wHubCharacteristics, (UHD_PWR_NO_SWITCH | UHD_OC_INDIVIDUAL)),
.bPwrOn2PwrGood = 50,
.bHubContrCurrent = 0,
.DeviceRemovable = {0}, /* port is removable */
diff --git a/sys/dev/usb/controller/ehci.c b/sys/dev/usb/controller/ehci.c
index f59c801..da37954 100644
--- a/sys/dev/usb/controller/ehci.c
+++ b/sys/dev/usb/controller/ehci.c
@@ -3011,13 +3011,8 @@ static const struct ehci_config_desc ehci_confd = {
static const
struct usb_hub_descriptor ehci_hubd =
{
- 0, /* dynamic length */
- UDESC_HUB,
- 0,
- {0, 0},
- 0,
- 0,
- {0},
+ .bDescLength = 0, /* dynamic length */
+ .bDescriptorType = UDESC_HUB,
};
static void
diff --git a/sys/dev/usb/controller/musb_otg.c b/sys/dev/usb/controller/musb_otg.c
index d463052..db0d54f 100644
--- a/sys/dev/usb/controller/musb_otg.c
+++ b/sys/dev/usb/controller/musb_otg.c
@@ -2192,14 +2192,13 @@ static const struct musbotg_config_desc musbotg_confd = {
},
};
+#define HSETW(ptr, val) ptr = { (uint8_t)(val), (uint8_t)((val) >> 8) }
+
static const struct usb_hub_descriptor_min musbotg_hubd = {
.bDescLength = sizeof(musbotg_hubd),
.bDescriptorType = UDESC_HUB,
.bNbrPorts = 1,
- .wHubCharacteristics[0] =
- (UHD_PWR_NO_SWITCH | UHD_OC_INDIVIDUAL) & 0xFF,
- .wHubCharacteristics[1] =
- (UHD_PWR_NO_SWITCH | UHD_OC_INDIVIDUAL) >> 16,
+ HSETW(.wHubCharacteristics, (UHD_PWR_NO_SWITCH | UHD_OC_INDIVIDUAL)),
.bPwrOn2PwrGood = 50,
.bHubContrCurrent = 0,
.DeviceRemovable = {0}, /* port is removable */
diff --git a/sys/dev/usb/controller/ohci.c b/sys/dev/usb/controller/ohci.c
index 93c2bb2..a3179f1 100644
--- a/sys/dev/usb/controller/ohci.c
+++ b/sys/dev/usb/controller/ohci.c
@@ -2080,13 +2080,8 @@ struct ohci_config_desc ohci_confd =
static const
struct usb_hub_descriptor ohci_hubd =
{
- 0, /* dynamic length */
- UDESC_HUB,
- 0,
- {0, 0},
- 0,
- 0,
- {0},
+ .bDescLength = 0, /* dynamic length */
+ .bDescriptorType = UDESC_HUB,
};
static usb_error_t
diff --git a/sys/dev/usb/controller/uhci.c b/sys/dev/usb/controller/uhci.c
index d9091c9..c7a8c19 100644
--- a/sys/dev/usb/controller/uhci.c
+++ b/sys/dev/usb/controller/uhci.c
@@ -2351,13 +2351,11 @@ static const struct uhci_config_desc uhci_confd = {
static const
struct usb_hub_descriptor_min uhci_hubd_piix =
{
- sizeof(uhci_hubd_piix),
- UDESC_HUB,
- 2,
- {UHD_PWR_NO_SWITCH | UHD_OC_INDIVIDUAL, 0},
- 50, /* power on to power good */
- 0,
- {0x00}, /* both ports are removable */
+ .bDescLength = sizeof(uhci_hubd_piix),
+ .bDescriptorType = UDESC_HUB,
+ .bNbrPorts = 2,
+ .wHubCharacteristics = {UHD_PWR_NO_SWITCH | UHD_OC_INDIVIDUAL, 0},
+ .bPwrOn2PwrGood = 50,
};
/*
diff --git a/sys/dev/usb/controller/uss820dci.c b/sys/dev/usb/controller/uss820dci.c
index 612bc81..19229f8 100644
--- a/sys/dev/usb/controller/uss820dci.c
+++ b/sys/dev/usb/controller/uss820dci.c
@@ -1789,14 +1789,13 @@ static const struct uss820dci_config_desc uss820dci_confd = {
},
};
+#define HSETW(ptr, val) ptr = { (uint8_t)(val), (uint8_t)((val) >> 8) }
+
static const struct usb_hub_descriptor_min uss820dci_hubd = {
.bDescLength = sizeof(uss820dci_hubd),
.bDescriptorType = UDESC_HUB,
.bNbrPorts = 1,
- .wHubCharacteristics[0] =
- (UHD_PWR_NO_SWITCH | UHD_OC_INDIVIDUAL) & 0xFF,
- .wHubCharacteristics[1] =
- (UHD_PWR_NO_SWITCH | UHD_OC_INDIVIDUAL) >> 8,
+ HSETW(.wHubCharacteristics, (UHD_PWR_NO_SWITCH | UHD_OC_INDIVIDUAL)),
.bPwrOn2PwrGood = 50,
.bHubContrCurrent = 0,
.DeviceRemovable = {0}, /* port is removable */
diff --git a/sys/dev/usb/controller/xhci.c b/sys/dev/usb/controller/xhci.c
index a9690f9..aed7edf 100644
--- a/sys/dev/usb/controller/xhci.c
+++ b/sys/dev/usb/controller/xhci.c
@@ -821,7 +821,7 @@ xhci_check_transfer(struct xhci_softc *sc, struct xhci_trb *trb)
offset = td_event - td->td_self;
if (offset >= 0 &&
- offset < sizeof(td->td_trb)) {
+ offset < (int64_t)sizeof(td->td_trb)) {
usb_pc_cpu_invalidate(td->page_cache);
@@ -2805,7 +2805,7 @@ struct usb_pipe_methods xhci_device_generic_methods =
* Simulate a hardware HUB by handling all the necessary requests.
*------------------------------------------------------------------------*/
-#define HSETW(ptr, val) ptr[0] = (uint8_t)(val), ptr[1] = (uint8_t)((val) >> 8)
+#define HSETW(ptr, val) ptr = { (uint8_t)(val), (uint8_t)((val) >> 8) }
static const
struct usb_device_descriptor xhci_devd =
@@ -2848,8 +2848,7 @@ struct xhci_bos_desc xhci_bosd = {
HSETW(.wSpeedsSupported, 0x000C),
.bFunctionalitySupport = 8,
.bU1DevExitLat = 255, /* dummy - not used */
- .wU2DevExitLat[0] = 0x00,
- .wU2DevExitLat[1] = 0x08,
+ .wU2DevExitLat = { 0x00, 0x08 },
},
.cidd = {
.bLength = sizeof(xhci_bosd.cidd),
OpenPOWER on IntegriCloud