All of lore.kernel.org
 help / color / mirror / Atom feed
From: WANG Cong <xiyou.wangcong@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/6] use BUG_ON correctly
Date: Thu, 27 Jan 2011 07:41:58 +0000 (UTC)	[thread overview]
Message-ID: <ihr7k5$qmm$5@dough.gmane.org> (raw)
In-Reply-To: 4D411C69.8080503@coly.li

On Thu, 27 Jan 2011 15:19:05 +0800, Coly Li wrote:
>>>>
>>> Could you please to identify a piece of kernel code which provides an
>>> example as the condition you mentioned ? So I can have a look firstly.
>>
>>     #   line  filename / context / line
>>     1     35  arch/mips/include/asm/bug.h<<HAVE_ARCH_BUG_ON>>
>>               #define HAVE_ARCH_BUG_ON
>>     2    115  arch/powerpc/include/asm/bug.h<<HAVE_ARCH_BUG_ON>>
>>               #define HAVE_ARCH_BUG_ON
> 
> I don't find arch dependent implementation of BUG_ON from the above
> files. Do I miss something ?

arch/mips/include/asm/bug.h:

static inline void  __BUG_ON(unsigned long condition)
{
        if (__builtin_constant_p(condition)) {
                if (condition)
                        BUG();
                else
                        return;
        }
        __asm__ __volatile__("tne $0, %0, %1"
                             : : "r" (condition), "i" (BRK_BUG));
}

#define BUG_ON(C) __BUG_ON((unsigned long)(C))

#define HAVE_ARCH_BUG_ON


arch/powerpc/include/asm/bug.h:

#define BUG_ON(x) do {                                          \
        if (__builtin_constant_p(x)) {                          \
                if (x)                                          \
                        BUG();                                  \
        } else {                                                \
                __asm__ __volatile__(                           \
                "1:     "PPC_TLNEI"     %4,0\n"                 \
                _EMIT_BUG_ENTRY                                 \
                : : "i" (__FILE__), "i" (__LINE__), "i" (0),    \
                  "i" (sizeof(struct bug_entry)),               \
                  "r" ((__force long)(x)));                     \
        }                                                       \
} while (0)


  reply	other threads:[~2011-01-27  7:42 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-26 18:39 [PATCH 0/6] use BUG_ON correctly Coly Li
2011-01-26 18:39 ` [PATCH 1/6] mm: use BUG_ON correctly in nommu.c Coly Li
2011-01-26 18:39 ` [PATCH 2/6] dma: use BUG_ON correctly in iop-adma.c Coly Li
2011-01-26 18:39 ` [PATCH 3/6] dma: use BUG_ON correctly in mv_xor.c Coly Li
2011-01-26 18:39 ` [PATCH 4/6] dma: use BUG_ON correctly in ppc4xx/adam.c Coly Li
2011-01-26 18:39 ` [PATCH 5/6] wl_cfg80211.c: use BUG_ON correctly Coly Li
2011-01-26 18:39 ` [PATCH 6/6] scsi_lib.c: " Coly Li
2011-01-27  2:02 ` [PATCH 0/6] " Yong Zhang
2011-01-27  6:21   ` Coly Li
2011-01-27  6:07     ` Yong Zhang
2011-01-27  6:38       ` Coly Li
2011-01-27  6:20         ` Yong Zhang
2011-01-27  7:19           ` Coly Li
2011-01-27  7:41             ` WANG Cong [this message]
2011-01-26 18:54 Coly Li

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='ihr7k5$qmm$5@dough.gmane.org' \
    --to=xiyou.wangcong@gmail.com \
    --cc=linux-kernel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.