aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/frontends/dvb_dummy_fe.c
diff options
context:
space:
mode:
authorPatrick Boettcher <pb@linuxtv.org>2006-05-14 04:01:31 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-06-25 01:00:42 -0400
commitdea74869f3c62b0b7addd67017b22b394e942aac (patch)
treed1a597caea6615c76f34896cc832fd1371f2e776 /drivers/media/dvb/frontends/dvb_dummy_fe.c
parent332bed5fc25ab0eb84215ecd89a4acd48219eee0 (diff)
V4L/DVB (4028): Change dvb_frontend_ops to be a real field instead of a pointer field inside dvb_frontend
The dvb_frontend_ops is a pointer inside dvb_frontend. That's why every demod-driver is having a field of dvb_frontend_ops in its private-state-struct and using the reference for filling the pointer-field in dvb_frontend. - It saves at least two lines of code per demod-driver, - reduces object size (one less dereference per frontend_ops-access), - be coherent with dvb_tuner_ops, - makes it a little bit easier for newbies to understand how it works and - avoids stupid mistakes because you would have to copy the dvb_frontend_ops always, before you could assign the static pointer directly, which was dangerous. Signed-off-by: Patrick Boettcher <pb@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb/frontends/dvb_dummy_fe.c')
-rw-r--r--drivers/media/dvb/frontends/dvb_dummy_fe.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/drivers/media/dvb/frontends/dvb_dummy_fe.c b/drivers/media/dvb/frontends/dvb_dummy_fe.c
index 78ea4ff03e68..6271b1e7f6ab 100644
--- a/drivers/media/dvb/frontends/dvb_dummy_fe.c
+++ b/drivers/media/dvb/frontends/dvb_dummy_fe.c
@@ -30,7 +30,6 @@
30 30
31 31
32struct dvb_dummy_fe_state { 32struct dvb_dummy_fe_state {
33 struct dvb_frontend_ops ops;
34 struct dvb_frontend frontend; 33 struct dvb_frontend frontend;
35}; 34};
36 35
@@ -121,11 +120,8 @@ struct dvb_frontend* dvb_dummy_fe_ofdm_attach(void)
121 state = kmalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL); 120 state = kmalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL);
122 if (state == NULL) goto error; 121 if (state == NULL) goto error;
123 122
124 /* setup the state */
125 memcpy(&state->ops, &dvb_dummy_fe_ofdm_ops, sizeof(struct dvb_frontend_ops));
126
127 /* create dvb_frontend */ 123 /* create dvb_frontend */
128 state->frontend.ops = &state->ops; 124 memcpy(&state->frontend.ops, &dvb_dummy_fe_ofdm_ops, sizeof(struct dvb_frontend_ops));
129 state->frontend.demodulator_priv = state; 125 state->frontend.demodulator_priv = state;
130 return &state->frontend; 126 return &state->frontend;
131 127
@@ -144,11 +140,8 @@ struct dvb_frontend* dvb_dummy_fe_qpsk_attach()
144 state = kmalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL); 140 state = kmalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL);
145 if (state == NULL) goto error; 141 if (state == NULL) goto error;
146 142
147 /* setup the state */
148 memcpy(&state->ops, &dvb_dummy_fe_qpsk_ops, sizeof(struct dvb_frontend_ops));
149
150 /* create dvb_frontend */ 143 /* create dvb_frontend */
151 state->frontend.ops = &state->ops; 144 memcpy(&state->frontend.ops, &dvb_dummy_fe_qpsk_ops, sizeof(struct dvb_frontend_ops));
152 state->frontend.demodulator_priv = state; 145 state->frontend.demodulator_priv = state;
153 return &state->frontend; 146 return &state->frontend;
154 147
@@ -167,11 +160,8 @@ struct dvb_frontend* dvb_dummy_fe_qam_attach()
167 state = kmalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL); 160 state = kmalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL);
168 if (state == NULL) goto error; 161 if (state == NULL) goto error;
169 162
170 /* setup the state */
171 memcpy(&state->ops, &dvb_dummy_fe_qam_ops, sizeof(struct dvb_frontend_ops));
172
173 /* create dvb_frontend */ 163 /* create dvb_frontend */
174 state->frontend.ops = &state->ops; 164 memcpy(&state->frontend.ops, &dvb_dummy_fe_qam_ops, sizeof(struct dvb_frontend_ops));
175 state->frontend.demodulator_priv = state; 165 state->frontend.demodulator_priv = state;
176 return &state->frontend; 166 return &state->frontend;
177 167