[linux-dvb] Re: [PATCH] LGDT3302 Frontend Driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Peter Beutner wrote:

> Michael Krufky schrieb:
>
>> Peter Beutner wrote:
>>
>>> Ben Dooks schrieb:
>>>
>>>>> I dont see why the code you posted above will break with dprintk 
>>>>> defined like this:
>>>>> #define dprintk(args...) if (debug) printk(KERN_DEBUG "lgdt3302: " 
>>>>> args)
>>>>>
>>>>> Imo:
>>>>>
>>>>> if(foo)
>>>>>     if (debug) printk(KERN_DEBUG "lgdt3302: " args);
>>>>> else
>>>>>     bar();
>>>>>
>>>>> should work like intended.
>>>>
>>>> The else will be part of the if (debug), not the if (foo) as
>>>> intended. This means that changing the dprintk macro would
>>>> end up breaking a number of things. Best to avoid these problems
>>>> in the first place.
>>>
>>> I see. Thx for the explanation.
>>
>> Doesn't this cover all bases:
>>
>>  #define dprintk(args...) { if (debug) printk(KERN_DEBUG "lgdt3302: " 
>> args); }
>
> No,
> this would resolve to:
>
> if(foo)
>     { if (debug) printk(KERN_DEBUG "lgdt3302: " args); };
> else
>     bar();
>
> where gcc would complain about the semicolon before else
> with a: syntax error before ?else?.

Okay, in that case, I will revert back to the following:

#define dprintk(args...) \
do { \
if (debug) printk(KERN_DEBUG "lgdt3302: " args); \
} while (0)


This is how it was originally, and Johannes said that this is 
acceptable. Any objections?

-- 
Michael Krufky





[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux