@@ -1654,8 +1654,7 @@ static void radio_enable(struct bttv *btv)
1654
1654
1655
1655
static int bttv_s_std (struct file * file , void * priv , v4l2_std_id id )
1656
1656
{
1657
- struct bttv_fh * fh = priv ;
1658
- struct bttv * btv = fh -> btv ;
1657
+ struct bttv * btv = video_drvdata (file );
1659
1658
unsigned int i ;
1660
1659
1661
1660
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)
1670
1669
1671
1670
static int bttv_g_std (struct file * file , void * priv , v4l2_std_id * id )
1672
1671
{
1673
- struct bttv_fh * fh = priv ;
1674
- struct bttv * btv = fh -> btv ;
1672
+ struct bttv * btv = video_drvdata (file );
1675
1673
1676
1674
* id = btv -> std ;
1677
1675
return 0 ;
1678
1676
}
1679
1677
1680
1678
static int bttv_querystd (struct file * file , void * f , v4l2_std_id * id )
1681
1679
{
1682
- struct bttv_fh * fh = f ;
1683
- struct bttv * btv = fh -> btv ;
1680
+ struct bttv * btv = video_drvdata (file );
1684
1681
1685
1682
if (btread (BT848_DSTATUS ) & BT848_DSTATUS_NUML )
1686
1683
* id &= V4L2_STD_625_50 ;
@@ -1692,8 +1689,7 @@ static int bttv_querystd(struct file *file, void *f, v4l2_std_id *id)
1692
1689
static int bttv_enum_input (struct file * file , void * priv ,
1693
1690
struct v4l2_input * i )
1694
1691
{
1695
- struct bttv_fh * fh = priv ;
1696
- struct bttv * btv = fh -> btv ;
1692
+ struct bttv * btv = video_drvdata (file );
1697
1693
1698
1694
if (i -> index >= bttv_tvcards [btv -> c .type ].video_inputs )
1699
1695
return - EINVAL ;
@@ -1725,8 +1721,7 @@ static int bttv_enum_input(struct file *file, void *priv,
1725
1721
1726
1722
static int bttv_g_input (struct file * file , void * priv , unsigned int * i )
1727
1723
{
1728
- struct bttv_fh * fh = priv ;
1729
- struct bttv * btv = fh -> btv ;
1724
+ struct bttv * btv = video_drvdata (file );
1730
1725
1731
1726
* i = btv -> input ;
1732
1727
@@ -1735,8 +1730,7 @@ static int bttv_g_input(struct file *file, void *priv, unsigned int *i)
1735
1730
1736
1731
static int bttv_s_input (struct file * file , void * priv , unsigned int i )
1737
1732
{
1738
- struct bttv_fh * fh = priv ;
1739
- struct bttv * btv = fh -> btv ;
1733
+ struct bttv * btv = video_drvdata (file );
1740
1734
1741
1735
if (i >= bttv_tvcards [btv -> c .type ].video_inputs )
1742
1736
return - EINVAL ;
@@ -1748,8 +1742,7 @@ static int bttv_s_input(struct file *file, void *priv, unsigned int i)
1748
1742
static int bttv_s_tuner (struct file * file , void * priv ,
1749
1743
const struct v4l2_tuner * t )
1750
1744
{
1751
- struct bttv_fh * fh = priv ;
1752
- struct bttv * btv = fh -> btv ;
1745
+ struct bttv * btv = video_drvdata (file );
1753
1746
1754
1747
if (t -> index )
1755
1748
return - EINVAL ;
@@ -1767,8 +1760,7 @@ static int bttv_s_tuner(struct file *file, void *priv,
1767
1760
static int bttv_g_frequency (struct file * file , void * priv ,
1768
1761
struct v4l2_frequency * f )
1769
1762
{
1770
- struct bttv_fh * fh = priv ;
1771
- struct bttv * btv = fh -> btv ;
1763
+ struct bttv * btv = video_drvdata (file );
1772
1764
1773
1765
if (f -> tuner )
1774
1766
return - EINVAL ;
@@ -1804,8 +1796,7 @@ static void bttv_set_frequency(struct bttv *btv, const struct v4l2_frequency *f)
1804
1796
static int bttv_s_frequency (struct file * file , void * priv ,
1805
1797
const struct v4l2_frequency * f )
1806
1798
{
1807
- struct bttv_fh * fh = priv ;
1808
- struct bttv * btv = fh -> btv ;
1799
+ struct bttv * btv = video_drvdata (file );
1809
1800
1810
1801
if (f -> tuner )
1811
1802
return - EINVAL ;
@@ -1817,8 +1808,7 @@ static int bttv_s_frequency(struct file *file, void *priv,
1817
1808
static int bttv_log_status (struct file * file , void * f )
1818
1809
{
1819
1810
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 );
1822
1812
1823
1813
v4l2_ctrl_handler_log_status (vdev -> ctrl_handler , btv -> c .v4l2_dev .name );
1824
1814
bttv_call_all (btv , core , log_status );
@@ -1829,8 +1819,7 @@ static int bttv_log_status(struct file *file, void *f)
1829
1819
static int bttv_g_register (struct file * file , void * f ,
1830
1820
struct v4l2_dbg_register * reg )
1831
1821
{
1832
- struct bttv_fh * fh = f ;
1833
- struct bttv * btv = fh -> btv ;
1822
+ struct bttv * btv = video_drvdata (file );
1834
1823
1835
1824
/* bt848 has a 12-bit register space */
1836
1825
reg -> reg &= 0xfff ;
@@ -1843,8 +1832,7 @@ static int bttv_g_register(struct file *file, void *f,
1843
1832
static int bttv_s_register (struct file * file , void * f ,
1844
1833
const struct v4l2_dbg_register * reg )
1845
1834
{
1846
- struct bttv_fh * fh = f ;
1847
- struct bttv * btv = fh -> btv ;
1835
+ struct bttv * btv = video_drvdata (file );
1848
1836
1849
1837
/* bt848 has a 12-bit register space */
1850
1838
btwrite (reg -> val , reg -> reg & 0xfff );
@@ -2106,7 +2094,7 @@ static int bttv_try_fmt_vid_cap(struct file *file, void *priv,
2106
2094
{
2107
2095
const struct bttv_format * fmt ;
2108
2096
struct bttv_fh * fh = priv ;
2109
- struct bttv * btv = fh -> btv ;
2097
+ struct bttv * btv = video_drvdata ( file ) ;
2110
2098
enum v4l2_field field ;
2111
2099
__s32 width , height ;
2112
2100
__s32 height2 ;
@@ -2165,7 +2153,7 @@ static int bttv_s_fmt_vid_cap(struct file *file, void *priv,
2165
2153
int retval ;
2166
2154
const struct bttv_format * fmt ;
2167
2155
struct bttv_fh * fh = priv ;
2168
- struct bttv * btv = fh -> btv ;
2156
+ struct bttv * btv = video_drvdata ( file ) ;
2169
2157
__s32 width , height ;
2170
2158
unsigned int width_mask , width_bias ;
2171
2159
enum v4l2_field field ;
@@ -2209,8 +2197,7 @@ static int bttv_s_fmt_vid_cap(struct file *file, void *priv,
2209
2197
static int bttv_querycap (struct file * file , void * priv ,
2210
2198
struct v4l2_capability * cap )
2211
2199
{
2212
- struct bttv_fh * fh = priv ;
2213
- struct bttv * btv = fh -> btv ;
2200
+ struct bttv * btv = video_drvdata (file );
2214
2201
2215
2202
if (0 == v4l2 )
2216
2203
return - EINVAL ;
@@ -2274,7 +2261,7 @@ static int bttv_querybuf(struct file *file, void *priv,
2274
2261
static int bttv_qbuf (struct file * file , void * priv , struct v4l2_buffer * b )
2275
2262
{
2276
2263
struct bttv_fh * fh = priv ;
2277
- struct bttv * btv = fh -> btv ;
2264
+ struct bttv * btv = video_drvdata ( file ) ;
2278
2265
int res = bttv_resource (fh );
2279
2266
2280
2267
if (!check_alloc_btres_lock (btv , fh , res ))
@@ -2322,8 +2309,7 @@ static int bttv_streamoff(struct file *file, void *priv,
2322
2309
static int bttv_g_parm (struct file * file , void * f ,
2323
2310
struct v4l2_streamparm * parm )
2324
2311
{
2325
- struct bttv_fh * fh = f ;
2326
- struct bttv * btv = fh -> btv ;
2312
+ struct bttv * btv = video_drvdata (file );
2327
2313
2328
2314
if (parm -> type != V4L2_BUF_TYPE_VIDEO_CAPTURE )
2329
2315
return - EINVAL ;
@@ -2337,8 +2323,7 @@ static int bttv_g_parm(struct file *file, void *f,
2337
2323
static int bttv_g_tuner (struct file * file , void * priv ,
2338
2324
struct v4l2_tuner * t )
2339
2325
{
2340
- struct bttv_fh * fh = priv ;
2341
- struct bttv * btv = fh -> btv ;
2326
+ struct bttv * btv = video_drvdata (file );
2342
2327
2343
2328
if (0 != t -> index )
2344
2329
return - EINVAL ;
@@ -2360,8 +2345,7 @@ static int bttv_g_tuner(struct file *file, void *priv,
2360
2345
static int bttv_g_pixelaspect (struct file * file , void * priv ,
2361
2346
int type , struct v4l2_fract * f )
2362
2347
{
2363
- struct bttv_fh * fh = priv ;
2364
- struct bttv * btv = fh -> btv ;
2348
+ struct bttv * btv = video_drvdata (file );
2365
2349
2366
2350
if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE )
2367
2351
return - EINVAL ;
@@ -2374,7 +2358,7 @@ static int bttv_g_pixelaspect(struct file *file, void *priv,
2374
2358
static int bttv_g_selection (struct file * file , void * f , struct v4l2_selection * sel )
2375
2359
{
2376
2360
struct bttv_fh * fh = f ;
2377
- struct bttv * btv = fh -> btv ;
2361
+ struct bttv * btv = video_drvdata ( file ) ;
2378
2362
2379
2363
if (sel -> type != V4L2_BUF_TYPE_VIDEO_CAPTURE )
2380
2364
return - EINVAL ;
@@ -2404,7 +2388,7 @@ static int bttv_g_selection(struct file *file, void *f, struct v4l2_selection *s
2404
2388
static int bttv_s_selection (struct file * file , void * f , struct v4l2_selection * sel )
2405
2389
{
2406
2390
struct bttv_fh * fh = f ;
2407
- struct bttv * btv = fh -> btv ;
2391
+ struct bttv * btv = video_drvdata ( file ) ;
2408
2392
const struct v4l2_rect * b ;
2409
2393
int retval ;
2410
2394
struct bttv_crop c ;
@@ -2781,7 +2765,7 @@ static int radio_open(struct file *file)
2781
2765
static int radio_release (struct file * file )
2782
2766
{
2783
2767
struct bttv_fh * fh = file -> private_data ;
2784
- struct bttv * btv = fh -> btv ;
2768
+ struct bttv * btv = video_drvdata ( file ) ;
2785
2769
struct saa6588_command cmd ;
2786
2770
2787
2771
file -> private_data = NULL ;
@@ -2800,8 +2784,7 @@ static int radio_release(struct file *file)
2800
2784
2801
2785
static int radio_g_tuner (struct file * file , void * priv , struct v4l2_tuner * t )
2802
2786
{
2803
- struct bttv_fh * fh = priv ;
2804
- struct bttv * btv = fh -> btv ;
2787
+ struct bttv * btv = video_drvdata (file );
2805
2788
2806
2789
if (0 != t -> index )
2807
2790
return - EINVAL ;
@@ -2823,8 +2806,7 @@ static int radio_g_tuner(struct file *file, void *priv, struct v4l2_tuner *t)
2823
2806
static int radio_s_tuner (struct file * file , void * priv ,
2824
2807
const struct v4l2_tuner * t )
2825
2808
{
2826
- struct bttv_fh * fh = priv ;
2827
- struct bttv * btv = fh -> btv ;
2809
+ struct bttv * btv = video_drvdata (file );
2828
2810
2829
2811
if (0 != t -> index )
2830
2812
return - EINVAL ;
@@ -2837,8 +2819,7 @@ static int radio_s_tuner(struct file *file, void *priv,
2837
2819
static int radio_s_hw_freq_seek (struct file * file , void * priv ,
2838
2820
const struct v4l2_hw_freq_seek * a )
2839
2821
{
2840
- struct bttv_fh * fh = priv ;
2841
- struct bttv * btv = fh -> btv ;
2822
+ struct bttv * btv = video_drvdata (file );
2842
2823
2843
2824
if (btv -> has_tea575x )
2844
2825
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,
2849
2830
static int radio_enum_freq_bands (struct file * file , void * priv ,
2850
2831
struct v4l2_frequency_band * band )
2851
2832
{
2852
- struct bttv_fh * fh = priv ;
2853
- struct bttv * btv = fh -> btv ;
2833
+ struct bttv * btv = video_drvdata (file );
2854
2834
2855
2835
if (btv -> has_tea575x )
2856
2836
return snd_tea575x_enum_freq_bands (& btv -> tea , band );
@@ -2861,8 +2841,7 @@ static int radio_enum_freq_bands(struct file *file, void *priv,
2861
2841
static ssize_t radio_read (struct file * file , char __user * data ,
2862
2842
size_t count , loff_t * ppos )
2863
2843
{
2864
- struct bttv_fh * fh = file -> private_data ;
2865
- struct bttv * btv = fh -> btv ;
2844
+ struct bttv * btv = video_drvdata (file );
2866
2845
struct saa6588_command cmd ;
2867
2846
2868
2847
cmd .block_count = count / 3 ;
@@ -2880,7 +2859,7 @@ static ssize_t radio_read(struct file *file, char __user *data,
2880
2859
static __poll_t radio_poll (struct file * file , poll_table * wait )
2881
2860
{
2882
2861
struct bttv_fh * fh = file -> private_data ;
2883
- struct bttv * btv = fh -> btv ;
2862
+ struct bttv * btv = video_drvdata ( file ) ;
2884
2863
__poll_t req_events = poll_requested_events (wait );
2885
2864
struct saa6588_command cmd ;
2886
2865
__poll_t res = 0 ;
0 commit comments