summaryrefslogtreecommitdiff
path: root/linux/drivers/media/dvb
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media/dvb')
-rw-r--r--linux/drivers/media/dvb/dvb-core/compat.h5
-rw-r--r--linux/drivers/media/dvb/ttpci-budget/budget-core.c54
2 files changed, 3 insertions, 56 deletions
diff --git a/linux/drivers/media/dvb/dvb-core/compat.h b/linux/drivers/media/dvb/dvb-core/compat.h
index c78e849ef..35471c721 100644
--- a/linux/drivers/media/dvb/dvb-core/compat.h
+++ b/linux/drivers/media/dvb/dvb-core/compat.h
@@ -81,11 +81,10 @@ int try_module_get(struct module *mod)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,20)
-
extern struct page * vmalloc_to_page(void *addr);
-
+#define unlikely(x) __builtin_expect((x),0)
+#define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0)
#endif
-
#endif
diff --git a/linux/drivers/media/dvb/ttpci-budget/budget-core.c b/linux/drivers/media/dvb/ttpci-budget/budget-core.c
index 684177f8e..71cbcfffd 100644
--- a/linux/drivers/media/dvb/ttpci-budget/budget-core.c
+++ b/linux/drivers/media/dvb/ttpci-budget/budget-core.c
@@ -9,35 +9,6 @@ int budget_debug = 0;
* General helper functions
****************************************************************************/
-/* this is videobuf_vmalloc_to_sg() from video-buf.c */
-static
-struct scatterlist* vmalloc_to_sg(unsigned char *virt, int nr_pages)
-{
- struct scatterlist *sglist;
- struct page *pg;
- int i;
-
- sglist = kmalloc(sizeof(struct scatterlist)*nr_pages, GFP_KERNEL);
- if (NULL == sglist)
- return NULL;
- memset(sglist,0,sizeof(struct scatterlist)*nr_pages);
- for (i = 0; i < nr_pages; i++, virt += PAGE_SIZE) {
- pg = vmalloc_to_page(virt);
- if (NULL == pg)
- goto err;
- if (PageHighMem(pg))
- BUG();
- sglist[i].page = pg;
- sglist[i].length = PAGE_SIZE;
- }
- return sglist;
-
- err:
- kfree(sglist);
- return NULL;
-}
-
-
static inline void ddelay(int i)
{
current->state=TASK_INTERRUPTIBLE;
@@ -262,10 +233,7 @@ int ttpci_budget_init (struct budget *budget,
struct saa7146_dev* dev,
struct saa7146_pci_extension_data *info)
{
- struct scatterlist *slist = NULL;
- int slen = 0;
int length = TS_WIDTH*TS_HEIGHT;
- int pages = (length+PAGE_SIZE-1)/PAGE_SIZE;
int ret = 0;
struct budget_info *bi = info->ext_priv;
@@ -297,28 +265,11 @@ int ttpci_budget_init (struct budget *budget,
return -ENOMEM;
}
- budget->grabbing = vmalloc(length);
- if (!budget->grabbing) {
- printk(KERN_ERR "dvb: vmalloc() failed.\n");
+ if( NULL == (budget->grabbing = saa7146_vmalloc_build_pgtable(dev->pci,length,&budget->pt))) {
ret = -ENOMEM;
goto err;
}
- if (!(slist = vmalloc_to_sg(budget->grabbing, pages))) {
- printk(KERN_ERR "dvb: vmalloc_to_sg() failed.\n");
- ret = -ENOMEM;
- goto err;
- }
-
- if (saa7146_pgtable_alloc(dev->pci, &budget->pt)) {
- printk(KERN_ERR "dvb: saa7146_pgtable_alloc() failed.\n");
- ret = -ENOMEM;
- goto err;
- }
-
- slen = pci_map_sg(dev->pci,slist,pages,PCI_DMA_FROMDEVICE);
- saa7146_pgtable_build_single(dev->pci, &budget->pt, slist, slen);
-
saa7146_write(dev, PCI_BT_V1, 0x001c0000);
/* upload all */
saa7146_write(dev, GPIO_CTRL, 0x000000);
@@ -331,9 +282,6 @@ int ttpci_budget_init (struct budget *budget,
return 0;
err:
- if (slist)
- kfree(slist);
-
if (budget->grabbing)
vfree(budget->grabbing);