public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Brownell <david-b@pacbell.net>
To: Adrian Bunk <bunk@stusta.de>
Cc: Andrew Morton <akpm@osdl.org>,
	linux-kernel@vger.kernel.org, Greg KH <greg@kroah.com>,
	linux-usb-devel@lists.sourceforge.net
Subject: Re: 2.6.12-rc4-mm1: drivers/usb/gadget/ether.c compile error
Date: Mon, 16 May 2005 08:26:38 -0700	[thread overview]
Message-ID: <200505160826.38832.david-b@pacbell.net> (raw)
In-Reply-To: <20050515094339.GO16549@stusta.de>

[-- Attachment #1: Type: text/plain, Size: 427 bytes --]

On Sunday 15 May 2005 2:43 am, Adrian Bunk wrote:
> On Thu, May 12, 2005 at 03:31:00AM -0700, Andrew Morton wrote:
> >...
> > Changes since 2.6.12-rc3-mm3:
> >...
> > +gregkh-04-USB-gregkh-usb-031_usb-ethernet_gadget_cleanups.patch
> >...
> >  USB tree
> >...
> 
> This patch breaks compilation with CONFIG_USB_ETH=y and 
> CONFIG_USB_ETH_RNDIS=n:

This one fixes that glitch (thanks!) and gets rid of more #ifdeffery.

- Dave

[-- Attachment #2: ether.patch --]
[-- Type: text/x-diff, Size: 4932 bytes --]

This fixes a compile glitch with CONFIG_USB_ETH_RNDIS disabled, and
replaces some inline #ifdeffery (and other code) with inline functions
which can evaluate to constants.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>

--- 1.91/drivers/usb/gadget/ether.c	2005-05-08 00:12:40 -07:00
+++ edited/drivers/usb/gadget/ether.c	2005-05-16 08:08:02 -07:00
@@ -91,12 +91,12 @@
 
 #define RX_EXTRA	20		/* guard against rx overflows */
 
-#ifdef	CONFIG_USB_ETH_RNDIS
 #include "rndis.h"
-#else
-#define rndis_init()	0
-#define rndis_uninit(x)	do{}while(0)
-#define rndis_exit()	do{}while(0)
+
+#ifndef	CONFIG_USB_ETH_RNDIS
+#define rndis_uninit(x)		do{}while(0)
+#define rndis_deregister(c)	do{}while(0)
+#define rndis_exit()		do{}while(0)
 #endif
 
 /* CDC and RNDIS support the same host-chosen outgoing packet filters. */
@@ -1133,9 +1133,9 @@
 		dev->config = number;
 		INFO (dev, "%s speed config #%d: %d mA, %s, using %s\n",
 				speed, number, power, driver_desc,
-				dev->rndis
+				rndis_active(dev)
 					? "RNDIS"
-					: (dev->cdc
+					: (cdc_active(dev)
 						? "CDC Ethernet"
 						: "CDC Ethernet Subset"));
 	}
@@ -1350,7 +1350,7 @@
 				|| !dev->config
 				|| wIndex > 1)
 			break;
-		if (!dev->cdc && wIndex != 0)
+		if (!cdc_active(dev) && wIndex != 0)
 			break;
 		spin_lock (&dev->lock);
 
@@ -1420,11 +1420,11 @@
 				|| !dev->config
 				|| wIndex > 1)
 			break;
-		if (!(dev->cdc || dev->rndis) && wIndex != 0)
+		if (!(cdc_active(dev) || rndis_active(dev)) && wIndex != 0)
 			break;
 
 		/* for CDC, iff carrier is on, data interface is active. */
-		if (dev->rndis || wIndex != 1)
+		if (rndis_active(dev) || wIndex != 1)
 			*(u8 *)req->buf = 0;
 		else
 			*(u8 *)req->buf = netif_carrier_ok (dev->net) ? 1 : 0;
