diff options
author | David Brownell <david-b@pacbell.net> | 2007-07-17 07:04:04 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-17 13:23:04 -0400 |
commit | 4917d927809918f0070bd1077b41e3daf78643b2 (patch) | |
tree | 207df3ec533d72933170a69962ec44b864892f2c /drivers/spi/spidev.c | |
parent | ad241528c4919505afccb022acbab3eeb0db4d80 (diff) |
spidev compiler warning gone
Get rid of annoying GCC warning on 32-bit platforms.
drivers/spi/spidev.c: In function 'spidev_message':
drivers/spi/spidev.c:184: warning: cast to pointer from integer of different size
drivers/spi/spidev.c:216: warning: cast to pointer from integer of different size
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@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/spi/spidev.c')
-rw-r--r-- | drivers/spi/spidev.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c index d04242aee40d..38b60ad0eda0 100644 --- a/drivers/spi/spidev.c +++ b/drivers/spi/spidev.c | |||
@@ -181,7 +181,8 @@ static int spidev_message(struct spidev_data *spidev, | |||
181 | } | 181 | } |
182 | if (u_tmp->tx_buf) { | 182 | if (u_tmp->tx_buf) { |
183 | k_tmp->tx_buf = buf; | 183 | k_tmp->tx_buf = buf; |
184 | if (copy_from_user(buf, (const u8 __user *)u_tmp->tx_buf, | 184 | if (copy_from_user(buf, (const u8 __user *) |
185 | (ptrdiff_t) u_tmp->tx_buf, | ||
185 | u_tmp->len)) | 186 | u_tmp->len)) |
186 | goto done; | 187 | goto done; |
187 | } | 188 | } |
@@ -213,7 +214,8 @@ static int spidev_message(struct spidev_data *spidev, | |||
213 | buf = spidev->buffer; | 214 | buf = spidev->buffer; |
214 | for (n = n_xfers, u_tmp = u_xfers; n; n--, u_tmp++) { | 215 | for (n = n_xfers, u_tmp = u_xfers; n; n--, u_tmp++) { |
215 | if (u_tmp->rx_buf) { | 216 | if (u_tmp->rx_buf) { |
216 | if (__copy_to_user((u8 __user *)u_tmp->rx_buf, buf, | 217 | if (__copy_to_user((u8 __user *) |
218 | (ptrdiff_t) u_tmp->rx_buf, buf, | ||
217 | u_tmp->len)) { | 219 | u_tmp->len)) { |
218 | status = -EFAULT; | 220 | status = -EFAULT; |
219 | goto done; | 221 | goto done; |