Skip to content

Commit d1846d7

Browse files
deborahbrouwermchehab
authored andcommitted
media: bttv: use video_drvdata to get bttv
Use video_drvdata(file) instead of fh->btv to get the bttv pointer wherever the bttv pointer will still be needed after the vb2 conversion. Signed-off-by: Deborah Brouwer <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
1 parent 33c7ae8 commit d1846d7

File tree

2 files changed

+32
-53
lines changed

2 files changed

+32
-53
lines changed

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

Lines changed: 28 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1654,8 +1654,7 @@ static void radio_enable(struct bttv *btv)
16541654

16551655
static int bttv_s_std(struct file *file, void *priv, v4l2_std_id id)
16561656
{
1657-
struct bttv_fh *fh = priv;
1658-
struct bttv *btv = fh->btv;
1657+
struct bttv *btv = video_drvdata(file);
16591658
unsigned int i;
16601659

16611660
for (i = 0; i < BTTV_TVNORMS; i++)
@@ -1670,17 +1669,15 @@ static int bttv_s_std(struct file *file, void *priv, v4l2_std_id id)
16701669

16711670
static int bttv_g_std(struct file *file, void *priv, v4l2_std_id *id)
16721671
{
1673-
struct bttv_fh *fh = priv;
1674-
struct bttv *btv = fh->btv;
1672+
struct bttv *btv = video_drvdata(file);
16751673

16761674
*id = btv->std;
16771675
return 0;
16781676
}
16791677

16801678
static int bttv_querystd(struct file *file, void *f, v4l2_std_id *id)
16811679
{
1682-
struct bttv_fh *fh = f;
1683-
struct bttv *btv = fh->btv;
1680+
struct bttv *btv = video_drvdata(file);
16841681

16851682
if (btread(BT848_DSTATUS) & BT848_DSTATUS_NUML)
16861683
*id &= V4L2_STD_625_50;
@@ -1692,8 +1689,7 @@ static int bttv_querystd(struct file *file, void *f, v4l2_std_id *id)
16921689
static int bttv_enum_input(struct file *file, void *priv,
16931690
struct v4l2_input *i)
16941691
{
1695-
struct bttv_fh *fh = priv;
1696-
struct bttv *btv = fh->btv;
1692+
struct bttv *btv = video_drvdata(file);
16971693

16981694
if (i->index >= bttv_tvcards[btv->c.type].video_inputs)
16991695
return -EINVAL;
@@ -1725,8 +1721,7 @@ static int bttv_enum_input(struct file *file, void *priv,
17251721

17261722
static int bttv_g_input(struct file *file, void *priv, unsigned int *i)
17271723
{
1728-
struct bttv_fh *fh = priv;
1729-
struct bttv *btv = fh->btv;
1724+
struct bttv *btv = video_drvdata(file);
17301725

17311726
*i = btv->input;
17321727

@@ -1735,8 +1730,7 @@ static int bttv_g_input(struct file *file, void *priv, unsigned int *i)
17351730

17361731
static int bttv_s_input(struct file *file, void *priv, unsigned int i)
17371732
{
1738-
struct bttv_fh *fh = priv;
1739-
struct bttv *btv = fh->btv;
1733+
struct bttv *btv = video_drvdata(file);
17401734

17411735
if (i >= bttv_tvcards[btv->c.type].video_inputs)
17421736
return -EINVAL;
@@ -1748,8 +1742,7 @@ static int bttv_s_input(struct file *file, void *priv, unsigned int i)
17481742
static int bttv_s_tuner(struct file *file, void *priv,
17491743
const struct v4l2_tuner *t)
17501744
{
1751-
struct bttv_fh *fh = priv;
1752-
struct bttv *btv = fh->btv;
1745+
struct bttv *btv = video_drvdata(file);
17531746

17541747
if (t->index)
17551748
return -EINVAL;
@@ -1767,8 +1760,7 @@ static int bttv_s_tuner(struct file *file, void *priv,
17671760
static int bttv_g_frequency(struct file *file, void *priv,
17681761
struct v4l2_frequency *f)
17691762
{
1770-
struct bttv_fh *fh = priv;
1771-
struct bttv *btv = fh->btv;
1763+
struct bttv *btv = video_drvdata(file);
17721764

17731765
if (f->tuner)
17741766
return -EINVAL;
@@ -1804,8 +1796,7 @@ static void bttv_set_frequency(struct bttv *btv, const struct v4l2_frequency *f)
18041796
static int bttv_s_frequency(struct file *file, void *priv,
18051797
const struct v4l2_frequency *f)
18061798
{
1807-
struct bttv_fh *fh = priv;
1808-
struct bttv *btv = fh->btv;
1799+
struct bttv *btv = video_drvdata(file);
18091800

18101801
if (f->tuner)
18111802
return -EINVAL;
@@ -1817,8 +1808,7 @@ static int bttv_s_frequency(struct file *file, void *priv,
18171808
static int bttv_log_status(struct file *file, void *f)
18181809
{
18191810
struct video_device *vdev = video_devdata(file);
1820-
struct bttv_fh *fh = f;
1821-
struct bttv *btv = fh->btv;
1811+
struct bttv *btv = video_drvdata(file);
18221812

18231813
v4l2_ctrl_handler_log_status(vdev->ctrl_handler, btv->c.v4l2_dev.name);
18241814
bttv_call_all(btv, core, log_status);
@@ -1829,8 +1819,7 @@ static int bttv_log_status(struct file *file, void *f)
18291819
static int bttv_g_register(struct file *file, void *f,
18301820
struct v4l2_dbg_register *reg)
18311821
{
1832-
struct bttv_fh *fh = f;
1833-
struct bttv *btv = fh->btv;
1822+
struct bttv *btv = video_drvdata(file);
18341823

18351824
/* bt848 has a 12-bit register space */
18361825
reg->reg &= 0xfff;
@@ -1843,8 +1832,7 @@ static int bttv_g_register(struct file *file, void *f,
18431832
static int bttv_s_register(struct file *file, void *f,
18441833
const struct v4l2_dbg_register *reg)
18451834
{
1846-
struct bttv_fh *fh = f;
1847-
struct bttv *btv = fh->btv;
1835+
struct bttv *btv = video_drvdata(file);
18481836

18491837
/* bt848 has a 12-bit register space */
18501838
btwrite(reg->val, reg->reg & 0xfff);
@@ -2106,7 +2094,7 @@ static int bttv_try_fmt_vid_cap(struct file *file, void *priv,
21062094
{
21072095
const struct bttv_format *fmt;
21082096
struct bttv_fh *fh = priv;
2109-
struct bttv *btv = fh->btv;
2097+
struct bttv *btv = video_drvdata(file);
21102098
enum v4l2_field field;
21112099
__s32 width, height;
21122100
__s32 height2;
@@ -2165,7 +2153,7 @@ static int bttv_s_fmt_vid_cap(struct file *file, void *priv,
21652153
int retval;
21662154
const struct bttv_format *fmt;
21672155
struct bttv_fh *fh = priv;
2168-
struct bttv *btv = fh->btv;
2156+
struct bttv *btv = video_drvdata(file);
21692157
__s32 width, height;
21702158
unsigned int width_mask, width_bias;
21712159
enum v4l2_field field;
@@ -2209,8 +2197,7 @@ static int bttv_s_fmt_vid_cap(struct file *file, void *priv,
22092197
static int bttv_querycap(struct file *file, void *priv,
22102198
struct v4l2_capability *cap)
22112199
{
2212-
struct bttv_fh *fh = priv;
2213-
struct bttv *btv = fh->btv;
2200+
struct bttv *btv = video_drvdata(file);
22142201

22152202
if (0 == v4l2)
22162203
return -EINVAL;
@@ -2274,7 +2261,7 @@ static int bttv_querybuf(struct file *file, void *priv,
22742261
static int bttv_qbuf(struct file *file, void *priv, struct v4l2_buffer *b)
22752262
{
22762263
struct bttv_fh *fh = priv;
2277-
struct bttv *btv = fh->btv;
2264+
struct bttv *btv = video_drvdata(file);
22782265
int res = bttv_resource(fh);
22792266

22802267
if (!check_alloc_btres_lock(btv, fh, res))
@@ -2322,8 +2309,7 @@ static int bttv_streamoff(struct file *file, void *priv,
23222309
static int bttv_g_parm(struct file *file, void *f,
23232310
struct v4l2_streamparm *parm)
23242311
{
2325-
struct bttv_fh *fh = f;
2326-
struct bttv *btv = fh->btv;
2312+
struct bttv *btv = video_drvdata(file);
23272313

23282314
if (parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
23292315
return -EINVAL;
@@ -2337,8 +2323,7 @@ static int bttv_g_parm(struct file *file, void *f,
23372323
static int bttv_g_tuner(struct file *file, void *priv,
23382324
struct v4l2_tuner *t)
23392325
{
2340-
struct bttv_fh *fh = priv;
2341-
struct bttv *btv = fh->btv;
2326+
struct bttv *btv = video_drvdata(file);
23422327

23432328
if (0 != t->index)
23442329
return -EINVAL;
@@ -2360,8 +2345,7 @@ static int bttv_g_tuner(struct file *file, void *priv,
23602345
static int bttv_g_pixelaspect(struct file *file, void *priv,
23612346
int type, struct v4l2_fract *f)
23622347
{
2363-
struct bttv_fh *fh = priv;
2364-
struct bttv *btv = fh->btv;
2348+
struct bttv *btv = video_drvdata(file);
23652349

23662350
if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
23672351
return -EINVAL;
@@ -2374,7 +2358,7 @@ static int bttv_g_pixelaspect(struct file *file, void *priv,
23742358
static int bttv_g_selection(struct file *file, void *f, struct v4l2_selection *sel)
23752359
{
23762360
struct bttv_fh *fh = f;
2377-
struct bttv *btv = fh->btv;
2361+
struct bttv *btv = video_drvdata(file);
23782362

23792363
if (sel->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
23802364
return -EINVAL;
@@ -2404,7 +2388,7 @@ static int bttv_g_selection(struct file *file, void *f, struct v4l2_selection *s
24042388
static int bttv_s_selection(struct file *file, void *f, struct v4l2_selection *sel)
24052389
{
24062390
struct bttv_fh *fh = f;
2407-
struct bttv *btv = fh->btv;
2391+
struct bttv *btv = video_drvdata(file);
24082392
const struct v4l2_rect *b;
24092393
int retval;
24102394
struct bttv_crop c;
@@ -2781,7 +2765,7 @@ static int radio_open(struct file *file)
27812765
static int radio_release(struct file *file)
27822766
{
27832767
struct bttv_fh *fh = file->private_data;
2784-
struct bttv *btv = fh->btv;
2768+
struct bttv *btv = video_drvdata(file);
27852769
struct saa6588_command cmd;
27862770

27872771
file->private_data = NULL;
@@ -2800,8 +2784,7 @@ static int radio_release(struct file *file)
28002784

28012785
static int radio_g_tuner(struct file *file, void *priv, struct v4l2_tuner *t)
28022786
{
2803-
struct bttv_fh *fh = priv;
2804-
struct bttv *btv = fh->btv;
2787+
struct bttv *btv = video_drvdata(file);
28052788

28062789
if (0 != t->index)
28072790
return -EINVAL;
@@ -2823,8 +2806,7 @@ static int radio_g_tuner(struct file *file, void *priv, struct v4l2_tuner *t)
28232806
static int radio_s_tuner(struct file *file, void *priv,
28242807
const struct v4l2_tuner *t)
28252808
{
2826-
struct bttv_fh *fh = priv;
2827-
struct bttv *btv = fh->btv;
2809+
struct bttv *btv = video_drvdata(file);
28282810

28292811
if (0 != t->index)
28302812
return -EINVAL;
@@ -2837,8 +2819,7 @@ static int radio_s_tuner(struct file *file, void *priv,
28372819
static int radio_s_hw_freq_seek(struct file *file, void *priv,
28382820
const struct v4l2_hw_freq_seek *a)
28392821
{
2840-
struct bttv_fh *fh = priv;
2841-
struct bttv *btv = fh->btv;
2822+
struct bttv *btv = video_drvdata(file);
28422823

28432824
if (btv->has_tea575x)
28442825
return snd_tea575x_s_hw_freq_seek(file, &btv->tea, a);
@@ -2849,8 +2830,7 @@ static int radio_s_hw_freq_seek(struct file *file, void *priv,
28492830
static int radio_enum_freq_bands(struct file *file, void *priv,
28502831
struct v4l2_frequency_band *band)
28512832
{
2852-
struct bttv_fh *fh = priv;
2853-
struct bttv *btv = fh->btv;
2833+
struct bttv *btv = video_drvdata(file);
28542834

28552835
if (btv->has_tea575x)
28562836
return snd_tea575x_enum_freq_bands(&btv->tea, band);
@@ -2861,8 +2841,7 @@ static int radio_enum_freq_bands(struct file *file, void *priv,
28612841
static ssize_t radio_read(struct file *file, char __user *data,
28622842
size_t count, loff_t *ppos)
28632843
{
2864-
struct bttv_fh *fh = file->private_data;
2865-
struct bttv *btv = fh->btv;
2844+
struct bttv *btv = video_drvdata(file);
28662845
struct saa6588_command cmd;
28672846

28682847
cmd.block_count = count / 3;
@@ -2880,7 +2859,7 @@ static ssize_t radio_read(struct file *file, char __user *data,
28802859
static __poll_t radio_poll(struct file *file, poll_table *wait)
28812860
{
28822861
struct bttv_fh *fh = file->private_data;
2883-
struct bttv *btv = fh->btv;
2862+
struct bttv *btv = video_drvdata(file);
28842863
__poll_t req_events = poll_requested_events(wait);
28852864
struct saa6588_command cmd;
28862865
__poll_t res = 0;

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,7 @@ static int try_fmt(struct v4l2_vbi_format *f, const struct bttv_tvnorm *tvnorm,
299299

300300
int bttv_try_fmt_vbi_cap(struct file *file, void *f, struct v4l2_format *frt)
301301
{
302-
struct bttv_fh *fh = f;
303-
struct bttv *btv = fh->btv;
302+
struct bttv *btv = video_drvdata(file);
304303
const struct bttv_tvnorm *tvnorm;
305304
__s32 crop_start;
306305

@@ -318,7 +317,7 @@ int bttv_try_fmt_vbi_cap(struct file *file, void *f, struct v4l2_format *frt)
318317
int bttv_s_fmt_vbi_cap(struct file *file, void *f, struct v4l2_format *frt)
319318
{
320319
struct bttv_fh *fh = f;
321-
struct bttv *btv = fh->btv;
320+
struct bttv *btv = video_drvdata(file);
322321
const struct bttv_tvnorm *tvnorm;
323322
__s32 start1, end;
324323
int rc;
@@ -367,10 +366,11 @@ int bttv_g_fmt_vbi_cap(struct file *file, void *f, struct v4l2_format *frt)
367366
{
368367
struct bttv_fh *fh = f;
369368
const struct bttv_tvnorm *tvnorm;
369+
struct bttv *btv = video_drvdata(file);
370370

371371
frt->fmt.vbi = fh->vbi_fmt.fmt;
372372

373-
tvnorm = &bttv_tvnorms[fh->btv->tvnorm];
373+
tvnorm = &bttv_tvnorms[btv->tvnorm];
374374

375375
if (tvnorm != fh->vbi_fmt.tvnorm) {
376376
__s32 max_end;

0 commit comments

Comments
 (0)