Contributors: 10
Author |
Tokens |
Token Proportion |
Commits |
Commit Proportion |
Gerd Knorr |
211 |
77.57% |
5 |
22.73% |
Linus Torvalds (pre-git) |
20 |
7.35% |
8 |
36.36% |
Mauro Carvalho Chehab |
13 |
4.78% |
1 |
4.55% |
Christophe Jaillet |
10 |
3.68% |
1 |
4.55% |
Jonathan Nieder |
6 |
2.21% |
1 |
4.55% |
Hans Verkuil |
5 |
1.84% |
2 |
9.09% |
Thomas Gleixner |
2 |
0.74% |
1 |
4.55% |
Mike Rapoport |
2 |
0.74% |
1 |
4.55% |
David S. Miller |
2 |
0.74% |
1 |
4.55% |
Al Viro |
1 |
0.37% |
1 |
4.55% |
Total |
272 |
|
22 |
|
// SPDX-License-Identifier: GPL-2.0-or-later
/*
btcx-risc.c
bt848/bt878/cx2388x risc code generator.
(c) 2000-03 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h>
#include <linux/init.h>
#include <linux/pci.h>
#include <linux/interrupt.h>
#include <linux/videodev2.h>
#include <linux/pgtable.h>
#include <asm/page.h>
#include "btcx-risc.h"
static unsigned int btcx_debug;
module_param(btcx_debug, int, 0644);
MODULE_PARM_DESC(btcx_debug,"debug messages, default is 0 (no)");
#define dprintk(fmt, arg...) do { \
if (btcx_debug) \
printk(KERN_DEBUG pr_fmt("%s: " fmt), \
__func__, ##arg); \
} while (0)
/* ---------------------------------------------------------- */
/* allocate/free risc memory */
static int memcnt;
void btcx_riscmem_free(struct pci_dev *pci,
struct btcx_riscmem *risc)
{
if (NULL == risc->cpu)
return;
memcnt--;
dprintk("btcx: riscmem free [%d] dma=%lx\n",
memcnt, (unsigned long)risc->dma);
dma_free_coherent(&pci->dev, risc->size, risc->cpu, risc->dma);
memset(risc,0,sizeof(*risc));
}
int btcx_riscmem_alloc(struct pci_dev *pci,
struct btcx_riscmem *risc,
unsigned int size)
{
__le32 *cpu;
dma_addr_t dma = 0;
if (NULL != risc->cpu && risc->size < size)
btcx_riscmem_free(pci,risc);
if (NULL == risc->cpu) {
cpu = dma_alloc_coherent(&pci->dev, size, &dma, GFP_KERNEL);
if (NULL == cpu)
return -ENOMEM;
risc->cpu = cpu;
risc->dma = dma;
risc->size = size;
memcnt++;
dprintk("btcx: riscmem alloc [%d] dma=%lx cpu=%p size=%d\n",
memcnt, (unsigned long)dma, cpu, size);
}
return 0;
}