usb: gadget: ether: Fix warnings about unused code
PATCH 1/1 usb: gadget: ether: Fix warnings about unused code
When building this with clang we see a few new warnings. There are a handful of structs that we declare and use only in the case of !defined(CONFIG_USB_ETH_CDC) && defined(CONFIG_USB_ETH_SUBSET) so update the guards used to match this as well as cover all members rather than just a few. Finally, eth_is_promisc() is only called by eth_start_xmit() which is under and #if 0 and immediately follows the function. Move the #if 0 up.
--- drivers/usb/gadget/ether.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
drivers/usb/gadget/ether.c +3 -8
@@ -476,14 +476,12 @@ static const struct usb_cdc_acm_descriptor acm_descriptor = {#endif -#ifndef CONFIG_USB_ETH_CDC - +#if !defined(CONFIG_USB_ETH_CDC ) && defined(CONFIG_USB_ETH_SUBSET )/* * "SAFE" loosely follows CDC WMC MDLM, violating the spec in various * ways: data endpoints live in the control interface, there's no data * interface, and it's not used to talk to a cell phone radio. */ -static const struct usb_cdc_mdlm_desc mdlm_desc = { .bLength =sizeof mdlm_desc, .bDescriptorType = USB_DT_CS_INTERFACE,
@@ -501,7 +499,6 @@ static const struct usb_cdc_mdlm_desc mdlm_desc = {* can't really use its struct. All we do here is say that we're using * the submode of "SAFE" which directly matches the CDC Subset. */ -#ifdef CONFIG_USB_ETH_SUBSET static const u8 mdlm_detail_desc[] = {6 ,USB_DT_CS_INTERFACE ,
@@ -511,9 +508,6 @@ static const u8 mdlm_detail_desc[] = {0 ,/* network control capabilities (none) */ 0, /* network data capabilities ("raw" encapsulation) */ }; -#endif - -#endif static const struct usb_cdc_ether_desc ether_desc = { .bLength = sizeof(ether_desc),
@@ -527,6 +521,7 @@ static const struct usb_cdc_ether_desc ether_desc = { .wNumberMCFilters = __constant_cpu_to_le16(0), .bNumberPowerFilters = 0, }; +#endif #if defined(CONFIG_USB_ETH_CDC ) || defined(CONFIG_USB_ETH_RNDIS )
@@ -1643,6 +1638,7 @@ static void tx_complete(struct usb_ep *ep, struct usb_request *req) packet_sent =1 ; } +#if 0 static inline int eth_is_promisc (struct eth_dev *dev) {/* no filters for the CDC subset; always promisc */
@@ -1651,7 +1647,6 @@ static inline int eth_is_promisc(struct eth_dev *dev)return dev->cdc_filter &USB_CDC_PACKET_TYPE_PROMISCUOUS ; } -#if 0 static int eth_start_xmit (struct sk_buff *skb,struct net_device *net) {struct eth_dev *dev =netdev_priv (net);
Signature · 1 line
2.17.1
PATCH 1/1 usb: gadget: ether: Fix warnings about unused code
Hi Tom,
Quoted 8 lines
When building this with clang we see a few new warnings. There are a handful of structs that we declare and use only in the case of !defined(CONFIG_USB_ETH_CDC) &&
defined(CONFIG_USB_ETH_SUBSET)so update the guards used to match this as well as cover all members rather than just a few. Finally,eth_is_promisc()is only called byeth_start_xmit()which is under and #if 0 and immediately follows the function. Move the #if 0 up.
Could you double check this patch and rebase it on top of newest master.
As it is now it causes following build break:
https://travis-ci.org/github/lmajewski/u-boot-dfu/jobs/720654040
Thanks in advance,
?ukasz
Quoted 65 lines
Cc Lukasz Majewski <[email protected]>Cc Marek Vasut <[email protected]>Signed-off-by Tom Rini <[email protected]>--- drivers/usb/gadget/ether.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)drivers/usb/gadget/ether.c +1
-2@@ -476,14 +476,12 @@ static const struct usb_cdc_acm_descriptor acm_descriptor = {#endif -#ifndef CONFIG_USB_ETH_CDC - +#if !defined(CONFIG_USB_ETH_CDC ) && defined(CONFIG_USB_ETH_SUBSET )/* * "SAFE" loosely follows CDC WMC MDLM, violating the spec in various * ways: data endpoints live in the control interface, there's no data
* interface, and it's not used to talk to a cell phone radio. */drivers/usb/gadget/ether.c +0
-1-static const struct usb_cdc_mdlm_desc mdlm_desc = { .bLength =sizeof mdlm_desc, .bDescriptorType =USB_DT_CS_INTERFACE ,@@ -501,7 +499,6 @@ static const struct usb_cdc_mdlm_desc mdlm_desc = { * can't really use its struct. All we do here is say that we'reusing
* the submode of "SAFE" which directly matches the CDC Subset. */drivers/usb/gadget/ether.c +2
-4-#ifdef CONFIG_USB_ETH_SUBSET static const u8 mdlm_detail_desc[] = {6 ,USB_DT_CS_INTERFACE ,@@ -511,9 +508,6 @@ static const u8 mdlm_detail_desc[] = {0 ,/* network control capabilities (none) */ 0, /* network data capabilities ("raw" encapsulation) */ }; -#endif - -#endif static const struct usb_cdc_ether_desc ether_desc = { .bLength = sizeof(ether_desc),@@ -527,6 +521,7 @@ static const struct usb_cdc_ether_desc ether_desc = { .wNumberMCFilters =__constant_cpu_to_le16 (0 ), .bNumberPowerFilters =0 , }; +#endif #if defined(CONFIG_USB_ETH_CDC ) || defined(CONFIG_USB_ETH_RNDIS )@@ -1643,6 +1638,7 @@ static void tx_complete(struct usb_ep *ep, struct usb_request *req) packet_sent = 1; } +#if 0 static inline int eth_is_promisc (struct eth_dev *dev) {/* no filters for the CDC subset; always promisc */
drivers/usb/gadget/ether.c static inline int eth_is_promisc(struct eth_dev · line 1652
Quoted 7 lines
drivers/usb/gadget/ether.c +0
-1@@ -1651,7 +1647,6 @@ static inline int eth_is_promisc(struct eth_dev *dev) return dev->cdc_filter & USB_CDC_PACKET_TYPE_PROMISCUOUS; } -#if 0 static int eth_start_xmit (struct sk_buff *skb,struct net_device *net) {struct eth_dev *dev =netdev_priv (net);
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200825/de6c6b51/attachment.sig>
PATCH 1/1 usb: gadget: ether: Fix warnings about unused code
Quoted 11 lines · Lukasz Majewski
Hi Tom,
Quoted 8 lines
When building this with clang we see a few new warnings. There are a handful of structs that we declare and use only in the case of !defined(CONFIG_USB_ETH_CDC) &&
defined(CONFIG_USB_ETH_SUBSET)so update the guards used to match this as well as cover all members rather than just a few. Finally,eth_is_promisc()is only called byeth_start_xmit()which is under and #if 0 and immediately follows the function. Move the #if 0 up.
Quoted 4 lines
Could you double check this patch and rebase it on top of newest master.
As it is now it causes following build break:
https://travis-ci.org/github/lmajewski/u-boot-dfu/jobs/720654040
Lets just set it aside then. It was fine at the time but I've put down my experiment of building various targets with clang for now.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200825/3b6959fe/attachment.sig>