diff options
Diffstat (limited to 'drivers/media/tuners/m88ts2022.c')
-rw-r--r-- | drivers/media/tuners/m88ts2022.c | 355 |
1 files changed, 129 insertions, 226 deletions
diff --git a/drivers/media/tuners/m88ts2022.c b/drivers/media/tuners/m88ts2022.c index 40c42dec721b..caa542346891 100644 --- a/drivers/media/tuners/m88ts2022.c +++ b/drivers/media/tuners/m88ts2022.c @@ -18,120 +18,11 @@ #include "m88ts2022_priv.h" -/* write multiple registers */ -static int m88ts2022_wr_regs(struct m88ts2022_priv *priv, - u8 reg, const u8 *val, int len) +static int m88ts2022_cmd(struct m88ts2022_dev *dev, int op, int sleep, u8 reg, + u8 mask, u8 val, u8 *reg_val) { -#define MAX_WR_LEN 3 -#define MAX_WR_XFER_LEN (MAX_WR_LEN + 1) - int ret; - u8 buf[MAX_WR_XFER_LEN]; - struct i2c_msg msg[1] = { - { - .addr = priv->client->addr, - .flags = 0, - .len = 1 + len, - .buf = buf, - } - }; - - if (WARN_ON(len > MAX_WR_LEN)) - return -EINVAL; - - buf[0] = reg; - memcpy(&buf[1], val, len); - - ret = i2c_transfer(priv->client->adapter, msg, 1); - if (ret == 1) { - ret = 0; - } else { - dev_warn(&priv->client->dev, - "%s: i2c wr failed=%d reg=%02x len=%d\n", - KBUILD_MODNAME, ret, reg, len); - ret = -EREMOTEIO; - } - - return ret; -} - -/* read multiple registers */ -static int m88ts2022_rd_regs(struct m88ts2022_priv *priv, u8 reg, - u8 *val, int len) -{ -#define MAX_RD_LEN 1 -#define MAX_RD_XFER_LEN (MAX_RD_LEN) - int ret; - u8 buf[MAX_RD_XFER_LEN]; - struct i2c_msg msg[2] = { - { - .addr = priv->client->addr, - .flags = 0, - .len = 1, - .buf = ®, - }, { - .addr = priv->client->addr, - .flags = I2C_M_RD, - .len = len, - .buf = buf, - } - }; - - if (WARN_ON(len > MAX_RD_LEN)) - return -EINVAL; - - ret = i2c_transfer(priv->client->adapter, msg, 2); - if (ret == 2) { - memcpy(val, buf, len); - ret = 0; - } else { - dev_warn(&priv->client->dev, - "%s: i2c rd failed=%d reg=%02x len=%d\n", - KBUILD_MODNAME, ret, reg, len); - ret = -EREMOTEIO; - } - - return ret; -} - -/* write single register */ -static int m88ts2022_wr_reg(struct m88ts2022_priv *priv, u8 reg, u8 val) -{ - return m88ts2022_wr_regs(priv, reg, &val, 1); -} - -/* read single register */ -static int m88ts2022_rd_reg(struct m88ts2022_priv *priv, u8 reg, u8 *val) -{ - return m88ts2022_rd_regs(priv, reg, val, 1); -} - -/* write single register with mask */ -static int m88ts2022_wr_reg_mask(struct m88ts2022_priv *priv, - u8 reg, u8 val, u8 mask) -{ - int ret; - u8 u8tmp; - - /* no need for read if whole reg is written */ - if (mask != 0xff) { - ret = m88ts2022_rd_regs(priv, reg, &u8tmp, 1); - if (ret) - return ret; - - val &= mask; - u8tmp &= ~mask; - val |= u8tmp; - } - - return m88ts2022_wr_regs(priv, reg, &val, 1); -} - -static int m88ts2022_cmd(struct dvb_frontend *fe, - int op, int sleep, u8 reg, u8 mask, u8 val, u8 *reg_val) -{ - struct m88ts2022_priv *priv = fe->tuner_priv; int ret, i; - u8 u8tmp; + unsigned int utmp; struct m88ts2022_reg_val reg_vals[] = { {0x51, 0x1f - op}, {0x51, 0x1f}, @@ -140,12 +31,12 @@ static int m88ts2022_cmd(struct dvb_frontend *fe, }; for (i = 0; i < 2; i++) { - dev_dbg(&priv->client->dev, - "%s: i=%d op=%02x reg=%02x mask=%02x val=%02x\n", - __func__, i, op, reg, mask, val); + dev_dbg(&dev->client->dev, + "i=%d op=%02x reg=%02x mask=%02x val=%02x\n", + i, op, reg, mask, val); for (i = 0; i < ARRAY_SIZE(reg_vals); i++) { - ret = m88ts2022_wr_reg(priv, reg_vals[i].reg, + ret = regmap_write(dev->regmap, reg_vals[i].reg, reg_vals[i].val); if (ret) goto err; @@ -153,37 +44,38 @@ static int m88ts2022_cmd(struct dvb_frontend *fe, usleep_range(sleep * 1000, sleep * 10000); - ret = m88ts2022_rd_reg(priv, reg, &u8tmp); + ret = regmap_read(dev->regmap, reg, &utmp); if (ret) goto err; - if ((u8tmp & mask) != val) + if ((utmp & mask) != val) break; } if (reg_val) - *reg_val = u8tmp; + *reg_val = utmp; err: return ret; } static int m88ts2022_set_params(struct dvb_frontend *fe) { - struct m88ts2022_priv *priv = fe->tuner_priv; + struct m88ts2022_dev *dev = fe->tuner_priv; struct dtv_frontend_properties *c = &fe->dtv_property_cache; int ret; - unsigned int frequency_khz, frequency_offset_khz, f_3db_hz; + unsigned int utmp, frequency_khz, frequency_offset_khz, f_3db_hz; unsigned int f_ref_khz, f_vco_khz, div_ref, div_out, pll_n, gdiv28; u8 buf[3], u8tmp, cap_code, lpf_gm, lpf_mxdiv, div_max, div_min; u16 u16tmp; - dev_dbg(&priv->client->dev, - "%s: frequency=%d symbol_rate=%d rolloff=%d\n", - __func__, c->frequency, c->symbol_rate, c->rolloff); + + dev_dbg(&dev->client->dev, + "frequency=%d symbol_rate=%d rolloff=%d\n", + c->frequency, c->symbol_rate, c->rolloff); /* * Integer-N PLL synthesizer * kHz is used for all calculations to keep calculations within 32-bit */ - f_ref_khz = DIV_ROUND_CLOSEST(priv->cfg.clock, 1000); + f_ref_khz = DIV_ROUND_CLOSEST(dev->cfg.clock, 1000); div_ref = DIV_ROUND_CLOSEST(f_ref_khz, 2000); if (c->symbol_rate < 5000000) @@ -203,14 +95,14 @@ static int m88ts2022_set_params(struct dvb_frontend *fe) buf[0] = u8tmp; buf[1] = 0x40; - ret = m88ts2022_wr_regs(priv, 0x10, buf, 2); + ret = regmap_bulk_write(dev->regmap, 0x10, buf, 2); if (ret) goto err; f_vco_khz = frequency_khz * div_out; pll_n = f_vco_khz * div_ref / f_ref_khz; pll_n += pll_n % 2; - priv->frequency_khz = pll_n * f_ref_khz / div_ref / div_out; + dev->frequency_khz = pll_n * f_ref_khz / div_ref / div_out; if (pll_n < 4095) u16tmp = pll_n - 1024; @@ -222,88 +114,87 @@ static int m88ts2022_set_params(struct dvb_frontend *fe) buf[0] = (u16tmp >> 8) & 0x3f; buf[1] = (u16tmp >> 0) & 0xff; buf[2] = div_ref - 8; - ret = m88ts2022_wr_regs(priv, 0x01, buf, 3); + ret = regmap_bulk_write(dev->regmap, 0x01, buf, 3); if (ret) goto err; - dev_dbg(&priv->client->dev, - "%s: frequency=%u offset=%d f_vco_khz=%u pll_n=%u div_ref=%u div_out=%u\n", - __func__, priv->frequency_khz, - priv->frequency_khz - c->frequency, f_vco_khz, pll_n, - div_ref, div_out); + dev_dbg(&dev->client->dev, + "frequency=%u offset=%d f_vco_khz=%u pll_n=%u div_ref=%u div_out=%u\n", + dev->frequency_khz, dev->frequency_khz - c->frequency, + f_vco_khz, pll_n, div_ref, div_out); - ret = m88ts2022_cmd(fe, 0x10, 5, 0x15, 0x40, 0x00, NULL); + ret = m88ts2022_cmd(dev, 0x10, 5, 0x15, 0x40, 0x00, NULL); if (ret) goto err; - ret = m88ts2022_rd_reg(priv, 0x14, &u8tmp); + ret = regmap_read(dev->regmap, 0x14, &utmp); if (ret) goto err; - u8tmp &= 0x7f; - if (u8tmp < 64) { - ret = m88ts2022_wr_reg_mask(priv, 0x10, 0x80, 0x80); + utmp &= 0x7f; + if (utmp < 64) { + ret = regmap_update_bits(dev->regmap, 0x10, 0x80, 0x80); if (ret) goto err; - ret = m88ts2022_wr_reg(priv, 0x11, 0x6f); + ret = regmap_write(dev->regmap, 0x11, 0x6f); if (ret) goto err; - ret = m88ts2022_cmd(fe, 0x10, 5, 0x15, 0x40, 0x00, NULL); + ret = m88ts2022_cmd(dev, 0x10, 5, 0x15, 0x40, 0x00, NULL); if (ret) goto err; } - ret = m88ts2022_rd_reg(priv, 0x14, &u8tmp); + ret = regmap_read(dev->regmap, 0x14, &utmp); if (ret) goto err; - u8tmp &= 0x1f; - if (u8tmp > 19) { - ret = m88ts2022_wr_reg_mask(priv, 0x10, 0x00, 0x02); + utmp &= 0x1f; + if (utmp > 19) { + ret = regmap_update_bits(dev->regmap, 0x10, 0x02, 0x00); if (ret) goto err; } - ret = m88ts2022_cmd(fe, 0x08, 5, 0x3c, 0xff, 0x00, NULL); + ret = m88ts2022_cmd(dev, 0x08, 5, 0x3c, 0xff, 0x00, NULL); if (ret) goto err; - ret = m88ts2022_wr_reg(priv, 0x25, 0x00); + ret = regmap_write(dev->regmap, 0x25, 0x00); if (ret) goto err; - ret = m88ts2022_wr_reg(priv, 0x27, 0x70); + ret = regmap_write(dev->regmap, 0x27, 0x70); if (ret) goto err; - ret = m88ts2022_wr_reg(priv, 0x41, 0x09); + ret = regmap_write(dev->regmap, 0x41, 0x09); if (ret) goto err; - ret = m88ts2022_wr_reg(priv, 0x08, 0x0b); + ret = regmap_write(dev->regmap, 0x08, 0x0b); if (ret) goto err; /* filters */ gdiv28 = DIV_ROUND_CLOSEST(f_ref_khz * 1694U, 1000000U); - ret = m88ts2022_wr_reg(priv, 0x04, gdiv28); + ret = regmap_write(dev->regmap, 0x04, gdiv28); if (ret) goto err; - ret = m88ts2022_cmd(fe, 0x04, 2, 0x26, 0xff, 0x00, &u8tmp); + ret = m88ts2022_cmd(dev, 0x04, 2, 0x26, 0xff, 0x00, &u8tmp); if (ret) goto err; cap_code = u8tmp & 0x3f; - ret = m88ts2022_wr_reg(priv, 0x41, 0x0d); + ret = regmap_write(dev->regmap, 0x41, 0x0d); if (ret) goto err; - ret = m88ts2022_cmd(fe, 0x04, 2, 0x26, 0xff, 0x00, &u8tmp); + ret = m88ts2022_cmd(dev, 0x04, 2, 0x26, 0xff, 0x00, &u8tmp); if (ret) goto err; @@ -314,7 +205,7 @@ static int m88ts2022_set_params(struct dvb_frontend *fe) div_min = gdiv28 * 78 / 100; div_max = clamp_val(div_max, 0U, 63U); - f_3db_hz = c->symbol_rate * 135UL / 200UL; + f_3db_hz = mult_frac(c->symbol_rate, 135, 200); f_3db_hz += 2000000U + (frequency_offset_khz * 1000U); f_3db_hz = clamp(f_3db_hz, 7000000U, 40000000U); @@ -327,25 +218,25 @@ static int m88ts2022_set_params(struct dvb_frontend *fe) lpf_mxdiv = DIV_ROUND_CLOSEST(++lpf_gm * LPF_COEFF * f_ref_khz, f_3db_hz); lpf_mxdiv = clamp_val(lpf_mxdiv, 0U, div_max); - ret = m88ts2022_wr_reg(priv, 0x04, lpf_mxdiv); + ret = regmap_write(dev->regmap, 0x04, lpf_mxdiv); if (ret) goto err; - ret = m88ts2022_wr_reg(priv, 0x06, lpf_gm); + ret = regmap_write(dev->regmap, 0x06, lpf_gm); if (ret) goto err; - ret = m88ts2022_cmd(fe, 0x04, 2, 0x26, 0xff, 0x00, &u8tmp); + ret = m88ts2022_cmd(dev, 0x04, 2, 0x26, 0xff, 0x00, &u8tmp); if (ret) goto err; cap_code = u8tmp & 0x3f; - ret = m88ts2022_wr_reg(priv, 0x41, 0x09); + ret = regmap_write(dev->regmap, 0x41, 0x09); if (ret) goto err; - ret = m88ts2022_cmd(fe, 0x04, 2, 0x26, 0xff, 0x00, &u8tmp); + ret = m88ts2022_cmd(dev, 0x04, 2, 0x26, 0xff, 0x00, &u8tmp); if (ret) goto err; @@ -353,31 +244,31 @@ static int m88ts2022_set_params(struct dvb_frontend *fe) cap_code = (cap_code + u8tmp) / 2; u8tmp = cap_code | 0x80; - ret = m88ts2022_wr_reg(priv, 0x25, u8tmp); + ret = regmap_write(dev->regmap, 0x25, u8tmp); if (ret) goto err; - ret = m88ts2022_wr_reg(priv, 0x27, 0x30); + ret = regmap_write(dev->regmap, 0x27, 0x30); if (ret) goto err; - ret = m88ts2022_wr_reg(priv, 0x08, 0x09); + ret = regmap_write(dev->regmap, 0x08, 0x09); if (ret) goto err; - ret = m88ts2022_cmd(fe, 0x01, 20, 0x21, 0xff, 0x00, NULL); + ret = m88ts2022_cmd(dev, 0x01, 20, 0x21, 0xff, 0x00, NULL); if (ret) goto err; err: if (ret) - dev_dbg(&priv->client->dev, "%s: failed=%d\n", __func__, ret); + dev_dbg(&dev->client->dev, "failed=%d\n", ret); return ret; } static int m88ts2022_init(struct dvb_frontend *fe) { - struct m88ts2022_priv *priv = fe->tuner_priv; + struct m88ts2022_dev *dev = fe->tuner_priv; int ret, i; u8 u8tmp; static const struct m88ts2022_reg_val reg_vals[] = { @@ -393,23 +284,24 @@ static int m88ts2022_init(struct dvb_frontend *fe) {0x24, 0x02}, {0x12, 0xa0}, }; - dev_dbg(&priv->client->dev, "%s:\n", __func__); - ret = m88ts2022_wr_reg(priv, 0x00, 0x01); + dev_dbg(&dev->client->dev, "\n"); + + ret = regmap_write(dev->regmap, 0x00, 0x01); if (ret) goto err; - ret = m88ts2022_wr_reg(priv, 0x00, 0x03); + ret = regmap_write(dev->regmap, 0x00, 0x03); if (ret) goto err; - switch (priv->cfg.clock_out) { + switch (dev->cfg.clock_out) { case M88TS2022_CLOCK_OUT_DISABLED: u8tmp = 0x60; break; case M88TS2022_CLOCK_OUT_ENABLED: u8tmp = 0x70; - ret = m88ts2022_wr_reg(priv, 0x05, priv->cfg.clock_out_div); + ret = regmap_write(dev->regmap, 0x05, dev->cfg.clock_out_div); if (ret) goto err; break; @@ -420,58 +312,61 @@ static int m88ts2022_init(struct dvb_frontend *fe) goto err; } - ret = m88ts2022_wr_reg(priv, 0x42, u8tmp); + ret = regmap_write(dev->regmap, 0x42, u8tmp); if (ret) goto err; - if (priv->cfg.loop_through) + if (dev->cfg.loop_through) u8tmp = 0xec; else u8tmp = 0x6c; - ret = m88ts2022_wr_reg(priv, 0x62, u8tmp); + ret = regmap_write(dev->regmap, 0x62, u8tmp); if (ret) goto err; for (i = 0; i < ARRAY_SIZE(reg_vals); i++) { - ret = m88ts2022_wr_reg(priv, reg_vals[i].reg, reg_vals[i].val); + ret = regmap_write(dev->regmap, reg_vals[i].reg, reg_vals[i].val); if (ret) goto err; } err: if (ret) - dev_dbg(&priv->client->dev, "%s: failed=%d\n", __func__, ret); + dev_dbg(&dev->client->dev, "failed=%d\n", ret); return ret; } static int m88ts2022_sleep(struct dvb_frontend *fe) { - struct m88ts2022_priv *priv = fe->tuner_priv; + struct m88ts2022_dev *dev = fe->tuner_priv; int ret; - dev_dbg(&priv->client->dev, "%s:\n", __func__); - ret = m88ts2022_wr_reg(priv, 0x00, 0x00); + dev_dbg(&dev->client->dev, "\n"); + + ret = regmap_write(dev->regmap, 0x00, 0x00); if (ret) goto err; err: if (ret) - dev_dbg(&priv->client->dev, "%s: failed=%d\n", __func__, ret); + dev_dbg(&dev->client->dev, "failed=%d\n", ret); return ret; } static int m88ts2022_get_frequency(struct dvb_frontend *fe, u32 *frequency) { - struct m88ts2022_priv *priv = fe->tuner_priv; - dev_dbg(&priv->client->dev, "%s:\n", __func__); + struct m88ts2022_dev *dev = fe->tuner_priv; - *frequency = priv->frequency_khz; + dev_dbg(&dev->client->dev, "\n"); + + *frequency = dev->frequency_khz; return 0; } static int m88ts2022_get_if_frequency(struct dvb_frontend *fe, u32 *frequency) { - struct m88ts2022_priv *priv = fe->tuner_priv; - dev_dbg(&priv->client->dev, "%s:\n", __func__); + struct m88ts2022_dev *dev = fe->tuner_priv; + + dev_dbg(&dev->client->dev, "\n"); *frequency = 0; /* Zero-IF */ return 0; @@ -479,31 +374,30 @@ static int m88ts2022_get_if_frequency(struct dvb_frontend *fe, u32 *frequency) static int m88ts2022_get_rf_strength(struct dvb_frontend *fe, u16 *strength) { - struct m88ts2022_priv *priv = fe->tuner_priv; + struct m88ts2022_dev *dev = fe->tuner_priv; int ret; - u8 u8tmp; u16 gain, u16tmp; - unsigned int gain1, gain2, gain3; + unsigned int utmp, gain1, gain2, gain3; - ret = m88ts2022_rd_reg(priv, 0x3d, &u8tmp); + ret = regmap_read(dev->regmap, 0x3d, &utmp); if (ret) goto err; - gain1 = (u8tmp >> 0) & 0x1f; + gain1 = (utmp >> 0) & 0x1f; gain1 = clamp(gain1, 0U, 15U); - ret = m88ts2022_rd_reg(priv, 0x21, &u8tmp); + ret = regmap_read(dev->regmap, 0x21, &utmp); if (ret) goto err; - gain2 = (u8tmp >> 0) & 0x1f; + gain2 = (utmp >> 0) & 0x1f; gain2 = clamp(gain2, 2U, 16U); - ret = m88ts2022_rd_reg(priv, 0x66, &u8tmp); + ret = regmap_read(dev->regmap, 0x66, &utmp); if (ret) goto err; - gain3 = (u8tmp >> 3) & 0x07; + gain3 = (utmp >> 3) & 0x07; gain3 = clamp(gain3, 0U, 6U); gain = gain1 * 265 + gain2 * 338 + gain3 * 285; @@ -515,7 +409,7 @@ static int m88ts2022_get_rf_strength(struct dvb_frontend *fe, u16 *strength) *strength = (u16tmp - 59000) * 0xffff / (61500 - 59000); err: if (ret) - dev_dbg(&priv->client->dev, "%s: failed=%d\n", __func__, ret); + dev_dbg(&dev->client->dev, "failed=%d\n", ret); return ret; } @@ -540,46 +434,56 @@ static int m88ts2022_probe(struct i2c_client *client, { struct m88ts2022_config *cfg = client->dev.platform_data; struct dvb_frontend *fe = cfg->fe; - struct m88ts2022_priv *priv; + struct m88ts2022_dev *dev; int ret; - u8 chip_id, u8tmp; + u8 u8tmp; + unsigned int utmp; + static const struct regmap_config regmap_config = { + .reg_bits = 8, + .val_bits = 8, + }; - priv = kzalloc(sizeof(*priv), GFP_KERNEL); - if (!priv) { + dev = kzalloc(sizeof(*dev), GFP_KERNEL); + if (!dev) { ret = -ENOMEM; - dev_err(&client->dev, "%s: kzalloc() failed\n", KBUILD_MODNAME); + dev_err(&client->dev, "kzalloc() failed\n"); goto err; } - memcpy(&priv->cfg, cfg, sizeof(struct m88ts2022_config)); - priv->client = client; + memcpy(&dev->cfg, cfg, sizeof(struct m88ts2022_config)); + dev->client = client; + dev->regmap = devm_regmap_init_i2c(client, ®map_config); + if (IS_ERR(dev->regmap)) { + ret = PTR_ERR(dev->regmap); + goto err; + } /* check if the tuner is there */ - ret = m88ts2022_rd_reg(priv, 0x00, &u8tmp); + ret = regmap_read(dev->regmap, 0x00, &utmp); if (ret) goto err; - if ((u8tmp & 0x03) == 0x00) { - ret = m88ts2022_wr_reg(priv, 0x00, 0x01); - if (ret < 0) + if ((utmp & 0x03) == 0x00) { + ret = regmap_write(dev->regmap, 0x00, 0x01); + if (ret) goto err; usleep_range(2000, 50000); } - ret = m88ts2022_wr_reg(priv, 0x00, 0x03); + ret = regmap_write(dev->regmap, 0x00, 0x03); if (ret) goto err; usleep_range(2000, 50000); - ret = m88ts2022_rd_reg(priv, 0x00, &chip_id); + ret = regmap_read(dev->regmap, 0x00, &utmp); if (ret) goto err; - dev_dbg(&priv->client->dev, "%s: chip_id=%02x\n", __func__, chip_id); + dev_dbg(&dev->client->dev, "chip_id=%02x\n", utmp); - switch (chip_id) { + switch (utmp) { case 0xc3: case 0x83: break; @@ -587,13 +491,13 @@ static int m88ts2022_probe(struct i2c_client *client, goto err; } - switch (priv->cfg.clock_out) { + switch (dev->cfg.clock_out) { case M88TS2022_CLOCK_OUT_DISABLED: u8tmp = 0x60; break; case M88TS2022_CLOCK_OUT_ENABLED: u8tmp = 0x70; - ret = m88ts2022_wr_reg(priv, 0x05, priv->cfg.clock_out_div); + ret = regmap_write(dev->regmap, 0x05, dev->cfg.clock_out_div); if (ret) goto err; break; @@ -604,49 +508,48 @@ static int m88ts2022_probe(struct i2c_client *client, goto err; } - ret = m88ts2022_wr_reg(priv, 0x42, u8tmp); + ret = regmap_write(dev->regmap, 0x42, u8tmp); if (ret) goto err; - if (priv->cfg.loop_through) + if (dev->cfg.loop_through) u8tmp = 0xec; else u8tmp = 0x6c; - ret = m88ts2022_wr_reg(priv, 0x62, u8tmp); + ret = regmap_write(dev->regmap, 0x62, u8tmp); if (ret) goto err; /* sleep */ - ret = m88ts2022_wr_reg(priv, 0x00, 0x00); + ret = regmap_write(dev->regmap, 0x00, 0x00); if (ret) goto err; - dev_info(&priv->client->dev, - "%s: Montage M88TS2022 successfully identified\n", - KBUILD_MODNAME); + dev_info(&dev->client->dev, "Montage M88TS2022 successfully identified\n"); - fe->tuner_priv = priv; + fe->tuner_priv = dev; memcpy(&fe->ops.tuner_ops, &m88ts2022_tuner_ops, sizeof(struct dvb_tuner_ops)); - i2c_set_clientdata(client, priv); + i2c_set_clientdata(client, dev); return 0; err: - dev_dbg(&client->dev, "%s: failed=%d\n", __func__, ret); - kfree(priv); + dev_dbg(&client->dev, "failed=%d\n", ret); + kfree(dev); return ret; } static int m88ts2022_remove(struct i2c_client *client) { - struct m88ts2022_priv *priv = i2c_get_clientdata(client); - struct dvb_frontend *fe = priv->cfg.fe; - dev_dbg(&client->dev, "%s:\n", __func__); + struct m88ts2022_dev *dev = i2c_get_clientdata(client); + struct dvb_frontend *fe = dev->cfg.fe; + + dev_dbg(&client->dev, "\n"); memset(&fe->ops.tuner_ops, 0, sizeof(struct dvb_tuner_ops)); fe->tuner_priv = NULL; - kfree(priv); + kfree(dev); return 0; } |