summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/bttv-risc.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2006-03-02 11:19:42 -0300
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-03-02 11:19:42 -0300
commit7626144ace9fbb7b98d1f581c8c2b415e59d606e (patch)
tree46109dd7851da3c9197012fe72692891ae6e35dc /linux/drivers/media/video/bttv-risc.c
parentd2c59cfc5b82e105272495a6502096ad6434064f (diff)
parent2a3699c7aea27b7c2c464e29e0b75b4f433f2d5a (diff)
downloadmediapointer-dvb-s2-7626144ace9fbb7b98d1f581c8c2b415e59d606e.tar.gz
mediapointer-dvb-s2-7626144ace9fbb7b98d1f581c8c2b415e59d606e.tar.bz2
Merging endriss tree
From: Mauro Carvalho Chehab <mchehab@infradead.org> merge: Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'linux/drivers/media/video/bttv-risc.c')
-rw-r--r--linux/drivers/media/video/bttv-risc.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/linux/drivers/media/video/bttv-risc.c b/linux/drivers/media/video/bttv-risc.c
index acceee39a..4efe74dd8 100644
--- a/linux/drivers/media/video/bttv-risc.c
+++ b/linux/drivers/media/video/bttv-risc.c
@@ -52,8 +52,10 @@ bttv_risc_packed(struct bttv *btv, struct btcx_riscmem *risc,
int rc;
/* estimate risc mem: worst case is one write per page border +
- one write per scan line + sync + jump (all 2 dwords) */
- instructions = (bpl * lines) / PAGE_SIZE + lines;
+ one write per scan line + sync + jump (all 2 dwords). padding
+ can cause next bpl to start close to a page border. First DMA
+ region may be smaller than PAGE_SIZE */
+ instructions = 1 + ((bpl + padding) * lines) / PAGE_SIZE + lines;
instructions += 2;
if ((rc = btcx_riscmem_alloc(btv->c.pci,risc,instructions*8)) < 0)
return rc;
@@ -105,7 +107,7 @@ bttv_risc_packed(struct bttv *btv, struct btcx_riscmem *risc,
/* save pointer to jmp instruction address */
risc->jmp = rp;
- BUG_ON((risc->jmp - risc->cpu + 2) / 4 > risc->size);
+ BUG_ON((risc->jmp - risc->cpu + 2) * sizeof(*risc->cpu) > risc->size);
return 0;
}
@@ -223,7 +225,7 @@ bttv_risc_planar(struct bttv *btv, struct btcx_riscmem *risc,
/* save pointer to jmp instruction address */
risc->jmp = rp;
- BUG_ON((risc->jmp - risc->cpu + 2) / 4 > risc->size);
+ BUG_ON((risc->jmp - risc->cpu + 2) * sizeof(*risc->cpu) > risc->size);
return 0;
}
@@ -308,7 +310,7 @@ bttv_risc_overlay(struct bttv *btv, struct btcx_riscmem *risc,
/* save pointer to jmp instruction address */
risc->jmp = rp;
- BUG_ON((risc->jmp - risc->cpu + 2) / 4 > risc->size);
+ BUG_ON((risc->jmp - risc->cpu + 2) * sizeof(*risc->cpu) > risc->size);
kfree(skips);
return 0;
}