lkml.org 
[lkml]   [2011]   [May]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
DateFri, 27 May 2011 09:54:09 +0200
FromIngo Molnar <>
SubjectRe: [PATCH 03/12] mce-severity: cleanup severity table

* Borislav Petkov <bp@alien8.de> wrote:

> > - BITCLR(
> > - MCI_STATUS_VAL,
> > - NO, "Invalid"
> > + MCESEV(
> > + NO, "Invalid",
> > + BITCLR(MCI_STATUS_VAL)
> > ),
> > - BITCLR(
> > - MCI_STATUS_EN,
> > - NO, "Not enabled"
> > + MCESEV(
> > + NO, "Not enabled",
> > + BITCLR(MCI_STATUS_EN)
> > ),
> > - BITSET(
> > - MCI_STATUS_PCC,
> > - PANIC, "Processor context corrupt"
> > + MCESEV(
> > + PANIC, "Processor context corrupt",
> > + BITSET(MCI_STATUS_PCC)
> > ),
>
> I'm still wondering whether using the gcc struct assignment syntax could
> make those much more readable instead of changing the macro inclusion:
>
> {
> .sev = MCE_PANIC_SEVERITY,
> .msg = "Processor context corrupt",
> .mask = MCI_STATUS_PCC,
> .result = MCI_STATUS_PCC,
> },
> ...

Hidetoshi's version was already an improvement over what we have
currently (what we have now is largely unreadable), but your variant
looks even more readable and isnt all that much longer either.

So, the case for macros is where the initialization can be compressed
into a single *readable* line. If that cannot be done then the least
obfuscated version is generally the better one.

Thanks,

Ingo


\
 
 \ /
  Last update: 2011-05-27 09:57    [from the cache]
©2003-2010