Avoid beyond bounds copy while caching ACL
[zen-stable.git] / drivers / media / dvb / frontends / tda8261_cfg.h
blob1af1ee49b5421d07bef42a59fe19fffefb4722b0
1 /*
2 TDA8261 8PSK/QPSK tuner driver
3 Copyright (C) Manu Abraham (abraham.manu@gmail.com)
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 static int tda8261_get_frequency(struct dvb_frontend *fe, u32 *frequency)
22 struct dvb_frontend_ops *frontend_ops = NULL;
23 struct dvb_tuner_ops *tuner_ops = NULL;
24 struct tuner_state t_state;
25 int err = 0;
27 if (&fe->ops)
28 frontend_ops = &fe->ops;
29 if (&frontend_ops->tuner_ops)
30 tuner_ops = &frontend_ops->tuner_ops;
31 if (tuner_ops->get_state) {
32 if ((err = tuner_ops->get_state(fe, DVBFE_TUNER_FREQUENCY, &t_state)) < 0) {
33 printk("%s: Invalid parameter\n", __func__);
34 return err;
36 *frequency = t_state.frequency;
37 printk("%s: Frequency=%d\n", __func__, t_state.frequency);
39 return 0;
42 static int tda8261_set_frequency(struct dvb_frontend *fe, u32 frequency)
44 struct dvb_frontend_ops *frontend_ops = NULL;
45 struct dvb_tuner_ops *tuner_ops = NULL;
46 struct tuner_state t_state;
47 int err = 0;
49 t_state.frequency = frequency;
50 if (&fe->ops)
51 frontend_ops = &fe->ops;
52 if (&frontend_ops->tuner_ops)
53 tuner_ops = &frontend_ops->tuner_ops;
54 if (tuner_ops->set_state) {
55 if ((err = tuner_ops->set_state(fe, DVBFE_TUNER_FREQUENCY, &t_state)) < 0) {
56 printk("%s: Invalid parameter\n", __func__);
57 return err;
60 printk("%s: Frequency=%d\n", __func__, t_state.frequency);
61 return 0;
64 static int tda8261_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth)
66 struct dvb_frontend_ops *frontend_ops = &fe->ops;
67 struct dvb_tuner_ops *tuner_ops = &frontend_ops->tuner_ops;
68 struct tuner_state t_state;
69 int err = 0;
71 if (&fe->ops)
72 frontend_ops = &fe->ops;
73 if (&frontend_ops->tuner_ops)
74 tuner_ops = &frontend_ops->tuner_ops;
75 if (tuner_ops->get_state) {
76 if ((err = tuner_ops->get_state(fe, DVBFE_TUNER_BANDWIDTH, &t_state)) < 0) {
77 printk("%s: Invalid parameter\n", __func__);
78 return err;
80 *bandwidth = t_state.bandwidth;
82 printk("%s: Bandwidth=%d\n", __func__, t_state.bandwidth);
83 return 0;