From 14c28c45f11f86e8d36fd1b2d5948630d11a398c Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Wed, 3 Nov 2021 14:39:01 +0100 Subject: [PATCH] usb: remove USB_SCD_ATTRIBUTES macro USB_SCD_ATTRIBUTES is a configuration dependent macro that does not map any part of the spec and does not belong to usb_ch9 header. Signed-off-by: Johann Fischer --- include/usb/usb_ch9.h | 5 ----- subsys/usb/class/dfu/usb_dfu.c | 6 +++++- subsys/usb/usb_descriptor.c | 6 +++++- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/include/usb/usb_ch9.h b/include/usb/usb_ch9.h index b83c0bcea72..5379c2ba014 100644 --- a/include/usb/usb_ch9.h +++ b/include/usb/usb_ch9.h @@ -220,11 +220,6 @@ struct usb_association_descriptor { #define USB_SCD_RESERVED BIT(7) #define USB_SCD_SELF_POWERED BIT(6) #define USB_SCD_REMOTE_WAKEUP BIT(5) -#define USB_SCD_ATTRIBUTES (USB_SCD_RESERVED | \ - COND_CODE_1(CONFIG_USB_SELF_POWERED, \ - (USB_SCD_SELF_POWERED), (0)) | \ - COND_CODE_1(CONFIG_USB_DEVICE_REMOTE_WAKEUP, \ - (USB_SCD_REMOTE_WAKEUP), (0))) /** USB Defined Base Class Codes from https://www.usb.org/defined-class-codes */ #define USB_BCC_AUDIO 0x01 diff --git a/subsys/usb/class/dfu/usb_dfu.c b/subsys/usb/class/dfu/usb_dfu.c index 04e43f08f7b..3d87f1d73ca 100644 --- a/subsys/usb/class/dfu/usb_dfu.c +++ b/subsys/usb/class/dfu/usb_dfu.c @@ -155,7 +155,11 @@ struct dev_dfu_mode_descriptor dfu_mode_desc = { .bNumInterfaces = 1, .bConfigurationValue = 1, .iConfiguration = 0, - .bmAttributes = USB_SCD_ATTRIBUTES, + .bmAttributes = USB_SCD_RESERVED | + COND_CODE_1(CONFIG_USB_SELF_POWERED, + (USB_SCD_SELF_POWERED), (0)) | + COND_CODE_1(CONFIG_USB_DEVICE_REMOTE_WAKEUP, + (USB_SCD_REMOTE_WAKEUP), (0)), .bMaxPower = CONFIG_USB_MAX_POWER, }, .sec_dfu_cfg = { diff --git a/subsys/usb/usb_descriptor.c b/subsys/usb/usb_descriptor.c index 7c0047e45bd..6446a738d6f 100644 --- a/subsys/usb/usb_descriptor.c +++ b/subsys/usb/usb_descriptor.c @@ -90,7 +90,11 @@ USBD_DEVICE_DESCR_DEFINE(primary) struct common_descriptor common_desc = { .bNumInterfaces = 0, .bConfigurationValue = 1, .iConfiguration = 0, - .bmAttributes = USB_SCD_ATTRIBUTES, + .bmAttributes = USB_SCD_RESERVED | + COND_CODE_1(CONFIG_USB_SELF_POWERED, + (USB_SCD_SELF_POWERED), (0)) | + COND_CODE_1(CONFIG_USB_DEVICE_REMOTE_WAKEUP, + (USB_SCD_REMOTE_WAKEUP), (0)), .bMaxPower = CONFIG_USB_MAX_POWER, }, };