All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Salyzyn, Mark" <mark_salyzyn@adaptec.com>
To: linux-scsi <linux-scsi@vger.kernel.org>
Subject: [PATCH] aacraid: resolve compiler warnings using ptrdiff_t
Date: Tue, 27 Mar 2007 15:07:28 -0400	[thread overview]
Message-ID: <AE4F746F2AECFC4DA4AADD66A1DFEF017A9910@otce2k301.adaptec.com> (raw)
In-Reply-To: <AE4F746F2AECFC4DA4AADD66A1DFEF017A9859@otce2k301.adaptec.com>

[-- Attachment #1: Type: text/plain, Size: 521 bytes --]

Unsigned long is not always the same size as a pointer, namely on 32 bit
systems with 64 bit address space. Ptrdiff_t is the same size as a
pointer in all configurations. By using ptrdiff_t we can mitigate the
warning messages on these configurations. There should be no side
effects of this patch.

ObligatoryDisclaimer: Please accept my condolences regarding Outlook's
handling of patches attachments.

This attached patch is against current scsi-misc-2.6

Signed-off-by: Mark Salyzyn <aacraid@adaptec.com>

[-- Attachment #2: aacraid_ptrdiff.patch --]
[-- Type: application/octet-stream, Size: 2073 bytes --]

diff -ru a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c
--- a/drivers/scsi/aacraid/commctrl.c	2007-03-27 14:51:11.670124719 -0400
+++ b/drivers/scsi/aacraid/commctrl.c	2007-03-27 15:00:53.286882719 -0400
@@ -391,10 +391,8 @@
 		/*
 		 *	Extract the fibctx from the input parameters
 		 */
-		if (fibctx->unique == (u32)(unsigned long)arg) {   
-			/* We found a winner */
+		if (fibctx->unique == (u32)(ptrdiff_t)arg) /* We found a winner */
 			break;
-		}
 		entry = entry->next;
 		fibctx = NULL;
 	}
Only in b: commctrl.c.orig
diff -ru a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c
--- a/drivers/scsi/aacraid/comminit.c	2007-03-27 14:51:11.670124719 -0400
+++ b/drivers/scsi/aacraid/comminit.c	2007-03-27 14:59:35.019740844 -0400
@@ -5,7 +5,7 @@
  * based on the old aacraid driver that is..
  * Adaptec aacraid device driver for Linux.
  *
- * Copyright (c) 2000 Adaptec, Inc. (aacraid@adaptec.com)
+ * Copyright (c) 2000-2007 Adaptec, Inc. (aacraid@adaptec.com)
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -110,7 +110,7 @@
 	/*
 	 *	Align the beginning of Headers to commalign
 	 */
-	align = (commalign - ((unsigned long)(base) & (commalign - 1)));
+	align = (commalign - ((ptrdiff_t)(base) & (commalign - 1)));
 	base = base + align;
 	phys = phys + align;
 	/*
diff -ru a/drivers/scsi/aacraid/dpcsup.c b/drivers/scsi/aacraid/dpcsup.c
--- a/drivers/scsi/aacraid/dpcsup.c	2007-03-27 14:51:11.671124593 -0400
+++ b/drivers/scsi/aacraid/dpcsup.c	2007-03-27 14:59:35.019740844 -0400
@@ -256,7 +256,8 @@
 			return 1;
 		}
 		memset(hw_fib, 0, sizeof(struct hw_fib));
-		memcpy(hw_fib, (struct hw_fib *)(((unsigned long)(dev->regs.sa)) + (index & ~0x00000002L)), sizeof(struct hw_fib));
+		memcpy(hw_fib, (struct hw_fib *)(((ptrdiff_t)(dev->regs.sa)) +
+		  (index & ~0x00000002L)), sizeof(struct hw_fib));
 		memset(fib, 0, sizeof(struct fib));
 		INIT_LIST_HEAD(&fib->fiblink);
 		fib->type = FSAFS_NTC_FIB_CONTEXT;

  reply	other threads:[~2007-03-27 19:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <AE4F746F2AECFC4DA4AADD66A1DFEF01400B18@otce2k301.adaptec.com>
2007-03-21 17:49 ` [PATCH] aacraid: cleanup and version stamp driver Salyzyn, Mark
2007-03-21 18:49   ` Boaz Harrosh
2007-03-21 19:10     ` Salyzyn, Mark
2007-03-21 19:43   ` [PATCH] aacraid: Add likely() and unlikely() Salyzyn, Mark
2007-03-22  9:24     ` Arjan van de Ven
2007-03-26 13:21       ` [PATCH] aacraid: Add likely() and unlikely() Take 2 Salyzyn, Mark
2007-03-27 15:51         ` [PATCH] aacraid: Add SMC and SUN products to README Salyzyn, Mark
2007-03-27 19:07           ` Salyzyn, Mark [this message]
2007-03-28 13:22             ` [PATCH] aacraid: remove unused or deprecated firmware constants Salyzyn, Mark
2007-03-28 17:44               ` [PATCH] aacraid: fix print of Firmware Build Date and add TSID Salyzyn, Mark

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=AE4F746F2AECFC4DA4AADD66A1DFEF017A9910@otce2k301.adaptec.com \
    --to=mark_salyzyn@adaptec.com \
    --cc=linux-scsi@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.