Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 371696
b: refs/heads/master
c: d570216
h: refs/heads/master
v: v3
  • Loading branch information
Christine Spang authored and Takashi Iwai committed Mar 11, 2013
1 parent c56620e commit 49658b7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 24 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8ba955cef30921417dffba901a8af5a2662a1dec
refs/heads/master: d5702162f85526319c848c667df49ee1754dccef
12 changes: 5 additions & 7 deletions trunk/Documentation/DocBook/writing-an-alsa-driver.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -6164,14 +6164,12 @@ struct _snd_pcm_runtime {

<para>
The macro takes an conditional expression to evaluate.
When <constant>CONFIG_SND_DEBUG</constant>, is set, the
expression is actually evaluated. If it's non-zero, it shows
the warning message such as
When <constant>CONFIG_SND_DEBUG</constant>, is set, if the
expression is non-zero, it shows the warning message such as
<computeroutput>BUG? (xxx)</computeroutput>
normally followed by stack trace. It returns the evaluated
value.
When no <constant>CONFIG_SND_DEBUG</constant> is set, this
macro always returns zero.
normally followed by stack trace.

In both cases it returns the evaluated value.
</para>

</section>
Expand Down
24 changes: 8 additions & 16 deletions trunk/include/sound/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -379,18 +379,10 @@ void __snd_printk(unsigned int level, const char *file, int line,
* snd_BUG_ON - debugging check macro
* @cond: condition to evaluate
*
* When CONFIG_SND_DEBUG is set, this macro evaluates the given condition,
* and call WARN() and returns the value if it's non-zero.
*
* When CONFIG_SND_DEBUG is not set, this just returns zero, and the given
* condition is ignored.
*
* NOTE: the argument won't be evaluated at all when CONFIG_SND_DEBUG=n.
* Thus, don't put any statement that influences on the code behavior,
* such as pre/post increment, to the argument of this macro.
* If you want to evaluate and give a warning, use standard WARN_ON().
* Has the same behavior as WARN_ON when CONFIG_SND_DEBUG is set,
* otherwise just evaluates the conditional and returns the value.
*/
#define snd_BUG_ON(cond) WARN((cond), "BUG? (%s)\n", __stringify(cond))
#define snd_BUG_ON(cond) WARN_ON((cond))

#else /* !CONFIG_SND_DEBUG */

Expand All @@ -400,11 +392,11 @@ __printf(2, 3)
static inline void _snd_printd(int level, const char *format, ...) {}

#define snd_BUG() do { } while (0)
static inline int __snd_bug_on(int cond)
{
return 0;
}
#define snd_BUG_ON(cond) __snd_bug_on(0 && (cond)) /* always false */

#define snd_BUG_ON(condition) ({ \
int __ret_warn_on = !!(condition); \
unlikely(__ret_warn_on); \
})

#endif /* CONFIG_SND_DEBUG */

Expand Down

0 comments on commit 49658b7

Please sign in to comment.