From b51875c9f634bc11fe13ea6f565ab4b7b8eff98f Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Wed, 30 Jan 2013 16:05:54 +0000 Subject: [PATCH] Use string literals in string descriptors for marginally better readability. Submitted by: Christoph Mallon --- sys/dev/usb/controller/at91dci.c | 6 ++-- sys/dev/usb/controller/atmegadci.c | 6 ++-- sys/dev/usb/controller/avr32dci.c | 6 ++-- sys/dev/usb/controller/dwc_otg.c | 6 ++-- sys/dev/usb/controller/musb_otg.c | 7 ++-- sys/dev/usb/controller/uss820dci.c | 6 ++-- sys/dev/usb/template/usb_template_audio.c | 13 +++---- sys/dev/usb/template/usb_template_cdce.c | 44 +++++------------------ sys/dev/usb/template/usb_template_kbd.c | 7 ++-- sys/dev/usb/template/usb_template_modem.c | 7 ++-- sys/dev/usb/template/usb_template_mouse.c | 7 ++-- sys/dev/usb/template/usb_template_msc.c | 29 ++++----------- sys/dev/usb/template/usb_template_mtp.c | 24 +++---------- 13 files changed, 42 insertions(+), 126 deletions(-) diff --git a/sys/dev/usb/controller/at91dci.c b/sys/dev/usb/controller/at91dci.c index 3b0c773a345a..6ebd37c3d08b 100644 --- a/sys/dev/usb/controller/at91dci.c +++ b/sys/dev/usb/controller/at91dci.c @@ -1741,12 +1741,10 @@ static const struct usb_hub_descriptor_min at91dci_hubd = { }; #define STRING_VENDOR \ - 'A', 0, 'T', 0, 'M', 0, 'E', 0, 'L', 0 + "A\0T\0M\0E\0L" #define STRING_PRODUCT \ - 'D', 0, 'C', 0, 'I', 0, ' ', 0, 'R', 0, \ - 'o', 0, 'o', 0, 't', 0, ' ', 0, 'H', 0, \ - 'U', 0, 'B', 0, + "D\0C\0I\0 \0R\0o\0o\0t\0 \0H\0U\0B" USB_MAKE_STRING_DESC(STRING_VENDOR, at91dci_vendor); USB_MAKE_STRING_DESC(STRING_PRODUCT, at91dci_product); diff --git a/sys/dev/usb/controller/atmegadci.c b/sys/dev/usb/controller/atmegadci.c index 426073ee9bba..0dc726ca7aa6 100644 --- a/sys/dev/usb/controller/atmegadci.c +++ b/sys/dev/usb/controller/atmegadci.c @@ -1566,12 +1566,10 @@ static const struct usb_hub_descriptor_min atmegadci_hubd = { }; #define STRING_VENDOR \ - 'A', 0, 'T', 0, 'M', 0, 'E', 0, 'G', 0, 'A', 0 + "A\0T\0M\0E\0G\0A" #define STRING_PRODUCT \ - 'D', 0, 'C', 0, 'I', 0, ' ', 0, 'R', 0, \ - 'o', 0, 'o', 0, 't', 0, ' ', 0, 'H', 0, \ - 'U', 0, 'B', 0, + "D\0C\0I\0 \0R\0o\0o\0t\0 \0H\0U\0B" USB_MAKE_STRING_DESC(STRING_VENDOR, atmegadci_vendor); USB_MAKE_STRING_DESC(STRING_PRODUCT, atmegadci_product); diff --git a/sys/dev/usb/controller/avr32dci.c b/sys/dev/usb/controller/avr32dci.c index e0244f5d0690..1d2ce87c7623 100644 --- a/sys/dev/usb/controller/avr32dci.c +++ b/sys/dev/usb/controller/avr32dci.c @@ -1506,12 +1506,10 @@ static const struct usb_hub_descriptor_min avr32dci_hubd = { }; #define STRING_VENDOR \ - 'A', 0, 'V', 0, 'R', 0, '3', 0, '2', 0 + "A\0V\0R\0003\0002" #define STRING_PRODUCT \ - 'D', 0, 'C', 0, 'I', 0, ' ', 0, 'R', 0, \ - 'o', 0, 'o', 0, 't', 0, ' ', 0, 'H', 0, \ - 'U', 0, 'B', 0, + "D\0C\0I\0 \0R\0o\0o\0t\0 \0H\0U\0B" USB_MAKE_STRING_DESC(STRING_VENDOR, avr32dci_vendor); USB_MAKE_STRING_DESC(STRING_PRODUCT, avr32dci_product); diff --git a/sys/dev/usb/controller/dwc_otg.c b/sys/dev/usb/controller/dwc_otg.c index 77dda2b5f587..d08b3d90c941 100644 --- a/sys/dev/usb/controller/dwc_otg.c +++ b/sys/dev/usb/controller/dwc_otg.c @@ -3492,12 +3492,10 @@ static const struct usb_hub_descriptor_min dwc_otg_hubd = { }; #define STRING_VENDOR \ - 'D', 0, 'W', 0, 'C', 0, 'O', 0, 'T', 0, 'G', 0 + "D\0W\0C\0O\0T\0G" #define STRING_PRODUCT \ - 'O', 0, 'T', 0, 'G', 0, ' ', 0, 'R', 0, \ - 'o', 0, 'o', 0, 't', 0, ' ', 0, 'H', 0, \ - 'U', 0, 'B', 0, + "O\0T\0G\0 \0R\0o\0o\0t\0 \0H\0U\0B" USB_MAKE_STRING_DESC(STRING_VENDOR, dwc_otg_vendor); USB_MAKE_STRING_DESC(STRING_PRODUCT, dwc_otg_product); diff --git a/sys/dev/usb/controller/musb_otg.c b/sys/dev/usb/controller/musb_otg.c index 0bf28025cd49..10dc90bee863 100644 --- a/sys/dev/usb/controller/musb_otg.c +++ b/sys/dev/usb/controller/musb_otg.c @@ -2212,13 +2212,10 @@ static const struct usb_hub_descriptor_min musbotg_hubd = { }; #define STRING_VENDOR \ - 'M', 0, 'e', 0, 'n', 0, 't', 0, 'o', 0, 'r', 0, ' ', 0, \ - 'G', 0, 'r', 0, 'a', 0, 'p', 0, 'h', 0, 'i', 0, 'c', 0, 's', 0 + "M\0e\0n\0t\0o\0r\0 \0G\0r\0a\0p\0h\0i\0c\0s" #define STRING_PRODUCT \ - 'O', 0, 'T', 0, 'G', 0, ' ', 0, 'R', 0, \ - 'o', 0, 'o', 0, 't', 0, ' ', 0, 'H', 0, \ - 'U', 0, 'B', 0, + "O\0T\0G\0 \0R\0o\0o\0t\0 \0H\0U\0B" USB_MAKE_STRING_DESC(STRING_VENDOR, musbotg_vendor); USB_MAKE_STRING_DESC(STRING_PRODUCT, musbotg_product); diff --git a/sys/dev/usb/controller/uss820dci.c b/sys/dev/usb/controller/uss820dci.c index ffb6cc8a210d..6750f32b06c1 100644 --- a/sys/dev/usb/controller/uss820dci.c +++ b/sys/dev/usb/controller/uss820dci.c @@ -1809,12 +1809,10 @@ static const struct usb_hub_descriptor_min uss820dci_hubd = { }; #define STRING_VENDOR \ - 'A', 0, 'G', 0, 'E', 0, 'R', 0, 'E', 0 + "A\0G\0E\0R\0E" #define STRING_PRODUCT \ - 'D', 0, 'C', 0, 'I', 0, ' ', 0, 'R', 0, \ - 'o', 0, 'o', 0, 't', 0, ' ', 0, 'H', 0, \ - 'U', 0, 'B', 0, + "D\0C\0I\0 \0R\0o\0o\0t\0 \0H\0U\0B" USB_MAKE_STRING_DESC(STRING_VENDOR, uss820dci_vendor); USB_MAKE_STRING_DESC(STRING_PRODUCT, uss820dci_product); diff --git a/sys/dev/usb/template/usb_template_audio.c b/sys/dev/usb/template/usb_template_audio.c index f40c601245db..7c7cebe33367 100644 --- a/sys/dev/usb/template/usb_template_audio.c +++ b/sys/dev/usb/template/usb_template_audio.c @@ -68,21 +68,16 @@ enum { }; #define STRING_AUDIO_PRODUCT \ - 'A', 0, 'u', 0, 'd', 0, 'i', 0, 'o', 0, ' ', 0, \ - 'T', 0, 'e', 0, 's', 0, 't', 0, ' ', 0, \ - 'D', 0, 'e', 0, 'v', 0, 'i', 0, 'c', 0, 'e', 0, + "A\0u\0d\0i\0o\0 \0T\0e\0s\0t\0 \0D\0e\0v\0i\0c\0e" #define STRING_AUDIO_MIXER \ - 'M', 0, 'i', 0, 'x', 0, 'e', 0, 'r', 0, ' ', 0, \ - 'i', 0, 'n', 0, 't', 0, 'e', 0, 'r', 0, 'f', 0, 'a', 0, 'c', 0, 'e', 0, + "M\0i\0x\0e\0r\0 \0i\0n\0t\0e\0r\0f\0a\0c\0e" #define STRING_AUDIO_RECORD \ - 'R', 0, 'e', 0, 'c', 0, 'o', 0, 'r', 0, 'd', 0, ' ', 0, \ - 'i', 0, 'n', 0, 't', 0, 'e', 0, 'r', 0, 'f', 0, 'a', 0, 'c', 0, 'e', 0, + "R\0e\0c\0o\0r\0d\0 \0i\0n\0t\0e\0r\0f\0a\0c\0e" #define STRING_AUDIO_PLAYBACK \ - 'P', 0, 'l', 0, 'a', 0, 'y', 0, 'b', 0, 'a', 0, 'c', 0, 'k', 0, ' ', 0, \ - 'i', 0, 'n', 0, 't', 0, 'e', 0, 'r', 0, 'f', 0, 'a', 0, 'c', 0, 'e', 0, + "P\0l\0a\0y\0b\0a\0c\0k\0 \0i\0n\0t\0e\0r\0f\0a\0c\0e" /* make the real string descriptors */ diff --git a/sys/dev/usb/template/usb_template_cdce.c b/sys/dev/usb/template/usb_template_cdce.c index 3bc5e3e1cd9b..68f69d0ad573 100644 --- a/sys/dev/usb/template/usb_template_cdce.c +++ b/sys/dev/usb/template/usb_template_cdce.c @@ -72,53 +72,27 @@ enum { }; #define STRING_MAC \ - '2', 0, 'A', 0, '2', 0, '3', 0, \ - '4', 0, '5', 0, '6', 0, '7', 0, \ - '8', 0, '9', 0, 'A', 0, 'B', 0, + "2\0A\0002\0003\0004\0005\0006\0007\08\09\0A\0B" #define STRING_ETH_CONTROL \ - 'U', 0, 'S', 0, 'B', 0, ' ', 0, \ - 'E', 0, 't', 0, 'h', 0, 'e', 0, \ - 'r', 0, 'n', 0, 'e', 0, 't', 0, \ - ' ', 0, 'C', 0, 'o', 0, 'm', 0, \ - 'm', 0, ' ', 0, 'i', 0, 'n', 0, \ - 't', 0, 'e', 0, 'r', 0, 'f', 0, \ - 'a', 0, 'c', 0, 'e', 0, + "U\0S\0B\0 \0E\0t\0h\0e\0r\0n\0e\0t\0 " \ + "\0C\0o\0m\0m\0 \0I\0n\0t\0e\0r\0f\0a\0c\0e" #define STRING_ETH_DATA \ - 'U', 0, 'S', 0, 'B', 0, ' ', 0, \ - 'E', 0, 't', 0, 'h', 0, 'e', 0, \ - 'r', 0, 'n', 0, 'e', 0, 't', 0, \ - ' ', 0, 'D', 0, 'a', 0, 't', 0, \ - 'a', 0, ' ', 0, 'i', 0, 'n', 0, \ - 't', 0, 'e', 0, 'r', 0, 'f', 0, \ - 'a', 0, 'c', 0, 'e', 0, + "U\0S\0B\0 \0E\0t\0h\0e\0r\0n\0e\0t\0 \0D\0a\0t\0a\0 " \ + "\0I\0n\0t\0e\0r\0f\0a\0c\0e" #define STRING_ETH_CONFIG \ - 'D', 0, 'e', 0, 'f', 0, 'a', 0, \ - 'u', 0, 'l', 0, 't', 0, ' ', 0, \ - 'c', 0, 'o', 0, 'n', 0, 'f', 0, \ - 'i', 0, 'g', 0, + "D\0e\0f\0a\0u\0l\0t\0 \0c\0o\0n\0f\0i\0g" #define STRING_ETH_VENDOR \ - 'F', 0, 'r', 0, 'e', 0, 'e', 0, \ - 'B', 0, 'S', 0, 'D', 0, ' ', 0, \ - 'f', 0, 'o', 0, 'u', 0, 'n', 0, \ - 'd', 0, 'a', 0, 't', 0, 'i', 0, \ - 'o', 0, 'n', 0, + "F\0r\0e\0e\0B\0S\0D\0 \0f\0o\0u\0n\0d\0a\0t\0i\0o\0n" #define STRING_ETH_PRODUCT \ - 'U', 0, 'S', 0, 'B', 0, ' ', 0, \ - 'E', 0, 't', 0, 'h', 0, 'e', 0, \ - 'r', 0, 'n', 0, 'e', 0, 't', 0, \ - ' ', 0, 'A', 0, 'd', 0, 'a', 0, \ - 'p', 0, 't', 0, 'e', 0, 'r', 0, + "U\0S\0B\0 \0E\0t\0h\0e\0r\0n\0e\0t\0 \0A\0d\0a\0p\0t\0e\0r" #define STRING_ETH_SERIAL \ - 'D', 0, 'e', 0, 'c', 0, 'e', 0, \ - 'm', 0, 'b', 0, 'e', 0, 'r', 0, \ - ' ', 0, '2', 0, '0', 0, '0', 0, \ - '7', 0, + "D\0e\0c\0e\0m\0b\0e\0r\0 \0002\0000\0000\0007" /* make the real string descriptors */ diff --git a/sys/dev/usb/template/usb_template_kbd.c b/sys/dev/usb/template/usb_template_kbd.c index 0538f469d5ca..306b2fee155c 100644 --- a/sys/dev/usb/template/usb_template_kbd.c +++ b/sys/dev/usb/template/usb_template_kbd.c @@ -66,13 +66,10 @@ enum { }; #define STRING_PRODUCT \ - 'K', 0, 'e', 0, 'y', 0, 'b', 0, 'o', 0, 'a', 0, 'r', 0, 'd', 0, ' ', 0, \ - 'T', 0, 'e', 0, 's', 0, 't', 0, ' ', 0, \ - 'D', 0, 'e', 0, 'v', 0, 'i', 0, 'c', 0, 'e', 0, + "K\0e\0y\0b\0o\0a\0r\0d\0 \0T\0e\0s\0t\0 \0D\0e\0v\0i\0c\0e" #define STRING_KEYBOARD \ - 'K', 0, 'e', 0, 'y', 0, 'b', 0, 'o', 0, 'a', 0, 'r', 0, 'd', 0, ' ', 0, \ - 'i', 0, 'n', 0, 't', 0, 'e', 0, 'r', 0, 'f', 0, 'a', 0, 'c', 0, 'e', 0, + "K\0e\0y\0b\0o\0a\0r\0d\0 \0i\0n\0t\0e\0r\0f\0a\0c\0e" /* make the real string descriptors */ diff --git a/sys/dev/usb/template/usb_template_modem.c b/sys/dev/usb/template/usb_template_modem.c index 784c7950adf3..6a976f7cbf17 100644 --- a/sys/dev/usb/template/usb_template_modem.c +++ b/sys/dev/usb/template/usb_template_modem.c @@ -66,13 +66,10 @@ enum { }; #define STRING_PRODUCT \ - 'M', 0, 'o', 0, 'd', 0, 'e', 0, 'm', 0, ' ', 0, \ - 'T', 0, 'e', 0, 's', 0, 't', 0, ' ', 0, \ - 'D', 0, 'e', 0, 'v', 0, 'i', 0, 'c', 0, 'e', 0, + "M\0o\0d\0e\0m\0 \0T\0e\0s\0t\0 \0D\0e\0v\0i\0c\0e" #define STRING_MODEM \ - 'M', 0, 'o', 0, 'd', 0, 'e', 0, 'm', 0, ' ', 0, \ - 'i', 0, 'n', 0, 't', 0, 'e', 0, 'r', 0, 'f', 0, 'a', 0, 'c', 0, 'e', 0, + "M\0o\0d\0e\0m\0 \0i\0n\0t\0e\0r\0f\0a\0c\0e" /* make the real string descriptors */ diff --git a/sys/dev/usb/template/usb_template_mouse.c b/sys/dev/usb/template/usb_template_mouse.c index 570a70cf006a..a48ccf4d61d6 100644 --- a/sys/dev/usb/template/usb_template_mouse.c +++ b/sys/dev/usb/template/usb_template_mouse.c @@ -66,13 +66,10 @@ enum { }; #define STRING_PRODUCT \ - 'M', 0, 'o', 0, 'u', 0, 's', 0, 'e', 0, ' ', 0, \ - 'T', 0, 'e', 0, 's', 0, 't', 0, ' ', 0, \ - 'D', 0, 'e', 0, 'v', 0, 'i', 0, 'c', 0, 'e', 0, + "M\0o\0u\0s\0e\0 \0T\0e\0s\0t\0 \0D\0e\0v\0i\0c\0e" #define STRING_MOUSE \ - 'M', 0, 'o', 0, 'u', 0, 's', 0, 'e', 0, ' ', 0, \ - 'i', 0, 'n', 0, 't', 0, 'e', 0, 'r', 0, 'f', 0, 'a', 0, 'c', 0, 'e', 0, + "M\0o\0u\0s\0e\0 \0i\0n\0t\0e\0r\0f\0a\0c\0e" /* make the real string descriptors */ diff --git a/sys/dev/usb/template/usb_template_msc.c b/sys/dev/usb/template/usb_template_msc.c index 3d13fee02b73..6809e63ff6e4 100644 --- a/sys/dev/usb/template/usb_template_msc.c +++ b/sys/dev/usb/template/usb_template_msc.c @@ -69,37 +69,20 @@ enum { }; #define STRING_MSC_DATA \ - 'U', 0, 'S', 0, 'B', 0, ' ', 0, \ - 'M', 0, 'a', 0, 's', 0, 's', 0, \ - ' ', 0, 'S', 0, 't', 0, 'o', 0, \ - 'r', 0, 'a', 0, 'g', 0, 'e', 0, \ - ' ', 0, 'I', 0, 'n', 0, 't', 0, \ - 'e', 0, 'r', 0, 'f', 0, 'a', 0, \ - 'c', 0, 'e', 0, + "U\0S\0B\0 \0M\0a\0s\0s\0 \0S\0t\0o\0r\0a\0g\0e\0 " \ + "\0I\0n\0t\0e\0r\0f\0a\0c\0e" #define STRING_MSC_CONFIG \ - 'D', 0, 'e', 0, 'f', 0, 'a', 0, \ - 'u', 0, 'l', 0, 't', 0, ' ', 0, \ - 'c', 0, 'o', 0, 'n', 0, 'f', 0, \ - 'i', 0, 'g', 0, + "D\0e\0f\0a\0u\0l\0t\0 \0c\0o\0n\0f\0i\0g" #define STRING_MSC_VENDOR \ - 'F', 0, 'r', 0, 'e', 0, 'e', 0, \ - 'B', 0, 'S', 0, 'D', 0, ' ', 0, \ - 'f', 0, 'o', 0, 'u', 0, 'n', 0, \ - 'd', 0, 'a', 0, 't', 0, 'i', 0, \ - 'o', 0, 'n', 0, + "F\0r\0e\0e\0B\0S\0D\0 \0f\0o\0u\0n\0d\0a\0t\0i\0o\0n" #define STRING_MSC_PRODUCT \ - 'U', 0, 'S', 0, 'B', 0, ' ', 0, \ - 'M', 0, 'e', 0, 'm', 0, 'o', 0, \ - 'r', 0, 'y', 0, ' ', 0, 'S', 0, \ - 't', 0, 'i', 0, 'c', 0, 'k', 0 + "U\0S\0B\0 \0M\0e\0m\0o\0r\0y\0 \0S\0t\0i\0c\0k" #define STRING_MSC_SERIAL \ - 'M', 0, 'a', 0, 'r', 0, 'c', 0, \ - 'h', 0, ' ', 0, '2', 0, '0', 0, \ - '0', 0, '8', 0, + "M\0a\0r\0c\0h\0 \0002\0000\0000\08" /* make the real string descriptors */ diff --git a/sys/dev/usb/template/usb_template_mtp.c b/sys/dev/usb/template/usb_template_mtp.c index e4c3c7ed3e7d..f0528a52aa89 100644 --- a/sys/dev/usb/template/usb_template_mtp.c +++ b/sys/dev/usb/template/usb_template_mtp.c @@ -78,33 +78,19 @@ enum { }; #define STRING_MTP_DATA \ - 'U', 0, 'S', 0, 'B', 0, ' ', 0, \ - 'M', 0, 'T', 0, 'P', 0, \ - ' ', 0, 'I', 0, 'n', 0, 't', 0, \ - 'e', 0, 'r', 0, 'f', 0, 'a', 0, \ - 'c', 0, 'e', 0, + "U\0S\0B\0 \0M\0T\0P\0 \0I\0n\0t\0e\0r\0f\0a\0c\0e" #define STRING_MTP_CONFIG \ - 'D', 0, 'e', 0, 'f', 0, 'a', 0, \ - 'u', 0, 'l', 0, 't', 0, ' ', 0, \ - 'c', 0, 'o', 0, 'n', 0, 'f', 0, \ - 'i', 0, 'g', 0, + "D\0e\0f\0a\0u\0l\0t\0 \0c\0o\0n\0f\0i\0g" #define STRING_MTP_VENDOR \ - 'F', 0, 'r', 0, 'e', 0, 'e', 0, \ - 'B', 0, 'S', 0, 'D', 0, ' ', 0, \ - 'f', 0, 'o', 0, 'u', 0, 'n', 0, \ - 'd', 0, 'a', 0, 't', 0, 'i', 0, \ - 'o', 0, 'n', 0, + "F\0r\0e\0e\0B\0S\0D\0 \0f\0o\0u\0n\0d\0a\0t\0i\0o\0n" #define STRING_MTP_PRODUCT \ - 'U', 0, 'S', 0, 'B', 0, ' ', 0, \ - 'M', 0, 'T', 0, 'P', 0, + "U\0S\0B\0 \0M\0T\0P" #define STRING_MTP_SERIAL \ - 'J', 0, 'u', 0, 'n', 0, 'e', 0, \ - ' ', 0, '2', 0, '0', 0, '0', 0, \ - '8', 0, + "J\0u\0n\0e\0 \0002\0000\0000\08" /* make the real string descriptors */