aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx18/cx18-io.c
diff options
context:
space:
mode:
authorAndy Walls <awalls@radix.net>2008-09-04 12:16:40 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-10-12 07:36:58 -0400
commitac2b97b13e5627127b8e29dc0e1e1d7be03eaae4 (patch)
tree6c16036a5fb7f959e82d81a1a68d4fa325096f0d /drivers/media/video/cx18/cx18-io.c
parentc641d09c60bfa36c7cf70444f24265090e51f5ce (diff)
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/video/cx18/cx18-io.c')
-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 @@
27void cx18_memcpy_fromio(struct cx18 *cx, void *to, 27void cx18_memcpy_fromio(struct cx18 *cx, void *to,
28 const void __iomem *from, unsigned int len) 28 const void __iomem *from, unsigned int len)
29{ 29{
30 const u8 *src = from;
31 u8 *dst = to;
32
30 /* Align reads on the CX23418's addresses */ 33 /* Align reads on the CX23418's addresses */
31 if ((len > 0) && ((unsigned)from & 1)) { 34 if ((len > 0) && ((unsigned long) src & 1)) {
32 *((u8 *)to) = cx18_readb(cx, from); 35 *dst = cx18_readb(cx, src);
33 len--; 36 len--;
34 to++; 37 dst++;
35 from++; 38 src++;
36 } 39 }
37 if ((len > 1) && ((unsigned)from & 2)) { 40 if ((len > 1) && ((unsigned long) src & 2)) {
38 *((u16 *)to) = cx18_raw_readw(cx, from); 41 *((u16 *)dst) = cx18_raw_readw(cx, src);
39 len -= 2; 42 len -= 2;
40 to += 2; 43 dst += 2;
41 from += 2; 44 src += 2;
42 } 45 }
43 while (len > 3) { 46 while (len > 3) {
44 *((u32 *)to) = cx18_raw_readl(cx, from); 47 *((u32 *)dst) = cx18_raw_readl(cx, src);
45 len -= 4; 48 len -= 4;
46 to += 4; 49 dst += 4;
47 from += 4; 50 src += 4;
48 } 51 }
49 if (len > 1) { 52 if (len > 1) {
50 *((u16 *)to) = cx18_raw_readw(cx, from); 53 *((u16 *)dst) = cx18_raw_readw(cx, src);
51 len -= 2; 54 len -= 2;
52 to += 2; 55 dst += 2;
53 from += 2; 56 src += 2;
54 } 57 }
55 if (len > 0) 58 if (len > 0)
56 *((u8 *)to) = cx18_readb(cx, from); 59 *dst = cx18_readb(cx, src);
57} 60}
58 61
59void cx18_memset_io(struct cx18 *cx, void __iomem *addr, int val, size_t count) 62void cx18_memset_io(struct cx18 *cx, void __iomem *addr, int val, size_t count)
60{ 63{
64 u8 *dst = addr;
61 u16 val2 = val | (val << 8); 65 u16 val2 = val | (val << 8);
62 u32 val4 = val2 | (val2 << 16); 66 u32 val4 = val2 | (val2 << 16);
63 67
64 /* Align writes on the CX23418's addresses */ 68 /* Align writes on the CX23418's addresses */
65 if ((count > 0) && ((unsigned)addr & 1)) { 69 if ((count > 0) && ((unsigned long)dst & 1)) {
66 cx18_writeb(cx, (u8) val, addr); 70 cx18_writeb(cx, (u8) val, dst);
67 count--; 71 count--;
68 addr++; 72 dst++;
69 } 73 }
70 if ((count > 1) && ((unsigned)addr & 2)) { 74 if ((count > 1) && ((unsigned long)dst & 2)) {
71 cx18_writew(cx, val2, addr); 75 cx18_writew(cx, val2, dst);
72 count -= 2; 76 count -= 2;
73 addr += 2; 77 dst += 2;
74 } 78 }
75 while (count > 3) { 79 while (count > 3) {
76 cx18_writel(cx, val4, addr); 80 cx18_writel(cx, val4, dst);
77 count -= 4; 81 count -= 4;
78 addr += 4; 82 dst += 4;
79 } 83 }
80 if (count > 1) { 84 if (count > 1) {
81 cx18_writew(cx, val2, addr); 85 cx18_writew(cx, val2, dst);
82 count -= 2; 86 count -= 2;
83 addr += 2; 87 dst += 2;
84 } 88 }
85 if (count > 0) 89 if (count > 0)
86 cx18_writeb(cx, (u8) val, addr); 90 cx18_writeb(cx, (u8) val, dst);
87} 91}
88 92
89void cx18_sw1_irq_enable(struct cx18 *cx, u32 val) 93void cx18_sw1_irq_enable(struct cx18 *cx, u32 val)