@@ -1437,8 +1437,7 @@
 		 * wValue = packet filter bitmap
 		 */
 		if (ctrl->bRequestType != (USB_TYPE_CLASS|USB_RECIP_INTERFACE)
-				|| !dev->cdc
-				|| dev->rndis
+				|| !cdc_active(dev)
 				|| wLength != 0
 				|| wIndex > 1)
 			break;
@@ -1462,7 +1461,7 @@
 	 */
 	case USB_CDC_SEND_ENCAPSULATED_COMMAND:
 		if (ctrl->bRequestType != (USB_TYPE_CLASS|USB_RECIP_INTERFACE)
-				|| !dev->rndis
+				|| !rndis_active(dev)
 				|| wLength > USB_BUFSIZ
 				|| wValue
 				|| rndis_control_intf.bInterfaceNumber
@@ -1477,7 +1476,7 @@
 	case USB_CDC_GET_ENCAPSULATED_RESPONSE:
 		if ((USB_DIR_IN|USB_TYPE_CLASS|USB_RECIP_INTERFACE)
 					== ctrl->bRequestType
-				&& dev->rndis
+				&& rndis_active(dev)
 				// && wLength >= 0x0400
 				&& !wValue
 				&& rndis_control_intf.bInterfaceNumber
@@ -1661,11 +1660,9 @@
 	/* normal completion */
 	case 0:
 		skb_put (skb, req->actual);
-#ifdef CONFIG_USB_ETH_RNDIS
 		/* we know MaxPacketsPerTransfer == 1 here */
-		if (dev->rndis)
+		if (rndis_active(dev))
 			status = rndis_rm_hdr (skb);
-#endif
 		if (status < 0
 				|| ETH_HLEN > skb->len
 				|| skb->len > ETH_FRAME_LEN) {
@@ -1893,8 +1890,7 @@
 	 * or the hardware can't use skb buffers.
 	 * or there's not enough space for any RNDIS headers we need
 	 */
-#ifdef CONFIG_USB_ETH_RNDIS
-	if (dev->rndis) {
+	if (rndis_active(dev)) {
 		struct sk_buff	*skb_rndis;
 
 		skb_rndis = skb_realloc_headroom (skb,
@@ -1907,7 +1903,6 @@
 		rndis_add_hdr (skb);
 		length = skb->len;
 	}
-#endif
 	req->buf = skb->data;
 	req->context = skb;
 	req->complete = tx_complete;
@@ -1940,9 +1935,7 @@
 	}
 
 	if (retval) {
-#ifdef CONFIG_USB_ETH_RNDIS
 drop:
-#endif
 		dev->stats.tx_dropped++;
 		dev_kfree_skb_any (skb);
 		spin_lock_irqsave (&dev->lock, flags);
@@ -2023,6 +2016,10 @@
 	return 0;
 }
 
+#else
+
+#define	rndis_control_ack	NULL
+
 #endif	/* RNDIS */
 
 static void eth_start (struct eth_dev *dev, int gfp_flags)
@@ -2035,14 +2032,12 @@
 	/* and open the tx floodgates */ 
 	atomic_set (&dev->tx_qlen, 0);
 	netif_wake_queue (dev->net);
-#ifdef CONFIG_USB_ETH_RNDIS
-	if (dev->rndis) {
+	if (rndis_active(dev)) {
 		rndis_set_param_medium (dev->rndis_config,
 					NDIS_MEDIUM_802_3,
 					BITRATE(dev->gadget)/100);
 		(void) rndis_signal_connect (dev->rndis_config);
 	}
-#endif	
 }
 
 static int eth_open (struct net_device *net)
@@ -2083,13 +2078,11 @@
 		}
 	}
 	
-#ifdef	CONFIG_USB_ETH_RNDIS
-	if (dev->rndis) {
+	if (rndis_active(dev)) {
 		rndis_set_param_medium (dev->rndis_config,
 					NDIS_MEDIUM_802_3, 0);
 		(void) rndis_signal_disconnect (dev->rndis_config);
 	}
-#endif
 
 	return 0;
 }
@@ -2127,10 +2120,8 @@
 	struct eth_dev		*dev = get_gadget_data (gadget);
 
 	DEBUG (dev, "unbind\n");
-#ifdef CONFIG_USB_ETH_RNDIS
 	rndis_deregister (dev->rndis_config);
 	rndis_exit ();
-#endif
 
 	/* we've already been disconnected ... no i/o is active */
 	if (dev->req) {
@@ -2481,7 +2472,6 @@
 			dev->host_mac [2], dev->host_mac [3],
 			dev->host_mac [4], dev->host_mac [5]);
 
-#ifdef	CONFIG_USB_ETH_RNDIS
 	if (rndis) {
 		u32	vendorID = 0;
 
@@ -2509,7 +2499,6 @@
 			goto fail0;
 		INFO (dev, "RNDIS ready\n");
 	}
-#endif	
 
 	return status;
 

  reply	other threads:[~2005-05-16 15:44 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-12 10:31 2.6.12-rc4-mm1 Andrew Morton
2005-05-12 12:21 ` 2.6.12-rc4-mm1, build results compared to 2.6.12-rc3-mm3 Jan Dittmer
2005-05-13  6:19   ` Maneesh Soni
2005-05-12 12:39 ` 2.6.12-rc4-mm1 Reuben Farrelly
2005-05-12 15:09   ` 2.6.12-rc4-mm1 Andrew Morton
2005-05-14 21:19   ` 2.6.12-rc4-mm1 Andrew James Wade
2005-05-12 12:58 ` kobject_register failed for intelfb (-EACCES) (Re: 2.6.12-rc4-mm1) Alexey Dobriyan
2005-05-12 15:43   ` Greg KH
2005-05-12 15:59     ` Andrew Morton
2005-05-12 16:04       ` Greg KH
2005-05-12 16:20       ` Alexey Dobriyan
2005-05-12 18:14 ` [PATCH -mm] Print KBD and AUX irqs correctly Alexey Dobriyan
2005-05-12 21:42 ` [-mm patch] mm.h: fix page_zone compile error Adrian Bunk
2005-05-12 22:09   ` Dave Hansen
2005-05-12 22:26     ` Adrian Bunk
2005-05-13 13:26   ` Andy Whitcroft
2005-05-12 21:54 ` 2.6.12-rc4-mm1 Greg KH
2005-05-13  0:47 ` [-mm patch] drivers/cpufreq/cpufreq_conservative.c: make cpufreq_gov_dbs static Adrian Bunk
2005-05-13  7:24 ` 2.6.12-rc4-mm1 Dave Airlie
2005-05-13  7:25   ` 2.6.12-rc4-mm1 Dave Airlie
2005-05-13 14:53 ` 2.6.12-rc4-mm1 steve
2005-05-13 18:12 ` [-mm patch] kprobes: arch_supports_kretprobes cleanup Frederik Deweerdt
2005-05-13 19:40 ` 2.6.12-rc4-mm1 Johannes Stezenbach
2005-05-14 11:27 ` 2.6.12-rc4-mm1 Richard Purdie
2005-05-16 11:27   ` 2.6.12-rc4-mm2 Richard Purdie
2005-05-15  1:20 ` 2.6.12-rc4-mm1 William Lee Irwin III
2005-05-15  1:30   ` 2.6.12-rc4-mm1 Andrew Morton
2005-05-15  9:44     ` 2.6.12-rc4-mm1 Jesper Juhl
2005-05-15  9:54       ` 2.6.12-rc4-mm1 Andrew Morton
2005-05-15  9:43 ` 2.6.12-rc4-mm1: drivers/usb/gadget/ether.c compile error Adrian Bunk
2005-05-16 15:26   ` David Brownell [this message]
2005-05-15 11:32 ` [-mm patch] arch/i386/Kconfig: SELECT_MEMORY_MODEL -> ARCH_SELECT_MEMORY_MODEL Adrian Bunk
2005-05-15 18:24   ` Dave Hansen

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=200505160826.38832.david-b@pacbell.net \
    --to=david-b@pacbell.net \
    --cc=akpm@osdl.org \
    --cc=bunk@stusta.de \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb-devel@lists.sourceforge.net \
    /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