netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [sparse] get rid of warnings from 8139too driver
@ 2004-06-22 20:51 Stephen Hemminger
  2004-06-22 23:15 ` Francois Romieu
  2004-06-30 20:40 ` Jeff Garzik
  0 siblings, 2 replies; 3+ messages in thread
From: Stephen Hemminger @ 2004-06-22 20:51 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: netdev

Get rid of sparse warnings from 8139too driver. 
	* move start_thread which was inline into the open routine (only place called).
	* handle #if constructs

Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
 
diff -Nru a/drivers/net/8139too.c b/drivers/net/8139too.c
--- a/drivers/net/8139too.c	2004-06-22 13:45:03 -07:00
+++ b/drivers/net/8139too.c	2004-06-22 13:45:03 -07:00
@@ -613,7 +613,7 @@
 static int mdio_read (struct net_device *dev, int phy_id, int location);
 static void mdio_write (struct net_device *dev, int phy_id, int location,
 			int val);
-static inline void rtl8139_start_thread(struct net_device *dev);
+static int rtl8139_thread (void *data);
 static void rtl8139_tx_timeout (struct net_device *dev);
 static void rtl8139_init_ring (struct net_device *dev);
 static int rtl8139_start_xmit (struct sk_buff *skb,
@@ -1359,7 +1359,19 @@
 			dev->irq, RTL_R8 (MediaStatus),
 			tp->mii.full_duplex ? "full" : "half");
 
-	rtl8139_start_thread(dev);
+
+	tp->thr_pid = -1;
+	tp->twistie = 0;
+	tp->time_to_die = 0;
+	if (tp->chipset == CH_8139_K)
+		tp->twistie = 1;
+	else if (!(tp->drv_flags & HAS_LNK_CHNG)) {
+		tp->thr_pid = kernel_thread(rtl8139_thread, dev, CLONE_FS|CLONE_FILES);
+		if (tp->thr_pid < 0) {
+			printk (KERN_WARNING "%s: unable to start kernel thread\n",
+				dev->name);
+		}
+	}
 
 	return 0;
 }
@@ -1643,25 +1655,6 @@
 	complete_and_exit (&tp->thr_exited, 0);
 }
 
-static inline void rtl8139_start_thread(struct net_device *dev)
-{
-	struct rtl8139_private *tp = dev->priv;
-
-	tp->thr_pid = -1;
-	tp->twistie = 0;
-	tp->time_to_die = 0;
-	if (tp->chipset == CH_8139_K)
-		tp->twistie = 1;
-	else if (tp->drv_flags & HAS_LNK_CHNG)
-		return;
-
-	tp->thr_pid = kernel_thread(rtl8139_thread, dev, CLONE_FS|CLONE_FILES);
-	if (tp->thr_pid < 0) {
-		printk (KERN_WARNING "%s: unable to start kernel thread\n",
-			dev->name);
-	}
-}
-
 static inline void rtl8139_tx_clear (struct rtl8139_private *tp)
 {
 	tp->cur_tx = 0;
@@ -1960,7 +1953,7 @@
 			printk(KERN_DEBUG "%s:  rtl8139_rx() status %4.4x, size %4.4x,"
 				" cur %4.4x.\n", dev->name, rx_status,
 			 rx_size, cur_rx);
-#if RTL8139_DEBUG > 2
+#if defined(RTL8139_DEBUG) && RTL8139_DEBUG > 2
 		{
 			int i;
 			DPRINTK ("%s: Frame contents ", dev->name);
@@ -2039,7 +2032,7 @@
 
  done:
 
-#if RTL8139_DEBUG > 1
+#if defined(RTL8139_DEBUG) &&  RTL8139_DEBUG > 1
 	DPRINTK ("%s: Done rtl8139_rx(), current %4.4x BufAddr %4.4x,"
 		 " free to %4.4x, Cmd %2.2x.\n", dev->name, cur_rx,
 		 RTL_R16 (RxBufAddr),

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

* Re: [PATCH] [sparse] get rid of warnings from 8139too driver
  2004-06-22 20:51 [PATCH] [sparse] get rid of warnings from 8139too driver Stephen Hemminger
@ 2004-06-22 23:15 ` Francois Romieu
  2004-06-30 20:40 ` Jeff Garzik
  1 sibling, 0 replies; 3+ messages in thread
From: Francois Romieu @ 2004-06-22 23:15 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: Jeff Garzik, netdev

Stephen Hemminger <shemminger@osdl.org> :
> Get rid of sparse warnings from 8139too driver. 
> 	* move start_thread which was inline into the open routine (only place called).

I can understand that rtl8139_start_thread() appears a bit late in the file
but I appreciate the virtues of helpers functions as they document what
the code is supposed to achieve. Just mho of course.

--
Ueimor

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

* Re: [PATCH] [sparse] get rid of warnings from 8139too driver
  2004-06-22 20:51 [PATCH] [sparse] get rid of warnings from 8139too driver Stephen Hemminger
  2004-06-22 23:15 ` Francois Romieu
@ 2004-06-30 20:40 ` Jeff Garzik
  1 sibling, 0 replies; 3+ messages in thread
From: Jeff Garzik @ 2004-06-30 20:40 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev

Stephen Hemminger wrote:
> Get rid of sparse warnings from 8139too driver. 
> 	* move start_thread which was inline into the open routine (only place called).

as mentioned by Francois, I prefer the code separate, for clarity.

	Jeff

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

end of thread, other threads:[~2004-06-30 20:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-22 20:51 [PATCH] [sparse] get rid of warnings from 8139too driver Stephen Hemminger
2004-06-22 23:15 ` Francois Romieu
2004-06-30 20:40 ` Jeff Garzik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).