Re: [PATCH 03/12] mce-severity: cleanup severity table

From: Ingo Molnar
Date: Fri May 27 2011 - 03:54:28 EST



* Borislav Petkov <bp@xxxxxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/