Changeset 93


Ignore:
Timestamp:
May 4, 2007, 8:15:36 AM (18 years ago)
Author:
Brendan Oakley
Message:

Merged driver.h from beta9 to beta10.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GPL/branches/alsa-resync1/alsa-kernel/include/sound/driver.h

    r92 r93  
    2323 */
    2424
    25 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
    26 #define NEW_MACRO_VARARGS
    27 #endif
    28 
    2925#ifdef ALSA_BUILD
    3026#include "config.h"
     
    106102#include <linux/kernel.h>
    107103#include <linux/sched.h>
    108 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 7)
    109 #include <linux/malloc.h>
    110 #else
    111104#include <linux/slab.h>
    112 #endif
    113105#include <linux/delay.h>
    114106#include <linux/bitops.h>
     
    597589/* --- */
    598590
    599 #ifdef NEW_MACRO_VARARGS
    600 
    601 /*
    602  *  VARARGS section
    603  */
    604 
    605 #define snd_printk(...) do {\
     591#define snd_printk(format, args...) do { \
    606592        printk("ALSA %s:%d: ", __FILE__, __LINE__); \
    607         printk(__VA_ARGS__); \
     593        printk(format, ##args); \
    608594} while (0)
    609595
    610596#ifdef CONFIG_SND_DEBUG
    611597
    612 #define snd_printd(...) snd_printk(__VA_ARGS__)
    613 #define snd_assert(expr, ...) do {\
     598#define snd_printd(format, args...) snd_printk(format, ##args)
     599#define snd_assert(expr, args...) do {\
    614600        if (!(expr)) {\
    615601                snd_printk("BUG? (%s) (called from %p)\n", __STRING(expr), __builtin_return_address(0));\
    616                 __VA_ARGS__;\
    617         }\
    618 } while (0)
    619 #define snd_runtime_check(expr, ...) do {\
    620         if (!(expr)) {\
    621                 snd_printk("ERROR (%s) (called from %p)\n", __STRING(expr), __builtin_return_address(0));\
    622                 __VA_ARGS__;\
    623         }\
    624 } while (0)
    625 
    626 #else /* !CONFIG_SND_DEBUG */
    627 
    628 #define snd_printd(...) /* nothing */
    629 #define snd_assert(expr, ...)   /* nothing */
    630 #define snd_runtime_check(expr, ...) do { if (!(expr)) {__VA_ARGS__;} } while (0)
    631 
    632 #endif /* CONFIG_SND_DEBUG */
    633 
    634 #ifdef CONFIG_SND_DEBUG_DETECT
    635 #define snd_printdd(...) snd_printk(__VA_ARGS__)
    636 #else
    637 #define snd_printdd(...) /* nothing */
    638 #endif
    639 
    640 #else /* !NEW_MACRO_VARARGS */
    641 
    642 /*
    643  *  Old args section...
    644  */
    645 
    646 #ifdef TARGET_OS2
    647 
    648 #define snd_printk printk
    649 
    650 #ifdef CONFIG_SND_DEBUG
    651 
    652 #define snd_printd snd_printk
    653 #define snd_assert(expr, retval) \
    654         if (!(expr)) {\
    655                 snd_printk("BUG? (%s)\n", __STRING(expr));\
    656                 ##retval;\
    657         }
    658 
    659 #define snd_runtime_check snd_assert
    660 #define snd_runtime_check_continue snd_assert_continue
    661 
    662 
    663 #else /* !CONFIG_SND_DEBUG */
    664 
    665 #define snd_printd  1 ? (void)0 : (void)((int (*)(char *, ...)) NULL)
    666 #define snd_assert(expr, retval) \
    667         if (!(expr)) {\
    668                 ##retval;\
    669         }
    670 #define snd_runtime_check snd_assert
    671 
    672 #endif /* CONFIG_SND_DEBUG */
    673 
    674 #ifdef CONFIG_SND_DEBUG_DETECT
    675 #define snd_printdd snd_printk
    676 #else
    677 #define snd_printdd 1 ? (void)0 : (void)((int (*)(char *, ...)) NULL)
    678 #endif
    679 
    680 #else
    681 #define snd_printk(args...) do {\
    682         printk("ALSA %s:%d: ", __FILE__, __LINE__); \
    683         printk(##args); \
    684 } while (0)
    685 
    686 #ifdef CONFIG_SND_DEBUG
    687 
    688 #define snd_printd(args...) snd_printk(##args)
    689 #define snd_assert(expr, args...) do {\
    690         if (!(expr)) {\
    691                 snd_printk("BUG? (%s)\n", __STRING(expr));\
    692                 ##args;\
     602                args;\
    693603        }\
    694604} while (0)
    695605#define snd_runtime_check(expr, args...) do {\
    696606        if (!(expr)) {\
    697                 snd_printk("ERROR (%s)\n", __STRING(expr));\
    698                 ##args;\
     607                snd_printk("ERROR (%s) (called from %p)\n", __STRING(expr), __builtin_return_address(0));\
     608                args;\
    699609        }\
    700610} while (0)
     
    702612#else /* !CONFIG_SND_DEBUG */
    703613
    704 #define snd_printd(args...) /* nothing */
     614#define snd_printd(format, args...)     /* nothing */
    705615#define snd_assert(expr, args...)       /* nothing */
    706 #define snd_runtime_check(expr, args...) do { if (!(expr)) {##args;} } while (0)
     616#define snd_runtime_check(expr, args...) do { if (!(expr)) { args; } } while (0)
    707617
    708618#endif /* CONFIG_SND_DEBUG */
    709619
    710620#ifdef CONFIG_SND_DEBUG_DETECT
    711 #define snd_printdd(args...) snd_printk(##args)
     621#define snd_printdd(format, args...) snd_printk(format, ##args)
    712622#else
    713 #define snd_printdd(args...) /* nothing */
    714 #endif
    715 #endif
    716 
    717 #endif /* NEW_MACRO_VARARGS */
     623#define snd_printdd(format, args...) /* nothing */
     624#endif
     625
     626#define snd_BUG() snd_assert(0, )
     627
    718628
    719629#ifdef DEBUG
Note: See TracChangeset for help on using the changeset viewer.