Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/nick-nhusb]: src/sys Use designated initializers for more descriptors.



details:   https://anonhg.NetBSD.org/src/rev/721b37760c70
branches:  nick-nhusb
changeset: 804207:721b37760c70
user:      skrll <skrll%NetBSD.org@localhost>
date:      Wed Dec 03 13:19:38 2014 +0000

description:
Use designated initializers for more descriptors.

diffstat:

 sys/arch/mips/adm5120/dev/ahci.c |  74 +++++++++++++++++----------------
 sys/dev/ic/sl811hs.c             |  83 ++++++++++++++++++++-----------------
 sys/dev/usb/ehci.c               |  88 ++++++++++++++++++++-------------------
 sys/dev/usb/ohci.c               |  46 ++++++++++---------
 sys/dev/usb/uhci.c               |  75 +++++++++++++++++---------------
 sys/dev/usb/xhci.c               |  89 ++++++++++++++++++++-------------------
 6 files changed, 237 insertions(+), 218 deletions(-)

diffs (truncated from 645 to 300 lines):

diff -r f3ea1e0a9a7b -r 721b37760c70 sys/arch/mips/adm5120/dev/ahci.c
--- a/sys/arch/mips/adm5120/dev/ahci.c  Wed Dec 03 13:08:59 2014 +0000
+++ b/sys/arch/mips/adm5120/dev/ahci.c  Wed Dec 03 13:19:38 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ahci.c,v 1.12.6.6 2014/12/03 13:08:59 skrll Exp $      */
+/*     $NetBSD: ahci.c,v 1.12.6.7 2014/12/03 13:19:38 skrll Exp $      */
 
 /*-
  * Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko.
@@ -64,7 +64,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ahci.c,v 1.12.6.6 2014/12/03 13:08:59 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahci.c,v 1.12.6.7 2014/12/03 13:19:38 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -540,7 +540,7 @@
        .bDeviceProtocol = 0,
        .bMaxPacketSize = 64,
        .idVendor = {
-               USB_VENDOR_SCANLOGIC & 0xff,    /* vendor ID (low)  */
+               USB_VENDOR_SCANLOGIC & 0xff,
                USB_VENDOR_SCANLOGIC >> 8
        },
        .idProduct = {0},
@@ -552,48 +552,50 @@
 };
 
 usb_config_descriptor_t ahci_confd = {
-       USB_CONFIG_DESCRIPTOR_SIZE,
-       UDESC_CONFIG,
-       {USB_CONFIG_DESCRIPTOR_SIZE +
-        USB_INTERFACE_DESCRIPTOR_SIZE +
-        USB_ENDPOINT_DESCRIPTOR_SIZE},
-       1,                      /* number of interfaces */
-       1,                      /* configuration value */
-       0,                      /* index to configuration */
-       UC_SELF_POWERED,        /* attributes */
-       250                     /* max current is 500mA... */
+       .bLength = USB_CONFIG_DESCRIPTOR_SIZE,
+       .bDescriptorType = UDESC_CONFIG,
+       .wTotalLength = {
+               USB_CONFIG_DESCRIPTOR_SIZE +
+               USB_INTERFACE_DESCRIPTOR_SIZE +
+               USB_ENDPOINT_DESCRIPTOR_SIZE,
+       },
+       .bNumInterface = 1,
+       .bConfigurationValue = 1,
+       .iConfiguration = 0,
+       .bmAttributes = UC_SELF_POWERED,
+       .bMaxPower = 250
 };
 
 usb_interface_descriptor_t ahci_ifcd = {
-       USB_INTERFACE_DESCRIPTOR_SIZE,
-       UDESC_INTERFACE,
-       0,                      /* interface number */
-       0,                      /* alternate setting */
-       1,                      /* number of endpoint */
-       UICLASS_HUB,            /* class */
-       UISUBCLASS_HUB,         /* subclass */
-       0,                      /* protocol */
-       0                       /* index to interface */
+       .bLength = USB_INTERFACE_DESCRIPTOR_SIZE,
+       .bDescriptorType = UDESC_INTERFACE,
+       .bInterfaceNumber = 0,
+       .bAlternateSetting = 0,
+       .bNumEndpoints = 1,
+       .bInterfaceClass = UICLASS_HUB,
+       .bInterfaceSubClass = UISUBCLASS_HUB,
+       .bInterfaceProtocol = 0,
+       .iInterface = 0
 };
 
 usb_endpoint_descriptor_t ahci_endpd = {
-       USB_ENDPOINT_DESCRIPTOR_SIZE,
-       UDESC_ENDPOINT,
-       UE_DIR_IN | AHCI_INTR_ENDPT,    /* endpoint address */
-       UE_INTERRUPT,           /* attributes */
-       {8},                    /* max packet size */
-       255                     /* interval */
+       .bLength = USB_ENDPOINT_DESCRIPTOR_SIZE,
+       .bDescriptorType = UDESC_ENDPOINT,
+       .bEndpointAddress = UE_DIR_IN | AHCI_INTR_ENDPT,
+       .bmAttributes = UE_INTERRUPT,
+       .wMaxPacketSize = {8},
+       .bInterval = 255
 };
 
 usb_hub_descriptor_t ahci_hubd = {
-       USB_HUB_DESCRIPTOR_SIZE,
-       UDESC_HUB,
-       2,                      /* number of ports */
-       { 0, 0},                /* hub characteristics */
-       0,                      /* 5:power on to power good */
-       0,                      /* 6:maximum current */
-       { 0x00 },               /* both ports are removable */
-       { 0x00 }                /* port power control mask */
+       .bDescLength = USB_HUB_DESCRIPTOR_SIZE,
+       .bDescriptorType = UDESC_HUB,
+       .bNbrPorts = 2,
+       .wHubCharacteristics = { 0, 0 },
+       .bPwrOn2PwrGood = 0,
+       .bHubContrCurrent = 0,
+       .DeviceRemovable = { 0x00 },
+       .PortPowerCtrlMask = { 0x00 }
 };
 
 static int
