public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: Prarit Bhargava <prarit@sgi.com>
To: linux-ia64@vger.kernel.org
Subject: [RFC]: Standardizing the SAL calls in arch/ia64
Date: Mon, 16 Jan 2006 19:27:01 +0000	[thread overview]
Message-ID: <43CBF385.60205@sgi.com> (raw)

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

Hello all,

I recently did a small amount of work on a SAL call in the patch

http://www.gelato.unsw.edu.au/archives/linux-ia64/0512/16309.html

While coding for this patch I noticed several minor-medium issues with
the SAL calls.

1) Some SAL calls do not properly return a SAL status.
2) Many of the SAL calls do not properly set ia64_sal_retval values to 0.
3) Callers of the SAL calls are not doing error checking.
4) The SAL status returns are not #define'd anywhere.
5) Several "dead" calls remaining in the code base.
6) Lots of Documentation/CodingStyle fix ups needed...

After looking at the SAL calls in arch/ia64, I suggest that we standardize
the SAL calls by using:

#define SAL_CALL_RETURN(isrv) do {      \
         return isrv.status;             \
} while (0)

b) return status and isrv.v0,

#define SAL_CALL_RETURN_V0(isrv, value) do {    \
         *value = isrv.v0;                       \
         return isrv.status;                     \
} while (0)

#define SAL_RETVAL_DECLARE(isrv) do {                   \
         struct ia64_sal_retval isrv = { 0,0,0,0 };      \
}while (0)

Admittedly, there are two or three cases which do not fit this model, but
this goes a long way to cleaning up the code.

For example,

static inline u64
ia64_sal_get_state_info_size (u64 sal_info_type)
{
         struct ia64_sal_retval isrv;
         SAL_CALL_REENTRANT(isrv, SAL_GET_STATE_INFO_SIZE, sal_info_type,
			   0, 0, 0, 0, 0, 0);
         if (isrv.status)
                 return 0;
         return isrv.v0;
}

would become

static s64
ia64_sal_get_state_info_size (u64 sal_info_type, u64 *result)
{
         SAL_RETVAL_DECLARE(isrv);
         SAL_CALL_REENTRANT(isrv, SAL_GET_STATE_INFO_SIZE, sal_info_type,
			   0, 0, 0, 0, 0, 0);
         SAL_CALL_RETURN_V0(isrv,result);
}

Thoughts, concerns?

P.

             reply	other threads:[~2006-01-16 19:27 UTC|newest]

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

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=43CBF385.60205@sgi.com \
    --to=prarit@sgi.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