[PATCH] usb: gadget: ether: Fix warnings about unused code
Tom Rini
trini at konsulko.com
Thu Jun 4 22:08:04 CEST 2020
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.
Cc: Lukasz Majewski <lukma at denx.de>
Cc: Marek Vasut <marex at denx.de>
Signed-off-by: Tom Rini <trini at konsulko.com>
---
drivers/usb/gadget/ether.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index 6f04523f15e9..0daaf36f68f7 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -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);
--
2.17.1
More information about the U-Boot
mailing list