Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ccbac9bb174db457181f5f58fecf9cbc3020ea1d
Commit:     ccbac9bb174db457181f5f58fecf9cbc3020ea1d
Parent:     09f83c4fc06b02597ad4458c2a6675b0872f0b5c
Author:     Michael Krufky <[EMAIL PROTECTED]>
AuthorDate: Sun Jan 6 00:55:21 2008 -0300
Committer:  Mauro Carvalho Chehab <[EMAIL PROTECTED]>
CommitDate: Fri Jan 25 19:04:42 2008 -0200

    V4L/DVB (6978): tda18271: store frequency and bandwidth after successful 
tune
    
    Store last tuned frequency & bandwidth after successful tune.
    
    Clean up tune functions -- remove pointer to tune function in
    state structure, instead call tune function based on priv->id.
    
    Signed-off-by: Michael Krufky <[EMAIL PROTECTED]>
    Signed-off-by: Mauro Carvalho Chehab <[EMAIL PROTECTED]>
---
 drivers/media/dvb/frontends/tda18271-fe.c   |   46 ++++++++++++++++++++++-----
 drivers/media/dvb/frontends/tda18271-priv.h |    3 --
 2 files changed, 38 insertions(+), 11 deletions(-)

diff --git a/drivers/media/dvb/frontends/tda18271-fe.c 
b/drivers/media/dvb/frontends/tda18271-fe.c
index 1a86c9f..c1da16a 100644
--- a/drivers/media/dvb/frontends/tda18271-fe.c
+++ b/drivers/media/dvb/frontends/tda18271-fe.c
@@ -770,6 +770,23 @@ static int tda18271c1_tune(struct dvb_frontend *fe,
        return 0;
 }
 
+static inline int tda18271_tune(struct dvb_frontend *fe,
+                               u32 ifc, u32 freq, u32 bw, u8 std)
+{
+       struct tda18271_priv *priv = fe->tuner_priv;
+       int ret = -EINVAL;
+
+       switch (priv->id) {
+       case TDA18271HDC1:
+               ret = tda18271c1_tune(fe, ifc, freq, bw, std);
+               break;
+       case TDA18271HDC2:
+               ret = tda18271c2_tune(fe, ifc, freq, bw, std);
+               break;
+       }
+       return ret;
+}
+
 /* ------------------------------------------------------------------ */
 
 static int tda18271_set_params(struct dvb_frontend *fe,
@@ -777,12 +794,11 @@ static int tda18271_set_params(struct dvb_frontend *fe,
 {
        struct tda18271_priv *priv = fe->tuner_priv;
        struct tda18271_std_map *std_map = &priv->std;
+       int ret;
        u8 std;
        u16 sgIF;
        u32 bw, freq = params->frequency;
 
-       BUG_ON(!priv->tune);
-
        priv->mode = TDA18271_DIGITAL;
 
        /* see table 22 */
@@ -833,7 +849,16 @@ static int tda18271_set_params(struct dvb_frontend *fe,
                return -EINVAL;
        }
 
-       return priv->tune(fe, sgIF * 1000, freq, bw, std);
+       ret = tda18271_tune(fe, sgIF * 1000, freq, bw, std);
+
+       if (ret < 0)
+               goto fail;
+
+       priv->frequency = freq;
+       priv->bandwidth = (fe->ops.info.type == FE_OFDM) ?
+               params->u.ofdm.bandwidth : 0;
+fail:
+       return ret;
 }
 
 static int tda18271_set_analog_params(struct dvb_frontend *fe,
@@ -842,12 +867,11 @@ static int tda18271_set_analog_params(struct dvb_frontend 
*fe,
        struct tda18271_priv *priv = fe->tuner_priv;
        struct tda18271_std_map *std_map = &priv->std;
        char *mode;
+       int ret;
        u8 std;
        u16 sgIF;
        u32 freq = params->frequency * 62500;
 
-       BUG_ON(!priv->tune);
-
        priv->mode = TDA18271_ANALOG;
 
        if (params->std & V4L2_STD_MN) {
@@ -886,7 +910,15 @@ static int tda18271_set_analog_params(struct dvb_frontend 
*fe,
 
        tda_dbg("setting tda18271 to system %s\n", mode);
 
-       return priv->tune(fe, sgIF * 1000, freq, 0, std);
+       ret = tda18271_tune(fe, sgIF * 1000, freq, 0, std);
+
+       if (ret < 0)
+               goto fail;
+
+       priv->frequency = freq;
+       priv->bandwidth = 0;
+fail:
+       return ret;
 }
 
 static int tda18271_release(struct dvb_frontend *fe)
@@ -986,12 +1018,10 @@ static int tda18271_get_id(struct dvb_frontend *fe)
        case 3:
                name = "TDA18271HD/C1";
                priv->id = TDA18271HDC1;
-               priv->tune = tda18271c1_tune;
                break;
        case 4:
                name = "TDA18271HD/C2";
                priv->id = TDA18271HDC2;
-               priv->tune = tda18271c2_tune;
                break;
        default:
                name = "Unknown device";
diff --git a/drivers/media/dvb/frontends/tda18271-priv.h 
b/drivers/media/dvb/frontends/tda18271-priv.h
index 7b06e05..b4d1ab7 100644
--- a/drivers/media/dvb/frontends/tda18271-priv.h
+++ b/drivers/media/dvb/frontends/tda18271-priv.h
@@ -112,9 +112,6 @@ struct tda18271_priv {
        struct tda18271_std_map std;
        struct tda18271_rf_tracking_filter_cal rf_cal_state[8];
 
-       int (*tune) (struct dvb_frontend *fe,
-                    u32 ifc, u32 freq, u32 bw, u8 std);
-
        u32 frequency;
        u32 bandwidth;
 };
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to