All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch 2.6.22-rc2-git] spidev compiler warning gone
@ 2007-05-25 17:35 David Brownell
       [not found] ` <200705251035.10587.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: David Brownell @ 2007-05-25 17:35 UTC (permalink / raw)
  To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f; +Cc: Andrew Morton

Get rid of annoying GCC warning on 32-bit platforms.  The trick is to
add an extra cast using "ptrdiff_t" to convert the u64 to the correct
size integer, and only then casting it into a "void *" pointer.

Signed-off-by: David Brownell <dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
---
 drivers/spi/spidev.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--- g26.orig/drivers/spi/spidev.c	2007-05-24 12:04:46.000000000 -0700
+++ g26/drivers/spi/spidev.c	2007-05-25 10:31:56.000000000 -0700
@@ -181,7 +181,8 @@ static int spidev_message(struct spidev_
 		}
 		if (u_tmp->tx_buf) {
 			k_tmp->tx_buf = buf;
-			if (copy_from_user(buf, (const u8 __user *)u_tmp->tx_buf,
+			if (copy_from_user(buf, (const u8 __user *)
+						(ptrdiff_t) u_tmp->tx_buf,
 					u_tmp->len))
 				goto done;
 		}
@@ -213,7 +214,8 @@ static int spidev_message(struct spidev_
 	buf = spidev->buffer;
 	for (n = n_xfers, u_tmp = u_xfers; n; n--, u_tmp++) {
 		if (u_tmp->rx_buf) {
-			if (__copy_to_user((u8 __user *)u_tmp->rx_buf, buf,
+			if (__copy_to_user((u8 __user *)
+					(ptrdiff_t) u_tmp->rx_buf, buf,
 					u_tmp->len)) {
 				status = -EFAULT;
 				goto done;

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-05-30  2:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-25 17:35 [patch 2.6.22-rc2-git] spidev compiler warning gone David Brownell
     [not found] ` <200705251035.10587.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2007-05-29 22:02   ` Andrew Morton
     [not found]     ` <20070529150214.75204439.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2007-05-29 22:39       ` David Brownell
     [not found]         ` <200705291539.04253.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2007-05-29 22:59           ` Andrew Morton
     [not found]             ` <20070529155911.105c65b7.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2007-05-30  2:05               ` David Brownell
     [not found]                 ` <200705291905.34670.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2007-05-30  2:19                   ` Andrew Morton

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.