public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: "Stephen M. Cameron" <scameron@beardog.cce.hp.com>
To: linux-scsi@vger.kernel.org
Cc: james.bottomley@suse.de, mikem@beardog.cce.hp.com
Subject: [PATCH 7/9] hpsa: Clarify calculation of padding for commandlist structure
Date: Thu, 25 Feb 2010 14:03:22 -0600	[thread overview]
Message-ID: <20100225200322.7508.41589.stgit@beardog.cce.hp.com> (raw)
In-Reply-To: <20100225200125.7508.11486.stgit@beardog.cce.hp.com>

From: Stephen M. Cameron <scameron@beardog.cce.hp.com>

hpsa: Clarify calculation of padding for commandlist structure

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
---
 drivers/scsi/hpsa_cmd.h |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/hpsa_cmd.h b/drivers/scsi/hpsa_cmd.h
index 3e0abdf..43b6f1c 100644
--- a/drivers/scsi/hpsa_cmd.h
+++ b/drivers/scsi/hpsa_cmd.h
@@ -313,12 +313,18 @@ struct CommandList {
 	void   *scsi_cmd;
 
 /* on 64 bit architectures, to get this to be 32-byte-aligned
- * it so happens we need no padding, on 32 bit systems,
- * we need 8 bytes of padding.   This does that.
+ * it so happens we need PAD_64 bytes of padding, on 32 bit systems,
+ * we need PAD_32 bytes of padding (see below).   This does that.
+ * If it happens that 64 bit and 32 bit systems need different
+ * padding, PAD_32 and PAD_64 can be set independently, and.
+ * the code below will do the right thing.
  */
-#define COMMANDLIST_PAD ((8 - sizeof(long))/4 * 8)
+#define IS_32_BIT ((8 - sizeof(long))/4)
+#define IS_64_BIT (!IS_32_BIT)
+#define PAD_32 (8)
+#define PAD_64 (0)
+#define COMMANDLIST_PAD (IS_32_BIT * PAD_32 + IS_64_BIT * PAD_64)
 	u8 pad[COMMANDLIST_PAD];
-
 };
 
 /* Configuration Table Structure */


  parent reply	other threads:[~2010-02-25 20:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-25 20:02 [PATCH 0/9] hpsa: driver updates Stephen M. Cameron
2010-02-25 20:02 ` [PATCH 1/9] hpsa: allow modifying device queue depth Stephen M. Cameron
2010-02-25 20:02 ` [PATCH 2/9] hpsa: fix firmwart typo Stephen M. Cameron
2010-02-25 20:03 ` [PATCH 3/9] hpsa: fix scsi status mis-shift Stephen M. Cameron
2010-02-25 20:03 ` [PATCH 4/9] hpsa: return -ENOMEM, not -1 Stephen M. Cameron
2010-02-25 20:03 ` [PATCH 5/9] hpsa: remove scan thread Stephen M. Cameron
2010-02-25 20:03 ` [PATCH 6/9] hpsa: mark hpsa_pci_init as __devinit Stephen M. Cameron
2010-02-25 20:03 ` Stephen M. Cameron [this message]
2010-02-25 20:03 ` [PATCH 8/9] hpsa: Increase the number of scatter gather elements supported Stephen M. Cameron
2010-02-25 20:03 ` [PATCH 9/9] hpsa: remove unused members next, prev, and retry_count from command list structure Stephen M. Cameron

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=20100225200322.7508.41589.stgit@beardog.cce.hp.com \
    --to=scameron@beardog.cce.hp.com \
    --cc=james.bottomley@suse.de \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mikem@beardog.cce.hp.com \
    /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