diff -r f3ea1e0a9a7b -r 721b37760c70 sys/dev/ic/sl811hs.c
--- a/sys/dev/ic/sl811hs.c      Wed Dec 03 13:08:59 2014 +0000
+++ b/sys/dev/ic/sl811hs.c      Wed Dec 03 13:19:38 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sl811hs.c,v 1.47.6.5 2014/12/03 13:09:00 skrll Exp $   */
+/*     $NetBSD: sl811hs.c,v 1.47.6.6 2014/12/03 13:19:38 skrll Exp $   */
 
 /*
  * Not (c) 2007 Matthew Orgass
@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.47.6.5 2014/12/03 13:09:00 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.47.6.6 2014/12/03 13:19:38 skrll Exp $");
 
 #include "opt_slhci.h"
 
@@ -2954,46 +2954,53 @@
        const usb_interface_descriptor_t ifcd;
        const usb_endpoint_descriptor_t endpd;
 } UPACKED slhci_confd = {
-       { /* Configuration */
-               USB_CONFIG_DESCRIPTOR_SIZE,
-               UDESC_CONFIG,
-               {USB_CONFIG_DESCRIPTOR_SIZE +
-                USB_INTERFACE_DESCRIPTOR_SIZE +
-                USB_ENDPOINT_DESCRIPTOR_SIZE},
-               1,                      /* number of interfaces */
-               1,                      /* configuration value */
-               0,                      /* index to configuration */
-               UC_SELF_POWERED,        /* attributes */
-               0                       /* max current, filled in later */
-       }, { /* Interface */
-               USB_INTERFACE_DESCRIPTOR_SIZE,
-               UDESC_INTERFACE,
-               0,                      /* interface number */
-               0,                      /* alternate setting */
-               1,                      /* number of endpoint */
-               UICLASS_HUB,            /* class */
-               UISUBCLASS_HUB,         /* subclass */
-               0,                      /* protocol */
-               0                       /* index to interface */
-       }, { /* Endpoint */
-               USB_ENDPOINT_DESCRIPTOR_SIZE,
-               UDESC_ENDPOINT,
-               UE_DIR_IN | ROOT_INTR_ENDPT,    /* endpoint address */
-               UE_INTERRUPT,                   /* attributes */
-               {240, 0},                       /* max packet size */
-               255                             /* interval */
+       .confd = {
+               .bLength = USB_CONFIG_DESCRIPTOR_SIZE,
+               .bDescriptorType = UDESC_CONFIG,
+               .wTotalLength = {
+                       USB_CONFIG_DESCRIPTOR_SIZE +
+                       USB_INTERFACE_DESCRIPTOR_SIZE +
+                       USB_ENDPOINT_DESCRIPTOR_SIZE
+               },
+               .bNumInterface = 1,
+               .bConfigurationValue = 1,
+               .iConfiguration = 0,
+               .bmAttributes = UC_SELF_POWERED,
+               .bMaxPower = 0
+       },
+       .ifcd = {
+               .bLength = USB_INTERFACE_DESCRIPTOR_SIZE,
+               .bDescriptorType = UDESC_INTERFACE,
+               .bInterfaceNumber = 0,
+               .bAlternateSetting = 0,
+               .bNumEndpoints = 1,
+               .bInterfaceClass = UICLASS_HUB, 
+               .bInterfaceSubClass = UISUBCLASS_HUB,
+               .bInterfaceProtocol = 0,
+               .iInterface = 0
+       },
+       .endpd = {
+               .bLength = USB_ENDPOINT_DESCRIPTOR_SIZE,
+               .bDescriptorType = UDESC_ENDPOINT,
+               .bEndpointAddress = UE_DIR_IN | ROOT_INTR_ENDPT,
+               .bmAttributes = UE_INTERRUPT,
+               .wMaxPacketSize = {240, 0},
+               .bInterval = 255
        }
 };
 
 static const usb_hub_descriptor_t slhci_hubd = {
-       USB_HUB_DESCRIPTOR_SIZE,
-       UDESC_HUB,
-       1,                      /* number of ports */
-       {UHD_PWR_INDIVIDUAL | UHD_OC_NONE, 0},  /* hub characteristics */
-       50,                     /* 5:power on to power good, units of 2ms */
-       0,                      /* 6:maximum current, filled in later */
-       { 0x00 },               /* port is removable */
-       { 0x00 }                /* port power control mask */
+       .bDescLength = USB_HUB_DESCRIPTOR_SIZE,
+       .bDescriptorType = UDESC_HUB,
+       .bNbrPorts = 1,
+       .wHubCharacteristics = {
+               UHD_PWR_INDIVIDUAL | UHD_OC_NONE,
+               0
+       },
+       .bPwrOn2PwrGood = 50,
+       .bHubContrCurrent = 0,
+       .DeviceRemovable = { 0x00 },
+       .PortPowerCtrlMask = { 0x00 }
 };
 
 static usbd_status
