Skip to content

Commit faebe84

Browse files
deborahbrouwermchehab
authored andcommitted
media: bttv: copy vbi_fmt from bttv_fh
In preparation for the vb2 conversion, copy the vbi format from struct bttv_fh and add it to the main struct bttv. Use vbi format from struct bttv wherever it will be needed after the vb2 conversion which stops using separate bttv file handles altogether. To avoid changing more code than necessary, just leave the vbi format in separate file handles wherever it will be subsequently removed by vb2. Signed-off-by: Deborah Brouwer <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
1 parent 79bbd35 commit faebe84

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

drivers/media/pci/bt8xx/bttv-driver.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -672,12 +672,12 @@ int check_alloc_btres_lock(struct bttv *btv, struct bttv_fh *fh, int bit)
672672
Claim scan lines crop[].rect.top to bottom. */
673673
btv->crop_start = top;
674674
} else if (bit & VBI_RESOURCES) {
675-
__s32 end = fh->vbi_fmt.end;
675+
__s32 end = btv->vbi_fmt.end;
676676

677677
if (end > btv->crop_start)
678678
goto fail;
679679

680-
/* Claim scan lines above fh->vbi_fmt.end. */
680+
/* Claim scan lines above btv->vbi_fmt.end. */
681681
btv->vbi_end = end;
682682
}
683683

@@ -3637,6 +3637,8 @@ static int bttv_probe(struct pci_dev *dev, const struct pci_device_id *pci_id)
36373637
btv->width = 320;
36383638
btv->height = 240;
36393639
btv->input = 0;
3640+
btv->tvnorm = 0; /* Index into bttv_tvnorms[] i.e. PAL. */
3641+
bttv_vbi_fmt_reset(&btv->vbi_fmt, btv->tvnorm);
36403642

36413643
v4l2_ctrl_new_std(hdl, &bttv_ctrl_ops,
36423644
V4L2_CID_BRIGHTNESS, 0, 0xff00, 0x100, 32768);

drivers/media/pci/bt8xx/bttv-vbi.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,9 @@ int bttv_s_fmt_vbi_cap(struct file *file, void *f, struct v4l2_format *frt)
350350
fh->vbi_fmt.fmt = frt->fmt.vbi;
351351
fh->vbi_fmt.tvnorm = tvnorm;
352352
fh->vbi_fmt.end = end;
353+
btv->vbi_fmt.fmt = frt->fmt.vbi;
354+
btv->vbi_fmt.tvnorm = tvnorm;
355+
btv->vbi_fmt.end = end;
353356

354357
mutex_unlock(&fh->vbi.vb_lock);
355358

@@ -364,15 +367,14 @@ int bttv_s_fmt_vbi_cap(struct file *file, void *f, struct v4l2_format *frt)
364367

365368
int bttv_g_fmt_vbi_cap(struct file *file, void *f, struct v4l2_format *frt)
366369
{
367-
struct bttv_fh *fh = f;
368370
const struct bttv_tvnorm *tvnorm;
369371
struct bttv *btv = video_drvdata(file);
370372

371-
frt->fmt.vbi = fh->vbi_fmt.fmt;
373+
frt->fmt.vbi = btv->vbi_fmt.fmt;
372374

373375
tvnorm = &bttv_tvnorms[btv->tvnorm];
374376

375-
if (tvnorm != fh->vbi_fmt.tvnorm) {
377+
if (tvnorm != btv->vbi_fmt.tvnorm) {
376378
__s32 max_end;
377379
unsigned int i;
378380

@@ -388,9 +390,8 @@ int bttv_g_fmt_vbi_cap(struct file *file, void *f, struct v4l2_format *frt)
388390
for (i = 0; i < 2; ++i) {
389391
__s32 new_start;
390392

391-
new_start = frt->fmt.vbi.start[i]
392-
+ tvnorm->vbistart[i]
393-
- fh->vbi_fmt.tvnorm->vbistart[i];
393+
new_start = frt->fmt.vbi.start[i] + tvnorm->vbistart[i]
394+
- btv->vbi_fmt.tvnorm->vbistart[i];
394395

395396
frt->fmt.vbi.start[i] = min(new_start, max_end - 1);
396397
frt->fmt.vbi.count[i] =

drivers/media/pci/bt8xx/bttvp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,7 @@ struct bttv {
452452
const struct bttv_format *fmt;
453453
int width;
454454
int height;
455+
struct bttv_vbi_fmt vbi_fmt;
455456

456457
/* used to make dvb-bt8xx autoloadable */
457458
struct work_struct request_module_wk;

0 commit comments

Comments
 (0)