public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: u-boot@lists.denx.de
Subject: [PATCH] usb: gadget: ether: Fix warnings about unused code
Date: Thu,  4 Jun 2020 16:08:04 -0400	[thread overview]
Message-ID: <20200604200804.5759-1-trini@konsulko.com> (raw)

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@denx.de>
Cc: Marek Vasut <marex@denx.de>
Signed-off-by: Tom Rini <trini@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

             reply	other threads:[~2020-06-04 20:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-04 20:08 Tom Rini [this message]
2020-08-25  9:55 ` [PATCH] usb: gadget: ether: Fix warnings about unused code Lukasz Majewski
2020-08-25 12:50   ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200604200804.5759-1-trini@konsulko.com \
    --to=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox