public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH] usb: gadget: ether: Fix warnings about unused code
@ 2020-06-04 20:08 Tom Rini
  2020-08-25  9:55 ` Lukasz Majewski
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Rini @ 2020-06-04 20:08 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] usb: gadget: ether: Fix warnings about unused code
  2020-06-04 20:08 [PATCH] usb: gadget: ether: Fix warnings about unused code Tom Rini
@ 2020-08-25  9:55 ` Lukasz Majewski
  2020-08-25 12:50   ` Tom Rini
  0 siblings, 1 reply; 3+ messages in thread
From: Lukasz Majewski @ 2020-08-25  9:55 UTC (permalink / raw)
  To: u-boot

Hi Tom,

> 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.
> 

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

> 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);




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>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] usb: gadget: ether: Fix warnings about unused code
  2020-08-25  9:55 ` Lukasz Majewski
@ 2020-08-25 12:50   ` Tom Rini
  0 siblings, 0 replies; 3+ messages in thread
From: Tom Rini @ 2020-08-25 12:50 UTC (permalink / raw)
  To: u-boot

On Tue, Aug 25, 2020 at 11:55:17AM +0200, Lukasz Majewski wrote:
> Hi Tom,
> 
> > 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.
> > 
> 
> 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.

-- 
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>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-08-25 12:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-04 20:08 [PATCH] usb: gadget: ether: Fix warnings about unused code Tom Rini
2020-08-25  9:55 ` Lukasz Majewski
2020-08-25 12:50   ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox