public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@gmail.com>
To: Greg Kroah-Hartman <gregkh@suse.de>, Martyn Welch <martyn.welch@ge.com>
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/8] Staging: vme_ca91cx42: fix compiler warning on 64-bit build
Date: Mon, 13 Dec 2010 22:16:29 +0900	[thread overview]
Message-ID: <1292246196-2332-1-git-send-email-namhyung@gmail.com> (raw)

The gcc complains about the cast pointer to int on 64-bit as follows.
Use unsigned long instead and wrap it up in new macro.

  CC [M]  drivers/staging/vme/bridges/vme_ca91cx42.o
drivers/staging/vme/bridges/vme_ca91cx42.c: In function ‘ca91cx42_master_read’:
drivers/staging/vme/bridges/vme_ca91cx42.c:870: warning: cast from pointer to integer of different size
drivers/staging/vme/bridges/vme_ca91cx42.c:876: warning: cast from pointer to integer of different size
drivers/staging/vme/bridges/vme_ca91cx42.c: In function ‘ca91cx42_master_write’:
drivers/staging/vme/bridges/vme_ca91cx42.c:924: warning: cast from pointer to integer of different size
drivers/staging/vme/bridges/vme_ca91cx42.c:930: warning: cast from pointer to integer of different size
drivers/staging/vme/bridges/vme_ca91cx42.c: In function ‘ca91cx42_master_rmw’:
drivers/staging/vme/bridges/vme_ca91cx42.c:983: warning: cast from pointer to integer of different size

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
I'm not sure about the name. Suggestions?

 drivers/staging/vme/bridges/vme_ca91cx42.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/vme/bridges/vme_ca91cx42.c b/drivers/staging/vme/bridges/vme_ca91cx42.c
index d1df7d12f504..cb72a5d1eeca 100644
--- a/drivers/staging/vme/bridges/vme_ca91cx42.c
+++ b/drivers/staging/vme/bridges/vme_ca91cx42.c
@@ -845,6 +845,8 @@ int ca91cx42_master_get(struct vme_master_resource *image, int *enabled,
 	return retval;
 }
 
+#define check_aligned(addr, align)	((unsigned long)addr & align)
+
 ssize_t ca91cx42_master_read(struct vme_master_resource *image, void *buf,
 	size_t count, loff_t offset)
 {
@@ -867,13 +869,13 @@ ssize_t ca91cx42_master_read(struct vme_master_resource *image, void *buf,
 	 * maximal configured data cycle is used and splits it
 	 * automatically for non-aligned addresses.
 	 */
-	if ((int)addr & 0x1) {
+	if (check_aligned(addr, 0x1)) {
 		*(u8 *)buf = ioread8(addr);
 		done += 1;
 		if (done == count)
 			goto out;
 	}
-	if ((int)addr & 0x2) {
+	if (check_aligned(addr, 0x2)) {
 		if ((count - done) < 2) {
 			*(u8 *)(buf + done) = ioread8(addr + done);
 			done += 1;
@@ -921,13 +923,13 @@ ssize_t ca91cx42_master_write(struct vme_master_resource *image, void *buf,
 	/* Here we apply for the same strategy we do in master_read
 	 * function in order to assure D16 cycle when required.
 	 */
-	if ((int)addr & 0x1) {
+	if (check_aligned(addr, 0x1)) {
 		iowrite8(*(u8 *)buf, addr);
 		done += 1;
 		if (done == count)
 			goto out;
 	}
-	if ((int)addr & 0x2) {
+	if (check_aligned(addr, 0x2)) {
 		if ((count - done) < 2) {
 			iowrite8(*(u8 *)(buf + done), addr + done);
 			done += 1;
@@ -980,7 +982,7 @@ unsigned int ca91cx42_master_rmw(struct vme_master_resource *image,
 	/* Lock image */
 	spin_lock(&(image->lock));
 
-	pci_addr = (u32)image->kern_base + offset;
+	pci_addr = (u32)(unsigned long)image->kern_base + offset;
 
 	/* Address must be 4-byte aligned */
 	if (pci_addr & 0x3) {
-- 
1.7.3.3.400.g93cef


             reply	other threads:[~2010-12-13 13:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-13 13:16 Namhyung Kim [this message]
2010-12-13 13:16 ` [PATCH 2/8] Staging: vme_bridge: mark vme_master_resource->kern_base as __iomem Namhyung Kim
2010-12-13 18:36   ` Greg KH
2010-12-14  4:52     ` Namhyung Kim
2010-12-14  9:15       ` Martyn Welch
2010-12-13 13:16 ` [PATCH 3/8] Staging: vme_ca91cx42: mark ca91cx42_driver->base " Namhyung Kim
2010-12-13 13:16 ` [PATCH 4/8] Staging: vme_ca91cx42: remove unreachable code Namhyung Kim
2010-12-13 13:16 ` [PATCH 5/8] Staging: vme_ca91cx42: make functions static Namhyung Kim
2010-12-13 13:16 ` [PATCH 6/8] Staging: vme_tsi148: mark tsi148_driver->base as __iomem Namhyung Kim
2010-12-13 13:16 ` [PATCH 7/8] Staging: vme_tsi148: remove unreachable code Namhyung Kim
2010-12-13 13:16 ` [PATCH 8/8] Staging: vme_tsi148: make functions static Namhyung Kim
2010-12-13 13:50 ` [PATCH 1/8] Staging: vme_ca91cx42: fix compiler warning on 64-bit build Jiri Slaby
2010-12-13 14:16   ` Namhyung Kim

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=1292246196-2332-1-git-send-email-namhyung@gmail.com \
    --to=namhyung@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martyn.welch@ge.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