Skip to content
Permalink
Browse files

usb: sort usb config data by section

USBD_CFG_DATA_DEFINE macro has not consider that a class
could have more than one set of usb_cfg_data struct.
If a class has more than one set of usb_cfg_data
then they should be sorted the same way like by
USBD_DEVICE_DESCR_DEFINE macro.

Fixes: #16240

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
  • Loading branch information...
jfischer-phytec-iot authored and carlescufi committed Jun 12, 2019
1 parent 6e75d64 commit abaeaed2af4b611ebaa1ac02a46a5bef0ec210bc
@@ -65,8 +65,8 @@ extern "C" {
* This macro should be used to place the struct usb_cfg_data
* inside usb data section in the RAM.
*/
#define USBD_CFG_DATA_DEFINE(name) \
static __in_section(usb, data, name) __used
#define USBD_CFG_DATA_DEFINE(p, name) \
static __in_section(usb, data_##p, name) __used

/*************************************************************************
* USB configuration
@@ -150,7 +150,7 @@ static int wpanusb_vendor_handler(struct usb_setup_packet *setup,
return 0;
}

USBD_CFG_DATA_DEFINE(wpanusb) struct usb_cfg_data wpanusb_config = {
USBD_CFG_DATA_DEFINE(primary, wpanusb) struct usb_cfg_data wpanusb_config = {
.usb_device_description = NULL,
.interface_descriptor = &wpanusb_desc.if0,
.cb_usb_status = wpanusb_status_cb,
@@ -213,7 +213,7 @@ static struct usb_ep_cfg_data webusb_ep_data[] = {
}
};

USBD_CFG_DATA_DEFINE(webusb) struct usb_cfg_data webusb_config = {
USBD_CFG_DATA_DEFINE(primary, webusb) struct usb_cfg_data webusb_config = {
.usb_device_description = NULL,
.interface_descriptor = &webusb_desc.if0,
.cb_usb_status = webusb_dev_status_cb,
@@ -287,7 +287,7 @@ static void bluetooth_interface_config(struct usb_desc_header *head,
bluetooth_cfg.if0.bInterfaceNumber = bInterfaceNumber;
}

USBD_CFG_DATA_DEFINE(hci) struct usb_cfg_data bluetooth_config = {
USBD_CFG_DATA_DEFINE(primary, hci) struct usb_cfg_data bluetooth_config = {
.usb_device_description = NULL,
.interface_config = bluetooth_interface_config,
.interface_descriptor = &bluetooth_cfg.if0,
@@ -966,7 +966,7 @@ static const struct uart_driver_api cdc_acm_driver_api = {
}

#define DEFINE_CDC_ACM_CFG_DATA(x, _) \
USBD_CFG_DATA_DEFINE(cdc_acm) \
USBD_CFG_DATA_DEFINE(primary, cdc_acm) \
struct usb_cfg_data cdc_acm_config_##x = { \
.usb_device_description = NULL, \
.interface_config = cdc_interface_config, \
@@ -631,7 +631,7 @@ static void hid_interface_config(struct usb_desc_header *head,
}

#define DEFINE_HID_CFG_DATA(x, _) \
USBD_CFG_DATA_DEFINE(hid) \
USBD_CFG_DATA_DEFINE(primary, hid) \
struct usb_cfg_data hid_config_##x = { \
.usb_device_description = NULL, \
.interface_config = hid_interface_config, \
@@ -166,7 +166,7 @@ static void loopback_interface_config(struct usb_desc_header *head,
}

/* usb.rst device config data start */
USBD_CFG_DATA_DEFINE(loopback) struct usb_cfg_data loopback_config = {
USBD_CFG_DATA_DEFINE(primary, loopback) struct usb_cfg_data loopback_config = {
.usb_device_description = NULL,
.interface_config = loopback_interface_config,
.interface_descriptor = &loopback_cfg.if0,
@@ -854,7 +854,7 @@ static void mass_interface_config(struct usb_desc_header *head,
}

/* Configuration of the Mass Storage Device send to the USB Driver */
USBD_CFG_DATA_DEFINE(msd) struct usb_cfg_data mass_storage_config = {
USBD_CFG_DATA_DEFINE(primary, msd) struct usb_cfg_data mass_storage_config = {
.usb_device_description = NULL,
.interface_config = mass_interface_config,
.interface_descriptor = &mass_cfg.if0,
@@ -428,7 +428,7 @@ static void ecm_interface_config(struct usb_desc_header *head,
#endif
}

USBD_CFG_DATA_DEFINE(netusb) struct usb_cfg_data netusb_config = {
USBD_CFG_DATA_DEFINE(primary, netusb) struct usb_cfg_data netusb_config = {
.usb_device_description = NULL,
.interface_config = ecm_interface_config,
.interface_descriptor = &cdc_ecm_cfg.if0,
@@ -280,7 +280,7 @@ static void eem_interface_config(struct usb_desc_header *head,
cdc_eem_cfg.if0.bInterfaceNumber = bInterfaceNumber;
}

USBD_CFG_DATA_DEFINE(netusb) struct usb_cfg_data netusb_config = {
USBD_CFG_DATA_DEFINE(primary, netusb) struct usb_cfg_data netusb_config = {
.usb_device_description = NULL,
.interface_config = eem_interface_config,
.interface_descriptor = &cdc_eem_cfg.if0,
@@ -1164,7 +1164,7 @@ static void netusb_interface_config(struct usb_desc_header *head,
#endif
}

USBD_CFG_DATA_DEFINE(netusb) struct usb_cfg_data netusb_config = {
USBD_CFG_DATA_DEFINE(primary, netusb) struct usb_cfg_data netusb_config = {
.usb_device_description = NULL,
.interface_config = netusb_interface_config,
.interface_descriptor = &rndis_cfg.if0,
@@ -698,7 +698,7 @@ static void dfu_interface_config(struct usb_desc_header *head,
}

/* Configuration of the DFU Device send to the USB Driver */
USBD_CFG_DATA_DEFINE(dfu) struct usb_cfg_data dfu_config = {
USBD_CFG_DATA_DEFINE(primary, dfu) struct usb_cfg_data dfu_config = {
.usb_device_description = NULL,
.interface_config = dfu_interface_config,
.interface_descriptor = &dfu_cfg.if0,
@@ -714,7 +714,7 @@ USBD_CFG_DATA_DEFINE(dfu) struct usb_cfg_data dfu_config = {
* Dummy configuration, this is necessary to configure DFU mode descriptor
* which is an alternative (secondary) device descriptor.
*/
USBD_CFG_DATA_DEFINE(dfu_mode) struct usb_cfg_data dfu_mode_config = {
USBD_CFG_DATA_DEFINE(secondary, dfu) struct usb_cfg_data dfu_mode_config = {
.usb_device_description = NULL,
.interface_config = NULL,
.interface_descriptor = &dfu_mode_desc.sec_dfu_cfg.if0,
@@ -91,7 +91,7 @@ struct usb_test_config {
};

#define DEFINE_TEST_CFG_DATA(x, _) \
USBD_CFG_DATA_DEFINE(test_##x) \
USBD_CFG_DATA_DEFINE(primary, test_##x) \
struct usb_cfg_data test_config_##x = { \
.usb_device_description = NULL, \
.interface_config = interface_config, \
@@ -76,7 +76,7 @@ static struct usb_ep_cfg_data device_ep[] = {
},
};

USBD_CFG_DATA_DEFINE(device) struct usb_cfg_data device_config = {
USBD_CFG_DATA_DEFINE(primary, device) struct usb_cfg_data device_config = {
.usb_device_description = NULL,
.interface_descriptor = &dev_desc.if0,
.cb_usb_status = status_cb,

0 comments on commit abaeaed

Please sign in to comment.
You can’t perform that action at this time.