Re: [PATCH] sparc64: Add preprocessor symbols for PAGE_* pgprot_t values.
From: David Miller
Date: Mon Nov 03 2014 - 11:29:56 EST
From: Clemens Ladisch <clemens@xxxxxxxxxx>
Date: Mon, 03 Nov 2014 10:44:40 +0100
> David Miller wrote:
>> I'd also rather the kernel use Kconfig based symbols to detect for
>> arch availability of feature X or Y, assuming things are CPP symbols
>> is very fragile at best.
>
> It is certainly possible to use Kconfig-based symbols. However, this
> would have its own fragility: adding, e.g., PAGE_KERNEL_SO to an arch
> requires that one remembers to update Kconfig, and if one forgets,
> a check like this:
>
> #ifndef CONFIG_ARCH_HAS_PAGE_KERNEL_RO
> #define PAGE_KERNEL_RO PAGE_KERNEL /* fallback for this code */
> #endif
>
> will not detect the error on sparc64 (if PAGE_KERNEL_RO were a CPP
> symbol, the compiler would complain about the redefinition).
>
> So even if PAGE_KERNEL_RO is a variable, making it into a CPP symbol
> is beneficial. And once it is a CPP symbol, introducing a separate
> Kconfig-based symbol is not necessary and just increases the chances
> of an error.
I'd rather code then use the symbol unconditionally, and we declare that
it's something every architecture must provide in some shape or form.
This CPP check business is fragile as hell and I'm not going to promote
it in the architectures I maintainer by applying patches like your's.
Sorry.
--
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/