Re: [RFC]: Standardizing the SAL calls in arch/ia64

From: Luck, Tony <>
Date: 2006-01-18 04:59:35
> I agree with the principle, the current SAL code is an utter
> mess. However, rather than obfuscating the code with a bunch of
> macros, I'd prefer to simply stick a guideline at the top of the
> relevant files and then change the code to match that. In particular
> declaring variables within macros and macros that call 'return' aren't
> good for making the code easy to read.

If the SAL stubs are sufficently regular, then you *might* make
a macro (or small set of macros) to generate them:

#define MK_VOID_SAL_STUB(fname, salfn)			\
static inline s64					\
fname(void)						\
{							\
	struct ia64_sal_retval isrv;			\
	SAL_CALL(isrv, salfn, 0, 0, 0, 0, 0, 0, 0);	\
	return isrv.status;				\

MK_VOID_SAL_STUB(ia64_sal_cache_init, SAL_CACHE_INIT)

But I think that you'd end up with lots of generator macros that are
only used once each unless you are astonishingly clever[1] with cpp macros,
so you'd have been better off to just write them in C.

Macros to generate functions can also be irritating as tools like
cscope can't show you the definition ... but they are used elsewhere
in the Linux kernel.

Summary: take a quick look at whether macros might help, if not then
just clean up the C code.


[1] which can have its own issues of code legibility.
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to
More majordomo info at
Received on Wed Jan 18 05:00:09 2006

This archive was generated by hypermail 2.1.8 : 2006-01-18 05:00:16 EST