public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: "Luck, Tony" <tony.luck@intel.com>
To: linux-ia64@vger.kernel.org
Subject: Re: [RFC]: Standardizing the SAL calls in arch/ia64
Date: Tue, 17 Jan 2006 17:59:35 +0000	[thread overview]
Message-ID: <20060117175935.GA4944@agluck-lia64.sc.intel.com> (raw)
In-Reply-To: <43CBF385.60205@sgi.com>

> 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.

-Tony

[1] which can have its own issues of code legibility.

      parent reply	other threads:[~2006-01-17 17:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-16 19:27 [RFC]: Standardizing the SAL calls in arch/ia64 Prarit Bhargava
2006-01-17  8:11 ` Jes Sorensen
2006-01-17 17:59 ` Luck, Tony [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060117175935.GA4944@agluck-lia64.sc.intel.com \
    --to=tony.luck@intel.com \
    --cc=linux-ia64@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox