Merge branch 'vuplus-1.6' of 192.168.102.66:/var/ikseong/repo/openembedded into test_0921
[vuplus_openembedded] / recipes / v4l-dvb / files / backport-6.patch
1 commit 9e332f6087c1bac263298afc3ef96c368131cbc1
2 Author: Andreas Oberritter <obi@linuxtv.org>
3 Date:   Sun May 8 20:03:39 2011 -0300
4
5     [media] DVB: dvb_frontend: use shortcut to access fe->dtv_property_cache
6     
7     Signed-off-by: Andreas Oberritter <obi@linuxtv.org>
8     Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
9     
10     Conflicts:
11     
12         drivers/media/dvb/dvb-core/dvb_frontend.c
13
14 diff -Naur a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c
15 --- a/drivers/media/dvb/dvb-core/dvb_frontend.c 2011-08-09 18:55:42.736223117 +0200
16 +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c 2011-08-09 18:57:42.520221665 +0200
17 @@ -871,34 +871,34 @@
18  
19  static int dvb_frontend_clear_cache(struct dvb_frontend *fe)
20  {
21 +       struct dtv_frontend_properties *c = &fe->dtv_property_cache;
22         int i;
23  
24 -       memset(&(fe->dtv_property_cache), 0,
25 -                       sizeof(struct dtv_frontend_properties));
26 +       memset(c, 0, sizeof(struct dtv_frontend_properties));
27  
28 -       fe->dtv_property_cache.state = DTV_CLEAR;
29 -       fe->dtv_property_cache.delivery_system = SYS_UNDEFINED;
30 -       fe->dtv_property_cache.inversion = INVERSION_AUTO;
31 -       fe->dtv_property_cache.fec_inner = FEC_AUTO;
32 -       fe->dtv_property_cache.transmission_mode = TRANSMISSION_MODE_AUTO;
33 -       fe->dtv_property_cache.bandwidth_hz = BANDWIDTH_AUTO;
34 -       fe->dtv_property_cache.guard_interval = GUARD_INTERVAL_AUTO;
35 -       fe->dtv_property_cache.hierarchy = HIERARCHY_AUTO;
36 -       fe->dtv_property_cache.symbol_rate = QAM_AUTO;
37 -       fe->dtv_property_cache.code_rate_HP = FEC_AUTO;
38 -       fe->dtv_property_cache.code_rate_LP = FEC_AUTO;
39 -
40 -       fe->dtv_property_cache.isdbt_partial_reception = -1;
41 -       fe->dtv_property_cache.isdbt_sb_mode = -1;
42 -       fe->dtv_property_cache.isdbt_sb_subchannel = -1;
43 -       fe->dtv_property_cache.isdbt_sb_segment_idx = -1;
44 -       fe->dtv_property_cache.isdbt_sb_segment_count = -1;
45 -       fe->dtv_property_cache.isdbt_layer_enabled = 0x7;
46 +       c->state = DTV_CLEAR;
47 +       c->delivery_system = SYS_UNDEFINED;
48 +       c->inversion = INVERSION_AUTO;
49 +       c->fec_inner = FEC_AUTO;
50 +       c->transmission_mode = TRANSMISSION_MODE_AUTO;
51 +       c->bandwidth_hz = BANDWIDTH_AUTO;
52 +       c->guard_interval = GUARD_INTERVAL_AUTO;
53 +       c->hierarchy = HIERARCHY_AUTO;
54 +       c->symbol_rate = QAM_AUTO;
55 +       c->code_rate_HP = FEC_AUTO;
56 +       c->code_rate_LP = FEC_AUTO;
57 +
58 +       c->isdbt_partial_reception = -1;
59 +       c->isdbt_sb_mode = -1;
60 +       c->isdbt_sb_subchannel = -1;
61 +       c->isdbt_sb_segment_idx = -1;
62 +       c->isdbt_sb_segment_count = -1;
63 +       c->isdbt_layer_enabled = 0x7;
64         for (i = 0; i < 3; i++) {
65 -               fe->dtv_property_cache.layer[i].fec = FEC_AUTO;
66 -               fe->dtv_property_cache.layer[i].modulation = QAM_AUTO;
67 -               fe->dtv_property_cache.layer[i].interleaving = -1;
68 -               fe->dtv_property_cache.layer[i].segment_count = -1;
69 +               c->layer[i].fec = FEC_AUTO;
70 +               c->layer[i].modulation = QAM_AUTO;
71 +               c->layer[i].interleaving = -1;
72 +               c->layer[i].segment_count = -1;
73         }
74  
75         return 0;
76 @@ -1207,118 +1207,119 @@
77                                     struct dtv_property *tvp,
78                                     struct inode *inode, struct file *file)
79  {
80 +       const struct dtv_frontend_properties *c = &fe->dtv_property_cache;
81         int r;
82  
83         switch(tvp->cmd) {
84         case DTV_FREQUENCY:
85 -               tvp->u.data = fe->dtv_property_cache.frequency;
86 +               tvp->u.data = c->frequency;
87                 break;
88         case DTV_MODULATION:
89 -               tvp->u.data = fe->dtv_property_cache.modulation;
90 +               tvp->u.data = c->modulation;
91                 break;
92         case DTV_BANDWIDTH_HZ:
93 -               tvp->u.data = fe->dtv_property_cache.bandwidth_hz;
94 +               tvp->u.data = c->bandwidth_hz;
95                 break;
96         case DTV_INVERSION:
97 -               tvp->u.data = fe->dtv_property_cache.inversion;
98 +               tvp->u.data = c->inversion;
99                 break;
100         case DTV_SYMBOL_RATE:
101 -               tvp->u.data = fe->dtv_property_cache.symbol_rate;
102 +               tvp->u.data = c->symbol_rate;
103                 break;
104         case DTV_INNER_FEC:
105 -               tvp->u.data = fe->dtv_property_cache.fec_inner;
106 +               tvp->u.data = c->fec_inner;
107                 break;
108         case DTV_PILOT:
109 -               tvp->u.data = fe->dtv_property_cache.pilot;
110 +               tvp->u.data = c->pilot;
111                 break;
112         case DTV_ROLLOFF:
113 -               tvp->u.data = fe->dtv_property_cache.rolloff;
114 +               tvp->u.data = c->rolloff;
115                 break;
116         case DTV_DELIVERY_SYSTEM:
117 -               tvp->u.data = fe->dtv_property_cache.delivery_system;
118 +               tvp->u.data = c->delivery_system;
119                 break;
120         case DTV_VOLTAGE:
121 -               tvp->u.data = fe->dtv_property_cache.voltage;
122 +               tvp->u.data = c->voltage;
123                 break;
124         case DTV_TONE:
125 -               tvp->u.data = fe->dtv_property_cache.sectone;
126 +               tvp->u.data = c->sectone;
127                 break;
128         case DTV_API_VERSION:
129                 tvp->u.data = (DVB_API_VERSION << 8) | DVB_API_VERSION_MINOR;
130                 break;
131         case DTV_CODE_RATE_HP:
132 -               tvp->u.data = fe->dtv_property_cache.code_rate_HP;
133 +               tvp->u.data = c->code_rate_HP;
134                 break;
135         case DTV_CODE_RATE_LP:
136 -               tvp->u.data = fe->dtv_property_cache.code_rate_LP;
137 +               tvp->u.data = c->code_rate_LP;
138                 break;
139         case DTV_GUARD_INTERVAL:
140 -               tvp->u.data = fe->dtv_property_cache.guard_interval;
141 +               tvp->u.data = c->guard_interval;
142                 break;
143         case DTV_TRANSMISSION_MODE:
144 -               tvp->u.data = fe->dtv_property_cache.transmission_mode;
145 +               tvp->u.data = c->transmission_mode;
146                 break;
147         case DTV_HIERARCHY:
148 -               tvp->u.data = fe->dtv_property_cache.hierarchy;
149 +               tvp->u.data = c->hierarchy;
150                 break;
151  
152         /* ISDB-T Support here */
153         case DTV_ISDBT_PARTIAL_RECEPTION:
154 -               tvp->u.data = fe->dtv_property_cache.isdbt_partial_reception;
155 +               tvp->u.data = c->isdbt_partial_reception;
156                 break;
157         case DTV_ISDBT_SOUND_BROADCASTING:
158 -               tvp->u.data = fe->dtv_property_cache.isdbt_sb_mode;
159 +               tvp->u.data = c->isdbt_sb_mode;
160                 break;
161         case DTV_ISDBT_SB_SUBCHANNEL_ID:
162 -               tvp->u.data = fe->dtv_property_cache.isdbt_sb_subchannel;
163 +               tvp->u.data = c->isdbt_sb_subchannel;
164                 break;
165         case DTV_ISDBT_SB_SEGMENT_IDX:
166 -               tvp->u.data = fe->dtv_property_cache.isdbt_sb_segment_idx;
167 +               tvp->u.data = c->isdbt_sb_segment_idx;
168                 break;
169         case DTV_ISDBT_SB_SEGMENT_COUNT:
170 -               tvp->u.data = fe->dtv_property_cache.isdbt_sb_segment_count;
171 +               tvp->u.data = c->isdbt_sb_segment_count;
172                 break;
173         case DTV_ISDBT_LAYER_ENABLED:
174 -               tvp->u.data = fe->dtv_property_cache.isdbt_layer_enabled;
175 +               tvp->u.data = c->isdbt_layer_enabled;
176                 break;
177         case DTV_ISDBT_LAYERA_FEC:
178 -               tvp->u.data = fe->dtv_property_cache.layer[0].fec;
179 +               tvp->u.data = c->layer[0].fec;
180                 break;
181         case DTV_ISDBT_LAYERA_MODULATION:
182 -               tvp->u.data = fe->dtv_property_cache.layer[0].modulation;
183 +               tvp->u.data = c->layer[0].modulation;
184                 break;
185         case DTV_ISDBT_LAYERA_SEGMENT_COUNT:
186 -               tvp->u.data = fe->dtv_property_cache.layer[0].segment_count;
187 +               tvp->u.data = c->layer[0].segment_count;
188                 break;
189         case DTV_ISDBT_LAYERA_TIME_INTERLEAVING:
190 -               tvp->u.data = fe->dtv_property_cache.layer[0].interleaving;
191 +               tvp->u.data = c->layer[0].interleaving;
192                 break;
193         case DTV_ISDBT_LAYERB_FEC:
194 -               tvp->u.data = fe->dtv_property_cache.layer[1].fec;
195 +               tvp->u.data = c->layer[1].fec;
196                 break;
197         case DTV_ISDBT_LAYERB_MODULATION:
198 -               tvp->u.data = fe->dtv_property_cache.layer[1].modulation;
199 +               tvp->u.data = c->layer[1].modulation;
200                 break;
201         case DTV_ISDBT_LAYERB_SEGMENT_COUNT:
202 -               tvp->u.data = fe->dtv_property_cache.layer[1].segment_count;
203 +               tvp->u.data = c->layer[1].segment_count;
204                 break;
205         case DTV_ISDBT_LAYERB_TIME_INTERLEAVING:
206 -               tvp->u.data = fe->dtv_property_cache.layer[1].interleaving;
207 +               tvp->u.data = c->layer[1].interleaving;
208                 break;
209         case DTV_ISDBT_LAYERC_FEC:
210 -               tvp->u.data = fe->dtv_property_cache.layer[2].fec;
211 +               tvp->u.data = c->layer[2].fec;
212                 break;
213         case DTV_ISDBT_LAYERC_MODULATION:
214 -               tvp->u.data = fe->dtv_property_cache.layer[2].modulation;
215 +               tvp->u.data = c->layer[2].modulation;
216                 break;
217         case DTV_ISDBT_LAYERC_SEGMENT_COUNT:
218 -               tvp->u.data = fe->dtv_property_cache.layer[2].segment_count;
219 +               tvp->u.data = c->layer[2].segment_count;
220                 break;
221         case DTV_ISDBT_LAYERC_TIME_INTERLEAVING:
222 -               tvp->u.data = fe->dtv_property_cache.layer[2].interleaving;
223 +               tvp->u.data = c->layer[2].interleaving;
224                 break;
225         case DTV_ISDBS_TS_ID:
226 -               tvp->u.data = fe->dtv_property_cache.isdbs_ts_id;
227 +               tvp->u.data = c->isdbs_ts_id;
228                 break;
229         default:
230                 return -EINVAL;
231 @@ -1342,6 +1343,7 @@
232                                     struct file *file)
233  {
234         int r = 0;
235 +       struct dtv_frontend_properties *c = &fe->dtv_property_cache;
236         struct dvb_frontend_private *fepriv = fe->frontend_priv;
237         dtv_property_dump(tvp);
238  
239 @@ -1365,7 +1367,7 @@
240                  * tunerequest so we can pass validation in the FE_SET_FRONTEND
241                  * ioctl.
242                  */
243 -               fe->dtv_property_cache.state = tvp->cmd;
244 +               c->state = tvp->cmd;
245                 dprintk("%s() Finalised property cache\n", __func__);
246                 dtv_property_cache_submit(fe);
247  
248 @@ -1373,115 +1375,115 @@
249                         &fepriv->parameters_in);
250                 break;
251         case DTV_FREQUENCY:
252 -               fe->dtv_property_cache.frequency = tvp->u.data;
253 +               c->frequency = tvp->u.data;
254                 break;
255         case DTV_MODULATION:
256 -               fe->dtv_property_cache.modulation = tvp->u.data;
257 +               c->modulation = tvp->u.data;
258                 break;
259         case DTV_BANDWIDTH_HZ:
260 -               fe->dtv_property_cache.bandwidth_hz = tvp->u.data;
261 +               c->bandwidth_hz = tvp->u.data;
262                 break;
263         case DTV_INVERSION:
264 -               fe->dtv_property_cache.inversion = tvp->u.data;
265 +               c->inversion = tvp->u.data;
266                 break;
267         case DTV_SYMBOL_RATE:
268 -               fe->dtv_property_cache.symbol_rate = tvp->u.data;
269 +               c->symbol_rate = tvp->u.data;
270                 break;
271         case DTV_INNER_FEC:
272 -               fe->dtv_property_cache.fec_inner = tvp->u.data;
273 +               c->fec_inner = tvp->u.data;
274                 break;
275         case DTV_PILOT:
276 -               fe->dtv_property_cache.pilot = tvp->u.data;
277 +               c->pilot = tvp->u.data;
278                 break;
279         case DTV_ROLLOFF:
280 -               fe->dtv_property_cache.rolloff = tvp->u.data;
281 +               c->rolloff = tvp->u.data;
282                 break;
283         case DTV_DELIVERY_SYSTEM:
284 -               fe->dtv_property_cache.delivery_system = tvp->u.data;
285 +               c->delivery_system = tvp->u.data;
286                 break;
287         case DTV_VOLTAGE:
288 -               fe->dtv_property_cache.voltage = tvp->u.data;
289 +               c->voltage = tvp->u.data;
290                 r = dvb_frontend_ioctl_legacy(inode, file, FE_SET_VOLTAGE,
291 -                       (void *)fe->dtv_property_cache.voltage);
292 +                       (void *)c->voltage);
293                 break;
294         case DTV_TONE:
295 -               fe->dtv_property_cache.sectone = tvp->u.data;
296 +               c->sectone = tvp->u.data;
297                 r = dvb_frontend_ioctl_legacy(inode, file, FE_SET_TONE,
298 -                       (void *)fe->dtv_property_cache.sectone);
299 +                       (void *)c->sectone);
300                 break;
301         case DTV_CODE_RATE_HP:
302 -               fe->dtv_property_cache.code_rate_HP = tvp->u.data;
303 +               c->code_rate_HP = tvp->u.data;
304                 break;
305         case DTV_CODE_RATE_LP:
306 -               fe->dtv_property_cache.code_rate_LP = tvp->u.data;
307 +               c->code_rate_LP = tvp->u.data;
308                 break;
309         case DTV_GUARD_INTERVAL:
310 -               fe->dtv_property_cache.guard_interval = tvp->u.data;
311 +               c->guard_interval = tvp->u.data;
312                 break;
313         case DTV_TRANSMISSION_MODE:
314 -               fe->dtv_property_cache.transmission_mode = tvp->u.data;
315 +               c->transmission_mode = tvp->u.data;
316                 break;
317         case DTV_HIERARCHY:
318 -               fe->dtv_property_cache.hierarchy = tvp->u.data;
319 +               c->hierarchy = tvp->u.data;
320                 break;
321  
322         /* ISDB-T Support here */
323         case DTV_ISDBT_PARTIAL_RECEPTION:
324 -               fe->dtv_property_cache.isdbt_partial_reception = tvp->u.data;
325 +               c->isdbt_partial_reception = tvp->u.data;
326                 break;
327         case DTV_ISDBT_SOUND_BROADCASTING:
328 -               fe->dtv_property_cache.isdbt_sb_mode = tvp->u.data;
329 +               c->isdbt_sb_mode = tvp->u.data;
330                 break;
331         case DTV_ISDBT_SB_SUBCHANNEL_ID:
332 -               fe->dtv_property_cache.isdbt_sb_subchannel = tvp->u.data;
333 +               c->isdbt_sb_subchannel = tvp->u.data;
334                 break;
335         case DTV_ISDBT_SB_SEGMENT_IDX:
336 -               fe->dtv_property_cache.isdbt_sb_segment_idx = tvp->u.data;
337 +               c->isdbt_sb_segment_idx = tvp->u.data;
338                 break;
339         case DTV_ISDBT_SB_SEGMENT_COUNT:
340 -               fe->dtv_property_cache.isdbt_sb_segment_count = tvp->u.data;
341 +               c->isdbt_sb_segment_count = tvp->u.data;
342                 break;
343         case DTV_ISDBT_LAYER_ENABLED:
344 -               fe->dtv_property_cache.isdbt_layer_enabled = tvp->u.data;
345 +               c->isdbt_layer_enabled = tvp->u.data;
346                 break;
347         case DTV_ISDBT_LAYERA_FEC:
348 -               fe->dtv_property_cache.layer[0].fec = tvp->u.data;
349 +               c->layer[0].fec = tvp->u.data;
350                 break;
351         case DTV_ISDBT_LAYERA_MODULATION:
352 -               fe->dtv_property_cache.layer[0].modulation = tvp->u.data;
353 +               c->layer[0].modulation = tvp->u.data;
354                 break;
355         case DTV_ISDBT_LAYERA_SEGMENT_COUNT:
356 -               fe->dtv_property_cache.layer[0].segment_count = tvp->u.data;
357 +               c->layer[0].segment_count = tvp->u.data;
358                 break;
359         case DTV_ISDBT_LAYERA_TIME_INTERLEAVING:
360 -               fe->dtv_property_cache.layer[0].interleaving = tvp->u.data;
361 +               c->layer[0].interleaving = tvp->u.data;
362                 break;
363         case DTV_ISDBT_LAYERB_FEC:
364 -               fe->dtv_property_cache.layer[1].fec = tvp->u.data;
365 +               c->layer[1].fec = tvp->u.data;
366                 break;
367         case DTV_ISDBT_LAYERB_MODULATION:
368 -               fe->dtv_property_cache.layer[1].modulation = tvp->u.data;
369 +               c->layer[1].modulation = tvp->u.data;
370                 break;
371         case DTV_ISDBT_LAYERB_SEGMENT_COUNT:
372 -               fe->dtv_property_cache.layer[1].segment_count = tvp->u.data;
373 +               c->layer[1].segment_count = tvp->u.data;
374                 break;
375         case DTV_ISDBT_LAYERB_TIME_INTERLEAVING:
376 -               fe->dtv_property_cache.layer[1].interleaving = tvp->u.data;
377 +               c->layer[1].interleaving = tvp->u.data;
378                 break;
379         case DTV_ISDBT_LAYERC_FEC:
380 -               fe->dtv_property_cache.layer[2].fec = tvp->u.data;
381 +               c->layer[2].fec = tvp->u.data;
382                 break;
383         case DTV_ISDBT_LAYERC_MODULATION:
384 -               fe->dtv_property_cache.layer[2].modulation = tvp->u.data;
385 +               c->layer[2].modulation = tvp->u.data;
386                 break;
387         case DTV_ISDBT_LAYERC_SEGMENT_COUNT:
388 -               fe->dtv_property_cache.layer[2].segment_count = tvp->u.data;
389 +               c->layer[2].segment_count = tvp->u.data;
390                 break;
391         case DTV_ISDBT_LAYERC_TIME_INTERLEAVING:
392 -               fe->dtv_property_cache.layer[2].interleaving = tvp->u.data;
393 +               c->layer[2].interleaving = tvp->u.data;
394                 break;
395         case DTV_ISDBS_TS_ID:
396 -               fe->dtv_property_cache.isdbs_ts_id = tvp->u.data;
397 +               c->isdbs_ts_id = tvp->u.data;
398                 break;
399         default:
400                 return -EINVAL;
401 @@ -1495,6 +1497,7 @@
402  {
403         struct dvb_device *dvbdev = file->private_data;
404         struct dvb_frontend *fe = dvbdev->priv;
405 +       struct dtv_frontend_properties *c = &fe->dtv_property_cache;
406         struct dvb_frontend_private *fepriv = fe->frontend_priv;
407         int err = -EOPNOTSUPP;
408  
409 @@ -1514,7 +1517,7 @@
410         if ((cmd == FE_SET_PROPERTY) || (cmd == FE_GET_PROPERTY))
411                 err = dvb_frontend_ioctl_properties(inode, file, cmd, parg);
412         else {
413 -               fe->dtv_property_cache.state = DTV_UNDEFINED;
414 +               c->state = DTV_UNDEFINED;
415                 err = dvb_frontend_ioctl_legacy(inode, file, cmd, parg);
416         }
417  
418 @@ -1527,6 +1530,7 @@
419  {
420         struct dvb_device *dvbdev = file->private_data;
421         struct dvb_frontend *fe = dvbdev->priv;
422 +       struct dtv_frontend_properties *c = &fe->dtv_property_cache;
423         int err = 0;
424  
425         struct dtv_properties *tvps = NULL;
426 @@ -1564,7 +1568,7 @@
427                         (tvp+i)->result = err;
428                 }
429  
430 -               if(fe->dtv_property_cache.state == DTV_TUNE)
431 +               if (c->state == DTV_TUNE)
432                         dprintk("%s() Property cache is full, tuning\n", __func__);
433  
434         } else
435 @@ -1795,9 +1799,10 @@
436                 break;
437  
438         case FE_SET_FRONTEND: {
439 +               struct dtv_frontend_properties *c = &fe->dtv_property_cache;
440                 struct dvb_frontend_tune_settings fetunesettings;
441  
442 -               if(fe->dtv_property_cache.state == DTV_TUNE) {
443 +               if (c->state == DTV_TUNE) {
444                         if (dvb_frontend_check_parameters(fe, &fepriv->parameters_in) < 0) {
445                                 err = -EINVAL;
446                                 break;