rcar-gen2: linux-renesas: backport r820t tuner driver to fix SPEC-418
[AGL/meta-agl.git] / meta-agl-bsp / meta-renesas / recipes-kernel / linux / linux / 0002-media-r820t-remove-redundant-initializations-in-r820.patch
1 From e2e324d70defce7ffc4668085dc3c8ae580074e5 Mon Sep 17 00:00:00 2001
2 From: Gianluca Gennari <gennarone@gmail.com>
3 Date: Sun, 2 Jun 2013 14:30:09 -0300
4 Subject: [PATCH 2/3] [media] r820t: remove redundant initializations in
5  r820t_attach()
6
7 fe->tuner_priv and fe->ops.tuner_ops are initialized twice in r820t_attach().
8 Remove the redundant initializations and also move fe->ops.tuner_ops
9 initialization outside of the mutex lock (as in the xc4000 tuner code for example).
10
11 Signed-off-by: Gianluca Gennari <gennarone@gmail.com>
12 Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
13 Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 ---
15  drivers/media/tuners/r820t.c | 9 +++------
16  1 file changed, 3 insertions(+), 6 deletions(-)
17
18 diff --git a/drivers/media/tuners/r820t.c b/drivers/media/tuners/r820t.c
19 index 64f9738..63062a9 100644
20 --- a/drivers/media/tuners/r820t.c
21 +++ b/drivers/media/tuners/r820t.c
22 @@ -2310,8 +2310,6 @@ struct dvb_frontend *r820t_attach(struct dvb_frontend *fe,
23                 break;
24         }
25  
26 -       memcpy(&fe->ops.tuner_ops, &r820t_tuner_ops, sizeof(r820t_tuner_ops));
27 -
28         if (fe->ops.i2c_gate_ctrl)
29                 fe->ops.i2c_gate_ctrl(fe, 1);
30  
31 @@ -2326,15 +2324,14 @@ struct dvb_frontend *r820t_attach(struct dvb_frontend *fe,
32  
33         tuner_info("Rafael Micro r820t successfully identified\n");
34  
35 -       fe->tuner_priv = priv;
36 -       memcpy(&fe->ops.tuner_ops, &r820t_tuner_ops,
37 -                       sizeof(struct dvb_tuner_ops));
38 -
39         if (fe->ops.i2c_gate_ctrl)
40                 fe->ops.i2c_gate_ctrl(fe, 0);
41  
42         mutex_unlock(&r820t_list_mutex);
43  
44 +       memcpy(&fe->ops.tuner_ops, &r820t_tuner_ops,
45 +                       sizeof(struct dvb_tuner_ops));
46 +
47         return fe;
48  err:
49         if (fe->ops.i2c_gate_ctrl)
50 -- 
51 2.9.2
52