treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / drivers / media / dvb-frontends / stb6100_cfg.h
blob1408c0c449172cfd16f3d9e25dc115e8cb062333
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3 STB6100 Silicon Tuner
4 Copyright (C) Manu Abraham (abraham.manu@gmail.com)
6 Copyright (C) ST Microelectronics
8 */
10 #include <linux/dvb/frontend.h>
11 #include <media/dvb_frontend.h>
13 static int stb6100_get_frequency(struct dvb_frontend *fe, u32 *frequency)
15 struct dvb_frontend_ops *frontend_ops = &fe->ops;
16 struct dvb_tuner_ops *tuner_ops = &frontend_ops->tuner_ops;
17 int err = 0;
19 if (tuner_ops->get_frequency) {
20 err = tuner_ops->get_frequency(fe, frequency);
21 if (err < 0) {
22 printk("%s: Invalid parameter\n", __func__);
23 return err;
26 return 0;
29 static int stb6100_set_frequency(struct dvb_frontend *fe, u32 frequency)
31 struct dvb_frontend_ops *frontend_ops = &fe->ops;
32 struct dvb_tuner_ops *tuner_ops = &frontend_ops->tuner_ops;
33 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
34 u32 bw = c->bandwidth_hz;
35 int err = 0;
37 c->frequency = frequency;
38 c->bandwidth_hz = 0; /* Don't adjust the bandwidth */
40 if (tuner_ops->set_params) {
41 err = tuner_ops->set_params(fe);
42 c->bandwidth_hz = bw;
43 if (err < 0) {
44 printk("%s: Invalid parameter\n", __func__);
45 return err;
48 return 0;
51 static int stb6100_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth)
53 struct dvb_frontend_ops *frontend_ops = &fe->ops;
54 struct dvb_tuner_ops *tuner_ops = &frontend_ops->tuner_ops;
55 int err = 0;
57 if (tuner_ops->get_bandwidth) {
58 err = tuner_ops->get_bandwidth(fe, bandwidth);
59 if (err < 0) {
60 printk("%s: Invalid parameter\n", __func__);
61 return err;
64 return 0;
67 static int stb6100_set_bandwidth(struct dvb_frontend *fe, u32 bandwidth)
69 struct dvb_frontend_ops *frontend_ops = &fe->ops;
70 struct dvb_tuner_ops *tuner_ops = &frontend_ops->tuner_ops;
71 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
72 u32 freq = c->frequency;
73 int err = 0;
75 c->bandwidth_hz = bandwidth;
76 c->frequency = 0; /* Don't adjust the frequency */
78 if (tuner_ops->set_params) {
79 err = tuner_ops->set_params(fe);
80 c->frequency = freq;
81 if (err < 0) {
82 printk("%s: Invalid parameter\n", __func__);
83 return err;
86 return 0;