diff -r f3ea1e0a9a7b -r 721b37760c70 sys/dev/usb/ehci.c
--- a/sys/dev/usb/ehci.c        Wed Dec 03 13:08:59 2014 +0000
+++ b/sys/dev/usb/ehci.c        Wed Dec 03 13:19:38 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ehci.c,v 1.234.2.9 2014/12/03 13:09:00 skrll Exp $ */
+/*     $NetBSD: ehci.c,v 1.234.2.10 2014/12/03 13:19:38 skrll Exp $ */
 
 /*
  * Copyright (c) 2004-2012 The NetBSD Foundation, Inc.
@@ -53,7 +53,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.234.2.9 2014/12/03 13:09:00 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.234.2.10 2014/12/03 13:19:38 skrll Exp $");
 
 #include "ohci.h"
 #include "uhci.h"
@@ -2272,60 +2272,62 @@
 };
 
 Static const usb_device_qualifier_t ehci_odevd = {
-       USB_DEVICE_DESCRIPTOR_SIZE,
-       UDESC_DEVICE_QUALIFIER, /* type */
-       {0x00, 0x02},           /* USB version */
-       UDCLASS_HUB,            /* class */
-       UDSUBCLASS_HUB,         /* subclass */
-       UDPROTO_FSHUB,          /* protocol */
-       64,                     /* max packet */
-       1,                      /* # of configurations */
+       .bLength = USB_DEVICE_DESCRIPTOR_SIZE,
+       .bDescriptorType = UDESC_DEVICE_QUALIFIER,
+       .bcdUSB = {0x00, 0x02},
+       .bDeviceClass = UDCLASS_HUB,
+       .bDeviceSubClass = UDSUBCLASS_HUB,
+       .bDeviceProtocol = UDPROTO_FSHUB,
+       .bMaxPacketSize0 = 64,
+       .bNumConfigurations = 1,
        0
 };
 
 Static const usb_config_descriptor_t ehci_confd = {
-       USB_CONFIG_DESCRIPTOR_SIZE,
-       UDESC_CONFIG,
-       {USB_CONFIG_DESCRIPTOR_SIZE +
-        USB_INTERFACE_DESCRIPTOR_SIZE +
-        USB_ENDPOINT_DESCRIPTOR_SIZE},
-       1,
-       1,
-       0,
-       UC_ATTR_MBO | UC_SELF_POWERED,
-       0                       /* max power */
+       .bLength = USB_CONFIG_DESCRIPTOR_SIZE,
+       .bDescriptorType = UDESC_CONFIG,
+       .wTotalLength = {
+               USB_CONFIG_DESCRIPTOR_SIZE +
+               USB_INTERFACE_DESCRIPTOR_SIZE +
+               USB_ENDPOINT_DESCRIPTOR_SIZE
+       },
+       .bNumInterface = 1,
+       .bConfigurationValue = 1,
+       .iConfiguration = 0,
+       .bmAttributes = UC_ATTR_MBO | UC_SELF_POWERED,
+       .bMaxPower = 0
 };
 
 Static const usb_interface_descriptor_t ehci_ifcd = {
-       USB_INTERFACE_DESCRIPTOR_SIZE,
-       UDESC_INTERFACE,
-       0,
-       0,
-       1,
-       UICLASS_HUB,
-       UISUBCLASS_HUB,
-       UIPROTO_HSHUBSTT,
-       0
+       .bLength = USB_INTERFACE_DESCRIPTOR_SIZE,
+       .bDescriptorType = UDESC_INTERFACE,
+       .bInterfaceNumber = 0,
+       .bAlternateSetting = 0,
+       .bNumEndpoints = 1,



Home | Main Index | Thread Index | Old Index