summaryrefslogtreecommitdiff
path: root/drivers/media
diff options
context:
space:
mode:
authorAndy Walls <awalls@radix.net>2008-09-04 20:16:40 +0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-10-12 15:36:58 +0400
commitac2b97b13e5627127b8e29dc0e1e1d7be03eaae4 (patch)
tree6c16036a5fb7f959e82d81a1a68d4fa325096f0d /drivers/media
parentc641d09c60bfa36c7cf70444f24265090e51f5ce (diff)
downloadlinux-ac2b97b13e5627127b8e29dc0e1e1d7be03eaae4.tar.xz
V4L/DVB (8915): cx18: Increment u8 pointers not void pointers.
cx18: Increment u8 pointers not void pointers. Incrementing void pointers is dubious and the real intent in cx18_memcpy_fromio() and cx18_memset_io() is to increment by bytes, so use u8 pointers instead. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/cx18/cx18-io.c56
1 files changed, 30 insertions, 26 deletions
diff --git a/drivers/media/video/cx18/cx18-io.c b/drivers/media/video/cx18/cx18-io.c
index d92f627d35e4..5d07b0fd8a17 100644
--- a/drivers/media/video/cx18/cx18-io.c
+++ b/drivers/media/video/cx18/cx18-io.c
@@ -27,63 +27,67 @@
void cx18_memcpy_fromio(struct cx18 *cx, void *to,
const void __iomem *from, unsigned int len)
{
+ const u8 *src = from;
+ u8 *dst = to;
+
/* Align reads on the CX23418's addresses */
- if ((len > 0) && ((unsigned)from & 1)) {
- *((u8 *)to) = cx18_readb(cx, from);
+ if ((len > 0) && ((unsigned long) src & 1)) {
+ *dst = cx18_readb(cx, src);
len--;
- to++;
- from++;
+ dst++;
+ src++;
}
- if ((len > 1) && ((unsigned)from & 2)) {
- *((u16 *)to) = cx18_raw_readw(cx, from);
+ if ((len > 1) && ((unsigned long) src & 2)) {
+ *((u16 *)dst) = cx18_raw_readw(cx, src);
len -= 2;
- to += 2;
- from += 2;
+ dst += 2;
+ src += 2;
}
while (len > 3) {
- *((u32 *)to) = cx18_raw_readl(cx, from);
+ *((u32 *)dst) = cx18_raw_readl(cx, src);
len -= 4;
- to += 4;
- from += 4;
+ dst += 4;
+ src += 4;
}
if (len > 1) {
- *((u16 *)to) = cx18_raw_readw(cx, from);
+ *((u16 *)dst) = cx18_raw_readw(cx, src);
len -= 2;
- to += 2;
- from += 2;
+ dst += 2;
+ src += 2;
}
if (len > 0)
- *((u8 *)to) = cx18_readb(cx, from);
+ *dst = cx18_readb(cx, src);
}
void cx18_memset_io(struct cx18 *cx, void __iomem *addr, int val, size_t count)
{
+ u8 *dst = addr;
u16 val2 = val | (val << 8);
u32 val4 = val2 | (val2 << 16);
/* Align writes on the CX23418's addresses */
- if ((count > 0) && ((unsigned)addr & 1)) {
- cx18_writeb(cx, (u8) val, addr);
+ if ((count > 0) && ((unsigned long)dst & 1)) {
+ cx18_writeb(cx, (u8) val, dst);
count--;
- addr++;
+ dst++;
}
- if ((count > 1) && ((unsigned)addr & 2)) {
- cx18_writew(cx, val2, addr);
+ if ((count > 1) && ((unsigned long)dst & 2)) {
+ cx18_writew(cx, val2, dst);
count -= 2;
- addr += 2;
+ dst += 2;
}
while (count > 3) {
- cx18_writel(cx, val4, addr);
+ cx18_writel(cx, val4, dst);
count -= 4;
- addr += 4;
+ dst += 4;
}
if (count > 1) {
- cx18_writew(cx, val2, addr);
+ cx18_writew(cx, val2, dst);
count -= 2;
- addr += 2;
+ dst += 2;
}
if (count > 0)
- cx18_writeb(cx, (u8) val, addr);
+ cx18_writeb(cx, (u8) val, dst);
}
void cx18_sw1_irq_enable(struct cx18 *cx, u32 val)