mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: akpm@linux-foundation.org
Cc: JBeulich@novell.com, linux-kernel@vger.kernel.org,
	sparclinux@vger.kernel.org
Subject: Re: [PATCH] fix BUILD_BUG_ON() and a couple of bogus uses of it
Date: Thu, 17 Sep 2009 17:01:56 -0700 (PDT)	[thread overview]
Message-ID: <20090917.170156.152594715.davem@davemloft.net> (raw)
In-Reply-To: <20090917162437.b1a890de.akpm@linux-foundation.org>

From: Andrew Morton <akpm@linux-foundation.org>
Date: Thu, 17 Sep 2009 16:24:37 -0700

> sparc64:
> 
> In file included from arch/sparc/kernel/vio.c:17:
> /usr/src/devel/arch/sparc/include/asm/vio.h: In function `vio_dring_avail':
> /usr/src/devel/arch/sparc/include/asm/vio.h:261: error: bit-field `<anonymous>' width not an integer constant
> 
> static inline u32 vio_dring_avail(struct vio_dring_state *dr,
> 				  unsigned int ring_size)
> {
> 	BUILD_BUG_ON(!is_power_of_2(ring_size));
> 
> 	return (dr->pending -
> 		((dr->prod - dr->cons) & (ring_size - 1)));
> }
> 
> changing it to MAYBE_BUILD_BUG_ON seems to have fixed it.

That's completely bogus.

First of all, arch/sparc/kernel/vio.c never calls this function
so it should never be evaluated.

Second of all, all the places that do call this function only
pass pure constants as the 'ring_size' parameter.

drivers/block/sunvdc.c:

static inline u32 vdc_tx_dring_avail(struct vio_dring_state *dr)
{
	return vio_dring_avail(dr, VDC_TX_RING_SIZE);
}

drivers/net/sunvnet.c:

static inline u32 vnet_tx_dring_avail(struct vio_dring_state *dr)
{
	return vio_dring_avail(dr, VNET_TX_RING_SIZE);
}

Making this MAYBE_BUILD_BUG_ON shouldn't be necessary.

  reply	other threads:[~2009-09-18  0:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-18 15:59 Jan Beulich
2009-09-17 23:24 ` Andrew Morton
2009-09-18  0:01   ` David Miller [this message]
2009-09-18  0:15     ` Andrew Morton
2009-09-18  0:18       ` Andrew Morton
2009-09-18  0:31       ` David Miller
2009-09-18  0:45         ` David Miller
2009-09-22  6:45 ` Rusty Russell
2009-09-23  0:57 ` Rusty Russell

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=20090917.170156.152594715.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=JBeulich@novell.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sparclinux@vger.kernel.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

all inboxes | Powered by JetHome®