[RFC PATCH 0/2] ARM: Add a generic macro for declaring proc_info structs

Dave Martin dave.martin at linaro.org
Thu Jun 9 13:21:50 EDT 2011

Based on recent problems with variable-size Thumb instructions
inside tables, this patch adds an experimental macro for declaring
proc_info structs, as an example of the kind of build-time robustness
we could implement for these and similar structures.

As such, it's an illustration of something we _could_ do, rather
than something we necessarily should do.

I'd be interested in people's views on this.

Potential advantages include:

 * automatic build-time checking that struct proc_info is reasonably
in sync with the assembler definitions;

 * automatic checking that proc_info structure declarations are
complete and correctly structured, with no mis-sized or misaligned
elements (particularly important for Thumb-2 kernels);

 * better readability of the declarations (depending on people's
personal taste, of course);

 * reduction of some boilerplate code (perhaps up to 700 lines net
if we were to convert all arch/arm/mm/proc-*.S to use the macro.

The same general technique could be potentially expanded to cover
any struct defined in assembler.

However, this may be taking a sledgehammer to crack a nut,
and it will cause some churn, though it could leave is with a
cleaner situation afterwards.

Much lighter-weight, less invasive build-time checks could
still deliver significant benefits.

Dave Martin (2):
  ARM: Add a generic macro for declaring proc_info structs
  ARM: proc-v7: Use the new proc_info declaration macro

 arch/arm/mm/proc-macros.S |  141 +++++++++++++++++++++++++++++++++++++++++++++
 arch/arm/mm/proc-v7.S     |   93 ++++++++++++-----------------
 2 files changed, 179 insertions(+), 55 deletions(-)


More information about the linux-arm-kernel mailing list