Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 137901
b: refs/heads/master
c: 4b10d3b
h: refs/heads/master
i:
  137899: 0e9564c
v: v3
  • Loading branch information
Trent Piepho authored and Mauro Carvalho Chehab committed Mar 30, 2009
1 parent 1cdff0b commit 846e290
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 35 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6f98700a5bb8d218162b04db1b8a3921a0dcc7ce
refs/heads/master: 4b10d3b626922ffa2387905a230b12450281a12d
45 changes: 16 additions & 29 deletions trunk/drivers/media/video/bt8xx/bttv-driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@


unsigned int bttv_num; /* number of Bt848s in use */
struct bttv bttvs[BTTV_MAX];
struct bttv *bttvs[BTTV_MAX];

unsigned int bttv_debug;
unsigned int bttv_verbose = 1;
Expand Down Expand Up @@ -3217,29 +3217,19 @@ static unsigned int bttv_poll(struct file *file, poll_table *wait)
static int bttv_open(struct file *file)
{
int minor = video_devdata(file)->minor;
struct bttv *btv = NULL;
struct bttv *btv = video_drvdata(file);
struct bttv_fh *fh;
enum v4l2_buf_type type = 0;
unsigned int i;

dprintk(KERN_DEBUG "bttv: open minor=%d\n",minor);

lock_kernel();
for (i = 0; i < bttv_num; i++) {
if (bttvs[i].video_dev &&
bttvs[i].video_dev->minor == minor) {
btv = &bttvs[i];
type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
break;
}
if (bttvs[i].vbi_dev &&
bttvs[i].vbi_dev->minor == minor) {
btv = &bttvs[i];
type = V4L2_BUF_TYPE_VBI_CAPTURE;
break;
}
}
if (NULL == btv) {
if (btv->video_dev->minor == minor) {
type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
} else if (btv->vbi_dev->minor == minor) {
type = V4L2_BUF_TYPE_VBI_CAPTURE;
} else {
WARN_ON(1);
unlock_kernel();
return -ENODEV;
}
Expand Down Expand Up @@ -3429,20 +3419,14 @@ static struct video_device bttv_video_template = {
static int radio_open(struct file *file)
{
int minor = video_devdata(file)->minor;
struct bttv *btv = NULL;
struct bttv *btv = video_drvdata(file);
struct bttv_fh *fh;
unsigned int i;

dprintk("bttv: open minor=%d\n",minor);

lock_kernel();
for (i = 0; i < bttv_num; i++) {
if (bttvs[i].radio_dev && bttvs[i].radio_dev->minor == minor) {
btv = &bttvs[i];
break;
}
}
if (NULL == btv) {
WARN_ON(btv->radio_dev && btv->radio_dev->minor != minor);
if (!btv->radio_dev || btv->radio_dev->minor != minor) {
unlock_kernel();
return -ENODEV;
}
Expand Down Expand Up @@ -4203,6 +4187,7 @@ static struct video_device *vdev_init(struct bttv *btv,
vfd->parent = &btv->c.pci->dev;
vfd->release = video_device_release;
vfd->debug = bttv_debug;
video_set_drvdata(vfd, btv);
snprintf(vfd->name, sizeof(vfd->name), "BT%d%s %s (%s)",
btv->id, (btv->id==848 && btv->revision==0x12) ? "A" : "",
type_name, bttv_tvcards[btv->c.type].name);
Expand Down Expand Up @@ -4312,8 +4297,7 @@ static int __devinit bttv_probe(struct pci_dev *dev,
if (bttv_num == BTTV_MAX)
return -ENOMEM;
printk(KERN_INFO "bttv: Bt8xx card found (%d).\n", bttv_num);
btv=&bttvs[bttv_num];
memset(btv,0,sizeof(*btv));
bttvs[bttv_num] = btv = kzalloc(sizeof(*btv), GFP_KERNEL);
btv->c.nr = bttv_num;
sprintf(btv->c.name,"bttv%d",btv->c.nr);

Expand Down Expand Up @@ -4517,6 +4501,9 @@ static void __devexit bttv_remove(struct pci_dev *pci_dev)
pci_resource_len(btv->c.pci,0));

pci_set_drvdata(pci_dev, NULL);
bttvs[btv->c.nr] = NULL;
kfree(btv);

return;
}

Expand Down
18 changes: 14 additions & 4 deletions trunk/drivers/media/video/bt8xx/bttv-if.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ struct pci_dev* bttv_get_pcidev(unsigned int card)
{
if (card >= bttv_num)
return NULL;
return bttvs[card].c.pci;
if (!bttvs[card])
return NULL;

return bttvs[card]->c.pci;
}


Expand All @@ -59,7 +62,10 @@ int bttv_gpio_enable(unsigned int card, unsigned long mask, unsigned long data)
return -EINVAL;
}

btv = &bttvs[card];
btv = bttvs[card];
if (!btv)
return -ENODEV;

gpio_inout(mask,data);
if (bttv_gpio)
bttv_gpio_tracking(btv,"extern enable");
Expand All @@ -74,7 +80,9 @@ int bttv_read_gpio(unsigned int card, unsigned long *data)
return -EINVAL;
}

btv = &bttvs[card];
btv = bttvs[card];
if (!btv)
return -ENODEV;

if(btv->shutdown) {
return -ENODEV;
Expand All @@ -94,7 +102,9 @@ int bttv_write_gpio(unsigned int card, unsigned long mask, unsigned long data)
return -EINVAL;
}

btv = &bttvs[card];
btv = bttvs[card];
if (!btv)
return -ENODEV;

/* prior setting BT848_GPIO_REG_INP is (probably) not needed
because direct input is set on init */
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/media/video/bt8xx/bttvp.h
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ struct bttv {
/* our devices */
#define BTTV_MAX 32
extern unsigned int bttv_num;
extern struct bttv bttvs[BTTV_MAX];
extern struct bttv *bttvs[BTTV_MAX];

static inline unsigned int bttv_muxsel(const struct bttv *btv,
unsigned int input)
Expand Down

0 comments on commit 846e290

Please sign in to comment.