netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: David Miller <davem@davemloft.net>
Cc: vapier@gentoo.org, netdev@vger.kernel.org, nico@fluxnic.net,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] smc91x: fix unused flags warnings on UP systems
Date: Sat, 12 Dec 2009 18:49:38 -0800	[thread overview]
Message-ID: <20091212184938.bd057145.akpm@linux-foundation.org> (raw)
In-Reply-To: <20091211.151502.188418417.davem@davemloft.net>

On Fri, 11 Dec 2009 15:15:02 -0800 (PST) David Miller <davem@davemloft.net> wrote:

> From: Mike Frysinger <vapier@gentoo.org>
> Date: Wed,  9 Dec 2009 08:40:04 -0500
> 
> > Local flags variables will be declared whenever these functions get used,
> > but obviously on UP systems the flags parameter won't be touched.  So add
> > some dummy ops that get optimized away anyways to satisfy gcc's warnings.
> > 
> > Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> 
> Applied, although I thought we had a standard macro to handle this
> kind of case.

Nope.

Coverting them to real C functions fixes the warning, and provides
previously-absent typechecking.  ie, (untested):

--- a/drivers/net/smc91x.c~a
+++ a/drivers/net/smc91x.c
@@ -534,9 +534,18 @@ static inline void  smc_rcv(struct net_d
 #define smc_special_lock(lock, flags)		spin_lock_irqsave(lock, flags)
 #define smc_special_unlock(lock, flags) 	spin_unlock_irqrestore(lock, flags)
 #else
-#define smc_special_trylock(lock, flags)	(1)
-#define smc_special_lock(lock, flags)   	do { } while (0)
-#define smc_special_unlock(lock, flags)	do { } while (0)
+static inline int smc_special_trylock(spinlock_t *lock, unsigned long flags)
+{
+	return 1;
+}
+
+static inline void smc_special_lock(spinlock_t *lock, unsigned long flags)
+{
+}
+
+static inline void smc_special_unlock(spinlock_t *lock, unsigned long flags)
+{
+}
 #endif
 
 /*
_

      reply	other threads:[~2009-12-13  2:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-09 13:40 [PATCH] smc91x: fix unused flags warnings on UP systems Mike Frysinger
2009-12-09 14:51 ` Nicolas Pitre
2009-12-11 23:15 ` David Miller
2009-12-13  2:49   ` Andrew Morton [this message]

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=20091212184938.bd057145.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nico@fluxnic.net \
    --cc=vapier@gentoo.org \
    /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;
as well as URLs for NNTP newsgroup(s).