On some archs, like tile, the PAGE_SIZE is not 4K. In the case
of tile arch, it can be either 16KB or 64KB.

Due to that, a warning is produced:
        drivers/media/pci/saa7134/saa7134.h:678:43: warning: large integer 
implicitly truncated to unsigned type [-Woverflow]

This is actually an error, as it will write trach to the DMA size
registers. The logic at saa7134-ts already does the right thing:

        saa_writeb(SAA7134_TS_DMA0, ((dev->ts.nr_packets-1)&0xff));
        saa_writeb(SAA7134_TS_DMA1, (((dev->ts.nr_packets-1)>>8)&0xff));
        /* TSNOPIT=0, TSCOLAP=0 */
        saa_writeb(SAA7134_TS_DMA2,
                ((((dev->ts.nr_packets-1)>>16)&0x3f) | 0x00));

So, fix the driver to take larger page sizes into account.

Signed-off-by: Mauro Carvalho Chehab <mche...@osg.samsung.com>

diff --git a/drivers/media/pci/saa7134/saa7134-go7007.c 
b/drivers/media/pci/saa7134/saa7134-go7007.c
index da7c4be4bed2..8a2abb34186b 100644
--- a/drivers/media/pci/saa7134/saa7134-go7007.c
+++ b/drivers/media/pci/saa7134/saa7134-go7007.c
@@ -289,9 +289,9 @@ static int saa7134_go7007_stream_start(struct go7007 *go)
 
        /* Set up transfer block size */
        saa_writeb(SAA7134_TS_PARALLEL_SERIAL, 128 - 1);
-       saa_writeb(SAA7134_TS_DMA0, (PAGE_SIZE >> 7) - 1);
-       saa_writeb(SAA7134_TS_DMA1, 0);
-       saa_writeb(SAA7134_TS_DMA2, 0);
+       saa_writeb(SAA7134_TS_DMA0, ((PAGE_SIZE >> 7) - 1) & 0xff);
+       saa_writeb(SAA7134_TS_DMA1, (PAGE_SIZE >> 15) & 0xff);
+       saa_writeb(SAA7134_TS_DMA2, (PAGE_SIZE >> 31) & 0x3f);
 
        /* Enable video streaming mode */
        saa_writeb(SAA7134_GPIO_GPSTATUS2, GPIO_COMMAND_VIDEO);
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to