diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-12-16 18:39:16 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-12-16 18:39:16 +0100 |
commit | bd9999cd6a5eb899504ce14c1f70c5479143bbbc (patch) | |
tree | ea8cba08f86c431d49cb3f58254dac8ca60e96d8 /drivers/media/dvb-frontends | |
parent | Merge tag 'edac/v4.10-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mch... (diff) | |
parent | Merge branch 'patchwork' into v4l_for_linus (diff) | |
download | linux-bd9999cd6a5eb899504ce14c1f70c5479143bbbc.tar.xz linux-bd9999cd6a5eb899504ce14c1f70c5479143bbbc.zip |
Merge tag 'media/v4.10-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
Pull media updates from Mauro Carvalho Chehab:
- new Mediatek drivers: mtk-mdp and mtk-vcodec
- some additions at the media documentation
- the CEC core and drivers were promoted from staging to mainstream
- some cleanups at the DVB core
- the LIRC serial driver got promoted from staging to mainstream
- added a driver for Renesas R-Car FDP1 driver
- add DVBv5 statistics support to mn88473 driver
- several fixes related to printk continuation lines
- add support for HSV encoding formats
- lots of other cleanups, fixups and driver improvements.
* tag 'media/v4.10-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (496 commits)
[media] v4l: tvp5150: Add missing break in set control handler
[media] v4l: tvp5150: Don't inline the tvp5150_selmux() function
[media] v4l: tvp5150: Compile tvp5150_link_setup out if !CONFIG_MEDIA_CONTROLLER
[media] em28xx: don't store usb_device at struct em28xx
[media] em28xx: use usb_interface for dev_foo() calls
[media] em28xx: don't change the device's name
[media] mn88472: fix chip id check on probe
[media] mn88473: fix chip id check on probe
[media] lirc: fix error paths in lirc_cdev_add()
[media] s5p-mfc: Add support for MFC v8 available in Exynos 5433 SoCs
[media] s5p-mfc: Rework clock handling
[media] s5p-mfc: Don't keep clock prepared all the time
[media] s5p-mfc: Kill all IS_ERR_OR_NULL in clocks management code
[media] s5p-mfc: Remove dead conditional code
[media] s5p-mfc: Ensure that clock is disabled before turning power off
[media] s5p-mfc: Remove special clock rate management
[media] s5p-mfc: Use printk_ratelimited for reporting ioctl errors
[media] s5p-mfc: Set DMA_ATTR_ALLOC_SINGLE_PAGES
[media] vivid: Set color_enc on HSV formats
[media] v4l2-tpg: Init hv_enc field with a valid value
...
Diffstat (limited to 'drivers/media/dvb-frontends')
103 files changed, 1097 insertions, 948 deletions
diff --git a/drivers/media/dvb-frontends/Kconfig b/drivers/media/dvb-frontends/Kconfig index b71b747ee0ba..c841fa1770be 100644 --- a/drivers/media/dvb-frontends/Kconfig +++ b/drivers/media/dvb-frontends/Kconfig @@ -642,7 +642,7 @@ config DVB_S5H1409 to support this frontend. config DVB_AU8522 - depends on I2C + depends on DVB_CORE && I2C tristate config DVB_AU8522_DTV @@ -656,7 +656,7 @@ config DVB_AU8522_DTV config DVB_AU8522_V4L tristate "Auvitek AU8522 based ATV demod" - depends on VIDEO_V4L2 && I2C + depends on VIDEO_V4L2 && DVB_CORE && I2C select DVB_AU8522 default m if !MEDIA_SUBDRV_AUTOSELECT help @@ -722,7 +722,7 @@ config DVB_PLL config DVB_TUNER_DIB0070 tristate "DiBcom DiB0070 silicon base-band tuner" - depends on I2C + depends on DVB_CORE && I2C default m if !MEDIA_SUBDRV_AUTOSELECT help A driver for the silicon baseband tuner DiB0070 from DiBcom. @@ -731,7 +731,7 @@ config DVB_TUNER_DIB0070 config DVB_TUNER_DIB0090 tristate "DiBcom DiB0090 silicon base-band tuner" - depends on I2C + depends on DVB_CORE && I2C default m if !MEDIA_SUBDRV_AUTOSELECT help A driver for the silicon baseband tuner DiB0090 from DiBcom. @@ -879,5 +879,6 @@ comment "Tools to develop new frontends" config DVB_DUMMY_FE tristate "Dummy frontend driver" + depends on DVB_CORE default n endmenu diff --git a/drivers/media/dvb-frontends/af9013.c b/drivers/media/dvb-frontends/af9013.c index 8bcde336ffd7..c6cb3bbc912a 100644 --- a/drivers/media/dvb-frontends/af9013.c +++ b/drivers/media/dvb-frontends/af9013.c @@ -1351,7 +1351,7 @@ static void af9013_release(struct dvb_frontend *fe) kfree(state); } -static struct dvb_frontend_ops af9013_ops; +static const struct dvb_frontend_ops af9013_ops; static int af9013_download_firmware(struct af9013_state *state) { @@ -1516,7 +1516,7 @@ err: } EXPORT_SYMBOL(af9013_attach); -static struct dvb_frontend_ops af9013_ops = { +static const struct dvb_frontend_ops af9013_ops = { .delsys = { SYS_DVBT }, .info = { .name = "Afatech AF9013", diff --git a/drivers/media/dvb-frontends/af9033.c b/drivers/media/dvb-frontends/af9033.c index 9a8157a5f49d..f8818028752e 100644 --- a/drivers/media/dvb-frontends/af9033.c +++ b/drivers/media/dvb-frontends/af9033.c @@ -1198,7 +1198,7 @@ err: return ret; } -static struct dvb_frontend_ops af9033_ops = { +static const struct dvb_frontend_ops af9033_ops = { .delsys = { SYS_DVBT }, .info = { .name = "Afatech AF9033 (DVB-T)", diff --git a/drivers/media/dvb-frontends/as102_fe.c b/drivers/media/dvb-frontends/as102_fe.c index 9412fcd1bddb..98d575f2744c 100644 --- a/drivers/media/dvb-frontends/as102_fe.c +++ b/drivers/media/dvb-frontends/as102_fe.c @@ -415,7 +415,7 @@ static void as102_fe_release(struct dvb_frontend *fe) } -static struct dvb_frontend_ops as102_fe_ops = { +static const struct dvb_frontend_ops as102_fe_ops = { .delsys = { SYS_DVBT }, .info = { .name = "Abilis AS102 DVB-T", diff --git a/drivers/media/dvb-frontends/ascot2e.c b/drivers/media/dvb-frontends/ascot2e.c index ad304eed656d..0ee0df53b91b 100644 --- a/drivers/media/dvb-frontends/ascot2e.c +++ b/drivers/media/dvb-frontends/ascot2e.c @@ -254,14 +254,13 @@ static int ascot2e_init(struct dvb_frontend *fe) return ascot2e_leave_power_save(priv); } -static int ascot2e_release(struct dvb_frontend *fe) +static void ascot2e_release(struct dvb_frontend *fe) { struct ascot2e_priv *priv = fe->tuner_priv; dev_dbg(&priv->i2c->dev, "%s()\n", __func__); kfree(fe->tuner_priv); fe->tuner_priv = NULL; - return 0; } static int ascot2e_sleep(struct dvb_frontend *fe) diff --git a/drivers/media/dvb-frontends/atbm8830.c b/drivers/media/dvb-frontends/atbm8830.c index 47248b868e38..07ce05578278 100644 --- a/drivers/media/dvb-frontends/atbm8830.c +++ b/drivers/media/dvb-frontends/atbm8830.c @@ -428,7 +428,7 @@ static int atbm8830_i2c_gate_ctrl(struct dvb_frontend *fe, int enable) return atbm8830_write_reg(priv, REG_I2C_GATE, enable ? 1 : 0); } -static struct dvb_frontend_ops atbm8830_ops = { +static const struct dvb_frontend_ops atbm8830_ops = { .delsys = { SYS_DTMB }, .info = { .name = "AltoBeam ATBM8830/8831 DMB-TH", diff --git a/drivers/media/dvb-frontends/au8522_common.c b/drivers/media/dvb-frontends/au8522_common.c index f135126bc373..cf4ac240a01f 100644 --- a/drivers/media/dvb-frontends/au8522_common.c +++ b/drivers/media/dvb-frontends/au8522_common.c @@ -50,8 +50,8 @@ int au8522_writereg(struct au8522_state *state, u16 reg, u8 data) ret = i2c_transfer(state->i2c, &msg, 1); if (ret != 1) - printk("%s: writereg error (reg == 0x%02x, val == 0x%04x, " - "ret == %i)\n", __func__, reg, data, ret); + printk("%s: writereg error (reg == 0x%02x, val == 0x%04x, ret == %i)\n", + __func__, reg, data, ret); return (ret != 1) ? -1 : 0; } diff --git a/drivers/media/dvb-frontends/au8522_dig.c b/drivers/media/dvb-frontends/au8522_dig.c index e676b9461a59..7ed326e43fc4 100644 --- a/drivers/media/dvb-frontends/au8522_dig.c +++ b/drivers/media/dvb-frontends/au8522_dig.c @@ -834,7 +834,7 @@ static int au8522_get_tune_settings(struct dvb_frontend *fe, return 0; } -static struct dvb_frontend_ops au8522_ops; +static const struct dvb_frontend_ops au8522_ops; static void au8522_release(struct dvb_frontend *fe) @@ -894,7 +894,7 @@ error: } EXPORT_SYMBOL(au8522_attach); -static struct dvb_frontend_ops au8522_ops = { +static const struct dvb_frontend_ops au8522_ops = { .delsys = { SYS_ATSC, SYS_DVBC_ANNEX_B }, .info = { .name = "Auvitek AU8522 QAM/8VSB Frontend", diff --git a/drivers/media/dvb-frontends/bcm3510.c b/drivers/media/dvb-frontends/bcm3510.c index bb698839e477..617c5e29f919 100644 --- a/drivers/media/dvb-frontends/bcm3510.c +++ b/drivers/media/dvb-frontends/bcm3510.c @@ -788,7 +788,7 @@ static int bcm3510_init(struct dvb_frontend* fe) } -static struct dvb_frontend_ops bcm3510_ops; +static const struct dvb_frontend_ops bcm3510_ops; struct dvb_frontend* bcm3510_attach(const struct bcm3510_config *config, struct i2c_adapter *i2c) @@ -834,7 +834,7 @@ error: } EXPORT_SYMBOL(bcm3510_attach); -static struct dvb_frontend_ops bcm3510_ops = { +static const struct dvb_frontend_ops bcm3510_ops = { .delsys = { SYS_ATSC, SYS_DVBC_ANNEX_B }, .info = { .name = "Broadcom BCM3510 VSB/QAM frontend", diff --git a/drivers/media/dvb-frontends/cx22700.c b/drivers/media/dvb-frontends/cx22700.c index 5cad925609e0..2b629e23ceeb 100644 --- a/drivers/media/dvb-frontends/cx22700.c +++ b/drivers/media/dvb-frontends/cx22700.c @@ -380,7 +380,7 @@ static void cx22700_release(struct dvb_frontend* fe) kfree(state); } -static struct dvb_frontend_ops cx22700_ops; +static const struct dvb_frontend_ops cx22700_ops; struct dvb_frontend* cx22700_attach(const struct cx22700_config* config, struct i2c_adapter* i2c) @@ -408,7 +408,7 @@ error: return NULL; } -static struct dvb_frontend_ops cx22700_ops = { +static const struct dvb_frontend_ops cx22700_ops = { .delsys = { SYS_DVBT }, .info = { .name = "Conexant CX22700 DVB-T", diff --git a/drivers/media/dvb-frontends/cx24110.c b/drivers/media/dvb-frontends/cx24110.c index 6cb81ec12847..cf1bc99d1f32 100644 --- a/drivers/media/dvb-frontends/cx24110.c +++ b/drivers/media/dvb-frontends/cx24110.c @@ -120,8 +120,8 @@ static int cx24110_writereg (struct cx24110_state* state, int reg, int data) int err; if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) { - dprintk ("%s: writereg error (err == %i, reg == 0x%02x," - " data == 0x%02x)\n", __func__, err, reg, data); + dprintk("%s: writereg error (err == %i, reg == 0x%02x, data == 0x%02x)\n", + __func__, err, reg, data); return -EREMOTEIO; } @@ -592,7 +592,7 @@ static void cx24110_release(struct dvb_frontend* fe) kfree(state); } -static struct dvb_frontend_ops cx24110_ops; +static const struct dvb_frontend_ops cx24110_ops; struct dvb_frontend* cx24110_attach(const struct cx24110_config* config, struct i2c_adapter* i2c) @@ -625,7 +625,7 @@ error: return NULL; } -static struct dvb_frontend_ops cx24110_ops = { +static const struct dvb_frontend_ops cx24110_ops = { .delsys = { SYS_DVBS }, .info = { .name = "Conexant CX24110 DVB-S", diff --git a/drivers/media/dvb-frontends/cx24113.c b/drivers/media/dvb-frontends/cx24113.c index 3883c3b31aef..db44ebb7c561 100644 --- a/drivers/media/dvb-frontends/cx24113.c +++ b/drivers/media/dvb-frontends/cx24113.c @@ -108,8 +108,8 @@ static int cx24113_writereg(struct cx24113_state *state, int reg, int data) .flags = 0, .buf = buf, .len = 2 }; int err = i2c_transfer(state->i2c, &msg, 1); if (err != 1) { - printk(KERN_DEBUG "%s: writereg error(err == %i, reg == 0x%02x," - " data == 0x%02x)\n", __func__, err, reg, data); + printk(KERN_DEBUG "%s: writereg error(err == %i, reg == 0x%02x, data == 0x%02x)\n", + __func__, err, reg, data); return err; } @@ -527,13 +527,12 @@ static int cx24113_get_frequency(struct dvb_frontend *fe, u32 *frequency) return 0; } -static int cx24113_release(struct dvb_frontend *fe) +static void cx24113_release(struct dvb_frontend *fe) { struct cx24113_state *state = fe->tuner_priv; dprintk("\n"); fe->tuner_priv = NULL; kfree(state); - return 0; } static const struct dvb_tuner_ops cx24113_tuner_ops = { diff --git a/drivers/media/dvb-frontends/cx24116.c b/drivers/media/dvb-frontends/cx24116.c index 8814f36d53fb..e105532bfba8 100644 --- a/drivers/media/dvb-frontends/cx24116.c +++ b/drivers/media/dvb-frontends/cx24116.c @@ -209,8 +209,8 @@ static int cx24116_writereg(struct cx24116_state *state, int reg, int data) err = i2c_transfer(state->i2c, &msg, 1); if (err != 1) { - printk(KERN_ERR "%s: writereg error(err == %i, reg == 0x%02x," - " value == 0x%02x)\n", __func__, err, reg, data); + printk(KERN_ERR "%s: writereg error(err == %i, reg == 0x%02x, value == 0x%02x)\n", + __func__, err, reg, data); return -EREMOTEIO; } @@ -498,8 +498,8 @@ static int cx24116_firmware_ondemand(struct dvb_frontend *fe) printk(KERN_INFO "%s: Waiting for firmware upload(2)...\n", __func__); if (ret) { - printk(KERN_ERR "%s: No firmware uploaded " - "(timeout or file not found?)\n", __func__); + printk(KERN_ERR "%s: No firmware uploaded (timeout or file not found?)\n", + __func__); return ret; } @@ -1116,7 +1116,7 @@ static void cx24116_release(struct dvb_frontend *fe) kfree(state); } -static struct dvb_frontend_ops cx24116_ops; +static const struct dvb_frontend_ops cx24116_ops; struct dvb_frontend *cx24116_attach(const struct cx24116_config *config, struct i2c_adapter *i2c) @@ -1467,7 +1467,7 @@ static int cx24116_get_algo(struct dvb_frontend *fe) return DVBFE_ALGO_HW; } -static struct dvb_frontend_ops cx24116_ops = { +static const struct dvb_frontend_ops cx24116_ops = { .delsys = { SYS_DVBS, SYS_DVBS2 }, .info = { .name = "Conexant CX24116/CX24118", diff --git a/drivers/media/dvb-frontends/cx24117.c b/drivers/media/dvb-frontends/cx24117.c index a3f7eb4e609d..d37cb7762bd6 100644 --- a/drivers/media/dvb-frontends/cx24117.c +++ b/drivers/media/dvb-frontends/cx24117.c @@ -474,8 +474,8 @@ static int cx24117_firmware_ondemand(struct dvb_frontend *fe) "%s: Waiting for firmware upload(2)...\n", __func__); if (ret) { dev_err(&state->priv->i2c->dev, - "%s: No firmware uploaded " - "(timeout or file not found?)\n", __func__); + "%s: No firmware uploaded (timeout or file not found?)\n", +__func__); return ret; } @@ -1164,7 +1164,7 @@ static void cx24117_release(struct dvb_frontend *fe) kfree(state); } -static struct dvb_frontend_ops cx24117_ops; +static const struct dvb_frontend_ops cx24117_ops; struct dvb_frontend *cx24117_attach(const struct cx24117_config *config, struct i2c_adapter *i2c) @@ -1618,7 +1618,7 @@ static int cx24117_get_frontend(struct dvb_frontend *fe, return 0; } -static struct dvb_frontend_ops cx24117_ops = { +static const struct dvb_frontend_ops cx24117_ops = { .delsys = { SYS_DVBS, SYS_DVBS2 }, .info = { .name = "Conexant CX24117/CX24132", diff --git a/drivers/media/dvb-frontends/cx24120.c b/drivers/media/dvb-frontends/cx24120.c index 066ee387bf25..7f11dcc94d85 100644 --- a/drivers/media/dvb-frontends/cx24120.c +++ b/drivers/media/dvb-frontends/cx24120.c @@ -267,7 +267,7 @@ out: return ret; } -static struct dvb_frontend_ops cx24120_ops; +static const struct dvb_frontend_ops cx24120_ops; struct dvb_frontend *cx24120_attach(const struct cx24120_config *config, struct i2c_adapter *i2c) @@ -1154,8 +1154,7 @@ static int cx24120_set_frontend(struct dvb_frontend *fe) dev_dbg(&state->i2c->dev, "delivery system(%d) not supported\n", c->delivery_system); - ret = -EINVAL; - break; + return -EINVAL; } state->dnxt.delsys = c->delivery_system; @@ -1552,7 +1551,7 @@ static int cx24120_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks) return 0; } -static struct dvb_frontend_ops cx24120_ops = { +static const struct dvb_frontend_ops cx24120_ops = { .delsys = { SYS_DVBS, SYS_DVBS2 }, .info = { .name = "Conexant CX24120/CX24118", diff --git a/drivers/media/dvb-frontends/cx24123.c b/drivers/media/dvb-frontends/cx24123.c index 113b0949408a..8aed8cc9f93d 100644 --- a/drivers/media/dvb-frontends/cx24123.c +++ b/drivers/media/dvb-frontends/cx24123.c @@ -255,8 +255,8 @@ static int cx24123_i2c_writereg(struct cx24123_state *state, err = i2c_transfer(state->i2c, &msg, 1); if (err != 1) { - printk("%s: writereg error(err == %i, reg == 0x%02x," - " data == 0x%02x)\n", __func__, err, reg, data); + printk("%s: writereg error(err == %i, reg == 0x%02x, data == 0x%02x)\n", + __func__, err, reg, data); return err; } @@ -1049,7 +1049,7 @@ struct i2c_adapter * } EXPORT_SYMBOL(cx24123_get_tuner_i2c_adapter); -static struct dvb_frontend_ops cx24123_ops; +static const struct dvb_frontend_ops cx24123_ops; struct dvb_frontend *cx24123_attach(const struct cx24123_config *config, struct i2c_adapter *i2c) @@ -1111,7 +1111,7 @@ error: } EXPORT_SYMBOL(cx24123_attach); -static struct dvb_frontend_ops cx24123_ops = { +static const struct dvb_frontend_ops cx24123_ops = { .delsys = { SYS_DVBS }, .info = { .name = "Conexant CX24123/CX24109", diff --git a/drivers/media/dvb-frontends/cxd2841er.c b/drivers/media/dvb-frontends/cxd2841er.c index 5afb9c508f65..614bfb3740f1 100644 --- a/drivers/media/dvb-frontends/cxd2841er.c +++ b/drivers/media/dvb-frontends/cxd2841er.c @@ -3719,7 +3719,7 @@ static int cxd2841er_init_tc(struct dvb_frontend *fe) return 0; } -static struct dvb_frontend_ops cxd2841er_dvbs_s2_ops; +static const struct dvb_frontend_ops cxd2841er_dvbs_s2_ops; static struct dvb_frontend_ops cxd2841er_t_c_ops; static struct dvb_frontend *cxd2841er_attach(struct cxd2841er_config *cfg, @@ -3801,7 +3801,7 @@ struct dvb_frontend *cxd2841er_attach_t_c(struct cxd2841er_config *cfg, } EXPORT_SYMBOL(cxd2841er_attach_t_c); -static struct dvb_frontend_ops cxd2841er_dvbs_s2_ops = { +static const struct dvb_frontend_ops cxd2841er_dvbs_s2_ops = { .delsys = { SYS_DVBS, SYS_DVBS2 }, .info = { .name = "Sony CXD2841ER DVB-S/S2 demodulator", @@ -3829,7 +3829,7 @@ static struct dvb_frontend_ops cxd2841er_dvbs_s2_ops = { .tune = cxd2841er_tune_s }; -static struct dvb_frontend_ops cxd2841er_t_c_ops = { +static struct dvb_frontend_ops cxd2841er_t_c_ops = { .delsys = { SYS_DVBT, SYS_DVBT2, SYS_DVBC_ANNEX_A }, .info = { .name = "", /* will set in attach function */ diff --git a/drivers/media/dvb-frontends/dib0070.c b/drivers/media/dvb-frontends/dib0070.c index ee7d66997ccd..befc8172159d 100644 --- a/drivers/media/dvb-frontends/dib0070.c +++ b/drivers/media/dvb-frontends/dib0070.c @@ -24,6 +24,8 @@ * */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <linux/kernel.h> #include <linux/slab.h> #include <linux/i2c.h> @@ -38,12 +40,10 @@ static int debug; module_param(debug, int, 0644); MODULE_PARM_DESC(debug, "turn on debugging (default: 0)"); -#define dprintk(args...) do { \ - if (debug) { \ - printk(KERN_DEBUG "DiB0070: "); \ - printk(args); \ - printk("\n"); \ - } \ +#define dprintk(fmt, arg...) do { \ + if (debug) \ + printk(KERN_DEBUG pr_fmt("%s: " fmt), \ + __func__, ##arg); \ } while (0) #define DIB0070_P1D 0x00 @@ -87,7 +87,7 @@ static u16 dib0070_read_reg(struct dib0070_state *state, u8 reg) u16 ret; if (mutex_lock_interruptible(&state->i2c_buffer_lock) < 0) { - dprintk("could not acquire lock"); + dprintk("could not acquire lock\n"); return 0; } @@ -104,7 +104,7 @@ static u16 dib0070_read_reg(struct dib0070_state *state, u8 reg) state->msg[1].len = 2; if (i2c_transfer(state->i2c, state->msg, 2) != 2) { - printk(KERN_WARNING "DiB0070 I2C read failed\n"); + pr_warn("DiB0070 I2C read failed\n"); ret = 0; } else ret = (state->i2c_read_buffer[0] << 8) @@ -119,7 +119,7 @@ static int dib0070_write_reg(struct dib0070_state *state, u8 reg, u16 val) int ret; if (mutex_lock_interruptible(&state->i2c_buffer_lock) < 0) { - dprintk("could not acquire lock"); + dprintk("could not acquire lock\n"); return -EINVAL; } state->i2c_write_buffer[0] = reg; @@ -133,7 +133,7 @@ static int dib0070_write_reg(struct dib0070_state *state, u8 reg, u16 val) state->msg[0].len = 3; if (i2c_transfer(state->i2c, state->msg, 1) != 1) { - printk(KERN_WARNING "DiB0070 I2C write failed\n"); + pr_warn("DiB0070 I2C write failed\n"); ret = -EREMOTEIO; } else ret = 0; @@ -205,7 +205,7 @@ static int dib0070_captrim(struct dib0070_state *state, enum frontend_tune_state adc = dib0070_read_reg(state, 0x19); - dprintk("CAPTRIM=%hd; ADC = %hd (ADC) & %dmV", state->captrim, adc, (u32) adc*(u32)1800/(u32)1024); + dprintk("CAPTRIM=%hd; ADC = %hd (ADC) & %dmV\n", state->captrim, adc, (u32) adc*(u32)1800/(u32)1024); if (adc >= 400) { adc -= 400; @@ -216,7 +216,7 @@ static int dib0070_captrim(struct dib0070_state *state, enum frontend_tune_state } if (adc < state->adc_diff) { - dprintk("CAPTRIM=%hd is closer to target (%hd/%hd)", state->captrim, adc, state->adc_diff); + dprintk("CAPTRIM=%hd is closer to target (%hd/%hd)\n", state->captrim, adc, state->adc_diff); state->adc_diff = adc; state->fcaptrim = state->captrim; } @@ -241,7 +241,7 @@ static int dib0070_set_ctrl_lo5(struct dvb_frontend *fe, u8 vco_bias_trim, u8 hf struct dib0070_state *state = fe->tuner_priv; u16 lo5 = (third_order_filt << 14) | (0 << 13) | (1 << 12) | (3 << 9) | (cp_current << 6) | (hf_div_trim << 3) | (vco_bias_trim << 0); - dprintk("CTRL_LO5: 0x%x", lo5); + dprintk("CTRL_LO5: 0x%x\n", lo5); return dib0070_write_reg(state, 0x15, lo5); } @@ -256,7 +256,7 @@ void dib0070_ctrl_agc_filter(struct dvb_frontend *fe, u8 open) dib0070_write_reg(state, 0x1b, 0x4112); if (state->cfg->vga_filter != 0) { dib0070_write_reg(state, 0x1a, state->cfg->vga_filter); - dprintk("vga filter register is set to %x", state->cfg->vga_filter); + dprintk("vga filter register is set to %x\n", state->cfg->vga_filter); } else dib0070_write_reg(state, 0x1a, 0x0009); } @@ -380,7 +380,7 @@ static int dib0070_tune_digital(struct dvb_frontend *fe) } if (*tune_state == CT_TUNER_START) { - dprintk("Tuning for Band: %hd (%d kHz)", band, freq); + dprintk("Tuning for Band: %hd (%d kHz)\n", band, freq); if (state->current_rf != freq) { u8 REFDIV; u32 FBDiv, Rest, FREF, VCOF_kHz; @@ -458,12 +458,12 @@ static int dib0070_tune_digital(struct dvb_frontend *fe) dib0070_write_reg(state, 0x20, 0x0040 | 0x0020 | 0x0010 | 0x0008 | 0x0002 | 0x0001 | state->current_tune_table_index->tuner_enable); - dprintk("REFDIV: %hd, FREF: %d", REFDIV, FREF); - dprintk("FBDIV: %d, Rest: %d", FBDiv, Rest); - dprintk("Num: %hd, Den: %hd, SD: %hd", (u16) Rest, Den, (state->lo4 >> 12) & 0x1); - dprintk("HFDIV code: %hd", state->current_tune_table_index->hfdiv); - dprintk("VCO = %hd", state->current_tune_table_index->vco_band); - dprintk("VCOF: ((%hd*%d) << 1))", state->current_tune_table_index->vco_multi, freq); + dprintk("REFDIV: %hd, FREF: %d\n", REFDIV, FREF); + dprintk("FBDIV: %d, Rest: %d\n", FBDiv, Rest); + dprintk("Num: %hd, Den: %hd, SD: %hd\n", (u16) Rest, Den, (state->lo4 >> 12) & 0x1); + dprintk("HFDIV code: %hd\n", state->current_tune_table_index->hfdiv); + dprintk("VCO = %hd\n", state->current_tune_table_index->vco_band); + dprintk("VCOF: ((%hd*%d) << 1))\n", state->current_tune_table_index->vco_multi, freq); *tune_state = CT_TUNER_STEP_0; } else { /* we are already tuned to this frequency - the configuration is correct */ @@ -625,7 +625,7 @@ static void dib0070_wbd_offset_calibration(struct dib0070_state *state) u8 gain; for (gain = 6; gain < 8; gain++) { state->wbd_offset_3_3[gain - 6] = ((dib0070_read_wbd_offset(state, gain) * 8 * 18 / 33 + 1) / 2); - dprintk("Gain: %d, WBDOffset (3.3V) = %hd", gain, state->wbd_offset_3_3[gain-6]); + dprintk("Gain: %d, WBDOffset (3.3V) = %hd\n", gain, state->wbd_offset_3_3[gain-6]); } } @@ -665,10 +665,10 @@ static int dib0070_reset(struct dvb_frontend *fe) state->revision = DIB0070S_P1A; /* P1F or not */ - dprintk("Revision: %x", state->revision); + dprintk("Revision: %x\n", state->revision); if (state->revision == DIB0070_P1D) { - dprintk("Error: this driver is not to be used meant for P1D or earlier"); + dprintk("Error: this driver is not to be used meant for P1D or earlier\n"); return -EINVAL; } @@ -722,11 +722,10 @@ static int dib0070_get_frequency(struct dvb_frontend *fe, u32 *frequency) return 0; } -static int dib0070_release(struct dvb_frontend *fe) +static void dib0070_release(struct dvb_frontend *fe) { kfree(fe->tuner_priv); fe->tuner_priv = NULL; - return 0; } static const struct dvb_tuner_ops dib0070_ops = { @@ -761,7 +760,7 @@ struct dvb_frontend *dib0070_attach(struct dvb_frontend *fe, struct i2c_adapter if (dib0070_reset(fe) != 0) goto free_mem; - printk(KERN_INFO "DiB0070: successfully identified\n"); + pr_info("DiB0070: successfully identified\n"); memcpy(&fe->ops.tuner_ops, &dib0070_ops, sizeof(struct dvb_tuner_ops)); fe->tuner_priv = state; diff --git a/drivers/media/dvb-frontends/dib0090.c b/drivers/media/dvb-frontends/dib0090.c index 14c403254fe0..fd3b33296b15 100644 --- a/drivers/media/dvb-frontends/dib0090.c +++ b/drivers/media/dvb-frontends/dib0090.c @@ -24,6 +24,8 @@ * */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <linux/kernel.h> #include <linux/slab.h> #include <linux/i2c.h> @@ -38,12 +40,10 @@ static int debug; module_param(debug, int, 0644); MODULE_PARM_DESC(debug, "turn on debugging (default: 0)"); -#define dprintk(args...) do { \ - if (debug) { \ - printk(KERN_DEBUG "DiB0090: "); \ - printk(args); \ - printk("\n"); \ - } \ +#define dprintk(fmt, arg...) do { \ + if (debug) \ + printk(KERN_DEBUG pr_fmt("%s: " fmt), \ + __func__, ##arg); \ } while (0) #define CONFIG_SYS_DVBT @@ -218,7 +218,7 @@ static u16 dib0090_read_reg(struct dib0090_state *state, u8 reg) u16 ret; if (mutex_lock_interruptible(&state->i2c_buffer_lock) < 0) { - dprintk("could not acquire lock"); + dprintk("could not acquire lock\n"); return 0; } @@ -235,7 +235,7 @@ static u16 dib0090_read_reg(struct dib0090_state *state, u8 reg) state->msg[1].len = 2; if (i2c_transfer(state->i2c, state->msg, 2) != 2) { - printk(KERN_WARNING "DiB0090 I2C read failed\n"); + pr_warn("DiB0090 I2C read failed\n"); ret = 0; } else ret = (state->i2c_read_buffer[0] << 8) @@ -250,7 +250,7 @@ static int dib0090_write_reg(struct dib0090_state *state, u32 reg, u16 val) int ret; if (mutex_lock_interruptible(&state->i2c_buffer_lock) < 0) { - dprintk("could not acquire lock"); + dprintk("could not acquire lock\n"); return -EINVAL; } @@ -265,7 +265,7 @@ static int dib0090_write_reg(struct dib0090_state *state, u32 reg, u16 val) state->msg[0].len = 3; if (i2c_transfer(state->i2c, state->msg, 1) != 1) { - printk(KERN_WARNING "DiB0090 I2C write failed\n"); + pr_warn("DiB0090 I2C write failed\n"); ret = -EREMOTEIO; } else ret = 0; @@ -279,7 +279,7 @@ static u16 dib0090_fw_read_reg(struct dib0090_fw_state *state, u8 reg) u16 ret; if (mutex_lock_interruptible(&state->i2c_buffer_lock) < 0) { - dprintk("could not acquire lock"); + dprintk("could not acquire lock\n"); return 0; } @@ -291,7 +291,7 @@ static u16 dib0090_fw_read_reg(struct dib0090_fw_state *state, u8 reg) state->msg.buf = state->i2c_read_buffer; state->msg.len = 2; if (i2c_transfer(state->i2c, &state->msg, 1) != 1) { - printk(KERN_WARNING "DiB0090 I2C read failed\n"); + pr_warn("DiB0090 I2C read failed\n"); ret = 0; } else ret = (state->i2c_read_buffer[0] << 8) @@ -306,7 +306,7 @@ static int dib0090_fw_write_reg(struct dib0090_fw_state *state, u8 reg, u16 val) int ret; if (mutex_lock_interruptible(&state->i2c_buffer_lock) < 0) { - dprintk("could not acquire lock"); + dprintk("could not acquire lock\n"); return -EINVAL; } @@ -319,7 +319,7 @@ static int dib0090_fw_write_reg(struct dib0090_fw_state *state, u8 reg, u16 val) state->msg.buf = state->i2c_write_buffer; state->msg.len = 2; if (i2c_transfer(state->i2c, &state->msg, 1) != 1) { - printk(KERN_WARNING "DiB0090 I2C write failed\n"); + pr_warn("DiB0090 I2C write failed\n"); ret = -EREMOTEIO; } else ret = 0; @@ -351,7 +351,7 @@ static int dib0090_identify(struct dvb_frontend *fe) identity->p1g = 0; identity->in_soc = 0; - dprintk("Tuner identification (Version = 0x%04x)", v); + dprintk("Tuner identification (Version = 0x%04x)\n", v); /* without PLL lock info */ v &= ~KROSUS_PLL_LOCKED; @@ -366,19 +366,19 @@ static int dib0090_identify(struct dvb_frontend *fe) identity->in_soc = 1; switch (identity->version) { case SOC_8090_P1G_11R1: - dprintk("SOC 8090 P1-G11R1 Has been detected"); + dprintk("SOC 8090 P1-G11R1 Has been detected\n"); identity->p1g = 1; break; case SOC_8090_P1G_21R1: - dprintk("SOC 8090 P1-G21R1 Has been detected"); + dprintk("SOC 8090 P1-G21R1 Has been detected\n"); identity->p1g = 1; break; case SOC_7090_P1G_11R1: - dprintk("SOC 7090 P1-G11R1 Has been detected"); + dprintk("SOC 7090 P1-G11R1 Has been detected\n"); identity->p1g = 1; break; case SOC_7090_P1G_21R1: - dprintk("SOC 7090 P1-G21R1 Has been detected"); + dprintk("SOC 7090 P1-G21R1 Has been detected\n"); identity->p1g = 1; break; default: @@ -387,16 +387,16 @@ static int dib0090_identify(struct dvb_frontend *fe) } else { switch ((identity->version >> 5) & 0x7) { case MP001: - dprintk("MP001 : 9090/8096"); + dprintk("MP001 : 9090/8096\n"); break; case MP005: - dprintk("MP005 : Single Sband"); + dprintk("MP005 : Single Sband\n"); break; case MP008: - dprintk("MP008 : diversity VHF-UHF-LBAND"); + dprintk("MP008 : diversity VHF-UHF-LBAND\n"); break; case MP009: - dprintk("MP009 : diversity 29098 CBAND-UHF-LBAND-SBAND"); + dprintk("MP009 : diversity 29098 CBAND-UHF-LBAND-SBAND\n"); break; default: goto identification_error; @@ -404,21 +404,21 @@ static int dib0090_identify(struct dvb_frontend *fe) switch (identity->version & 0x1f) { case P1G_21R2: - dprintk("P1G_21R2 detected"); + dprintk("P1G_21R2 detected\n"); identity->p1g = 1; break; case P1G: - dprintk("P1G detected"); + dprintk("P1G detected\n"); identity->p1g = 1; break; case P1D_E_F: - dprintk("P1D/E/F detected"); + dprintk("P1D/E/F detected\n"); break; case P1C: - dprintk("P1C detected"); + dprintk("P1C detected\n"); break; case P1A_B: - dprintk("P1-A/B detected: driver is deactivated - not available"); + dprintk("P1-A/B detected: driver is deactivated - not available\n"); goto identification_error; break; default: @@ -441,7 +441,7 @@ static int dib0090_fw_identify(struct dvb_frontend *fe) identity->p1g = 0; identity->in_soc = 0; - dprintk("FE: Tuner identification (Version = 0x%04x)", v); + dprintk("FE: Tuner identification (Version = 0x%04x)\n", v); /* without PLL lock info */ v &= ~KROSUS_PLL_LOCKED; @@ -456,19 +456,19 @@ static int dib0090_fw_identify(struct dvb_frontend *fe) identity->in_soc = 1; switch (identity->version) { case SOC_8090_P1G_11R1: - dprintk("SOC 8090 P1-G11R1 Has been detected"); + dprintk("SOC 8090 P1-G11R1 Has been detected\n"); identity->p1g = 1; break; case SOC_8090_P1G_21R1: - dprintk("SOC 8090 P1-G21R1 Has been detected"); + dprintk("SOC 8090 P1-G21R1 Has been detected\n"); identity->p1g = 1; break; case SOC_7090_P1G_11R1: - dprintk("SOC 7090 P1-G11R1 Has been detected"); + dprintk("SOC 7090 P1-G11R1 Has been detected\n"); identity->p1g = 1; break; case SOC_7090_P1G_21R1: - dprintk("SOC 7090 P1-G21R1 Has been detected"); + dprintk("SOC 7090 P1-G21R1 Has been detected\n"); identity->p1g = 1; break; default: @@ -477,16 +477,16 @@ static int dib0090_fw_identify(struct dvb_frontend *fe) } else { switch ((identity->version >> 5) & 0x7) { case MP001: - dprintk("MP001 : 9090/8096"); + dprintk("MP001 : 9090/8096\n"); break; case MP005: - dprintk("MP005 : Single Sband"); + dprintk("MP005 : Single Sband\n"); break; case MP008: - dprintk("MP008 : diversity VHF-UHF-LBAND"); + dprintk("MP008 : diversity VHF-UHF-LBAND\n"); break; case MP009: - dprintk("MP009 : diversity 29098 CBAND-UHF-LBAND-SBAND"); + dprintk("MP009 : diversity 29098 CBAND-UHF-LBAND-SBAND\n"); break; default: goto identification_error; @@ -494,21 +494,21 @@ static int dib0090_fw_identify(struct dvb_frontend *fe) switch (identity->version & 0x1f) { case P1G_21R2: - dprintk("P1G_21R2 detected"); + dprintk("P1G_21R2 detected\n"); identity->p1g = 1; break; case P1G: - dprintk("P1G detected"); + dprintk("P1G detected\n"); identity->p1g = 1; break; case P1D_E_F: - dprintk("P1D/E/F detected"); + dprintk("P1D/E/F detected\n"); break; case P1C: - dprintk("P1C detected"); + dprintk("P1C detected\n"); break; case P1A_B: - dprintk("P1-A/B detected: driver is deactivated - not available"); + dprintk("P1-A/B detected: driver is deactivated - not available\n"); goto identification_error; break; default: @@ -574,7 +574,7 @@ static void dib0090_reset_digital(struct dvb_frontend *fe, const struct dib0090_ } while (--i); if (i == 0) { - dprintk("Pll: Unable to lock Pll"); + dprintk("Pll: Unable to lock Pll\n"); return; } @@ -596,7 +596,7 @@ static int dib0090_fw_reset_digital(struct dvb_frontend *fe, const struct dib009 u16 v; int i; - dprintk("fw reset digital"); + dprintk("fw reset digital\n"); HARD_RESET(state); dib0090_fw_write_reg(state, 0x24, EN_PLL | EN_CRYSTAL); @@ -645,7 +645,7 @@ static int dib0090_fw_reset_digital(struct dvb_frontend *fe, const struct dib009 } while (--i); if (i == 0) { - dprintk("Pll: Unable to lock Pll"); + dprintk("Pll: Unable to lock Pll\n"); return -EIO; } @@ -922,7 +922,7 @@ static void dib0090_wbd_target(struct dib0090_state *state, u32 rf) #endif state->wbd_target = dib0090_wbd_to_db(state, state->wbd_offset + offset); - dprintk("wbd-target: %d dB", (u32) state->wbd_target); + dprintk("wbd-target: %d dB\n", (u32) state->wbd_target); } static const int gain_reg_addr[4] = { @@ -1019,7 +1019,7 @@ static void dib0090_gain_apply(struct dib0090_state *state, s16 gain_delta, s16 gain_reg[3] |= ((bb % 10) * 100) / 125; #ifdef DEBUG_AGC - dprintk("GA CALC: DB: %3d(rf) + %3d(bb) = %3d gain_reg[0]=%04x gain_reg[1]=%04x gain_reg[2]=%04x gain_reg[0]=%04x", rf, bb, rf + bb, + dprintk("GA CALC: DB: %3d(rf) + %3d(bb) = %3d gain_reg[0]=%04x gain_reg[1]=%04x gain_reg[2]=%04x gain_reg[0]=%04x\n", rf, bb, rf + bb, gain_reg[0], gain_reg[1], gain_reg[2], gain_reg[3]); #endif @@ -1050,7 +1050,7 @@ static void dib0090_set_rframp_pwm(struct dib0090_state *state, const u16 * cfg) dib0090_write_reg(state, 0x2a, 0xffff); - dprintk("total RF gain: %ddB, step: %d", (u32) cfg[0], dib0090_read_reg(state, 0x2a)); + dprintk("total RF gain: %ddB, step: %d\n", (u32) cfg[0], dib0090_read_reg(state, 0x2a)); dib0090_write_regs(state, 0x2c, cfg + 3, 6); dib0090_write_regs(state, 0x3e, cfg + 9, 2); @@ -1069,7 +1069,7 @@ static void dib0090_set_bbramp_pwm(struct dib0090_state *state, const u16 * cfg) dib0090_set_boost(state, cfg[0] > 500); /* we want the boost if the gain is higher that 50dB */ dib0090_write_reg(state, 0x33, 0xffff); - dprintk("total BB gain: %ddB, step: %d", (u32) cfg[0], dib0090_read_reg(state, 0x33)); + dprintk("total BB gain: %ddB, step: %d\n", (u32) cfg[0], dib0090_read_reg(state, 0x33)); dib0090_write_regs(state, 0x35, cfg + 3, 4); } @@ -1122,7 +1122,7 @@ void dib0090_pwm_gain_reset(struct dvb_frontend *fe) /* activate the ramp generator using PWM control */ if (state->rf_ramp) - dprintk("ramp RF gain = %d BAND = %s version = %d", + dprintk("ramp RF gain = %d BAND = %s version = %d\n", state->rf_ramp[0], (state->current_band == BAND_CBAND) ? "CBAND" : "NOT CBAND", state->identity.version & 0x1f); @@ -1130,10 +1130,10 @@ void dib0090_pwm_gain_reset(struct dvb_frontend *fe) if (rf_ramp && ((state->rf_ramp && state->rf_ramp[0] == 0) || (state->current_band == BAND_CBAND && (state->identity.version & 0x1f) <= P1D_E_F))) { - dprintk("DE-Engage mux for direct gain reg control"); + dprintk("DE-Engage mux for direct gain reg control\n"); en_pwm_rf_mux = 0; } else - dprintk("Engage mux for PWM control"); + dprintk("Engage mux for PWM control\n"); dib0090_write_reg(state, 0x32, (en_pwm_rf_mux << 12) | (en_pwm_rf_mux << 11)); @@ -1352,7 +1352,7 @@ u16 dib0090_get_wbd_target(struct dvb_frontend *fe) while (f_MHz > wbd->max_freq) wbd++; - dprintk("using wbd-table-entry with max freq %d", wbd->max_freq); + dprintk("using wbd-table-entry with max freq %d\n", wbd->max_freq); if (current_temp < 0) current_temp = 0; @@ -1373,8 +1373,8 @@ u16 dib0090_get_wbd_target(struct dvb_frontend *fe) wbd_tcold += ((wbd_thot - wbd_tcold) * current_temp) >> 7; state->wbd_target = dib0090_wbd_to_db(state, state->wbd_offset + wbd_tcold); - dprintk("wbd-target: %d dB", (u32) state->wbd_target); - dprintk("wbd offset applied is %d", wbd_tcold); + dprintk("wbd-target: %d dB\n", (u32) state->wbd_target); + dprintk("wbd offset applied is %d\n", wbd_tcold); return state->wbd_offset + wbd_tcold; } @@ -1415,7 +1415,7 @@ int dib0090_update_rframp_7090(struct dvb_frontend *fe, u8 cfg_sensitivity) if ((!state->identity.p1g) || (!state->identity.in_soc) || ((state->identity.version != SOC_7090_P1G_21R1) && (state->identity.version != SOC_7090_P1G_11R1))) { - dprintk("%s() function can only be used for dib7090P", __func__); + dprintk("%s() function can only be used for dib7090P\n", __func__); return -ENODEV; } @@ -1598,7 +1598,7 @@ static int dib0090_reset(struct dvb_frontend *fe) dib0090_write_reg(state, 0x14, 1); else dib0090_write_reg(state, 0x14, 2); - dprintk("Pll lock : %d", (dib0090_read_reg(state, 0x1a) >> 11) & 0x1); + dprintk("Pll lock : %d\n", (dib0090_read_reg(state, 0x1a) >> 11) & 0x1); state->calibrate = DC_CAL | WBD_CAL | TEMP_CAL; /* enable iq-offset-calibration and wbd-calibration when tuning next time */ @@ -1711,7 +1711,8 @@ static int dib0090_dc_offset_calibration(struct dib0090_state *state, enum front /* fall through */ case CT_TUNER_STEP_0: - dprintk("Start/continue DC calibration for %s path", (state->dc->i == 1) ? "I" : "Q"); + dprintk("Start/continue DC calibration for %s path\n", + (state->dc->i == 1) ? "I" : "Q"); dib0090_write_reg(state, 0x01, state->dc->bb1); dib0090_write_reg(state, 0x07, state->bb7 | (state->dc->i << 7)); @@ -1733,13 +1734,13 @@ static int dib0090_dc_offset_calibration(struct dib0090_state *state, enum front break; case CT_TUNER_STEP_5: /* found an offset */ - dprintk("adc_diff = %d, current step= %d", (u32) state->adc_diff, state->step); + dprintk("adc_diff = %d, current step= %d\n", (u32) state->adc_diff, state->step); if (state->step == 0 && state->adc_diff < 0) { state->min_adc_diff = -1023; - dprintk("Change of sign of the minimum adc diff"); + dprintk("Change of sign of the minimum adc diff\n"); } - dprintk("adc_diff = %d, min_adc_diff = %d current_step = %d", state->adc_diff, state->min_adc_diff, state->step); + dprintk("adc_diff = %d, min_adc_diff = %d current_step = %d\n", state->adc_diff, state->min_adc_diff, state->step); /* first turn for this frequency */ if (state->step == 0) { @@ -1758,12 +1759,12 @@ static int dib0090_dc_offset_calibration(struct dib0090_state *state, enum front } else { /* the minimum was what we have seen in the step before */ if (ABS(state->adc_diff) > ABS(state->min_adc_diff)) { - dprintk("Since adc_diff N = %d > adc_diff step N-1 = %d, Come back one step", state->adc_diff, state->min_adc_diff); + dprintk("Since adc_diff N = %d > adc_diff step N-1 = %d, Come back one step\n", state->adc_diff, state->min_adc_diff); state->step--; } dib0090_set_trim(state); - dprintk("BB Offset Cal, BBreg=%hd,Offset=%hd,Value Set=%hd", state->dc->addr, state->adc_diff, state->step); + dprintk("BB Offset Cal, BBreg=%hd,Offset=%hd,Value Set=%hd\n", state->dc->addr, state->adc_diff, state->step); state->dc++; if (state->dc->addr == 0) /* done */ @@ -1819,7 +1820,7 @@ static int dib0090_wbd_calibration(struct dib0090_state *state, enum frontend_tu case CT_TUNER_STEP_0: state->wbd_offset = dib0090_get_slow_adc_val(state); - dprintk("WBD calibration offset = %d", state->wbd_offset); + dprintk("WBD calibration offset = %d\n", state->wbd_offset); *tune_state = CT_TUNER_START; /* reset done -> real tuning can now begin */ state->calibrate &= ~WBD_CAL; break; @@ -2064,7 +2065,7 @@ int dib0090_update_tuning_table_7090(struct dvb_frontend *fe, if ((!state->identity.p1g) || (!state->identity.in_soc) || ((state->identity.version != SOC_7090_P1G_21R1) && (state->identity.version != SOC_7090_P1G_11R1))) { - dprintk("%s() function can only be used for dib7090", __func__); + dprintk("%s() function can only be used for dib7090\n", __func__); return -ENODEV; } @@ -2098,7 +2099,8 @@ static int dib0090_captrim_search(struct dib0090_state *state, enum frontend_tun force_soft_search = 1; if (*tune_state == CT_TUNER_START) { - dprintk("Start Captrim search : %s", (force_soft_search == 1) ? "FORCE SOFT SEARCH" : "AUTO"); + dprintk("Start Captrim search : %s\n", + (force_soft_search == 1) ? "FORCE SOFT SEARCH" : "AUTO"); dib0090_write_reg(state, 0x10, 0x2B1); dib0090_write_reg(state, 0x1e, 0x0032); @@ -2140,13 +2142,13 @@ static int dib0090_captrim_search(struct dib0090_state *state, enum frontend_tun dib0090_read_reg(state, 0x40); state->fcaptrim = dib0090_read_reg(state, 0x18) & 0x7F; - dprintk("***Final Captrim= 0x%x", state->fcaptrim); + dprintk("***Final Captrim= 0x%x\n", state->fcaptrim); *tune_state = CT_TUNER_STEP_3; } else { /* MERGE for all krosus before P1G */ adc = dib0090_get_slow_adc_val(state); - dprintk("CAPTRIM=%d; ADC = %d (ADC) & %dmV", (u32) state->captrim, (u32) adc, (u32) (adc) * (u32) 1800 / (u32) 1024); + dprintk("CAPTRIM=%d; ADC = %d (ADC) & %dmV\n", (u32) state->captrim, (u32) adc, (u32) (adc) * (u32) 1800 / (u32) 1024); if (state->rest == 0 || state->identity.in_soc) { /* Just for 8090P SOCS where auto captrim HW bug : TO CHECK IN ACI for SOCS !!! if 400 for 8090p SOC => tune issue !!! */ adc_target = 200; @@ -2162,7 +2164,7 @@ static int dib0090_captrim_search(struct dib0090_state *state, enum frontend_tun } if (adc < state->adc_diff) { - dprintk("CAPTRIM=%d is closer to target (%d/%d)", (u32) state->captrim, (u32) adc, (u32) state->adc_diff); + dprintk("CAPTRIM=%d is closer to target (%d/%d)\n", (u32) state->captrim, (u32) adc, (u32) state->adc_diff); state->adc_diff = adc; state->fcaptrim = state->captrim; } @@ -2216,7 +2218,7 @@ static int dib0090_get_temperature(struct dib0090_state *state, enum frontend_tu val = dib0090_get_slow_adc_val(state); state->temperature = ((s16) ((val - state->adc_diff) * 180) >> 8) + 55; - dprintk("temperature: %d C", state->temperature - 30); + dprintk("temperature: %d C\n", state->temperature - 30); *tune_state = CT_TUNER_STEP_2; break; @@ -2478,13 +2480,13 @@ static int dib0090_tune(struct dvb_frontend *fe) wbd++; dib0090_write_reg(state, 0x1e, 0x07ff); - dprintk("Final Captrim: %d", (u32) state->fcaptrim); - dprintk("HFDIV code: %d", (u32) pll->hfdiv_code); - dprintk("VCO = %d", (u32) pll->vco_band); - dprintk("VCOF in kHz: %d ((%d*%d) << 1))", (u32) ((pll->hfdiv * state->rf_request) * 2), (u32) pll->hfdiv, (u32) state->rf_request); - dprintk("REFDIV: %d, FREF: %d", (u32) 1, (u32) state->config->io.clock_khz); - dprintk("FBDIV: %d, Rest: %d", (u32) dib0090_read_reg(state, 0x15), (u32) dib0090_read_reg(state, 0x17)); - dprintk("Num: %d, Den: %d, SD: %d", (u32) dib0090_read_reg(state, 0x17), (u32) (dib0090_read_reg(state, 0x16) >> 8), + dprintk("Final Captrim: %d\n", (u32) state->fcaptrim); + dprintk("HFDIV code: %d\n", (u32) pll->hfdiv_code); + dprintk("VCO = %d\n", (u32) pll->vco_band); + dprintk("VCOF in kHz: %d ((%d*%d) << 1))\n", (u32) ((pll->hfdiv * state->rf_request) * 2), (u32) pll->hfdiv, (u32) state->rf_request); + dprintk("REFDIV: %d, FREF: %d\n", (u32) 1, (u32) state->config->io.clock_khz); + dprintk("FBDIV: %d, Rest: %d\n", (u32) dib0090_read_reg(state, 0x15), (u32) dib0090_read_reg(state, 0x17)); + dprintk("Num: %d, Den: %d, SD: %d\n", (u32) dib0090_read_reg(state, 0x17), (u32) (dib0090_read_reg(state, 0x16) >> 8), (u32) dib0090_read_reg(state, 0x1c) & 0x3); #define WBD 0x781 /* 1 1 1 1 0000 0 0 1 */ @@ -2498,7 +2500,7 @@ static int dib0090_tune(struct dvb_frontend *fe) dib0090_write_reg(state, 0x10, state->wbdmux); if ((tune->tuner_enable == EN_CAB) && state->identity.p1g) { - dprintk("P1G : The cable band is selected and lna_tune = %d", tune->lna_tune); + dprintk("P1G : The cable band is selected and lna_tune = %d\n", tune->lna_tune); dib0090_write_reg(state, 0x09, tune->lna_bias); dib0090_write_reg(state, 0x0b, 0xb800 | (tune->lna_tune << 6) | (tune->switch_trim)); } else @@ -2524,11 +2526,10 @@ static int dib0090_tune(struct dvb_frontend *fe) return ret; } -static int dib0090_release(struct dvb_frontend *fe) +static void dib0090_release(struct dvb_frontend *fe) { kfree(fe->tuner_priv); fe->tuner_priv = NULL; - return 0; } enum frontend_tune_state dib0090_get_tune_state(struct dvb_frontend *fe) @@ -2643,7 +2644,7 @@ struct dvb_frontend *dib0090_register(struct dvb_frontend *fe, struct i2c_adapte if (dib0090_reset(fe) != 0) goto free_mem; - printk(KERN_INFO "DiB0090: successfully identified\n"); + pr_info("DiB0090: successfully identified\n"); memcpy(&fe->ops.tuner_ops, &dib0090_ops, sizeof(struct dvb_tuner_ops)); return fe; @@ -2670,7 +2671,7 @@ struct dvb_frontend *dib0090_fw_register(struct dvb_frontend *fe, struct i2c_ada if (dib0090_fw_reset_digital(fe, st->config) != 0) goto free_mem; - dprintk("DiB0090 FW: successfully identified"); + dprintk("DiB0090 FW: successfully identified\n"); memcpy(&fe->ops.tuner_ops, &dib0090_fw_ops, sizeof(struct dvb_tuner_ops)); return fe; diff --git a/drivers/media/dvb-frontends/dib3000mb.c b/drivers/media/dvb-frontends/dib3000mb.c index 6821ecb53d63..068bec104e29 100644 --- a/drivers/media/dvb-frontends/dib3000mb.c +++ b/drivers/media/dvb-frontends/dib3000mb.c @@ -21,6 +21,8 @@ * */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <linux/kernel.h> #include <linux/module.h> #include <linux/init.h> @@ -42,13 +44,13 @@ static int debug; module_param(debug, int, 0644); MODULE_PARM_DESC(debug, "set debugging level (1=info,2=xfer,4=setfe,8=getfe (|-able))."); -#define deb_info(args...) dprintk(0x01,args) -#define deb_i2c(args...) dprintk(0x02,args) -#define deb_srch(args...) dprintk(0x04,args) -#define deb_info(args...) dprintk(0x01,args) -#define deb_xfer(args...) dprintk(0x02,args) -#define deb_setf(args...) dprintk(0x04,args) -#define deb_getf(args...) dprintk(0x08,args) +#define deb_info(args...) dprintk(0x01, args) +#define deb_i2c(args...) dprintk(0x02, args) +#define deb_srch(args...) dprintk(0x04, args) +#define deb_info(args...) dprintk(0x01, args) +#define deb_xfer(args...) dprintk(0x02, args) +#define deb_setf(args...) dprintk(0x04, args) +#define deb_getf(args...) dprintk(0x08, args) static int dib3000_read_reg(struct dib3000_state *state, u16 reg) { @@ -126,103 +128,96 @@ static int dib3000mb_set_frontend(struct dvb_frontend *fe, int tuner) fe->ops.tuner_ops.set_params(fe); if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); - deb_setf("bandwidth: "); switch (c->bandwidth_hz) { case 8000000: - deb_setf("8 MHz\n"); wr_foreach(dib3000mb_reg_timing_freq, dib3000mb_timing_freq[2]); wr_foreach(dib3000mb_reg_bandwidth, dib3000mb_bandwidth_8mhz); break; case 7000000: - deb_setf("7 MHz\n"); wr_foreach(dib3000mb_reg_timing_freq, dib3000mb_timing_freq[1]); wr_foreach(dib3000mb_reg_bandwidth, dib3000mb_bandwidth_7mhz); break; case 6000000: - deb_setf("6 MHz\n"); wr_foreach(dib3000mb_reg_timing_freq, dib3000mb_timing_freq[0]); wr_foreach(dib3000mb_reg_bandwidth, dib3000mb_bandwidth_6mhz); break; case 0: return -EOPNOTSUPP; default: - err("unknown bandwidth value."); + pr_err("unknown bandwidth value.\n"); return -EINVAL; } + deb_setf("bandwidth: %d MHZ\n", c->bandwidth_hz / 1000000); } wr(DIB3000MB_REG_LOCK1_MASK, DIB3000MB_LOCK1_SEARCH_4); - deb_setf("transmission mode: "); switch (c->transmission_mode) { case TRANSMISSION_MODE_2K: - deb_setf("2k\n"); + deb_setf("transmission mode: 2k\n"); wr(DIB3000MB_REG_FFT, DIB3000_TRANSMISSION_MODE_2K); break; case TRANSMISSION_MODE_8K: - deb_setf("8k\n"); + deb_setf("transmission mode: 8k\n"); wr(DIB3000MB_REG_FFT, DIB3000_TRANSMISSION_MODE_8K); break; case TRANSMISSION_MODE_AUTO: - deb_setf("auto\n"); + deb_setf("transmission mode: auto\n"); break; default: return -EINVAL; } - deb_setf("guard: "); switch (c->guard_interval) { case GUARD_INTERVAL_1_32: - deb_setf("1_32\n"); + deb_setf("guard 1_32\n"); wr(DIB3000MB_REG_GUARD_TIME, DIB3000_GUARD_TIME_1_32); break; case GUARD_INTERVAL_1_16: - deb_setf("1_16\n"); + deb_setf("guard 1_16\n"); wr(DIB3000MB_REG_GUARD_TIME, DIB3000_GUARD_TIME_1_16); break; case GUARD_INTERVAL_1_8: - deb_setf("1_8\n"); + deb_setf("guard 1_8\n"); wr(DIB3000MB_REG_GUARD_TIME, DIB3000_GUARD_TIME_1_8); break; case GUARD_INTERVAL_1_4: - deb_setf("1_4\n"); + deb_setf("guard 1_4\n"); wr(DIB3000MB_REG_GUARD_TIME, DIB3000_GUARD_TIME_1_4); break; case GUARD_INTERVAL_AUTO: - deb_setf("auto\n"); + deb_setf("guard auto\n"); break; default: return -EINVAL; } - deb_setf("inversion: "); switch (c->inversion) { case INVERSION_OFF: - deb_setf("off\n"); + deb_setf("inversion off\n"); wr(DIB3000MB_REG_DDS_INV, DIB3000_DDS_INVERSION_OFF); break; case INVERSION_AUTO: - deb_setf("auto "); + deb_setf("inversion auto\n"); break; case INVERSION_ON: - deb_setf("on\n"); + deb_setf("inversion on\n"); wr(DIB3000MB_REG_DDS_INV, DIB3000_DDS_INVERSION_ON); break; default: return -EINVAL; } - deb_setf("modulation: "); switch (c->modulation) { case QPSK: - deb_setf("qpsk\n"); + deb_setf("modulation: qpsk\n"); wr(DIB3000MB_REG_QAM, DIB3000_CONSTELLATION_QPSK); break; case QAM_16: - deb_setf("qam16\n"); + deb_setf("modulation: qam16\n"); wr(DIB3000MB_REG_QAM, DIB3000_CONSTELLATION_16QAM); break; case QAM_64: - deb_setf("qam64\n"); + deb_setf("modulation: qam64\n"); wr(DIB3000MB_REG_QAM, DIB3000_CONSTELLATION_64QAM); break; case QAM_AUTO: @@ -230,69 +225,64 @@ static int dib3000mb_set_frontend(struct dvb_frontend *fe, int tuner) default: return -EINVAL; } - deb_setf("hierarchy: "); switch (c->hierarchy) { case HIERARCHY_NONE: - deb_setf("none "); + deb_setf("hierarchy: none\n"); /* fall through */ case HIERARCHY_1: - deb_setf("alpha=1\n"); + deb_setf("hierarchy: alpha=1\n"); wr(DIB3000MB_REG_VIT_ALPHA, DIB3000_ALPHA_1); break; case HIERARCHY_2: - deb_setf("alpha=2\n"); + deb_setf("hierarchy: alpha=2\n"); wr(DIB3000MB_REG_VIT_ALPHA, DIB3000_ALPHA_2); break; case HIERARCHY_4: - deb_setf("alpha=4\n"); + deb_setf("hierarchy: alpha=4\n"); wr(DIB3000MB_REG_VIT_ALPHA, DIB3000_ALPHA_4); break; case HIERARCHY_AUTO: - deb_setf("alpha=auto\n"); + deb_setf("hierarchy: alpha=auto\n"); break; default: return -EINVAL; } - deb_setf("hierarchy: "); if (c->hierarchy == HIERARCHY_NONE) { - deb_setf("none\n"); wr(DIB3000MB_REG_VIT_HRCH, DIB3000_HRCH_OFF); wr(DIB3000MB_REG_VIT_HP, DIB3000_SELECT_HP); fe_cr = c->code_rate_HP; } else if (c->hierarchy != HIERARCHY_AUTO) { - deb_setf("on\n"); wr(DIB3000MB_REG_VIT_HRCH, DIB3000_HRCH_ON); wr(DIB3000MB_REG_VIT_HP, DIB3000_SELECT_LP); fe_cr = c->code_rate_LP; } - deb_setf("fec: "); switch (fe_cr) { case FEC_1_2: - deb_setf("1_2\n"); + deb_setf("fec: 1_2\n"); wr(DIB3000MB_REG_VIT_CODE_RATE, DIB3000_FEC_1_2); break; case FEC_2_3: - deb_setf("2_3\n"); + deb_setf("fec: 2_3\n"); wr(DIB3000MB_REG_VIT_CODE_RATE, DIB3000_FEC_2_3); break; case FEC_3_4: - deb_setf("3_4\n"); + deb_setf("fec: 3_4\n"); wr(DIB3000MB_REG_VIT_CODE_RATE, DIB3000_FEC_3_4); break; case FEC_5_6: - deb_setf("5_6\n"); + deb_setf("fec: 5_6\n"); wr(DIB3000MB_REG_VIT_CODE_RATE, DIB3000_FEC_5_6); break; case FEC_7_8: - deb_setf("7_8\n"); + deb_setf("fec: 7_8\n"); wr(DIB3000MB_REG_VIT_CODE_RATE, DIB3000_FEC_7_8); break; case FEC_NONE: - deb_setf("none "); + deb_setf("fec: none\n"); break; case FEC_AUTO: - deb_setf("auto\n"); + deb_setf("fec: auto\n"); break; default: return -EINVAL; @@ -357,7 +347,8 @@ static int dib3000mb_set_frontend(struct dvb_frontend *fe, int tuner) rd(DIB3000MB_REG_LOCK2_VALUE))) < 0 && as_count++ < 100) msleep(1); - deb_setf("search_state after autosearch %d after %d checks\n",search_state,as_count); + deb_setf("search_state after autosearch %d after %d checks\n", + search_state, as_count); if (search_state == 1) { if (dib3000mb_get_frontend(fe, c) == 0) { @@ -464,7 +455,7 @@ static int dib3000mb_get_frontend(struct dvb_frontend* fe, return 0; dds_val = ((rd(DIB3000MB_REG_DDS_VALUE_MSB) & 0xff) << 16) + rd(DIB3000MB_REG_DDS_VALUE_LSB); - deb_getf("DDS_VAL: %x %x %x",dds_val, rd(DIB3000MB_REG_DDS_VALUE_MSB), rd(DIB3000MB_REG_DDS_VALUE_LSB)); + deb_getf("DDS_VAL: %x %x %x\n", dds_val, rd(DIB3000MB_REG_DDS_VALUE_MSB), rd(DIB3000MB_REG_DDS_VALUE_LSB)); if (dds_val < threshold) inv_test1 = 0; else if (dds_val == threshold) @@ -473,7 +464,7 @@ static int dib3000mb_get_frontend(struct dvb_frontend* fe, inv_test1 = 2; dds_val = ((rd(DIB3000MB_REG_DDS_FREQ_MSB) & 0xff) << 16) + rd(DIB3000MB_REG_DDS_FREQ_LSB); - deb_getf("DDS_FREQ: %x %x %x",dds_val, rd(DIB3000MB_REG_DDS_FREQ_MSB), rd(DIB3000MB_REG_DDS_FREQ_LSB)); + deb_getf("DDS_FREQ: %x %x %x\n", dds_val, rd(DIB3000MB_REG_DDS_FREQ_MSB), rd(DIB3000MB_REG_DDS_FREQ_LSB)); if (dds_val < threshold) inv_test2 = 0; else if (dds_val == threshold) @@ -490,19 +481,19 @@ static int dib3000mb_get_frontend(struct dvb_frontend* fe, switch ((tps_val = rd(DIB3000MB_REG_TPS_QAM))) { case DIB3000_CONSTELLATION_QPSK: - deb_getf("QPSK "); + deb_getf("QPSK\n"); c->modulation = QPSK; break; case DIB3000_CONSTELLATION_16QAM: - deb_getf("QAM16 "); + deb_getf("QAM16\n"); c->modulation = QAM_16; break; case DIB3000_CONSTELLATION_64QAM: - deb_getf("QAM64 "); + deb_getf("QAM64\n"); c->modulation = QAM_64; break; default: - err("Unexpected constellation returned by TPS (%d)", tps_val); + pr_err("Unexpected constellation returned by TPS (%d)\n", tps_val); break; } deb_getf("TPS: %d\n", tps_val); @@ -513,23 +504,23 @@ static int dib3000mb_get_frontend(struct dvb_frontend* fe, c->code_rate_HP = FEC_NONE; switch ((tps_val = rd(DIB3000MB_REG_TPS_VIT_ALPHA))) { case DIB3000_ALPHA_0: - deb_getf("HIERARCHY_NONE "); + deb_getf("HIERARCHY_NONE\n"); c->hierarchy = HIERARCHY_NONE; break; case DIB3000_ALPHA_1: - deb_getf("HIERARCHY_1 "); + deb_getf("HIERARCHY_1\n"); c->hierarchy = HIERARCHY_1; break; case DIB3000_ALPHA_2: - deb_getf("HIERARCHY_2 "); + deb_getf("HIERARCHY_2\n"); c->hierarchy = HIERARCHY_2; break; case DIB3000_ALPHA_4: - deb_getf("HIERARCHY_4 "); + deb_getf("HIERARCHY_4\n"); c->hierarchy = HIERARCHY_4; break; default: - err("Unexpected ALPHA value returned by TPS (%d)", tps_val); + pr_err("Unexpected ALPHA value returned by TPS (%d)\n", tps_val); break; } deb_getf("TPS: %d\n", tps_val); @@ -546,65 +537,65 @@ static int dib3000mb_get_frontend(struct dvb_frontend* fe, switch (tps_val) { case DIB3000_FEC_1_2: - deb_getf("FEC_1_2 "); + deb_getf("FEC_1_2\n"); *cr = FEC_1_2; break; case DIB3000_FEC_2_3: - deb_getf("FEC_2_3 "); + deb_getf("FEC_2_3\n"); *cr = FEC_2_3; break; case DIB3000_FEC_3_4: - deb_getf("FEC_3_4 "); + deb_getf("FEC_3_4\n"); *cr = FEC_3_4; break; case DIB3000_FEC_5_6: - deb_getf("FEC_5_6 "); + deb_getf("FEC_5_6\n"); *cr = FEC_4_5; break; case DIB3000_FEC_7_8: - deb_getf("FEC_7_8 "); + deb_getf("FEC_7_8\n"); *cr = FEC_7_8; break; default: - err("Unexpected FEC returned by TPS (%d)", tps_val); + pr_err("Unexpected FEC returned by TPS (%d)\n", tps_val); break; } deb_getf("TPS: %d\n",tps_val); switch ((tps_val = rd(DIB3000MB_REG_TPS_GUARD_TIME))) { case DIB3000_GUARD_TIME_1_32: - deb_getf("GUARD_INTERVAL_1_32 "); + deb_getf("GUARD_INTERVAL_1_32\n"); c->guard_interval = GUARD_INTERVAL_1_32; break; case DIB3000_GUARD_TIME_1_16: - deb_getf("GUARD_INTERVAL_1_16 "); + deb_getf("GUARD_INTERVAL_1_16\n"); c->guard_interval = GUARD_INTERVAL_1_16; break; case DIB3000_GUARD_TIME_1_8: - deb_getf("GUARD_INTERVAL_1_8 "); + deb_getf("GUARD_INTERVAL_1_8\n"); c->guard_interval = GUARD_INTERVAL_1_8; break; case DIB3000_GUARD_TIME_1_4: - deb_getf("GUARD_INTERVAL_1_4 "); + deb_getf("GUARD_INTERVAL_1_4\n"); c->guard_interval = GUARD_INTERVAL_1_4; break; default: - err("Unexpected Guard Time returned by TPS (%d)", tps_val); + pr_err("Unexpected Guard Time returned by TPS (%d)\n", tps_val); break; } deb_getf("TPS: %d\n", tps_val); switch ((tps_val = rd(DIB3000MB_REG_TPS_FFT))) { case DIB3000_TRANSMISSION_MODE_2K: - deb_getf("TRANSMISSION_MODE_2K "); + deb_getf("TRANSMISSION_MODE_2K\n"); c->transmission_mode = TRANSMISSION_MODE_2K; break; case DIB3000_TRANSMISSION_MODE_8K: - deb_getf("TRANSMISSION_MODE_8K "); + deb_getf("TRANSMISSION_MODE_8K\n"); c->transmission_mode = TRANSMISSION_MODE_8K; break; default: - err("unexpected transmission mode return by TPS (%d)", tps_val); + pr_err("unexpected transmission mode return by TPS (%d)\n", tps_val); break; } deb_getf("TPS: %d\n", tps_val); @@ -751,7 +742,7 @@ static int dib3000mb_tuner_pass_ctrl(struct dvb_frontend *fe, int onoff, u8 pll_ return 0; } -static struct dvb_frontend_ops dib3000mb_ops; +static const struct dvb_frontend_ops dib3000mb_ops; struct dvb_frontend* dib3000mb_attach(const struct dib3000_config* config, struct i2c_adapter* i2c, struct dib_fe_xfer_ops *xfer_ops) @@ -791,7 +782,7 @@ error: return NULL; } -static struct dvb_frontend_ops dib3000mb_ops = { +static const struct dvb_frontend_ops dib3000mb_ops = { .delsys = { SYS_DVBT }, .info = { .name = "DiBcom 3000M-B DVB-T", diff --git a/drivers/media/dvb-frontends/dib3000mb_priv.h b/drivers/media/dvb-frontends/dib3000mb_priv.h index 0459d5c84314..ef7f5d136c6b 100644 --- a/drivers/media/dvb-frontends/dib3000mb_priv.h +++ b/drivers/media/dvb-frontends/dib3000mb_priv.h @@ -13,20 +13,15 @@ #ifndef __DIB3000MB_PRIV_H_INCLUDED__ #define __DIB3000MB_PRIV_H_INCLUDED__ -/* info and err, taken from usb.h, if there is anything available like by default. */ -#define err(format, arg...) printk(KERN_ERR "dib3000: " format "\n" , ## arg) -#define info(format, arg...) printk(KERN_INFO "dib3000: " format "\n" , ## arg) -#define warn(format, arg...) printk(KERN_WARNING "dib3000: " format "\n" , ## arg) - /* handy shortcuts */ #define rd(reg) dib3000_read_reg(state,reg) #define wr(reg,val) if (dib3000_write_reg(state,reg,val)) \ - { err("while sending 0x%04x to 0x%04x.",val,reg); return -EREMOTEIO; } + { pr_err("while sending 0x%04x to 0x%04x.", val, reg); return -EREMOTEIO; } #define wr_foreach(a,v) { int i; \ if (sizeof(a) != sizeof(v)) \ - err("sizeof: %zu %zu is different",sizeof(a),sizeof(v));\ + pr_err("sizeof: %zu %zu is different", sizeof(a), sizeof(v));\ for (i=0; i < sizeof(a)/sizeof(u16); i++) \ wr(a[i],v[i]); \ } @@ -37,8 +32,11 @@ /* debug */ -#define dprintk(level,args...) \ - do { if ((debug & level)) { printk(args); } } while (0) +#define dprintk(level, fmt, arg...) do { \ + if (debug & level) \ + printk(KERN_DEBUG pr_fmt("%s: " fmt), \ + __func__, ##arg); \ +} while (0) /* mask for enabling a specific pid for the pid_filter */ #define DIB3000_ACTIVATE_PID_FILTERING (0x2000) diff --git a/drivers/media/dvb-frontends/dib3000mc.c b/drivers/media/dvb-frontends/dib3000mc.c index da0f1dc5aaf7..224283fe100a 100644 --- a/drivers/media/dvb-frontends/dib3000mc.c +++ b/drivers/media/dvb-frontends/dib3000mc.c @@ -11,6 +11,8 @@ * published by the Free Software Foundation, version 2. */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <linux/kernel.h> #include <linux/slab.h> #include <linux/i2c.h> @@ -27,7 +29,11 @@ static int buggy_sfn_workaround; module_param(buggy_sfn_workaround, int, 0644); MODULE_PARM_DESC(buggy_sfn_workaround, "Enable work-around for buggy SFNs (default: 0)"); -#define dprintk(args...) do { if (debug) { printk(KERN_DEBUG "DiB3000MC/P:"); printk(args); printk("\n"); } } while (0) +#define dprintk(fmt, arg...) do { \ + if (debug) \ + printk(KERN_DEBUG pr_fmt("%s: " fmt), \ + __func__, ##arg); \ +} while (0) struct dib3000mc_state { struct dvb_frontend demod; @@ -873,7 +879,7 @@ int dib3000mc_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u8 defa } EXPORT_SYMBOL(dib3000mc_i2c_enumeration); -static struct dvb_frontend_ops dib3000mc_ops; +static const struct dvb_frontend_ops dib3000mc_ops; struct dvb_frontend * dib3000mc_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, struct dib3000mc_config *cfg) { @@ -906,7 +912,7 @@ error: } EXPORT_SYMBOL(dib3000mc_attach); -static struct dvb_frontend_ops dib3000mc_ops = { +static const struct dvb_frontend_ops dib3000mc_ops = { .delsys = { SYS_DVBT }, .info = { .name = "DiBcom 3000MC/P", diff --git a/drivers/media/dvb-frontends/dib7000m.c b/drivers/media/dvb-frontends/dib7000m.c index b3ddae8885ac..5ce9f93a65c3 100644 --- a/drivers/media/dvb-frontends/dib7000m.c +++ b/drivers/media/dvb-frontends/dib7000m.c @@ -8,6 +8,9 @@ * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation, version 2. */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <linux/kernel.h> #include <linux/slab.h> #include <linux/i2c.h> @@ -21,7 +24,11 @@ static int debug; module_param(debug, int, 0644); MODULE_PARM_DESC(debug, "turn on debugging (default: 0)"); -#define dprintk(args...) do { if (debug) { printk(KERN_DEBUG "DiB7000M: "); printk(args); printk("\n"); } } while (0) +#define dprintk(fmt, arg...) do { \ + if (debug) \ + printk(KERN_DEBUG pr_fmt("%s: " fmt), \ + __func__, ##arg); \ +} while (0) struct dib7000m_state { struct dvb_frontend demod; @@ -74,7 +81,7 @@ static u16 dib7000m_read_word(struct dib7000m_state *state, u16 reg) u16 ret; if (mutex_lock_interruptible(&state->i2c_buffer_lock) < 0) { - dprintk("could not acquire lock"); + dprintk("could not acquire lock\n"); return 0; } @@ -92,7 +99,7 @@ static u16 dib7000m_read_word(struct dib7000m_state *state, u16 reg) state->msg[1].len = 2; if (i2c_transfer(state->i2c_adap, state->msg, 2) != 2) - dprintk("i2c read error on %d",reg); + dprintk("i2c read error on %d\n", reg); ret = (state->i2c_read_buffer[0] << 8) | state->i2c_read_buffer[1]; mutex_unlock(&state->i2c_buffer_lock); @@ -105,7 +112,7 @@ static int dib7000m_write_word(struct dib7000m_state *state, u16 reg, u16 val) int ret; if (mutex_lock_interruptible(&state->i2c_buffer_lock) < 0) { - dprintk("could not acquire lock"); + dprintk("could not acquire lock\n"); return -EINVAL; } @@ -154,7 +161,7 @@ static int dib7000m_set_output_mode(struct dib7000m_state *state, int mode) fifo_threshold = 1792; smo_mode = (dib7000m_read_word(state, 294 + state->reg_offs) & 0x0010) | (1 << 1); - dprintk( "setting output mode for demod %p to %d", &state->demod, mode); + dprintk("setting output mode for demod %p to %d\n", &state->demod, mode); switch (mode) { case OUTMODE_MPEG2_PAR_GATED_CLK: // STBs with parallel gated clock @@ -181,7 +188,7 @@ static int dib7000m_set_output_mode(struct dib7000m_state *state, int mode) outreg = 0; break; default: - dprintk( "Unhandled output_mode passed to be set for demod %p",&state->demod); + dprintk("Unhandled output_mode passed to be set for demod %p\n", &state->demod); break; } @@ -302,7 +309,7 @@ static int dib7000m_set_adc_state(struct dib7000m_state *state, enum dibx000_adc break; } -// dprintk( "913: %x, 914: %x", reg_913, reg_914); +// dprintk("913: %x, 914: %x\n", reg_913, reg_914); ret |= dib7000m_write_word(state, 913, reg_913); ret |= dib7000m_write_word(state, 914, reg_914); @@ -320,10 +327,10 @@ static int dib7000m_set_bandwidth(struct dib7000m_state *state, u32 bw) state->current_bandwidth = bw; if (state->timf == 0) { - dprintk( "using default timf"); + dprintk("using default timf\n"); timf = state->timf_default; } else { - dprintk( "using updated timf"); + dprintk("using updated timf\n"); timf = state->timf; } @@ -340,7 +347,7 @@ static int dib7000m_set_diversity_in(struct dvb_frontend *demod, int onoff) struct dib7000m_state *state = demod->demodulator_priv; if (state->div_force_off) { - dprintk( "diversity combination deactivated - forced by COFDM parameters"); + dprintk("diversity combination deactivated - forced by COFDM parameters\n"); onoff = 0; } state->div_state = (u8)onoff; @@ -580,10 +587,10 @@ static int dib7000m_demod_reset(struct dib7000m_state *state) dib7000mc_reset_pll(state); if (dib7000m_reset_gpio(state) != 0) - dprintk( "GPIO reset was not successful."); + dprintk("GPIO reset was not successful.\n"); if (dib7000m_set_output_mode(state, OUTMODE_HIGH_Z) != 0) - dprintk( "OUTPUT_MODE could not be reset."); + dprintk("OUTPUT_MODE could not be reset.\n"); /* unforce divstr regardless whether i2c enumeration was done or not */ dib7000m_write_word(state, 1794, dib7000m_read_word(state, 1794) & ~(1 << 1) ); @@ -650,7 +657,7 @@ static int dib7000m_agc_soft_split(struct dib7000m_state *state) (agc - state->current_agc->split.min_thres) / (state->current_agc->split.max_thres - state->current_agc->split.min_thres); - dprintk( "AGC split_offset: %d",split_offset); + dprintk("AGC split_offset: %d\n", split_offset); // P_agc_force_split and P_agc_split_offset return dib7000m_write_word(state, 103, (dib7000m_read_word(state, 103) & 0xff00) | split_offset); @@ -687,7 +694,7 @@ static int dib7000m_set_agc_config(struct dib7000m_state *state, u8 band) } if (agc == NULL) { - dprintk( "no valid AGC configuration found for band 0x%02x",band); + dprintk("no valid AGC configuration found for band 0x%02x\n", band); return -EINVAL; } @@ -703,7 +710,7 @@ static int dib7000m_set_agc_config(struct dib7000m_state *state, u8 band) dib7000m_write_word(state, 98, (agc->alpha_mant << 5) | agc->alpha_exp); dib7000m_write_word(state, 99, (agc->beta_mant << 6) | agc->beta_exp); - dprintk( "WBD: ref: %d, sel: %d, active: %d, alpha: %d", + dprintk("WBD: ref: %d, sel: %d, active: %d, alpha: %d\n", state->wbd_ref != 0 ? state->wbd_ref : agc->wbd_ref, agc->wbd_sel, !agc->perform_agc_softsplit, agc->wbd_sel); /* AGC continued */ @@ -724,7 +731,7 @@ static int dib7000m_set_agc_config(struct dib7000m_state *state, u8 band) if (state->revision > 0x4000) { // settings for the MC dib7000m_write_word(state, 71, agc->agc1_pt3); -// dprintk( "929: %x %d %d", +// dprintk("929: %x %d %d\n", // (dib7000m_read_word(state, 929) & 0xffe3) | (agc->wbd_inv << 4) | (agc->wbd_sel << 2), agc->wbd_inv, agc->wbd_sel); dib7000m_write_word(state, 929, (dib7000m_read_word(state, 929) & 0xffe3) | (agc->wbd_inv << 4) | (agc->wbd_sel << 2)); } else { @@ -742,7 +749,7 @@ static void dib7000m_update_timf(struct dib7000m_state *state) state->timf = timf * 160 / (state->current_bandwidth / 50); dib7000m_write_word(state, 23, (u16) (timf >> 16)); dib7000m_write_word(state, 24, (u16) (timf & 0xffff)); - dprintk( "updated timf_frequency: %d (default: %d)",state->timf, state->timf_default); + dprintk("updated timf_frequency: %d (default: %d)\n", state->timf, state->timf_default); } static int dib7000m_agc_startup(struct dvb_frontend *demod) @@ -804,7 +811,7 @@ static int dib7000m_agc_startup(struct dvb_frontend *demod) dib7000m_restart_agc(state); - dprintk( "SPLIT %p: %hd", demod, agc_split); + dprintk("SPLIT %p: %hd\n", demod, agc_split); (*agc_state)++; ret = 5; @@ -1013,12 +1020,12 @@ static int dib7000m_autosearch_irq(struct dib7000m_state *state, u16 reg) u16 irq_pending = dib7000m_read_word(state, reg); if (irq_pending & 0x1) { // failed - dprintk( "autosearch failed"); + dprintk("autosearch failed\n"); return 1; } if (irq_pending & 0x2) { // succeeded - dprintk( "autosearch succeeded"); + dprintk("autosearch succeeded\n"); return 2; } return 0; // still pending @@ -1102,7 +1109,7 @@ static int dib7000m_wakeup(struct dvb_frontend *demod) dib7000m_set_power_mode(state, DIB7000M_POWER_ALL); if (dib7000m_set_adc_state(state, DIBX000_SLOW_ADC_ON) != 0) - dprintk( "could not start Slow ADC"); + dprintk("could not start Slow ADC\n"); return 0; } @@ -1121,7 +1128,7 @@ static int dib7000m_identify(struct dib7000m_state *state) u16 value; if ((value = dib7000m_read_word(state, 896)) != 0x01b3) { - dprintk( "wrong Vendor ID (0x%x)",value); + dprintk("wrong Vendor ID (0x%x)\n", value); return -EREMOTEIO; } @@ -1130,21 +1137,21 @@ static int dib7000m_identify(struct dib7000m_state *state) state->revision != 0x4001 && state->revision != 0x4002 && state->revision != 0x4003) { - dprintk( "wrong Device ID (0x%x)",value); + dprintk("wrong Device ID (0x%x)\n", value); return -EREMOTEIO; } /* protect this driver to be used with 7000PC */ if (state->revision == 0x4000 && dib7000m_read_word(state, 769) == 0x4000) { - dprintk( "this driver does not work with DiB7000PC"); + dprintk("this driver does not work with DiB7000PC\n"); return -EREMOTEIO; } switch (state->revision) { - case 0x4000: dprintk( "found DiB7000MA/PA/MB/PB"); break; - case 0x4001: state->reg_offs = 1; dprintk( "found DiB7000HC"); break; - case 0x4002: state->reg_offs = 1; dprintk( "found DiB7000MC"); break; - case 0x4003: state->reg_offs = 1; dprintk( "found DiB9000"); break; + case 0x4000: dprintk("found DiB7000MA/PA/MB/PB\n"); break; + case 0x4001: state->reg_offs = 1; dprintk("found DiB7000HC\n"); break; + case 0x4002: state->reg_offs = 1; dprintk("found DiB7000MC\n"); break; + case 0x4003: state->reg_offs = 1; dprintk("found DiB9000\n"); break; } return 0; @@ -1242,7 +1249,7 @@ static int dib7000m_set_frontend(struct dvb_frontend *fe) found = dib7000m_autosearch_is_irq(fe); } while (found == 0 && i--); - dprintk("autosearch returns: %d",found); + dprintk("autosearch returns: %d\n", found); if (found == 0 || found == 1) return 0; // no channel found @@ -1330,7 +1337,7 @@ int dib7000m_pid_filter_ctrl(struct dvb_frontend *fe, u8 onoff) struct dib7000m_state *state = fe->demodulator_priv; u16 val = dib7000m_read_word(state, 294 + state->reg_offs) & 0xffef; val |= (onoff & 0x1) << 4; - dprintk("PID filter enabled %d", onoff); + dprintk("PID filter enabled %d\n", onoff); return dib7000m_write_word(state, 294 + state->reg_offs, val); } EXPORT_SYMBOL(dib7000m_pid_filter_ctrl); @@ -1338,7 +1345,7 @@ EXPORT_SYMBOL(dib7000m_pid_filter_ctrl); int dib7000m_pid_filter(struct dvb_frontend *fe, u8 id, u16 pid, u8 onoff) { struct dib7000m_state *state = fe->demodulator_priv; - dprintk("PID filter: index %x, PID %d, OnOff %d", id, pid, onoff); + dprintk("PID filter: index %x, PID %d, OnOff %d\n", id, pid, onoff); return dib7000m_write_word(state, 300 + state->reg_offs + id, onoff ? (1 << 13) | pid : 0); } @@ -1362,7 +1369,7 @@ int dib7000m_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, if (dib7000m_identify(&st) != 0) { st.i2c_addr = default_addr; if (dib7000m_identify(&st) != 0) { - dprintk("DiB7000M #%d: not identified", k); + dprintk("DiB7000M #%d: not identified\n", k); return -EIO; } } @@ -1375,7 +1382,7 @@ int dib7000m_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, /* set new i2c address and force divstart */ dib7000m_write_word(&st, 1794, (new_addr << 2) | 0x2); - dprintk("IC %d initialized (to i2c_address 0x%x)", k, new_addr); + dprintk("IC %d initialized (to i2c_address 0x%x)\n", k, new_addr); } for (k = 0; k < no_of_demods; k++) { @@ -1394,7 +1401,7 @@ int dib7000m_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, EXPORT_SYMBOL(dib7000m_i2c_enumeration); #endif -static struct dvb_frontend_ops dib7000m_ops; +static const struct dvb_frontend_ops dib7000m_ops; struct dvb_frontend * dib7000m_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, struct dib7000m_config *cfg) { struct dvb_frontend *demod; @@ -1432,7 +1439,7 @@ error: } EXPORT_SYMBOL(dib7000m_attach); -static struct dvb_frontend_ops dib7000m_ops = { +static const struct dvb_frontend_ops dib7000m_ops = { .delsys = { SYS_DVBT }, .info = { .name = "DiBcom 7000MA/MB/PA/PB/MC", diff --git a/drivers/media/dvb-frontends/dib7000p.c b/drivers/media/dvb-frontends/dib7000p.c index b861d4437f2a..a27c0001f2d6 100644 --- a/drivers/media/dvb-frontends/dib7000p.c +++ b/drivers/media/dvb-frontends/dib7000p.c @@ -7,6 +7,9 @@ * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation, version 2. */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <linux/kernel.h> #include <linux/slab.h> #include <linux/i2c.h> @@ -26,7 +29,11 @@ static int buggy_sfn_workaround; module_param(buggy_sfn_workaround, int, 0644); MODULE_PARM_DESC(buggy_sfn_workaround, "Enable work-around for buggy SFNs (default: 0)"); -#define dprintk(args...) do { if (debug) { printk(KERN_DEBUG "DiB7000P: "); printk(args); printk("\n"); } } while (0) +#define dprintk(fmt, arg...) do { \ + if (debug) \ + printk(KERN_DEBUG pr_fmt("%s: " fmt), \ + __func__, ##arg); \ +} while (0) struct i2c_device { struct i2c_adapter *i2c_adap; @@ -98,7 +105,7 @@ static u16 dib7000p_read_word(struct dib7000p_state *state, u16 reg) u16 ret; if (mutex_lock_interruptible(&state->i2c_buffer_lock) < 0) { - dprintk("could not acquire lock"); + dprintk("could not acquire lock\n"); return 0; } @@ -116,7 +123,7 @@ static u16 dib7000p_read_word(struct dib7000p_state *state, u16 reg) state->msg[1].len = 2; if (i2c_transfer(state->i2c_adap, state->msg, 2) != 2) - dprintk("i2c read error on %d", reg); + dprintk("i2c read error on %d\n", reg); ret = (state->i2c_read_buffer[0] << 8) | state->i2c_read_buffer[1]; mutex_unlock(&state->i2c_buffer_lock); @@ -128,7 +135,7 @@ static int dib7000p_write_word(struct dib7000p_state *state, u16 reg, u16 val) int ret; if (mutex_lock_interruptible(&state->i2c_buffer_lock) < 0) { - dprintk("could not acquire lock"); + dprintk("could not acquire lock\n"); return -EINVAL; } @@ -174,7 +181,7 @@ static int dib7000p_set_output_mode(struct dib7000p_state *state, int mode) fifo_threshold = 1792; smo_mode = (dib7000p_read_word(state, 235) & 0x0050) | (1 << 1); - dprintk("setting output mode for demod %p to %d", &state->demod, mode); + dprintk("setting output mode for demod %p to %d\n", &state->demod, mode); switch (mode) { case OUTMODE_MPEG2_PAR_GATED_CLK: @@ -204,7 +211,7 @@ static int dib7000p_set_output_mode(struct dib7000p_state *state, int mode) outreg = 0; break; default: - dprintk("Unhandled output_mode passed to be set for demod %p", &state->demod); + dprintk("Unhandled output_mode passed to be set for demod %p\n", &state->demod); break; } @@ -224,7 +231,7 @@ static int dib7000p_set_diversity_in(struct dvb_frontend *demod, int onoff) struct dib7000p_state *state = demod->demodulator_priv; if (state->div_force_off) { - dprintk("diversity combination deactivated - forced by COFDM parameters"); + dprintk("diversity combination deactivated - forced by COFDM parameters\n"); onoff = 0; dib7000p_write_word(state, 207, 0); } else @@ -374,10 +381,10 @@ static int dib7000p_set_bandwidth(struct dib7000p_state *state, u32 bw) state->current_bandwidth = bw; if (state->timf == 0) { - dprintk("using default timf"); + dprintk("using default timf\n"); timf = state->cfg.bw->timf; } else { - dprintk("using updated timf"); + dprintk("using updated timf\n"); timf = state->timf; } @@ -494,7 +501,7 @@ static int dib7000p_update_pll(struct dvb_frontend *fe, struct dibx000_bandwidth loopdiv = (reg_1856 >> 6) & 0x3f; if ((bw != NULL) && (bw->pll_prediv != prediv || bw->pll_ratio != loopdiv)) { - dprintk("Updating pll (prediv: old = %d new = %d ; loopdiv : old = %d new = %d)", prediv, bw->pll_prediv, loopdiv, bw->pll_ratio); + dprintk("Updating pll (prediv: old = %d new = %d ; loopdiv : old = %d new = %d)\n", prediv, bw->pll_prediv, loopdiv, bw->pll_ratio); reg_1856 &= 0xf000; reg_1857 = dib7000p_read_word(state, 1857); dib7000p_write_word(state, 1857, reg_1857 & ~(1 << 15)); @@ -511,7 +518,7 @@ static int dib7000p_update_pll(struct dvb_frontend *fe, struct dibx000_bandwidth dib7000p_write_word(state, 1857, reg_1857 | (1 << 15)); while (((dib7000p_read_word(state, 1856) >> 15) & 0x1) != 1) - dprintk("Waiting for PLL to lock"); + dprintk("Waiting for PLL to lock\n"); return 0; } @@ -521,7 +528,7 @@ static int dib7000p_update_pll(struct dvb_frontend *fe, struct dibx000_bandwidth static int dib7000p_reset_gpio(struct dib7000p_state *st) { /* reset the GPIOs */ - dprintk("gpio dir: %x: val: %x, pwm_pos: %x", st->gpio_dir, st->gpio_val, st->cfg.gpio_pwm_pos); + dprintk("gpio dir: %x: val: %x, pwm_pos: %x\n", st->gpio_dir, st->gpio_val, st->cfg.gpio_pwm_pos); dib7000p_write_word(st, 1029, st->gpio_dir); dib7000p_write_word(st, 1030, st->gpio_val); @@ -669,7 +676,7 @@ static int dib7000p_demod_reset(struct dib7000p_state *state) dib7000p_reset_pll(state); if (dib7000p_reset_gpio(state) != 0) - dprintk("GPIO reset was not successful."); + dprintk("GPIO reset was not successful.\n"); if (state->version == SOC7090) { dib7000p_write_word(state, 899, 0); @@ -681,7 +688,7 @@ static int dib7000p_demod_reset(struct dib7000p_state *state) dib7000p_write_word(state, 273, (0<<6) | 30); } if (dib7000p_set_output_mode(state, OUTMODE_HIGH_Z) != 0) - dprintk("OUTPUT_MODE could not be reset."); + dprintk("OUTPUT_MODE could not be reset.\n"); dib7000p_set_adc_state(state, DIBX000_SLOW_ADC_ON); dib7000p_sad_calib(state); @@ -759,7 +766,7 @@ static int dib7000p_set_agc_config(struct dib7000p_state *state, u8 band) } if (agc == NULL) { - dprintk("no valid AGC configuration found for band 0x%02x", band); + dprintk("no valid AGC configuration found for band 0x%02x\n", band); return -EINVAL; } @@ -776,7 +783,7 @@ static int dib7000p_set_agc_config(struct dib7000p_state *state, u8 band) dib7000p_write_word(state, 102, (agc->beta_mant << 6) | agc->beta_exp); /* AGC continued */ - dprintk("WBD: ref: %d, sel: %d, active: %d, alpha: %d", + dprintk("WBD: ref: %d, sel: %d, active: %d, alpha: %d\n", state->wbd_ref != 0 ? state->wbd_ref : agc->wbd_ref, agc->wbd_sel, !agc->perform_agc_softsplit, agc->wbd_sel); if (state->wbd_ref != 0) @@ -806,7 +813,7 @@ static void dib7000p_set_dds(struct dib7000p_state *state, s32 offset_khz) u32 dds = state->cfg.bw->ifreq & 0x1ffffff; u8 invert = !!(state->cfg.bw->ifreq & (1 << 25)); - dprintk("setting a frequency offset of %dkHz internal freq = %d invert = %d", offset_khz, internal, invert); + dprintk("setting a frequency offset of %dkHz internal freq = %d invert = %d\n", offset_khz, internal, invert); if (offset_khz < 0) unit_khz_dds_val *= -1; @@ -902,7 +909,7 @@ static int dib7000p_agc_startup(struct dvb_frontend *demod) dib7000p_restart_agc(state); - dprintk("SPLIT %p: %hd", demod, agc_split); + dprintk("SPLIT %p: %hd\n", demod, agc_split); (*agc_state)++; ret = 5; @@ -934,7 +941,7 @@ static void dib7000p_update_timf(struct dib7000p_state *state) state->timf = timf * 160 / (state->current_bandwidth / 50); dib7000p_write_word(state, 23, (u16) (timf >> 16)); dib7000p_write_word(state, 24, (u16) (timf & 0xffff)); - dprintk("updated timf_frequency: %d (default: %d)", state->timf, state->cfg.bw->timf); + dprintk("updated timf_frequency: %d (default: %d)\n", state->timf, state->cfg.bw->timf); } @@ -1202,7 +1209,7 @@ static void dib7000p_spur_protect(struct dib7000p_state *state, u32 rf_khz, u32 int bw_khz = bw; u32 pha; - dprintk("relative position of the Spur: %dk (RF: %dk, XTAL: %dk)", f_rel, rf_khz, xtal); + dprintk("relative position of the Spur: %dk (RF: %dk, XTAL: %dk)\n", f_rel, rf_khz, xtal); if (f_rel < -bw_khz / 2 || f_rel > bw_khz / 2) return; @@ -1252,7 +1259,7 @@ static void dib7000p_spur_protect(struct dib7000p_state *state, u32 rf_khz, u32 coef_im[k] = (1 << 24) - 1; coef_im[k] /= (1 << 15); - dprintk("PALF COEF: %d re: %d im: %d", k, coef_re[k], coef_im[k]); + dprintk("PALF COEF: %d re: %d im: %d\n", k, coef_re[k], coef_im[k]); dib7000p_write_word(state, 143, (0 << 14) | (k << 10) | (coef_re[k] & 0x3ff)); dib7000p_write_word(state, 144, coef_im[k] & 0x3ff); @@ -1280,7 +1287,7 @@ static int dib7000p_tune(struct dvb_frontend *demod) /* P_ctrl_inh_cor=0, P_ctrl_alpha_cor=4, P_ctrl_inh_isi=0, P_ctrl_alpha_isi=3, P_ctrl_inh_cor4=1, P_ctrl_alpha_cor4=3 */ tmp = (0 << 14) | (4 << 10) | (0 << 9) | (3 << 5) | (1 << 4) | (0x3); if (state->sfn_workaround_active) { - dprintk("SFN workaround is active"); + dprintk("SFN workaround is active\n"); tmp |= (1 << 9); dib7000p_write_word(state, 166, 0x4000); } else { @@ -1390,15 +1397,15 @@ static int dib7000p_sleep(struct dvb_frontend *demod) static int dib7000p_identify(struct dib7000p_state *st) { u16 value; - dprintk("checking demod on I2C address: %d (%x)", st->i2c_addr, st->i2c_addr); + dprintk("checking demod on I2C address: %d (%x)\n", st->i2c_addr, st->i2c_addr); if ((value = dib7000p_read_word(st, 768)) != 0x01b3) { - dprintk("wrong Vendor ID (read=0x%x)", value); + dprintk("wrong Vendor ID (read=0x%x)\n", value); return -EREMOTEIO; } if ((value = dib7000p_read_word(st, 769)) != 0x4000) { - dprintk("wrong Device ID (%x)", value); + dprintk("wrong Device ID (%x)\n", value); return -EREMOTEIO; } @@ -1536,7 +1543,7 @@ static int dib7000p_set_frontend(struct dvb_frontend *fe) found = dib7000p_autosearch_is_irq(fe); } while (found == 0 && i--); - dprintk("autosearch returns: %d", found); + dprintk("autosearch returns: %d\n", found); if (found == 0 || found == 1) return 0; @@ -1951,7 +1958,7 @@ static int dib7000p_get_stats(struct dvb_frontend *demod, enum fe_status stat) time_us = dib7000p_get_time_us(demod); state->ber_jiffies_stats = jiffies + msecs_to_jiffies((time_us + 500) / 1000); - dprintk("Next all layers stats available in %u us.", time_us); + dprintk("Next all layers stats available in %u us.\n", time_us); dib7000p_read_ber(demod, &val); c->post_bit_error.stat[0].scale = FE_SCALE_COUNTER; @@ -2019,7 +2026,7 @@ static int dib7000pc_detection(struct i2c_adapter *i2c_adap) if (i2c_transfer(i2c_adap, msg, 2) == 2) if (rx[0] == 0x01 && rx[1] == 0xb3) { - dprintk("-D- DiB7000PC detected"); + dprintk("-D- DiB7000PC detected\n"); return 1; } @@ -2027,11 +2034,11 @@ static int dib7000pc_detection(struct i2c_adapter *i2c_adap) if (i2c_transfer(i2c_adap, msg, 2) == 2) if (rx[0] == 0x01 && rx[1] == 0xb3) { - dprintk("-D- DiB7000PC detected"); + dprintk("-D- DiB7000PC detected\n"); return 1; } - dprintk("-D- DiB7000PC not detected"); + dprintk("-D- DiB7000PC not detected\n"); kfree(rx); rx_memory_error: @@ -2050,14 +2057,14 @@ static int dib7000p_pid_filter_ctrl(struct dvb_frontend *fe, u8 onoff) struct dib7000p_state *state = fe->demodulator_priv; u16 val = dib7000p_read_word(state, 235) & 0xffef; val |= (onoff & 0x1) << 4; - dprintk("PID filter enabled %d", onoff); + dprintk("PID filter enabled %d\n", onoff); return dib7000p_write_word(state, 235, val); } static int dib7000p_pid_filter(struct dvb_frontend *fe, u8 id, u16 pid, u8 onoff) { struct dib7000p_state *state = fe->demodulator_priv; - dprintk("PID filter: index %x, PID %d, OnOff %d", id, pid, onoff); + dprintk("PID filter: index %x, PID %d, OnOff %d\n", id, pid, onoff); return dib7000p_write_word(state, 241 + id, onoff ? (1 << 13) | pid : 0); } @@ -2100,7 +2107,7 @@ static int dib7000p_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u /* set new i2c address and force divstart */ dib7000p_write_word(dpst, 1285, (new_addr << 2) | 0x2); - dprintk("IC %d initialized (to i2c_address 0x%x)", k, new_addr); + dprintk("IC %d initialized (to i2c_address 0x%x)\n", k, new_addr); } for (k = 0; k < no_of_demods; k++) { @@ -2136,21 +2143,21 @@ static s32 dib7000p_get_adc_power(struct dvb_frontend *fe) buf[0] = dib7000p_read_word(state, 0x184); buf[1] = dib7000p_read_word(state, 0x185); pow_i = (buf[0] << 16) | buf[1]; - dprintk("raw pow_i = %d", pow_i); + dprintk("raw pow_i = %d\n", pow_i); tmp_val = pow_i; while (tmp_val >>= 1) exp++; mant = (pow_i * 1000 / (1 << exp)); - dprintk(" mant = %d exp = %d", mant / 1000, exp); + dprintk(" mant = %d exp = %d\n", mant / 1000, exp); ix = (u8) ((mant - 1000) / 100); /* index of the LUT */ - dprintk(" ix = %d", ix); + dprintk(" ix = %d\n", ix); pow_i = (lut_1000ln_mant[ix] + 693 * (exp - 20) - 6908); pow_i = (pow_i << 8) / 1000; - dprintk(" pow_i = %d", pow_i); + dprintk(" pow_i = %d\n", pow_i); return pow_i; } @@ -2185,7 +2192,7 @@ static int w7090p_tuner_write_serpar(struct i2c_adapter *i2c_adap, struct i2c_ms n_overflow = (dib7000p_read_word(state, 1984) >> 1) & 0x1; i--; if (i == 0) - dprintk("Tuner ITF: write busy (overflow)"); + dprintk("Tuner ITF: write busy (overflow)\n"); } dib7000p_write_word(state, 1985, (1 << 6) | (serpar_num & 0x3f)); dib7000p_write_word(state, 1986, (msg[0].buf[1] << 8) | msg[0].buf[2]); @@ -2205,7 +2212,7 @@ static int w7090p_tuner_read_serpar(struct i2c_adapter *i2c_adap, struct i2c_msg n_overflow = (dib7000p_read_word(state, 1984) >> 1) & 0x1; i--; if (i == 0) - dprintk("TunerITF: read busy (overflow)"); + dprintk("TunerITF: read busy (overflow)\n"); } dib7000p_write_word(state, 1985, (0 << 6) | (serpar_num & 0x3f)); @@ -2214,7 +2221,7 @@ static int w7090p_tuner_read_serpar(struct i2c_adapter *i2c_adap, struct i2c_msg n_empty = dib7000p_read_word(state, 1984) & 0x1; i--; if (i == 0) - dprintk("TunerITF: read busy (empty)"); + dprintk("TunerITF: read busy (empty)\n"); } read_word = dib7000p_read_word(state, 1987); msg[1].buf[0] = (read_word >> 8) & 0xff; @@ -2435,7 +2442,7 @@ static u32 dib7090_calcSyncFreq(u32 P_Kin, u32 P_Kout, u32 insertExtSynchro, u32 static int dib7090_cfg_DibTx(struct dib7000p_state *state, u32 P_Kin, u32 P_Kout, u32 insertExtSynchro, u32 synchroMode, u32 syncWord, u32 syncSize) { - dprintk("Configure DibStream Tx"); + dprintk("Configure DibStream Tx\n"); dib7000p_write_word(state, 1615, 1); dib7000p_write_word(state, 1603, P_Kin); @@ -2455,7 +2462,7 @@ static int dib7090_cfg_DibRx(struct dib7000p_state *state, u32 P_Kin, u32 P_Kout { u32 syncFreq; - dprintk("Configure DibStream Rx"); + dprintk("Configure DibStream Rx\n"); if ((P_Kin != 0) && (P_Kout != 0)) { syncFreq = dib7090_calcSyncFreq(P_Kin, P_Kout, insertExtSynchro, syncSize); dib7000p_write_word(state, 1542, syncFreq); @@ -2492,7 +2499,7 @@ static void dib7090_enMpegMux(struct dib7000p_state *state, int onoff) static void dib7090_configMpegMux(struct dib7000p_state *state, u16 pulseWidth, u16 enSerialMode, u16 enSerialClkDiv2) { - dprintk("Enable Mpeg mux"); + dprintk("Enable Mpeg mux\n"); dib7090_enMpegMux(state, 0); @@ -2513,17 +2520,17 @@ static void dib7090_setDibTxMux(struct dib7000p_state *state, int mode) switch (mode) { case MPEG_ON_DIBTX: - dprintk("SET MPEG ON DIBSTREAM TX"); + dprintk("SET MPEG ON DIBSTREAM TX\n"); dib7090_cfg_DibTx(state, 8, 5, 0, 0, 0, 0); reg_1288 |= (1<<9); break; case DIV_ON_DIBTX: - dprintk("SET DIV_OUT ON DIBSTREAM TX"); + dprintk("SET DIV_OUT ON DIBSTREAM TX\n"); dib7090_cfg_DibTx(state, 5, 5, 0, 0, 0, 0); reg_1288 |= (1<<8); break; case ADC_ON_DIBTX: - dprintk("SET ADC_OUT ON DIBSTREAM TX"); + dprintk("SET ADC_OUT ON DIBSTREAM TX\n"); dib7090_cfg_DibTx(state, 20, 5, 10, 0, 0, 0); reg_1288 |= (1<<7); break; @@ -2539,17 +2546,17 @@ static void dib7090_setHostBusMux(struct dib7000p_state *state, int mode) switch (mode) { case DEMOUT_ON_HOSTBUS: - dprintk("SET DEM OUT OLD INTERF ON HOST BUS"); + dprintk("SET DEM OUT OLD INTERF ON HOST BUS\n"); dib7090_enMpegMux(state, 0); reg_1288 |= (1<<6); break; case DIBTX_ON_HOSTBUS: - dprintk("SET DIBSTREAM TX ON HOST BUS"); + dprintk("SET DIBSTREAM TX ON HOST BUS\n"); dib7090_enMpegMux(state, 0); reg_1288 |= (1<<5); break; case MPEG_ON_HOSTBUS: - dprintk("SET MPEG MUX ON HOST BUS"); + dprintk("SET MPEG MUX ON HOST BUS\n"); reg_1288 |= (1<<4); break; default: @@ -2565,7 +2572,7 @@ static int dib7090_set_diversity_in(struct dvb_frontend *fe, int onoff) switch (onoff) { case 0: /* only use the internal way - not the diversity input */ - dprintk("%s mode OFF : by default Enable Mpeg INPUT", __func__); + dprintk("%s mode OFF : by default Enable Mpeg INPUT\n", __func__); dib7090_cfg_DibRx(state, 8, 5, 0, 0, 0, 8, 0); /* Do not divide the serial clock of MPEG MUX */ @@ -2581,7 +2588,7 @@ static int dib7090_set_diversity_in(struct dvb_frontend *fe, int onoff) break; case 1: /* both ways */ case 2: /* only the diversity input */ - dprintk("%s ON : Enable diversity INPUT", __func__); + dprintk("%s ON : Enable diversity INPUT\n", __func__); dib7090_cfg_DibRx(state, 5, 5, 0, 0, 0, 0, 0); state->input_mode_mpeg = 0; break; @@ -2612,11 +2619,11 @@ static int dib7090_set_output_mode(struct dvb_frontend *fe, int mode) case OUTMODE_MPEG2_SERIAL: if (prefer_mpeg_mux_use) { - dprintk("setting output mode TS_SERIAL using Mpeg Mux"); + dprintk("setting output mode TS_SERIAL using Mpeg Mux\n"); dib7090_configMpegMux(state, 3, 1, 1); dib7090_setHostBusMux(state, MPEG_ON_HOSTBUS); } else {/* Use Smooth block */ - dprintk("setting output mode TS_SERIAL using Smooth bloc"); + dprintk("setting output mode TS_SERIAL using Smooth bloc\n"); dib7090_setHostBusMux(state, DEMOUT_ON_HOSTBUS); outreg |= (2<<6) | (0 << 1); } @@ -2624,24 +2631,24 @@ static int dib7090_set_output_mode(struct dvb_frontend *fe, int mode) case OUTMODE_MPEG2_PAR_GATED_CLK: if (prefer_mpeg_mux_use) { - dprintk("setting output mode TS_PARALLEL_GATED using Mpeg Mux"); + dprintk("setting output mode TS_PARALLEL_GATED using Mpeg Mux\n"); dib7090_configMpegMux(state, 2, 0, 0); dib7090_setHostBusMux(state, MPEG_ON_HOSTBUS); } else { /* Use Smooth block */ - dprintk("setting output mode TS_PARALLEL_GATED using Smooth block"); + dprintk("setting output mode TS_PARALLEL_GATED using Smooth block\n"); dib7090_setHostBusMux(state, DEMOUT_ON_HOSTBUS); outreg |= (0<<6); } break; case OUTMODE_MPEG2_PAR_CONT_CLK: /* Using Smooth block only */ - dprintk("setting output mode TS_PARALLEL_CONT using Smooth block"); + dprintk("setting output mode TS_PARALLEL_CONT using Smooth block\n"); dib7090_setHostBusMux(state, DEMOUT_ON_HOSTBUS); outreg |= (1<<6); break; case OUTMODE_MPEG2_FIFO: /* Using Smooth block because not supported by new Mpeg Mux bloc */ - dprintk("setting output mode TS_FIFO using Smooth block"); + dprintk("setting output mode TS_FIFO using Smooth block\n"); dib7090_setHostBusMux(state, DEMOUT_ON_HOSTBUS); outreg |= (5<<6); smo_mode |= (3 << 1); @@ -2649,13 +2656,13 @@ static int dib7090_set_output_mode(struct dvb_frontend *fe, int mode) break; case OUTMODE_DIVERSITY: - dprintk("setting output mode MODE_DIVERSITY"); + dprintk("setting output mode MODE_DIVERSITY\n"); dib7090_setDibTxMux(state, DIV_ON_DIBTX); dib7090_setHostBusMux(state, DIBTX_ON_HOSTBUS); break; case OUTMODE_ANALOG_ADC: - dprintk("setting output mode MODE_ANALOG_ADC"); + dprintk("setting output mode MODE_ANALOG_ADC\n"); dib7090_setDibTxMux(state, ADC_ON_DIBTX); dib7090_setHostBusMux(state, DIBTX_ON_HOSTBUS); break; @@ -2678,7 +2685,7 @@ static int dib7090_tuner_sleep(struct dvb_frontend *fe, int onoff) struct dib7000p_state *state = fe->demodulator_priv; u16 en_cur_state; - dprintk("sleep dib7090: %d", onoff); + dprintk("sleep dib7090: %d\n", onoff); en_cur_state = dib7000p_read_word(state, 1922); @@ -2714,7 +2721,7 @@ static int dib7090_slave_reset(struct dvb_frontend *fe) return 0; } -static struct dvb_frontend_ops dib7000p_ops; +static const struct dvb_frontend_ops dib7000p_ops; static struct dvb_frontend *dib7000p_init(struct i2c_adapter *i2c_adap, u8 i2c_addr, struct dib7000p_config *cfg) { struct dvb_frontend *demod; @@ -2804,7 +2811,7 @@ void *dib7000p_attach(struct dib7000p_ops *ops) } EXPORT_SYMBOL(dib7000p_attach); -static struct dvb_frontend_ops dib7000p_ops = { +static const struct dvb_frontend_ops dib7000p_ops = { .delsys = { SYS_DVBT }, .info = { .name = "DiBcom 7000PC", diff --git a/drivers/media/dvb-frontends/dib8000.c b/drivers/media/dvb-frontends/dib8000.c index ddf9c44877a2..e501ec964df1 100644 --- a/drivers/media/dvb-frontends/dib8000.c +++ b/drivers/media/dvb-frontends/dib8000.c @@ -7,6 +7,9 @@ * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation, version 2. */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <linux/kernel.h> #include <linux/slab.h> #include <linux/i2c.h> @@ -31,7 +34,11 @@ static int debug; module_param(debug, int, 0644); MODULE_PARM_DESC(debug, "turn on debugging (default: 0)"); -#define dprintk(args...) do { if (debug) { printk(KERN_DEBUG "DiB8000: "); printk(args); printk("\n"); } } while (0) +#define dprintk(fmt, arg...) do { \ + if (debug) \ + printk(KERN_DEBUG pr_fmt("%s: " fmt), \ + __func__, ##arg); \ +} while (0) struct i2c_device { struct i2c_adapter *adap; @@ -147,7 +154,7 @@ static u16 dib8000_i2c_read16(struct i2c_device *i2c, u16 reg) }; if (mutex_lock_interruptible(i2c->i2c_buffer_lock) < 0) { - dprintk("could not acquire lock"); + dprintk("could not acquire lock\n"); return 0; } @@ -157,7 +164,7 @@ static u16 dib8000_i2c_read16(struct i2c_device *i2c, u16 reg) msg[1].buf = i2c->i2c_read_buffer; if (i2c_transfer(i2c->adap, msg, 2) != 2) - dprintk("i2c read error on %d", reg); + dprintk("i2c read error on %d\n", reg); ret = (msg[1].buf[0] << 8) | msg[1].buf[1]; mutex_unlock(i2c->i2c_buffer_lock); @@ -182,7 +189,7 @@ static u16 __dib8000_read_word(struct dib8000_state *state, u16 reg) state->msg[1].len = 2; if (i2c_transfer(state->i2c.adap, state->msg, 2) != 2) - dprintk("i2c read error on %d", reg); + dprintk("i2c read error on %d\n", reg); ret = (state->i2c_read_buffer[0] << 8) | state->i2c_read_buffer[1]; @@ -194,7 +201,7 @@ static u16 dib8000_read_word(struct dib8000_state *state, u16 reg) u16 ret; if (mutex_lock_interruptible(&state->i2c_buffer_lock) < 0) { - dprintk("could not acquire lock"); + dprintk("could not acquire lock\n"); return 0; } @@ -210,7 +217,7 @@ static u32 dib8000_read32(struct dib8000_state *state, u16 reg) u16 rw[2]; if (mutex_lock_interruptible(&state->i2c_buffer_lock) < 0) { - dprintk("could not acquire lock"); + dprintk("could not acquire lock\n"); return 0; } @@ -228,7 +235,7 @@ static int dib8000_i2c_write16(struct i2c_device *i2c, u16 reg, u16 val) int ret = 0; if (mutex_lock_interruptible(i2c->i2c_buffer_lock) < 0) { - dprintk("could not acquire lock"); + dprintk("could not acquire lock\n"); return -EINVAL; } @@ -249,7 +256,7 @@ static int dib8000_write_word(struct dib8000_state *state, u16 reg, u16 val) int ret; if (mutex_lock_interruptible(&state->i2c_buffer_lock) < 0) { - dprintk("could not acquire lock"); + dprintk("could not acquire lock\n"); return -EINVAL; } @@ -395,7 +402,7 @@ static void dib8000_set_acquisition_mode(struct dib8000_state *state) { u16 nud = dib8000_read_word(state, 298); nud |= (1 << 3) | (1 << 0); - dprintk("acquisition mode activated"); + dprintk("acquisition mode activated\n"); dib8000_write_word(state, 298, nud); } static int dib8000_set_output_mode(struct dvb_frontend *fe, int mode) @@ -408,7 +415,7 @@ static int dib8000_set_output_mode(struct dvb_frontend *fe, int mode) fifo_threshold = 1792; smo_mode = (dib8000_read_word(state, 299) & 0x0050) | (1 << 1); - dprintk("-I- Setting output mode for demod %p to %d", + dprintk("-I- Setting output mode for demod %p to %d\n", &state->fe[0], mode); switch (mode) { @@ -443,7 +450,7 @@ static int dib8000_set_output_mode(struct dvb_frontend *fe, int mode) break; default: - dprintk("Unhandled output_mode passed to be set for demod %p", + dprintk("Unhandled output_mode passed to be set for demod %p\n", &state->fe[0]); return -EINVAL; } @@ -464,7 +471,7 @@ static int dib8000_set_diversity_in(struct dvb_frontend *fe, int onoff) struct dib8000_state *state = fe->demodulator_priv; u16 tmp, sync_wait = dib8000_read_word(state, 273) & 0xfff0; - dprintk("set diversity input to %i", onoff); + dprintk("set diversity input to %i\n", onoff); if (!state->differential_constellation) { dib8000_write_word(state, 272, 1 << 9); //dvsy_off_lmod4 = 1 dib8000_write_word(state, 273, sync_wait | (1 << 2) | 2); // sync_enable = 1; comb_mode = 2 @@ -531,7 +538,7 @@ static void dib8000_set_power_mode(struct dib8000_state *state, enum dib8000_pow break; } - dprintk("powermode : 774 : %x ; 775 : %x; 776 : %x ; 900 : %x; 1280 : %x", reg_774, reg_775, reg_776, reg_900, reg_1280); + dprintk("powermode : 774 : %x ; 775 : %x; 776 : %x ; 900 : %x; 1280 : %x\n", reg_774, reg_775, reg_776, reg_900, reg_1280); dib8000_write_word(state, 774, reg_774); dib8000_write_word(state, 775, reg_775); dib8000_write_word(state, 776, reg_776); @@ -619,10 +626,10 @@ static int dib8000_set_bandwidth(struct dvb_frontend *fe, u32 bw) bw = 6000; if (state->timf == 0) { - dprintk("using default timf"); + dprintk("using default timf\n"); timf = state->timf_default; } else { - dprintk("using updated timf"); + dprintk("using updated timf\n"); timf = state->timf; } @@ -667,7 +674,7 @@ static int dib8000_set_wbd_ref(struct dvb_frontend *fe, u16 value) static void dib8000_reset_pll_common(struct dib8000_state *state, const struct dibx000_bandwidth_config *bw) { - dprintk("ifreq: %d %x, inversion: %d", bw->ifreq, bw->ifreq, bw->ifreq >> 25); + dprintk("ifreq: %d %x, inversion: %d\n", bw->ifreq, bw->ifreq, bw->ifreq >> 25); if (state->revision != 0x8090) { dib8000_write_word(state, 23, (u16) (((bw->internal * 1000) >> 16) & 0xffff)); @@ -704,7 +711,7 @@ static void dib8000_reset_pll(struct dib8000_state *state) clk_cfg1 = (clk_cfg1 & 0xfff7) | (pll->pll_bypass << 3); dib8000_write_word(state, 902, clk_cfg1); - dprintk("clk_cfg1: 0x%04x", clk_cfg1); + dprintk("clk_cfg1: 0x%04x\n", clk_cfg1); /* smpl_cfg: P_refclksel=2, P_ensmplsel=1 nodivsmpl=1 */ if (state->cfg.pll->ADClkSrc == 0) @@ -754,7 +761,7 @@ static int dib8000_update_pll(struct dvb_frontend *fe, pll->pll_ratio == loopdiv)) return -EINVAL; - dprintk("Updating pll (prediv: old = %d new = %d ; loopdiv : old = %d new = %d)", prediv, pll->pll_prediv, loopdiv, pll->pll_ratio); + dprintk("Updating pll (prediv: old = %d new = %d ; loopdiv : old = %d new = %d)\n", prediv, pll->pll_prediv, loopdiv, pll->pll_ratio); if (state->revision == 0x8090) { reg_1856 &= 0xf000; reg_1857 = dib8000_read_word(state, 1857); @@ -767,11 +774,11 @@ static int dib8000_update_pll(struct dvb_frontend *fe, /* write new system clk into P_sec_len */ internal = dib8000_read32(state, 23) / 1000; - dprintk("Old Internal = %d", internal); + dprintk("Old Internal = %d\n", internal); xtal = 2 * (internal / loopdiv) * prediv; internal = 1000 * (xtal/pll->pll_prediv) * pll->pll_ratio; - dprintk("Xtal = %d , New Fmem = %d New Fdemod = %d, New Fsampling = %d", xtal, internal/1000, internal/2000, internal/8000); - dprintk("New Internal = %d", internal); + dprintk("Xtal = %d , New Fmem = %d New Fdemod = %d, New Fsampling = %d\n", xtal, internal/1000, internal/2000, internal/8000); + dprintk("New Internal = %d\n", internal); dib8000_write_word(state, 23, (u16) (((internal / 2) >> 16) & 0xffff)); @@ -780,22 +787,22 @@ static int dib8000_update_pll(struct dvb_frontend *fe, dib8000_write_word(state, 1857, reg_1857 | (1 << 15)); while (((dib8000_read_word(state, 1856)>>15)&0x1) != 1) - dprintk("Waiting for PLL to lock"); + dprintk("Waiting for PLL to lock\n"); /* verify */ reg_1856 = dib8000_read_word(state, 1856); - dprintk("PLL Updated with prediv = %d and loopdiv = %d", + dprintk("PLL Updated with prediv = %d and loopdiv = %d\n", reg_1856&0x3f, (reg_1856>>6)&0x3f); } else { if (bw != state->current_demod_bw) { /** Bandwidth change => force PLL update **/ - dprintk("PLL: Bandwidth Change %d MHz -> %d MHz (prediv: %d->%d)", state->current_demod_bw / 1000, bw / 1000, oldprediv, state->cfg.pll->pll_prediv); + dprintk("PLL: Bandwidth Change %d MHz -> %d MHz (prediv: %d->%d)\n", state->current_demod_bw / 1000, bw / 1000, oldprediv, state->cfg.pll->pll_prediv); if (state->cfg.pll->pll_prediv != oldprediv) { /** Full PLL change only if prediv is changed **/ /** full update => bypass and reconfigure **/ - dprintk("PLL: New Setting for %d MHz Bandwidth (prediv: %d, ratio: %d)", bw/1000, state->cfg.pll->pll_prediv, state->cfg.pll->pll_ratio); + dprintk("PLL: New Setting for %d MHz Bandwidth (prediv: %d, ratio: %d)\n", bw/1000, state->cfg.pll->pll_prediv, state->cfg.pll->pll_ratio); dib8000_write_word(state, 902, dib8000_read_word(state, 902) | (1<<3)); /* bypass PLL */ dib8000_reset_pll(state); dib8000_write_word(state, 898, 0x0004); /* sad */ @@ -807,7 +814,7 @@ static int dib8000_update_pll(struct dvb_frontend *fe, if (ratio != 0) { /** ratio update => only change ratio **/ - dprintk("PLL: Update ratio (prediv: %d, ratio: %d)", state->cfg.pll->pll_prediv, ratio); + dprintk("PLL: Update ratio (prediv: %d, ratio: %d)\n", state->cfg.pll->pll_prediv, ratio); dib8000_write_word(state, 901, (state->cfg.pll->pll_prediv << 8) | (ratio << 0)); /* only the PLL ratio is updated. */ } } @@ -841,7 +848,7 @@ static int dib8000_cfg_gpio(struct dib8000_state *st, u8 num, u8 dir, u8 val) st->cfg.gpio_val |= (val & 0x01) << num; /* set the new value */ dib8000_write_word(st, 1030, st->cfg.gpio_val); - dprintk("gpio dir: %x: gpio val: %x", st->cfg.gpio_dir, st->cfg.gpio_val); + dprintk("gpio dir: %x: gpio val: %x\n", st->cfg.gpio_dir, st->cfg.gpio_val); return 0; } @@ -958,29 +965,29 @@ static u16 dib8000_identify(struct i2c_device *client) value = dib8000_i2c_read16(client, 896); if ((value = dib8000_i2c_read16(client, 896)) != 0x01b3) { - dprintk("wrong Vendor ID (read=0x%x)", value); + dprintk("wrong Vendor ID (read=0x%x)\n", value); return 0; } value = dib8000_i2c_read16(client, 897); if (value != 0x8000 && value != 0x8001 && value != 0x8002 && value != 0x8090) { - dprintk("wrong Device ID (%x)", value); + dprintk("wrong Device ID (%x)\n", value); return 0; } switch (value) { case 0x8000: - dprintk("found DiB8000A"); + dprintk("found DiB8000A\n"); break; case 0x8001: - dprintk("found DiB8000B"); + dprintk("found DiB8000B\n"); break; case 0x8002: - dprintk("found DiB8000C"); + dprintk("found DiB8000C\n"); break; case 0x8090: - dprintk("found DiB8096P"); + dprintk("found DiB8096P\n"); break; } return value; @@ -1037,7 +1044,7 @@ static int dib8000_reset(struct dvb_frontend *fe) dib8000_write_word(state, 1287, 0x0003); if (state->revision == 0x8000) - dprintk("error : dib8000 MA not supported"); + dprintk("error : dib8000 MA not supported\n"); dibx000_reset_i2c_master(&state->i2c_master); @@ -1069,7 +1076,7 @@ static int dib8000_reset(struct dvb_frontend *fe) if (state->cfg.drives) dib8000_write_word(state, 906, state->cfg.drives); else { - dprintk("using standard PAD-drive-settings, please adjust settings in config-struct to be optimal."); + dprintk("using standard PAD-drive-settings, please adjust settings in config-struct to be optimal.\n"); /* min drive SDRAM - not optimal - adjust */ dib8000_write_word(state, 906, 0x2d98); } @@ -1080,11 +1087,11 @@ static int dib8000_reset(struct dvb_frontend *fe) dib8000_write_word(state, 898, 0x0004); if (dib8000_reset_gpio(state) != 0) - dprintk("GPIO reset was not successful."); + dprintk("GPIO reset was not successful.\n"); if ((state->revision != 0x8090) && (dib8000_set_output_mode(fe, OUTMODE_HIGH_Z) != 0)) - dprintk("OUTPUT_MODE could not be resetted."); + dprintk("OUTPUT_MODE could not be resetted.\n"); state->current_agc = NULL; @@ -1176,7 +1183,7 @@ static int dib8000_set_agc_config(struct dib8000_state *state, u8 band) } if (agc == NULL) { - dprintk("no valid AGC configuration found for band 0x%02x", band); + dprintk("no valid AGC configuration found for band 0x%02x\n", band); return -EINVAL; } @@ -1192,7 +1199,7 @@ static int dib8000_set_agc_config(struct dib8000_state *state, u8 band) dib8000_write_word(state, 102, (agc->alpha_mant << 5) | agc->alpha_exp); dib8000_write_word(state, 103, (agc->beta_mant << 6) | agc->beta_exp); - dprintk("WBD: ref: %d, sel: %d, active: %d, alpha: %d", + dprintk("WBD: ref: %d, sel: %d, active: %d, alpha: %d\n", state->wbd_ref != 0 ? state->wbd_ref : agc->wbd_ref, agc->wbd_sel, !agc->perform_agc_softsplit, agc->wbd_sel); /* AGC continued */ @@ -1251,7 +1258,7 @@ static int dib8000_agc_soft_split(struct dib8000_state *state) (agc - state->current_agc->split.min_thres) / (state->current_agc->split.max_thres - state->current_agc->split.min_thres); - dprintk("AGC split_offset: %d", split_offset); + dprintk("AGC split_offset: %d\n", split_offset); // P_agc_force_split and P_agc_split_offset dib8000_write_word(state, 107, (dib8000_read_word(state, 107) & 0xff00) | split_offset); @@ -1395,7 +1402,7 @@ static void dib8096p_cfg_DibTx(struct dib8000_state *state, u32 P_Kin, u32 P_Kout, u32 insertExtSynchro, u32 synchroMode, u32 syncWord, u32 syncSize) { - dprintk("Configure DibStream Tx"); + dprintk("Configure DibStream Tx\n"); dib8000_write_word(state, 1615, 1); dib8000_write_word(state, 1603, P_Kin); @@ -1414,7 +1421,7 @@ static void dib8096p_cfg_DibRx(struct dib8000_state *state, u32 P_Kin, { u32 syncFreq; - dprintk("Configure DibStream Rx synchroMode = %d", synchroMode); + dprintk("Configure DibStream Rx synchroMode = %d\n", synchroMode); if ((P_Kin != 0) && (P_Kout != 0)) { syncFreq = dib8096p_calcSyncFreq(P_Kin, P_Kout, @@ -1456,7 +1463,7 @@ static void dib8096p_configMpegMux(struct dib8000_state *state, { u16 reg_1287; - dprintk("Enable Mpeg mux"); + dprintk("Enable Mpeg mux\n"); dib8096p_enMpegMux(state, 0); @@ -1477,15 +1484,15 @@ static void dib8096p_setDibTxMux(struct dib8000_state *state, int mode) switch (mode) { case MPEG_ON_DIBTX: - dprintk("SET MPEG ON DIBSTREAM TX"); + dprintk("SET MPEG ON DIBSTREAM TX\n"); dib8096p_cfg_DibTx(state, 8, 5, 0, 0, 0, 0); reg_1288 |= (1 << 9); break; case DIV_ON_DIBTX: - dprintk("SET DIV_OUT ON DIBSTREAM TX"); + dprintk("SET DIV_OUT ON DIBSTREAM TX\n"); dib8096p_cfg_DibTx(state, 5, 5, 0, 0, 0, 0); reg_1288 |= (1 << 8); break; case ADC_ON_DIBTX: - dprintk("SET ADC_OUT ON DIBSTREAM TX"); + dprintk("SET ADC_OUT ON DIBSTREAM TX\n"); dib8096p_cfg_DibTx(state, 20, 5, 10, 0, 0, 0); reg_1288 |= (1 << 7); break; default: @@ -1500,17 +1507,17 @@ static void dib8096p_setHostBusMux(struct dib8000_state *state, int mode) switch (mode) { case DEMOUT_ON_HOSTBUS: - dprintk("SET DEM OUT OLD INTERF ON HOST BUS"); + dprintk("SET DEM OUT OLD INTERF ON HOST BUS\n"); dib8096p_enMpegMux(state, 0); reg_1288 |= (1 << 6); break; case DIBTX_ON_HOSTBUS: - dprintk("SET DIBSTREAM TX ON HOST BUS"); + dprintk("SET DIBSTREAM TX ON HOST BUS\n"); dib8096p_enMpegMux(state, 0); reg_1288 |= (1 << 5); break; case MPEG_ON_HOSTBUS: - dprintk("SET MPEG MUX ON HOST BUS"); + dprintk("SET MPEG MUX ON HOST BUS\n"); reg_1288 |= (1 << 4); break; default: @@ -1526,7 +1533,7 @@ static int dib8096p_set_diversity_in(struct dvb_frontend *fe, int onoff) switch (onoff) { case 0: /* only use the internal way - not the diversity input */ - dprintk("%s mode OFF : by default Enable Mpeg INPUT", + dprintk("%s mode OFF : by default Enable Mpeg INPUT\n", __func__); /* outputRate = 8 */ dib8096p_cfg_DibRx(state, 8, 5, 0, 0, 0, 8, 0); @@ -1544,7 +1551,7 @@ static int dib8096p_set_diversity_in(struct dvb_frontend *fe, int onoff) break; case 1: /* both ways */ case 2: /* only the diversity input */ - dprintk("%s ON : Enable diversity INPUT", __func__); + dprintk("%s ON : Enable diversity INPUT\n", __func__); dib8096p_cfg_DibRx(state, 5, 5, 0, 0, 0, 0, 0); state->input_mode_mpeg = 0; break; @@ -1576,11 +1583,11 @@ static int dib8096p_set_output_mode(struct dvb_frontend *fe, int mode) case OUTMODE_MPEG2_SERIAL: if (prefer_mpeg_mux_use) { - dprintk("dib8096P setting output mode TS_SERIAL using Mpeg Mux"); + dprintk("dib8096P setting output mode TS_SERIAL using Mpeg Mux\n"); dib8096p_configMpegMux(state, 3, 1, 1); dib8096p_setHostBusMux(state, MPEG_ON_HOSTBUS); } else {/* Use Smooth block */ - dprintk("dib8096P setting output mode TS_SERIAL using Smooth bloc"); + dprintk("dib8096P setting output mode TS_SERIAL using Smooth bloc\n"); dib8096p_setHostBusMux(state, DEMOUT_ON_HOSTBUS); outreg |= (2 << 6) | (0 << 1); @@ -1589,11 +1596,11 @@ static int dib8096p_set_output_mode(struct dvb_frontend *fe, int mode) case OUTMODE_MPEG2_PAR_GATED_CLK: if (prefer_mpeg_mux_use) { - dprintk("dib8096P setting output mode TS_PARALLEL_GATED using Mpeg Mux"); + dprintk("dib8096P setting output mode TS_PARALLEL_GATED using Mpeg Mux\n"); dib8096p_configMpegMux(state, 2, 0, 0); dib8096p_setHostBusMux(state, MPEG_ON_HOSTBUS); } else { /* Use Smooth block */ - dprintk("dib8096P setting output mode TS_PARALLEL_GATED using Smooth block"); + dprintk("dib8096P setting output mode TS_PARALLEL_GATED using Smooth block\n"); dib8096p_setHostBusMux(state, DEMOUT_ON_HOSTBUS); outreg |= (0 << 6); @@ -1601,7 +1608,7 @@ static int dib8096p_set_output_mode(struct dvb_frontend *fe, int mode) break; case OUTMODE_MPEG2_PAR_CONT_CLK: /* Using Smooth block only */ - dprintk("dib8096P setting output mode TS_PARALLEL_CONT using Smooth block"); + dprintk("dib8096P setting output mode TS_PARALLEL_CONT using Smooth block\n"); dib8096p_setHostBusMux(state, DEMOUT_ON_HOSTBUS); outreg |= (1 << 6); break; @@ -1609,7 +1616,7 @@ static int dib8096p_set_output_mode(struct dvb_frontend *fe, int mode) case OUTMODE_MPEG2_FIFO: /* Using Smooth block because not supported by new Mpeg Mux bloc */ - dprintk("dib8096P setting output mode TS_FIFO using Smooth block"); + dprintk("dib8096P setting output mode TS_FIFO using Smooth block\n"); dib8096p_setHostBusMux(state, DEMOUT_ON_HOSTBUS); outreg |= (5 << 6); smo_mode |= (3 << 1); @@ -1617,13 +1624,13 @@ static int dib8096p_set_output_mode(struct dvb_frontend *fe, int mode) break; case OUTMODE_DIVERSITY: - dprintk("dib8096P setting output mode MODE_DIVERSITY"); + dprintk("dib8096P setting output mode MODE_DIVERSITY\n"); dib8096p_setDibTxMux(state, DIV_ON_DIBTX); dib8096p_setHostBusMux(state, DIBTX_ON_HOSTBUS); break; case OUTMODE_ANALOG_ADC: - dprintk("dib8096P setting output mode MODE_ANALOG_ADC"); + dprintk("dib8096P setting output mode MODE_ANALOG_ADC\n"); dib8096p_setDibTxMux(state, ADC_ON_DIBTX); dib8096p_setHostBusMux(state, DIBTX_ON_HOSTBUS); break; @@ -1632,7 +1639,7 @@ static int dib8096p_set_output_mode(struct dvb_frontend *fe, int mode) if (mode != OUTMODE_HIGH_Z) outreg |= (1<<10); - dprintk("output_mpeg2_in_188_bytes = %d", + dprintk("output_mpeg2_in_188_bytes = %d\n", state->cfg.output_mpeg2_in_188_bytes); if (state->cfg.output_mpeg2_in_188_bytes) smo_mode |= (1 << 5); @@ -1678,7 +1685,7 @@ static int dib8096p_tuner_write_serpar(struct i2c_adapter *i2c_adap, n_overflow = (dib8000_read_word(state, 1984) >> 1) & 0x1; i--; if (i == 0) - dprintk("Tuner ITF: write busy (overflow)"); + dprintk("Tuner ITF: write busy (overflow)\n"); } dib8000_write_word(state, 1985, (1 << 6) | (serpar_num & 0x3f)); dib8000_write_word(state, 1986, (msg[0].buf[1] << 8) | msg[0].buf[2]); @@ -1699,7 +1706,7 @@ static int dib8096p_tuner_read_serpar(struct i2c_adapter *i2c_adap, n_overflow = (dib8000_read_word(state, 1984) >> 1) & 0x1; i--; if (i == 0) - dprintk("TunerITF: read busy (overflow)"); + dprintk("TunerITF: read busy (overflow)\n"); } dib8000_write_word(state, 1985, (0<<6) | (serpar_num&0x3f)); @@ -1708,7 +1715,7 @@ static int dib8096p_tuner_read_serpar(struct i2c_adapter *i2c_adap, n_empty = dib8000_read_word(state, 1984)&0x1; i--; if (i == 0) - dprintk("TunerITF: read busy (empty)"); + dprintk("TunerITF: read busy (empty)\n"); } read_word = dib8000_read_word(state, 1987); @@ -1889,7 +1896,7 @@ static int dib8096p_tuner_sleep(struct dvb_frontend *fe, int onoff) struct dib8000_state *state = fe->demodulator_priv; u16 en_cur_state; - dprintk("sleep dib8096p: %d", onoff); + dprintk("sleep dib8096p: %d\n", onoff); en_cur_state = dib8000_read_word(state, 1922); @@ -1958,7 +1965,7 @@ static void dib8000_update_timf(struct dib8000_state *state) dib8000_write_word(state, 29, (u16) (timf >> 16)); dib8000_write_word(state, 30, (u16) (timf & 0xffff)); - dprintk("Updated timing frequency: %d (default: %d)", state->timf, state->timf_default); + dprintk("Updated timing frequency: %d (default: %d)\n", state->timf, state->timf_default); } static u32 dib8000_ctrl_timf(struct dvb_frontend *fe, uint8_t op, uint32_t timf) @@ -2118,7 +2125,7 @@ static u16 dib8000_get_init_prbs(struct dib8000_state *state, u16 subchannel) int sub_channel_prbs_group = 0; sub_channel_prbs_group = (subchannel / 3) + 1; - dprintk("sub_channel_prbs_group = %d , subchannel =%d prbs = 0x%04x", sub_channel_prbs_group, subchannel, lut_prbs_8k[sub_channel_prbs_group]); + dprintk("sub_channel_prbs_group = %d , subchannel =%d prbs = 0x%04x\n", sub_channel_prbs_group, subchannel, lut_prbs_8k[sub_channel_prbs_group]); switch (state->fe[0]->dtv_property_cache.transmission_mode) { case TRANSMISSION_MODE_2K: @@ -2604,7 +2611,7 @@ static int dib8000_autosearch_start(struct dvb_frontend *fe) slist = 0; } } - dprintk("Using list for autosearch : %d", slist); + dprintk("Using list for autosearch : %d\n", slist); dib8000_set_isdbt_common_channel(state, slist, 1); @@ -2638,17 +2645,17 @@ static int dib8000_autosearch_irq(struct dvb_frontend *fe) if ((state->revision >= 0x8002) && (state->autosearch_state == AS_SEARCHING_FFT)) { if (irq_pending & 0x1) { - dprintk("dib8000_autosearch_irq: max correlation result available"); + dprintk("dib8000_autosearch_irq: max correlation result available\n"); return 3; } } else { if (irq_pending & 0x1) { /* failed */ - dprintk("dib8000_autosearch_irq failed"); + dprintk("dib8000_autosearch_irq failed\n"); return 1; } if (irq_pending & 0x2) { /* succeeded */ - dprintk("dib8000_autosearch_irq succeeded"); + dprintk("dib8000_autosearch_irq succeeded\n"); return 2; } } @@ -2699,7 +2706,7 @@ static void dib8000_set_dds(struct dib8000_state *state, s32 offset_khz) dds += abs_offset_khz * unit_khz_dds_val; } - dprintk("setting a DDS frequency offset of %c%dkHz", invert ? '-' : ' ', dds / unit_khz_dds_val); + dprintk("setting a DDS frequency offset of %c%dkHz\n", invert ? '-' : ' ', dds / unit_khz_dds_val); if (abs_offset_khz <= (state->cfg.pll->internal / ratio)) { /* Max dds offset is the half of the demod freq */ @@ -2738,7 +2745,7 @@ static void dib8000_set_frequency_offset(struct dib8000_state *state) } } - dprintk("%dkhz tuner offset (frequency = %dHz & current_rf = %dHz) total_dds_offset_hz = %d", c->frequency - current_rf, c->frequency, current_rf, total_dds_offset_khz); + dprintk("%dkhz tuner offset (frequency = %dHz & current_rf = %dHz) total_dds_offset_hz = %d\n", c->frequency - current_rf, c->frequency, current_rf, total_dds_offset_khz); /* apply dds offset now */ dib8000_set_dds(state, total_dds_offset_khz); @@ -2890,7 +2897,7 @@ static u16 dib8000_read_lock(struct dvb_frontend *fe) static int dib8090p_init_sdram(struct dib8000_state *state) { u16 reg = 0; - dprintk("init sdram"); + dprintk("init sdram\n"); reg = dib8000_read_word(state, 274) & 0xfff0; dib8000_write_word(state, 274, reg | 0x7); /* P_dintlv_delay_ram = 7 because of MobileSdram */ @@ -2931,7 +2938,7 @@ static int is_manual_mode(struct dtv_frontend_properties *c) * Transmission mode is only detected on auto mode, currently */ if (c->transmission_mode == TRANSMISSION_MODE_AUTO) { - dprintk("transmission mode auto"); + dprintk("transmission mode auto\n"); return 0; } @@ -2939,7 +2946,7 @@ static int is_manual_mode(struct dtv_frontend_properties *c) * Guard interval is only detected on auto mode, currently */ if (c->guard_interval == GUARD_INTERVAL_AUTO) { - dprintk("guard interval auto"); + dprintk("guard interval auto\n"); return 0; } @@ -2948,7 +2955,7 @@ static int is_manual_mode(struct dtv_frontend_properties *c) * layer should be enabled */ if (!c->isdbt_layer_enabled) { - dprintk("no layer modulation specified"); + dprintk("no layer modulation specified\n"); return 0; } @@ -2970,7 +2977,7 @@ static int is_manual_mode(struct dtv_frontend_properties *c) if ((c->layer[i].modulation == QAM_AUTO) || (c->layer[i].fec == FEC_AUTO)) { - dprintk("layer %c has either modulation or FEC auto", + dprintk("layer %c has either modulation or FEC auto\n", 'A' + i); return 0; } @@ -2981,7 +2988,7 @@ static int is_manual_mode(struct dtv_frontend_properties *c) * fallback to auto mode. */ if (n_segs == 0 || n_segs > 13) { - dprintk("number of segments is invalid"); + dprintk("number of segments is invalid\n"); return 0; } @@ -3009,7 +3016,7 @@ static int dib8000_tune(struct dvb_frontend *fe) #if 0 if (*tune_state < CT_DEMOD_STOP) - dprintk("IN: context status = %d, TUNE_STATE %d autosearch step = %u jiffies = %lu", + dprintk("IN: context status = %d, TUNE_STATE %d autosearch step = %u jiffies = %lu\n", state->channel_parameters_set, *tune_state, state->autosearch_state, now); #endif @@ -3022,7 +3029,7 @@ static int dib8000_tune(struct dvb_frontend *fe) state->status = FE_STATUS_TUNE_PENDING; state->channel_parameters_set = is_manual_mode(c); - dprintk("Tuning channel on %s search mode", + dprintk("Tuning channel on %s search mode\n", state->channel_parameters_set ? "manual" : "auto"); dib8000_viterbi_state(state, 0); /* force chan dec in restart */ @@ -3102,7 +3109,7 @@ static int dib8000_tune(struct dvb_frontend *fe) corm[1] = (dib8000_read_word(state, 596) << 16) | (dib8000_read_word(state, 597)); corm[0] = (dib8000_read_word(state, 598) << 16) | (dib8000_read_word(state, 599)); } - /* dprintk("corm fft: %u %u %u", corm[0], corm[1], corm[2]); */ + /* dprintk("corm fft: %u %u %u\n", corm[0], corm[1], corm[2]); */ max_value = 0; for (find_index = 1 ; find_index < 3 ; find_index++) { @@ -3122,7 +3129,7 @@ static int dib8000_tune(struct dvb_frontend *fe) state->found_nfft = TRANSMISSION_MODE_8K; break; } - /* dprintk("Autosearch FFT has found Mode %d", max_value + 1); */ + /* dprintk("Autosearch FFT has found Mode %d\n", max_value + 1); */ *tune_state = CT_DEMOD_SEARCH_NEXT; state->autosearch_state = AS_SEARCHING_GUARD; @@ -3137,7 +3144,7 @@ static int dib8000_tune(struct dvb_frontend *fe) state->found_guard = dib8000_read_word(state, 572) & 0x3; else state->found_guard = dib8000_read_word(state, 570) & 0x3; - /* dprintk("guard interval found=%i", state->found_guard); */ + /* dprintk("guard interval found=%i\n", state->found_guard); */ *tune_state = CT_DEMOD_STEP_3; break; @@ -3233,7 +3240,7 @@ static int dib8000_tune(struct dvb_frontend *fe) /* defines timeout for mpeg lock depending on interleaver length of longest layer */ for (i = 0; i < 3; i++) { if (c->layer[i].interleaving >= deeper_interleaver) { - dprintk("layer%i: time interleaver = %d ", i, c->layer[i].interleaving); + dprintk("layer%i: time interleaver = %d\n", i, c->layer[i].interleaving); if (c->layer[i].segment_count > 0) { /* valid layer */ deeper_interleaver = c->layer[0].interleaving; state->longest_intlv_layer = i; @@ -3252,7 +3259,7 @@ static int dib8000_tune(struct dvb_frontend *fe) locks *= 2; *timeout = now + msecs_to_jiffies(200 * locks); /* give the mpeg lock 800ms if sram is present */ - dprintk("Deeper interleaver mode = %d on layer %d : timeout mult factor = %d => will use timeout = %ld", + dprintk("Deeper interleaver mode = %d on layer %d : timeout mult factor = %d => will use timeout = %ld\n", deeper_interleaver, state->longest_intlv_layer, locks, *timeout); *tune_state = CT_DEMOD_STEP_10; @@ -3263,7 +3270,7 @@ static int dib8000_tune(struct dvb_frontend *fe) case CT_DEMOD_STEP_10: /* 40 */ locks = dib8000_read_lock(fe); if (locks&(1<<(7-state->longest_intlv_layer))) { /* mpeg lock : check the longest one */ - dprintk("ISDB-T layer locks: Layer A %s, Layer B %s, Layer C %s", + dprintk("ISDB-T layer locks: Layer A %s, Layer B %s, Layer C %s\n", c->layer[0].segment_count ? (locks >> 7) & 0x1 ? "locked" : "NOT LOCKED" : "not enabled", c->layer[1].segment_count ? (locks >> 6) & 0x1 ? "locked" : "NOT LOCKED" : "not enabled", c->layer[2].segment_count ? (locks >> 5) & 0x1 ? "locked" : "NOT LOCKED" : "not enabled"); @@ -3283,7 +3290,7 @@ static int dib8000_tune(struct dvb_frontend *fe) *tune_state = CT_DEMOD_STEP_11; } else { /* we are done mpeg of the longest interleaver xas not locking but let's try if an other layer has locked in the same time */ if (locks & (0x7 << 5)) { - dprintk("Not all ISDB-T layers locked in %d ms: Layer A %s, Layer B %s, Layer C %s", + dprintk("Not all ISDB-T layers locked in %d ms: Layer A %s, Layer B %s, Layer C %s\n", jiffies_to_msecs(now - *timeout), c->layer[0].segment_count ? (locks >> 7) & 0x1 ? "locked" : "NOT LOCKED" : "not enabled", c->layer[1].segment_count ? (locks >> 6) & 0x1 ? "locked" : "NOT LOCKED" : "not enabled", @@ -3348,7 +3355,7 @@ static int dib8000_wakeup(struct dvb_frontend *fe) dib8000_set_power_mode(state, DIB8000_POWER_ALL); dib8000_set_adc_state(state, DIBX000_ADC_ON); if (dib8000_set_adc_state(state, DIBX000_SLOW_ADC_ON) != 0) - dprintk("could not start Slow ADC"); + dprintk("could not start Slow ADC\n"); if (state->revision == 0x8090) dib8000_sad_calib(state); @@ -3401,11 +3408,11 @@ static int dib8000_get_frontend(struct dvb_frontend *fe, if (!(stat & FE_HAS_SYNC)) return 0; - dprintk("dib8000_get_frontend: TMCC lock"); + dprintk("dib8000_get_frontend: TMCC lock\n"); for (index_frontend = 1; (index_frontend < MAX_NUMBER_OF_FRONTENDS) && (state->fe[index_frontend] != NULL); index_frontend++) { state->fe[index_frontend]->ops.read_status(state->fe[index_frontend], &stat); if (stat&FE_HAS_SYNC) { - dprintk("TMCC lock on the slave%i", index_frontend); + dprintk("TMCC lock on the slave%i\n", index_frontend); /* synchronize the cache with the other frontends */ state->fe[index_frontend]->ops.get_frontend(state->fe[index_frontend], c); for (sub_index_frontend = 0; (sub_index_frontend < MAX_NUMBER_OF_FRONTENDS) && (state->fe[sub_index_frontend] != NULL); sub_index_frontend++) { @@ -3437,41 +3444,41 @@ static int dib8000_get_frontend(struct dvb_frontend *fe, switch ((val & 0x30) >> 4) { case 1: c->transmission_mode = TRANSMISSION_MODE_2K; - dprintk("dib8000_get_frontend: transmission mode 2K"); + dprintk("dib8000_get_frontend: transmission mode 2K\n"); break; case 2: c->transmission_mode = TRANSMISSION_MODE_4K; - dprintk("dib8000_get_frontend: transmission mode 4K"); + dprintk("dib8000_get_frontend: transmission mode 4K\n"); break; case 3: default: c->transmission_mode = TRANSMISSION_MODE_8K; - dprintk("dib8000_get_frontend: transmission mode 8K"); + dprintk("dib8000_get_frontend: transmission mode 8K\n"); break; } switch (val & 0x3) { case 0: c->guard_interval = GUARD_INTERVAL_1_32; - dprintk("dib8000_get_frontend: Guard Interval = 1/32 "); + dprintk("dib8000_get_frontend: Guard Interval = 1/32\n"); break; case 1: c->guard_interval = GUARD_INTERVAL_1_16; - dprintk("dib8000_get_frontend: Guard Interval = 1/16 "); + dprintk("dib8000_get_frontend: Guard Interval = 1/16\n"); break; case 2: - dprintk("dib8000_get_frontend: Guard Interval = 1/8 "); + dprintk("dib8000_get_frontend: Guard Interval = 1/8\n"); c->guard_interval = GUARD_INTERVAL_1_8; break; case 3: - dprintk("dib8000_get_frontend: Guard Interval = 1/4 "); + dprintk("dib8000_get_frontend: Guard Interval = 1/4\n"); c->guard_interval = GUARD_INTERVAL_1_4; break; } val = dib8000_read_word(state, 505); c->isdbt_partial_reception = val & 1; - dprintk("dib8000_get_frontend: partial_reception = %d ", c->isdbt_partial_reception); + dprintk("dib8000_get_frontend: partial_reception = %d\n", c->isdbt_partial_reception); for (i = 0; i < 3; i++) { int show; @@ -3485,7 +3492,7 @@ static int dib8000_get_frontend(struct dvb_frontend *fe, show = 1; if (show) - dprintk("dib8000_get_frontend: Layer %d segments = %d ", + dprintk("dib8000_get_frontend: Layer %d segments = %d\n", i, c->layer[i].segment_count); val = dib8000_read_word(state, 499 + i) & 0x3; @@ -3494,7 +3501,7 @@ static int dib8000_get_frontend(struct dvb_frontend *fe, val = 4; c->layer[i].interleaving = val; if (show) - dprintk("dib8000_get_frontend: Layer %d time_intlv = %d ", + dprintk("dib8000_get_frontend: Layer %d time_intlv = %d\n", i, c->layer[i].interleaving); val = dib8000_read_word(state, 481 + i); @@ -3502,27 +3509,27 @@ static int dib8000_get_frontend(struct dvb_frontend *fe, case 1: c->layer[i].fec = FEC_1_2; if (show) - dprintk("dib8000_get_frontend: Layer %d Code Rate = 1/2 ", i); + dprintk("dib8000_get_frontend: Layer %d Code Rate = 1/2\n", i); break; case 2: c->layer[i].fec = FEC_2_3; if (show) - dprintk("dib8000_get_frontend: Layer %d Code Rate = 2/3 ", i); + dprintk("dib8000_get_frontend: Layer %d Code Rate = 2/3\n", i); break; case 3: c->layer[i].fec = FEC_3_4; if (show) - dprintk("dib8000_get_frontend: Layer %d Code Rate = 3/4 ", i); + dprintk("dib8000_get_frontend: Layer %d Code Rate = 3/4\n", i); break; case 5: c->layer[i].fec = FEC_5_6; if (show) - dprintk("dib8000_get_frontend: Layer %d Code Rate = 5/6 ", i); + dprintk("dib8000_get_frontend: Layer %d Code Rate = 5/6\n", i); break; default: c->layer[i].fec = FEC_7_8; if (show) - dprintk("dib8000_get_frontend: Layer %d Code Rate = 7/8 ", i); + dprintk("dib8000_get_frontend: Layer %d Code Rate = 7/8\n", i); break; } @@ -3531,23 +3538,23 @@ static int dib8000_get_frontend(struct dvb_frontend *fe, case 0: c->layer[i].modulation = DQPSK; if (show) - dprintk("dib8000_get_frontend: Layer %d DQPSK ", i); + dprintk("dib8000_get_frontend: Layer %d DQPSK\n", i); break; case 1: c->layer[i].modulation = QPSK; if (show) - dprintk("dib8000_get_frontend: Layer %d QPSK ", i); + dprintk("dib8000_get_frontend: Layer %d QPSK\n", i); break; case 2: c->layer[i].modulation = QAM_16; if (show) - dprintk("dib8000_get_frontend: Layer %d QAM16 ", i); + dprintk("dib8000_get_frontend: Layer %d QAM16\n", i); break; case 3: default: c->layer[i].modulation = QAM_64; if (show) - dprintk("dib8000_get_frontend: Layer %d QAM64 ", i); + dprintk("dib8000_get_frontend: Layer %d QAM64\n", i); break; } } @@ -3578,12 +3585,12 @@ static int dib8000_set_frontend(struct dvb_frontend *fe) unsigned long delay, callback_time; if (c->frequency == 0) { - dprintk("dib8000: must at least specify frequency "); + dprintk("dib8000: must at least specify frequency\n"); return 0; } if (c->bandwidth_hz == 0) { - dprintk("dib8000: no bandwidth specified, set to default "); + dprintk("dib8000: no bandwidth specified, set to default\n"); c->bandwidth_hz = 6000000; } @@ -3671,7 +3678,7 @@ static int dib8000_set_frontend(struct dvb_frontend *fe) /* we are in autosearch */ if (state->channel_parameters_set == 0) { /* searching */ if ((dib8000_get_status(state->fe[index_frontend]) == FE_STATUS_DEMOD_SUCCESS) || (dib8000_get_status(state->fe[index_frontend]) == FE_STATUS_FFT_SUCCESS)) { - dprintk("autosearch succeeded on fe%i", index_frontend); + dprintk("autosearch succeeded on fe%i\n", index_frontend); dib8000_get_frontend(state->fe[index_frontend], c); /* we read the channel parameters from the frontend which was successful */ state->channel_parameters_set = 1; @@ -3708,11 +3715,11 @@ static int dib8000_set_frontend(struct dvb_frontend *fe) active = 1; } if (active == 0) - dprintk("tuning done with status %d", dib8000_get_status(state->fe[0])); + dprintk("tuning done with status %d\n", dib8000_get_status(state->fe[0])); } if ((active == 1) && (callback_time == 0)) { - dprintk("strange callback time something went wrong"); + dprintk("strange callback time something went wrong\n"); active = 0; } @@ -4172,7 +4179,7 @@ static int dib8000_get_stats(struct dvb_frontend *fe, enum fe_status stat) time_us = dib8000_get_time_us(fe, -1); state->ber_jiffies_stats = jiffies + msecs_to_jiffies((time_us + 500) / 1000); - dprintk("Next all layers stats available in %u us.", time_us); + dprintk("Next all layers stats available in %u us.\n", time_us); dib8000_read_ber(fe, &val); c->post_bit_error.stat[0].scale = FE_SCALE_COUNTER; @@ -4239,12 +4246,12 @@ static int dib8000_set_slave_frontend(struct dvb_frontend *fe, struct dvb_fronte while ((index_frontend < MAX_NUMBER_OF_FRONTENDS) && (state->fe[index_frontend] != NULL)) index_frontend++; if (index_frontend < MAX_NUMBER_OF_FRONTENDS) { - dprintk("set slave fe %p to index %i", fe_slave, index_frontend); + dprintk("set slave fe %p to index %i\n", fe_slave, index_frontend); state->fe[index_frontend] = fe_slave; return 0; } - dprintk("too many slave frontend"); + dprintk("too many slave frontend\n"); return -ENOMEM; } @@ -4256,12 +4263,12 @@ static int dib8000_remove_slave_frontend(struct dvb_frontend *fe) while ((index_frontend < MAX_NUMBER_OF_FRONTENDS) && (state->fe[index_frontend] != NULL)) index_frontend++; if (index_frontend != 1) { - dprintk("remove slave fe %p (index %i)", state->fe[index_frontend-1], index_frontend-1); + dprintk("remove slave fe %p (index %i)\n", state->fe[index_frontend-1], index_frontend-1); state->fe[index_frontend] = NULL; return 0; } - dprintk("no frontend to be removed"); + dprintk("no frontend to be removed\n"); return -ENODEV; } @@ -4283,18 +4290,18 @@ static int dib8000_i2c_enumeration(struct i2c_adapter *host, int no_of_demods, client.i2c_write_buffer = kzalloc(4 * sizeof(u8), GFP_KERNEL); if (!client.i2c_write_buffer) { - dprintk("%s: not enough memory", __func__); + dprintk("%s: not enough memory\n", __func__); return -ENOMEM; } client.i2c_read_buffer = kzalloc(4 * sizeof(u8), GFP_KERNEL); if (!client.i2c_read_buffer) { - dprintk("%s: not enough memory", __func__); + dprintk("%s: not enough memory\n", __func__); ret = -ENOMEM; goto error_memory_read; } client.i2c_buffer_lock = kzalloc(sizeof(struct mutex), GFP_KERNEL); if (!client.i2c_buffer_lock) { - dprintk("%s: not enough memory", __func__); + dprintk("%s: not enough memory\n", __func__); ret = -ENOMEM; goto error_memory_lock; } @@ -4313,7 +4320,7 @@ static int dib8000_i2c_enumeration(struct i2c_adapter *host, int no_of_demods, dib8000_i2c_write16(&client, 1287, 0x0003); client.addr = default_addr; if (dib8000_identify(&client) == 0) { - dprintk("#%d: not identified", k); + dprintk("#%d: not identified\n", k); ret = -EINVAL; goto error; } @@ -4327,7 +4334,7 @@ static int dib8000_i2c_enumeration(struct i2c_adapter *host, int no_of_demods, client.addr = new_addr; dib8000_identify(&client); - dprintk("IC %d initialized (to i2c_address 0x%x)", k, new_addr); + dprintk("IC %d initialized (to i2c_address 0x%x)\n", k, new_addr); } for (k = 0; k < no_of_demods; k++) { @@ -4385,14 +4392,14 @@ static int dib8000_pid_filter_ctrl(struct dvb_frontend *fe, u8 onoff) u16 val = dib8000_read_word(st, 299) & 0xffef; val |= (onoff & 0x1) << 4; - dprintk("pid filter enabled %d", onoff); + dprintk("pid filter enabled %d\n", onoff); return dib8000_write_word(st, 299, val); } static int dib8000_pid_filter(struct dvb_frontend *fe, u8 id, u16 pid, u8 onoff) { struct dib8000_state *st = fe->demodulator_priv; - dprintk("Index %x, PID %d, OnOff %d", id, pid, onoff); + dprintk("Index %x, PID %d, OnOff %d\n", id, pid, onoff); return dib8000_write_word(st, 305 + id, onoff ? (1 << 13) | pid : 0); } @@ -4431,7 +4438,7 @@ static struct dvb_frontend *dib8000_init(struct i2c_adapter *i2c_adap, u8 i2c_ad struct dvb_frontend *fe; struct dib8000_state *state; - dprintk("dib8000_init"); + dprintk("dib8000_init\n"); state = kzalloc(sizeof(struct dib8000_state), GFP_KERNEL); if (state == NULL) diff --git a/drivers/media/dvb-frontends/dib9000.c b/drivers/media/dvb-frontends/dib9000.c index 5897977d2d00..c95fff4f9582 100644 --- a/drivers/media/dvb-frontends/dib9000.c +++ b/drivers/media/dvb-frontends/dib9000.c @@ -7,6 +7,9 @@ * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation, version 2. */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <linux/kernel.h> #include <linux/i2c.h> #include <linux/mutex.h> @@ -21,7 +24,12 @@ static int debug; module_param(debug, int, 0644); MODULE_PARM_DESC(debug, "turn on debugging (default: 0)"); -#define dprintk(args...) do { if (debug) { printk(KERN_DEBUG "DiB9000: "); printk(args); printk("\n"); } } while (0) +#define dprintk(fmt, arg...) do { \ + if (debug) \ + printk(KERN_DEBUG pr_fmt("%s: " fmt), \ + __func__, ##arg); \ +} while (0) + #define MAX_NUMBER_OF_FRONTENDS 6 struct i2c_device { @@ -258,7 +266,7 @@ static int dib9000_read16_attr(struct dib9000_state *state, u16 reg, u8 *b, u32 state->msg[1].buf = b; ret = i2c_transfer(state->i2c.i2c_adap, state->msg, 2) != 2 ? -EREMOTEIO : 0; if (ret != 0) { - dprintk("i2c read error on %d", reg); + dprintk("i2c read error on %d\n", reg); return -EREMOTEIO; } @@ -285,7 +293,7 @@ static u16 dib9000_i2c_read16(struct i2c_device *i2c, u16 reg) i2c->i2c_write_buffer[1] = reg & 0xff; if (i2c_transfer(i2c->i2c_adap, msg, 2) != 2) { - dprintk("read register %x error", reg); + dprintk("read register %x error\n", reg); return 0; } @@ -440,7 +448,7 @@ static int dib9000_risc_mem_read(struct dib9000_state *state, u8 cmd, u8 * b, u1 return -EIO; if (mutex_lock_interruptible(&state->platform.risc.mem_lock) < 0) { - dprintk("could not get the lock"); + dprintk("could not get the lock\n"); return -EINTR; } dib9000_risc_mem_setup(state, cmd | 0x80); @@ -456,7 +464,7 @@ static int dib9000_risc_mem_write(struct dib9000_state *state, u8 cmd, const u8 return -EIO; if (mutex_lock_interruptible(&state->platform.risc.mem_lock) < 0) { - dprintk("could not get the lock"); + dprintk("could not get the lock\n"); return -EINTR; } dib9000_risc_mem_setup(state, cmd); @@ -479,13 +487,13 @@ static int dib9000_firmware_download(struct dib9000_state *state, u8 risc_id, u1 dib9000_write_word(state, 1025 + offs, 0); dib9000_write_word(state, 1031 + offs, key); - dprintk("going to download %dB of microcode", len); + dprintk("going to download %dB of microcode\n", len); if (dib9000_write16_noinc(state, 1026 + offs, (u8 *) code, (u16) len) != 0) { - dprintk("error while downloading microcode for RISC %c", 'A' + risc_id); + dprintk("error while downloading microcode for RISC %c\n", 'A' + risc_id); return -EIO; } - dprintk("Microcode for RISC %c loaded", 'A' + risc_id); + dprintk("Microcode for RISC %c loaded\n", 'A' + risc_id); return 0; } @@ -511,10 +519,10 @@ static int dib9000_mbx_host_init(struct dib9000_state *state, u8 risc_id) } while ((reset_reg & 0x8000) && --tries); if (reset_reg & 0x8000) { - dprintk("MBX: init ERROR, no response from RISC %c", 'A' + risc_id); + dprintk("MBX: init ERROR, no response from RISC %c\n", 'A' + risc_id); return -EIO; } - dprintk("MBX: initialized"); + dprintk("MBX: initialized\n"); return 0; } @@ -531,30 +539,27 @@ static int dib9000_mbx_send_attr(struct dib9000_state *state, u8 id, u16 * data, return -EINVAL; if (mutex_lock_interruptible(&state->platform.risc.mbx_if_lock) < 0) { - dprintk("could not get the lock"); + dprintk("could not get the lock\n"); return -EINTR; } tmp = MAX_MAILBOX_TRY; do { size = dib9000_read_word_attr(state, 1043, attr) & 0xff; if ((size + len + 1) > MBX_MAX_WORDS && --tmp) { - dprintk("MBX: RISC mbx full, retrying"); + dprintk("MBX: RISC mbx full, retrying\n"); msleep(100); } else break; } while (1); - /*dprintk( "MBX: size: %d", size); */ + /*dprintk( "MBX: size: %d\n", size); */ if (tmp == 0) { ret = -EINVAL; goto out; } #ifdef DUMP_MSG - dprintk("--> %02x %d ", id, len + 1); - for (i = 0; i < len; i++) - dprintk("%04x ", data[i]); - dprintk("\n"); + dprintk("--> %02x %d %*ph\n", id, len + 1, len, data); #endif /* byte-order conversion - works on big (where it is not necessary) or little endian */ @@ -596,7 +601,7 @@ static u8 dib9000_mbx_read(struct dib9000_state *state, u16 * data, u8 risc_id, return 0; if (mutex_lock_interruptible(&state->platform.risc.mbx_if_lock) < 0) { - dprintk("could not get the lock"); + dprintk("could not get the lock\n"); return 0; } if (risc_id == 1) @@ -622,13 +627,13 @@ static u8 dib9000_mbx_read(struct dib9000_state *state, u16 * data, u8 risc_id, } #ifdef DUMP_MSG - dprintk("<-- "); + dprintk("<--\n"); for (i = 0; i < size + 1; i++) - dprintk("%04x ", d[i]); + dprintk("%04x\n", d[i]); dprintk("\n"); #endif } else { - dprintk("MBX: message is too big for message cache (%d), flushing message", size); + dprintk("MBX: message is too big for message cache (%d), flushing message\n", size); size--; /* Initial word already read */ while (size--) dib9000_read16_noinc_attr(state, 1029 + mc_base, (u8 *) data, 2, attr); @@ -649,9 +654,11 @@ static int dib9000_risc_debug_buf(struct dib9000_state *state, u16 * data, u8 si b[2 * (size - 2) - 1] = '\0'; /* Bullet proof the buffer */ if (*b == '~') { b++; - dprintk("%s", b); + dprintk("%s\n", b); } else - dprintk("RISC%d: %d.%04d %s", state->fe_id, ts / 10000, ts % 10000, *b ? b : "<empty>"); + dprintk("RISC%d: %d.%04d %s\n", + state->fe_id, + ts / 10000, ts % 10000, *b ? b : "<empty>"); return 1; } @@ -666,7 +673,7 @@ static int dib9000_mbx_fetch_to_cache(struct dib9000_state *state, u16 attr) if (*block == 0) { size = dib9000_mbx_read(state, block, 1, attr); -/* dprintk( "MBX: fetched %04x message to cache", *block); */ +/* dprintk( "MBX: fetched %04x message to cache\n", *block); */ switch (*block >> 8) { case IN_MSG_DEBUG_BUF: @@ -686,7 +693,7 @@ static int dib9000_mbx_fetch_to_cache(struct dib9000_state *state, u16 attr) return 1; } } - dprintk("MBX: no free cache-slot found for new message..."); + dprintk("MBX: no free cache-slot found for new message...\n"); return -1; } @@ -706,7 +713,7 @@ static int dib9000_mbx_process(struct dib9000_state *state, u16 attr) return -1; if (mutex_lock_interruptible(&state->platform.risc.mbx_lock) < 0) { - dprintk("could not get the lock"); + dprintk("could not get the lock\n"); return -1; } @@ -715,7 +722,7 @@ static int dib9000_mbx_process(struct dib9000_state *state, u16 attr) dib9000_read_word_attr(state, 1229, attr); /* Clear the IRQ */ /* if (tmp) */ -/* dprintk( "cleared IRQ: %x", tmp); */ +/* dprintk( "cleared IRQ: %x\n", tmp); */ mutex_unlock(&state->platform.risc.mbx_lock); return ret; @@ -750,7 +757,7 @@ static int dib9000_mbx_get_message_attr(struct dib9000_state *state, u16 id, u16 } while (--timeout); if (timeout == 0) { - dprintk("waiting for message %d timed out", id); + dprintk("waiting for message %d timed out\n", id); return -1; } @@ -770,7 +777,7 @@ static int dib9000_risc_check_version(struct dib9000_state *state) return -EIO; fw_version = (r[0] << 8) | r[1]; - dprintk("RISC: ver: %d.%02d (IC: %d)", fw_version >> 10, fw_version & 0x3ff, (r[2] << 8) | r[3]); + dprintk("RISC: ver: %d.%02d (IC: %d)\n", fw_version >> 10, fw_version & 0x3ff, (r[2] << 8) | r[3]); if ((fw_version >> 10) != 7) return -EINVAL; @@ -850,40 +857,40 @@ static u16 dib9000_identify(struct i2c_device *client) value = dib9000_i2c_read16(client, 896); if (value != 0x01b3) { - dprintk("wrong Vendor ID (0x%x)", value); + dprintk("wrong Vendor ID (0x%x)\n", value); return 0; } value = dib9000_i2c_read16(client, 897); if (value != 0x4000 && value != 0x4001 && value != 0x4002 && value != 0x4003 && value != 0x4004 && value != 0x4005) { - dprintk("wrong Device ID (0x%x)", value); + dprintk("wrong Device ID (0x%x)\n", value); return 0; } /* protect this driver to be used with 7000PC */ if (value == 0x4000 && dib9000_i2c_read16(client, 769) == 0x4000) { - dprintk("this driver does not work with DiB7000PC"); + dprintk("this driver does not work with DiB7000PC\n"); return 0; } switch (value) { case 0x4000: - dprintk("found DiB7000MA/PA/MB/PB"); + dprintk("found DiB7000MA/PA/MB/PB\n"); break; case 0x4001: - dprintk("found DiB7000HC"); + dprintk("found DiB7000HC\n"); break; case 0x4002: - dprintk("found DiB7000MC"); + dprintk("found DiB7000MC\n"); break; case 0x4003: - dprintk("found DiB9000A"); + dprintk("found DiB9000A\n"); break; case 0x4004: - dprintk("found DiB9000H"); + dprintk("found DiB9000H\n"); break; case 0x4005: - dprintk("found DiB9000M"); + dprintk("found DiB9000M\n"); break; } @@ -1013,7 +1020,7 @@ static int dib9000_risc_apb_access_read(struct dib9000_state *state, u32 address if (address >= 1024 || !state->platform.risc.fw_is_running) return -EINVAL; - /* dprintk( "APB access thru rd fw %d %x", address, attribute); */ + /* dprintk( "APB access thru rd fw %d %x\n", address, attribute); */ mb[0] = (u16) address; mb[1] = len / 2; @@ -1043,7 +1050,7 @@ static int dib9000_risc_apb_access_write(struct dib9000_state *state, u32 addres if (len > 18) return -EINVAL; - /* dprintk( "APB access thru wr fw %d %x", address, attribute); */ + /* dprintk( "APB access thru wr fw %d %x\n", address, attribute); */ mb[0] = (u16)address; for (i = 0; i + 1 < len; i += 2) @@ -1191,7 +1198,7 @@ static int dib9000_fw_get_channel(struct dvb_frontend *fe) int ret = 0; if (mutex_lock_interruptible(&state->platform.risc.mem_mbx_lock) < 0) { - dprintk("could not get the lock"); + dprintk("could not get the lock\n"); return -EINTR; } if (dib9000_fw_memmbx_sync(state, FE_SYNC_CHANNEL) < 0) { @@ -1534,7 +1541,7 @@ static int dib9000_fw_set_output_mode(struct dvb_frontend *fe, int mode) struct dib9000_state *state = fe->demodulator_priv; u16 outreg, smo_mode; - dprintk("setting output mode for demod %p to %d", fe, mode); + dprintk("setting output mode for demod %p to %d\n", fe, mode); switch (mode) { case OUTMODE_MPEG2_PAR_GATED_CLK: @@ -1556,7 +1563,7 @@ static int dib9000_fw_set_output_mode(struct dvb_frontend *fe, int mode) outreg = 0; break; default: - dprintk("Unhandled output_mode passed to be set for demod %p", &state->fe[0]); + dprintk("Unhandled output_mode passed to be set for demod %p\n", &state->fe[0]); return -EINVAL; } @@ -1590,7 +1597,7 @@ static int dib9000_tuner_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msg[] len = 16; if (dib9000_read_word(state, 790) != 0) - dprintk("TunerITF: read busy"); + dprintk("TunerITF: read busy\n"); dib9000_write_word(state, 784, (u16) (msg[index_msg].addr)); dib9000_write_word(state, 787, (len / 2) - 1); @@ -1601,7 +1608,7 @@ static int dib9000_tuner_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msg[] i--; if (i == 0) - dprintk("TunerITF: read failed"); + dprintk("TunerITF: read failed\n"); for (i = 0; i < len; i += 2) { t = dib9000_read_word(state, 785); @@ -1609,13 +1616,13 @@ static int dib9000_tuner_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msg[] msg[index_msg].buf[i + 1] = (t) & 0xff; } if (dib9000_read_word(state, 790) != 0) - dprintk("TunerITF: read more data than expected"); + dprintk("TunerITF: read more data than expected\n"); } else { i = 1000; while (dib9000_read_word(state, 789) && i) i--; if (i == 0) - dprintk("TunerITF: write busy"); + dprintk("TunerITF: write busy\n"); len = msg[index_msg].len; if (len > 16) @@ -1631,7 +1638,7 @@ static int dib9000_tuner_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msg[] while (dib9000_read_word(state, 791) > 0 && i) i--; if (i == 0) - dprintk("TunerITF: write failed"); + dprintk("TunerITF: write failed\n"); } } return num; @@ -1676,7 +1683,7 @@ static int dib9000_fw_component_bus_xfer(struct i2c_adapter *i2c_adap, struct i2 } if (mutex_lock_interruptible(&state->platform.risc.mem_mbx_lock) < 0) { - dprintk("could not get the lock"); + dprintk("could not get the lock\n"); return 0; } @@ -1759,7 +1766,7 @@ static int dib9000_cfg_gpio(struct dib9000_state *st, u8 num, u8 dir, u8 val) st->gpio_val |= (val & 0x01) << num; /* set the new value */ dib9000_write_word(st, 774, st->gpio_val); - dprintk("gpio dir: %04x: gpio val: %04x", st->gpio_dir, st->gpio_val); + dprintk("gpio dir: %04x: gpio val: %04x\n", st->gpio_dir, st->gpio_val); return 0; } @@ -1779,7 +1786,7 @@ int dib9000_fw_pid_filter_ctrl(struct dvb_frontend *fe, u8 onoff) if ((state->pid_ctrl_index != -2) && (state->pid_ctrl_index < 9)) { /* postpone the pid filtering cmd */ - dprintk("pid filter cmd postpone"); + dprintk("pid filter cmd postpone\n"); state->pid_ctrl_index++; state->pid_ctrl[state->pid_ctrl_index].cmd = DIB9000_PID_FILTER_CTRL; state->pid_ctrl[state->pid_ctrl_index].onoff = onoff; @@ -1787,14 +1794,14 @@ int dib9000_fw_pid_filter_ctrl(struct dvb_frontend *fe, u8 onoff) } if (mutex_lock_interruptible(&state->demod_lock) < 0) { - dprintk("could not get the lock"); + dprintk("could not get the lock\n"); return -EINTR; } val = dib9000_read_word(state, 294 + 1) & 0xffef; val |= (onoff & 0x1) << 4; - dprintk("PID filter enabled %d", onoff); + dprintk("PID filter enabled %d\n", onoff); ret = dib9000_write_word(state, 294 + 1, val); mutex_unlock(&state->demod_lock); return ret; @@ -1809,7 +1816,7 @@ int dib9000_fw_pid_filter(struct dvb_frontend *fe, u8 id, u16 pid, u8 onoff) if (state->pid_ctrl_index != -2) { /* postpone the pid filtering cmd */ - dprintk("pid filter postpone"); + dprintk("pid filter postpone\n"); if (state->pid_ctrl_index < 9) { state->pid_ctrl_index++; state->pid_ctrl[state->pid_ctrl_index].cmd = DIB9000_PID_FILTER; @@ -1817,15 +1824,15 @@ int dib9000_fw_pid_filter(struct dvb_frontend *fe, u8 id, u16 pid, u8 onoff) state->pid_ctrl[state->pid_ctrl_index].pid = pid; state->pid_ctrl[state->pid_ctrl_index].onoff = onoff; } else - dprintk("can not add any more pid ctrl cmd"); + dprintk("can not add any more pid ctrl cmd\n"); return 0; } if (mutex_lock_interruptible(&state->demod_lock) < 0) { - dprintk("could not get the lock"); + dprintk("could not get the lock\n"); return -EINTR; } - dprintk("Index %x, PID %d, OnOff %d", id, pid, onoff); + dprintk("Index %x, PID %d, OnOff %d\n", id, pid, onoff); ret = dib9000_write_word(state, 300 + 1 + id, onoff ? (1 << 13) | pid : 0); mutex_unlock(&state->demod_lock); @@ -1868,7 +1875,7 @@ static int dib9000_sleep(struct dvb_frontend *fe) int ret = 0; if (mutex_lock_interruptible(&state->demod_lock) < 0) { - dprintk("could not get the lock"); + dprintk("could not get the lock\n"); return -EINTR; } for (index_frontend = 1; (index_frontend < MAX_NUMBER_OF_FRONTENDS) && (state->fe[index_frontend] != NULL); index_frontend++) { @@ -1899,7 +1906,7 @@ static int dib9000_get_frontend(struct dvb_frontend *fe, if (state->get_frontend_internal == 0) { if (mutex_lock_interruptible(&state->demod_lock) < 0) { - dprintk("could not get the lock"); + dprintk("could not get the lock\n"); return -EINTR; } } @@ -1907,7 +1914,7 @@ static int dib9000_get_frontend(struct dvb_frontend *fe, for (index_frontend = 1; (index_frontend < MAX_NUMBER_OF_FRONTENDS) && (state->fe[index_frontend] != NULL); index_frontend++) { state->fe[index_frontend]->ops.read_status(state->fe[index_frontend], &stat); if (stat & FE_HAS_SYNC) { - dprintk("TPS lock on the slave%i", index_frontend); + dprintk("TPS lock on the slave%i\n", index_frontend); /* synchronize the cache with the other frontends */ state->fe[index_frontend]->ops.get_frontend(state->fe[index_frontend], c); @@ -1995,18 +2002,18 @@ static int dib9000_set_frontend(struct dvb_frontend *fe) /* check that the correct parameters are set */ if (state->fe[0]->dtv_property_cache.frequency == 0) { - dprintk("dib9000: must specify frequency "); + dprintk("dib9000: must specify frequency\n"); return 0; } if (state->fe[0]->dtv_property_cache.bandwidth_hz == 0) { - dprintk("dib9000: must specify bandwidth "); + dprintk("dib9000: must specify bandwidth\n"); return 0; } state->pid_ctrl_index = -1; /* postpone the pid filtering cmd */ if (mutex_lock_interruptible(&state->demod_lock) < 0) { - dprintk("could not get the lock"); + dprintk("could not get the lock\n"); return 0; } @@ -2073,14 +2080,14 @@ static int dib9000_set_frontend(struct dvb_frontend *fe) /* check the tune result */ if (exit_condition == 1) { /* tune failed */ - dprintk("tune failed"); + dprintk("tune failed\n"); mutex_unlock(&state->demod_lock); /* tune failed; put all the pid filtering cmd to junk */ state->pid_ctrl_index = -1; return 0; } - dprintk("tune success on frontend%i", index_frontend_success); + dprintk("tune success on frontend%i\n", index_frontend_success); /* synchronize all the channel cache */ state->get_frontend_internal = 1; @@ -2169,7 +2176,7 @@ static int dib9000_read_status(struct dvb_frontend *fe, enum fe_status *stat) u16 lock = 0, lock_slave = 0; if (mutex_lock_interruptible(&state->demod_lock) < 0) { - dprintk("could not get the lock"); + dprintk("could not get the lock\n"); return -EINTR; } for (index_frontend = 1; (index_frontend < MAX_NUMBER_OF_FRONTENDS) && (state->fe[index_frontend] != NULL); index_frontend++) @@ -2202,11 +2209,11 @@ static int dib9000_read_ber(struct dvb_frontend *fe, u32 * ber) int ret = 0; if (mutex_lock_interruptible(&state->demod_lock) < 0) { - dprintk("could not get the lock"); + dprintk("could not get the lock\n"); return -EINTR; } if (mutex_lock_interruptible(&state->platform.risc.mem_mbx_lock) < 0) { - dprintk("could not get the lock"); + dprintk("could not get the lock\n"); ret = -EINTR; goto error; } @@ -2237,7 +2244,7 @@ static int dib9000_read_signal_strength(struct dvb_frontend *fe, u16 * strength) int ret = 0; if (mutex_lock_interruptible(&state->demod_lock) < 0) { - dprintk("could not get the lock"); + dprintk("could not get the lock\n"); return -EINTR; } *strength = 0; @@ -2250,7 +2257,7 @@ static int dib9000_read_signal_strength(struct dvb_frontend *fe, u16 * strength) } if (mutex_lock_interruptible(&state->platform.risc.mem_mbx_lock) < 0) { - dprintk("could not get the lock"); + dprintk("could not get the lock\n"); ret = -EINTR; goto error; } @@ -2281,7 +2288,7 @@ static u32 dib9000_get_snr(struct dvb_frontend *fe) u16 val; if (mutex_lock_interruptible(&state->platform.risc.mem_mbx_lock) < 0) { - dprintk("could not get the lock"); + dprintk("could not get the lock\n"); return 0; } if (dib9000_fw_memmbx_sync(state, FE_SYNC_CHANNEL) < 0) { @@ -2320,7 +2327,7 @@ static int dib9000_read_snr(struct dvb_frontend *fe, u16 * snr) u32 snr_master; if (mutex_lock_interruptible(&state->demod_lock) < 0) { - dprintk("could not get the lock"); + dprintk("could not get the lock\n"); return -EINTR; } snr_master = dib9000_get_snr(fe); @@ -2345,11 +2352,11 @@ static int dib9000_read_unc_blocks(struct dvb_frontend *fe, u32 * unc) int ret = 0; if (mutex_lock_interruptible(&state->demod_lock) < 0) { - dprintk("could not get the lock"); + dprintk("could not get the lock\n"); return -EINTR; } if (mutex_lock_interruptible(&state->platform.risc.mem_mbx_lock) < 0) { - dprintk("could not get the lock"); + dprintk("could not get the lock\n"); ret = -EINTR; goto error; } @@ -2376,12 +2383,12 @@ int dib9000_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u8 defaul client.i2c_write_buffer = kzalloc(4 * sizeof(u8), GFP_KERNEL); if (!client.i2c_write_buffer) { - dprintk("%s: not enough memory", __func__); + dprintk("%s: not enough memory\n", __func__); return -ENOMEM; } client.i2c_read_buffer = kzalloc(4 * sizeof(u8), GFP_KERNEL); if (!client.i2c_read_buffer) { - dprintk("%s: not enough memory", __func__); + dprintk("%s: not enough memory\n", __func__); ret = -ENOMEM; goto error_memory; } @@ -2408,7 +2415,7 @@ int dib9000_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u8 defaul if (dib9000_identify(&client) == 0) { client.i2c_addr = default_addr; if (dib9000_identify(&client) == 0) { - dprintk("DiB9000 #%d: not identified", k); + dprintk("DiB9000 #%d: not identified\n", k); ret = -EIO; goto error; } @@ -2417,7 +2424,7 @@ int dib9000_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u8 defaul dib9000_i2c_write16(&client, 1795, (1 << 10) | (4 << 6)); dib9000_i2c_write16(&client, 1794, (new_addr << 2) | 2); - dprintk("IC %d initialized (to i2c_address 0x%x)", k, new_addr); + dprintk("IC %d initialized (to i2c_address 0x%x)\n", k, new_addr); } for (k = 0; k < no_of_demods; k++) { @@ -2445,12 +2452,12 @@ int dib9000_set_slave_frontend(struct dvb_frontend *fe, struct dvb_frontend *fe_ while ((index_frontend < MAX_NUMBER_OF_FRONTENDS) && (state->fe[index_frontend] != NULL)) index_frontend++; if (index_frontend < MAX_NUMBER_OF_FRONTENDS) { - dprintk("set slave fe %p to index %i", fe_slave, index_frontend); + dprintk("set slave fe %p to index %i\n", fe_slave, index_frontend); state->fe[index_frontend] = fe_slave; return 0; } - dprintk("too many slave frontend"); + dprintk("too many slave frontend\n"); return -ENOMEM; } EXPORT_SYMBOL(dib9000_set_slave_frontend); @@ -2463,12 +2470,12 @@ int dib9000_remove_slave_frontend(struct dvb_frontend *fe) while ((index_frontend < MAX_NUMBER_OF_FRONTENDS) && (state->fe[index_frontend] != NULL)) index_frontend++; if (index_frontend != 1) { - dprintk("remove slave fe %p (index %i)", state->fe[index_frontend - 1], index_frontend - 1); + dprintk("remove slave fe %p (index %i)\n", state->fe[index_frontend - 1], index_frontend - 1); state->fe[index_frontend] = NULL; return 0; } - dprintk("no frontend to be removed"); + dprintk("no frontend to be removed\n"); return -ENODEV; } EXPORT_SYMBOL(dib9000_remove_slave_frontend); @@ -2483,7 +2490,7 @@ struct dvb_frontend *dib9000_get_slave_frontend(struct dvb_frontend *fe, int sla } EXPORT_SYMBOL(dib9000_get_slave_frontend); -static struct dvb_frontend_ops dib9000_ops; +static const struct dvb_frontend_ops dib9000_ops; struct dvb_frontend *dib9000_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, const struct dib9000_config *cfg) { struct dvb_frontend *fe; @@ -2560,7 +2567,7 @@ error: } EXPORT_SYMBOL(dib9000_attach); -static struct dvb_frontend_ops dib9000_ops = { +static const struct dvb_frontend_ops dib9000_ops = { .delsys = { SYS_DVBT }, .info = { .name = "DiBcom 9000", diff --git a/drivers/media/dvb-frontends/dibx000_common.c b/drivers/media/dvb-frontends/dibx000_common.c index 723358d7ca84..bc28184c7fb0 100644 --- a/drivers/media/dvb-frontends/dibx000_common.c +++ b/drivers/media/dvb-frontends/dibx000_common.c @@ -1,3 +1,5 @@ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <linux/i2c.h> #include <linux/mutex.h> #include <linux/module.h> @@ -8,14 +10,18 @@ static int debug; module_param(debug, int, 0644); MODULE_PARM_DESC(debug, "turn on debugging (default: 0)"); -#define dprintk(args...) do { if (debug) { printk(KERN_DEBUG "DiBX000: "); printk(args); printk("\n"); } } while (0) +#define dprintk(fmt, arg...) do { \ + if (debug) \ + printk(KERN_DEBUG pr_fmt("%s: " fmt), \ + __func__, ##arg); \ +} while (0) static int dibx000_write_word(struct dibx000_i2c_master *mst, u16 reg, u16 val) { int ret; if (mutex_lock_interruptible(&mst->i2c_buffer_lock) < 0) { - dprintk("could not acquire lock"); + dprintk("could not acquire lock\n"); return -EINVAL; } @@ -41,7 +47,7 @@ static u16 dibx000_read_word(struct dibx000_i2c_master *mst, u16 reg) u16 ret; if (mutex_lock_interruptible(&mst->i2c_buffer_lock) < 0) { - dprintk("could not acquire lock"); + dprintk("could not acquire lock\n"); return 0; } @@ -59,7 +65,7 @@ static u16 dibx000_read_word(struct dibx000_i2c_master *mst, u16 reg) mst->msg[1].len = 2; if (i2c_transfer(mst->i2c_adap, mst->msg, 2) != 2) - dprintk("i2c read error on %d", reg); + dprintk("i2c read error on %d\n", reg); ret = (mst->i2c_read_buffer[0] << 8) | mst->i2c_read_buffer[1]; mutex_unlock(&mst->i2c_buffer_lock); @@ -192,7 +198,7 @@ static int dibx000_i2c_select_interface(struct dibx000_i2c_master *mst, enum dibx000_i2c_interface intf) { if (mst->device_rev > DIB3000MC && mst->selected_interface != intf) { - dprintk("selecting interface: %d", intf); + dprintk("selecting interface: %d\n", intf); mst->selected_interface = intf; return dibx000_write_word(mst, mst->base_reg + 4, intf); } @@ -290,7 +296,7 @@ static int dibx000_i2c_gated_gpio67_xfer(struct i2c_adapter *i2c_adap, dibx000_i2c_select_interface(mst, DIBX000_I2C_INTERFACE_GPIO_6_7); if (mutex_lock_interruptible(&mst->i2c_buffer_lock) < 0) { - dprintk("could not acquire lock"); + dprintk("could not acquire lock\n"); return -EINVAL; } @@ -337,7 +343,7 @@ static int dibx000_i2c_gated_tuner_xfer(struct i2c_adapter *i2c_adap, dibx000_i2c_select_interface(mst, DIBX000_I2C_INTERFACE_TUNER); if (mutex_lock_interruptible(&mst->i2c_buffer_lock) < 0) { - dprintk("could not acquire lock"); + dprintk("could not acquire lock\n"); return -EINVAL; } memset(mst->msg, 0, sizeof(struct i2c_msg) * (2 + num)); @@ -391,7 +397,7 @@ struct i2c_adapter *dibx000_get_i2c_adapter(struct dibx000_i2c_master *mst, i2c = &mst->master_i2c_adap_gpio67; break; default: - printk(KERN_ERR "DiBX000: incorrect I2C interface selected\n"); + pr_err("incorrect I2C interface selected\n"); break; } @@ -434,7 +440,7 @@ int dibx000_init_i2c_master(struct dibx000_i2c_master *mst, u16 device_rev, mutex_init(&mst->i2c_buffer_lock); if (mutex_lock_interruptible(&mst->i2c_buffer_lock) < 0) { - dprintk("could not acquire lock"); + dprintk("could not acquire lock\n"); return -EINVAL; } memset(mst->msg, 0, sizeof(struct i2c_msg)); @@ -456,29 +462,25 @@ int dibx000_init_i2c_master(struct dibx000_i2c_master *mst, u16 device_rev, if (i2c_adapter_init (&mst->gated_tuner_i2c_adap, &dibx000_i2c_gated_tuner_algo, "DiBX000 tuner I2C bus", mst) != 0) - printk(KERN_ERR - "DiBX000: could not initialize the tuner i2c_adapter\n"); + pr_err("could not initialize the tuner i2c_adapter\n"); mst->master_i2c_adap_gpio12.dev.parent = mst->i2c_adap->dev.parent; if (i2c_adapter_init (&mst->master_i2c_adap_gpio12, &dibx000_i2c_master_gpio12_xfer_algo, "DiBX000 master GPIO12 I2C bus", mst) != 0) - printk(KERN_ERR - "DiBX000: could not initialize the master i2c_adapter\n"); + pr_err("could not initialize the master i2c_adapter\n"); mst->master_i2c_adap_gpio34.dev.parent = mst->i2c_adap->dev.parent; if (i2c_adapter_init (&mst->master_i2c_adap_gpio34, &dibx000_i2c_master_gpio34_xfer_algo, "DiBX000 master GPIO34 I2C bus", mst) != 0) - printk(KERN_ERR - "DiBX000: could not initialize the master i2c_adapter\n"); + pr_err("could not initialize the master i2c_adapter\n"); mst->master_i2c_adap_gpio67.dev.parent = mst->i2c_adap->dev.parent; if (i2c_adapter_init (&mst->master_i2c_adap_gpio67, &dibx000_i2c_gated_gpio67_algo, "DiBX000 master GPIO67 I2C bus", mst) != 0) - printk(KERN_ERR - "DiBX000: could not initialize the master i2c_adapter\n"); + pr_err("could not initialize the master i2c_adapter\n"); /* initialize the i2c-master by closing the gate */ dibx000_i2c_gate_ctrl(mst, mst->i2c_write_buffer, 0, 0); @@ -500,16 +502,6 @@ void dibx000_exit_i2c_master(struct dibx000_i2c_master *mst) } EXPORT_SYMBOL(dibx000_exit_i2c_master); - -u32 systime(void) -{ - struct timespec t; - - t = current_kernel_time(); - return (t.tv_sec * 10000) + (t.tv_nsec / 100000); -} -EXPORT_SYMBOL(systime); - MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@posteo.de>"); MODULE_DESCRIPTION("Common function the DiBcom demodulator family"); MODULE_LICENSE("GPL"); diff --git a/drivers/media/dvb-frontends/dibx000_common.h b/drivers/media/dvb-frontends/dibx000_common.h index b538e0555c95..61f4152f24ee 100644 --- a/drivers/media/dvb-frontends/dibx000_common.h +++ b/drivers/media/dvb-frontends/dibx000_common.h @@ -47,8 +47,6 @@ extern void dibx000_exit_i2c_master(struct dibx000_i2c_master *mst); extern void dibx000_reset_i2c_master(struct dibx000_i2c_master *mst); extern int dibx000_i2c_set_speed(struct i2c_adapter *i2c_adap, u16 speed); -extern u32 systime(void); - #define BAND_LBAND 0x01 #define BAND_UHF 0x02 #define BAND_VHF 0x04 diff --git a/drivers/media/dvb-frontends/drx39xyj/drxj.c b/drivers/media/dvb-frontends/drx39xyj/drxj.c index bd6d2ee0f7c9..f1c3e3b09b65 100644 --- a/drivers/media/dvb-frontends/drx39xyj/drxj.c +++ b/drivers/media/dvb-frontends/drx39xyj/drxj.c @@ -12264,7 +12264,7 @@ static void drx39xxj_release(struct dvb_frontend *fe) kfree(state); } -static struct dvb_frontend_ops drx39xxj_ops; +static const struct dvb_frontend_ops drx39xxj_ops; struct dvb_frontend *drx39xxj_attach(struct i2c_adapter *i2c) { @@ -12363,7 +12363,7 @@ error: } EXPORT_SYMBOL(drx39xxj_attach); -static struct dvb_frontend_ops drx39xxj_ops = { +static const struct dvb_frontend_ops drx39xxj_ops = { .delsys = { SYS_ATSC, SYS_DVBC_ANNEX_B }, .info = { .name = "Micronas DRX39xxj family Frontend", diff --git a/drivers/media/dvb-frontends/drxd_hard.c b/drivers/media/dvb-frontends/drxd_hard.c index 445a15c2714f..4143f0326684 100644 --- a/drivers/media/dvb-frontends/drxd_hard.c +++ b/drivers/media/dvb-frontends/drxd_hard.c @@ -2912,7 +2912,7 @@ static void drxd_release(struct dvb_frontend *fe) kfree(state); } -static struct dvb_frontend_ops drxd_ops = { +static const struct dvb_frontend_ops drxd_ops = { .delsys = { SYS_DVBT}, .info = { .name = "Micronas DRXD DVB-T", diff --git a/drivers/media/dvb-frontends/drxk_hard.c b/drivers/media/dvb-frontends/drxk_hard.c index c595adc61c6f..146edf344dd8 100644 --- a/drivers/media/dvb-frontends/drxk_hard.c +++ b/drivers/media/dvb-frontends/drxk_hard.c @@ -6737,7 +6737,7 @@ static int drxk_get_tune_settings(struct dvb_frontend *fe, } } -static struct dvb_frontend_ops drxk_ops = { +static const struct dvb_frontend_ops drxk_ops = { /* .delsys will be filled dynamically */ .info = { .name = "DRXK", diff --git a/drivers/media/dvb-frontends/ds3000.c b/drivers/media/dvb-frontends/ds3000.c index 447b518e287a..0b17a45c5640 100644 --- a/drivers/media/dvb-frontends/ds3000.c +++ b/drivers/media/dvb-frontends/ds3000.c @@ -248,8 +248,8 @@ static int ds3000_writereg(struct ds3000_state *state, int reg, int data) err = i2c_transfer(state->i2c, &msg, 1); if (err != 1) { - printk(KERN_ERR "%s: writereg error(err == %i, reg == 0x%02x," - " value == 0x%02x)\n", __func__, err, reg, data); + printk(KERN_ERR "%s: writereg error(err == %i, reg == 0x%02x, value == 0x%02x)\n", + __func__, err, reg, data); return -EREMOTEIO; } @@ -296,8 +296,8 @@ static int ds3000_writeFW(struct ds3000_state *state, int reg, ret = i2c_transfer(state->i2c, &msg, 1); if (ret != 1) { - printk(KERN_ERR "%s: write error(err == %i, " - "reg == 0x%02x\n", __func__, ret, reg); + printk(KERN_ERR "%s: write error(err == %i, reg == 0x%02x\n", + __func__, ret, reg); ret = -EREMOTEIO; goto error; } @@ -364,8 +364,8 @@ static int ds3000_firmware_ondemand(struct dvb_frontend *fe) state->i2c->dev.parent); printk(KERN_INFO "%s: Waiting for firmware upload(2)...\n", __func__); if (ret) { - printk(KERN_ERR "%s: No firmware uploaded (timeout or file not " - "found?)\n", __func__); + printk(KERN_ERR "%s: No firmware uploaded (timeout or file not found?)\n", + __func__); return ret; } @@ -830,7 +830,7 @@ static void ds3000_release(struct dvb_frontend *fe) kfree(state); } -static struct dvb_frontend_ops ds3000_ops; +static const struct dvb_frontend_ops ds3000_ops; struct dvb_frontend *ds3000_attach(const struct ds3000_config *config, struct i2c_adapter *i2c) @@ -1104,7 +1104,7 @@ static int ds3000_initfe(struct dvb_frontend *fe) return 0; } -static struct dvb_frontend_ops ds3000_ops = { +static const struct dvb_frontend_ops ds3000_ops = { .delsys = { SYS_DVBS, SYS_DVBS2 }, .info = { .name = "Montage Technology DS3000", @@ -1144,8 +1144,7 @@ static struct dvb_frontend_ops ds3000_ops = { module_param(debug, int, 0644); MODULE_PARM_DESC(debug, "Activates frontend debugging (default:0)"); -MODULE_DESCRIPTION("DVB Frontend module for Montage Technology " - "DS3000 hardware"); +MODULE_DESCRIPTION("DVB Frontend module for Montage Technology DS3000 hardware"); MODULE_AUTHOR("Konstantin Dimitrov <kosio.dimitrov@gmail.com>"); MODULE_LICENSE("GPL"); MODULE_FIRMWARE(DS3000_DEFAULT_FIRMWARE); diff --git a/drivers/media/dvb-frontends/dvb-pll.c b/drivers/media/dvb-frontends/dvb-pll.c index 735a96662022..ef976eb23344 100644 --- a/drivers/media/dvb-frontends/dvb-pll.c +++ b/drivers/media/dvb-frontends/dvb-pll.c @@ -18,6 +18,8 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <linux/slab.h> #include <linux/module.h> #include <linux/dvb/frontend.h> @@ -25,6 +27,9 @@ #include "dvb-pll.h" +#define dprintk(fmt, arg...) \ + printk(KERN_DEBUG pr_fmt("%s: " fmt), __func__, ##arg) + struct dvb_pll_priv { /* pll number */ int nr; @@ -362,7 +367,7 @@ static void opera1_bw(struct dvb_frontend *fe, u8 *buf) result = i2c_transfer(priv->i2c, &msg, 1); if (result != 1) - printk(KERN_ERR "%s: i2c_transfer failed:%d", + pr_err("%s: i2c_transfer failed:%d", __func__, result); if (b_w <= 10000) @@ -432,7 +437,7 @@ static void samsung_dtos403ih102a_set(struct dvb_frontend *fe, u8 *buf) result = i2c_transfer(priv->i2c, &msg, 1); if (result != 1) - printk(KERN_ERR "%s: i2c_transfer failed:%d", + pr_err("%s: i2c_transfer failed:%d", __func__, result); buf[2] = 0x9e; @@ -578,7 +583,7 @@ static int dvb_pll_configure(struct dvb_frontend *fe, u8 *buf, } if (debug) - printk("pll: %s: freq=%d | i=%d/%d\n", desc->name, + dprintk("pll: %s: freq=%d | i=%d/%d\n", desc->name, frequency, i, desc->count); if (i == desc->count) return -EINVAL; @@ -594,18 +599,17 @@ static int dvb_pll_configure(struct dvb_frontend *fe, u8 *buf, desc->set(fe, buf); if (debug) - printk("pll: %s: div=%d | buf=0x%02x,0x%02x,0x%02x,0x%02x\n", + dprintk("pll: %s: div=%d | buf=0x%02x,0x%02x,0x%02x,0x%02x\n", desc->name, div, buf[0], buf[1], buf[2], buf[3]); // calculate the frequency we set it to return (div * desc->entries[i].stepsize) - desc->iffreq; } -static int dvb_pll_release(struct dvb_frontend *fe) +static void dvb_pll_release(struct dvb_frontend *fe) { kfree(fe->tuner_priv); fe->tuner_priv = NULL; - return 0; } static int dvb_pll_sleep(struct dvb_frontend *fe) @@ -803,10 +807,10 @@ struct dvb_frontend *dvb_pll_attach(struct dvb_frontend *fe, int pll_addr, fe->tuner_priv = priv; if ((debug) || (id[priv->nr] == pll_desc_id)) { - printk("dvb-pll[%d]", priv->nr); + dprintk("dvb-pll[%d]", priv->nr); if (i2c != NULL) - printk(" %d-%04x", i2c_adapter_id(i2c), pll_addr); - printk(": id# %d (%s) attached, %s\n", pll_desc_id, desc->name, + pr_cont(" %d-%04x", i2c_adapter_id(i2c), pll_addr); + pr_cont(": id# %d (%s) attached, %s\n", pll_desc_id, desc->name, id[priv->nr] == pll_desc_id ? "insmod option" : "autodetected"); } diff --git a/drivers/media/dvb-frontends/dvb_dummy_fe.c b/drivers/media/dvb-frontends/dvb_dummy_fe.c index e5bd8c62ad3a..efc3c31a7635 100644 --- a/drivers/media/dvb-frontends/dvb_dummy_fe.c +++ b/drivers/media/dvb-frontends/dvb_dummy_fe.c @@ -119,7 +119,7 @@ static void dvb_dummy_fe_release(struct dvb_frontend* fe) kfree(state); } -static struct dvb_frontend_ops dvb_dummy_fe_ofdm_ops; +static const struct dvb_frontend_ops dvb_dummy_fe_ofdm_ops; struct dvb_frontend* dvb_dummy_fe_ofdm_attach(void) { @@ -136,7 +136,7 @@ struct dvb_frontend* dvb_dummy_fe_ofdm_attach(void) return &state->frontend; } -static struct dvb_frontend_ops dvb_dummy_fe_qpsk_ops; +static const struct dvb_frontend_ops dvb_dummy_fe_qpsk_ops; struct dvb_frontend *dvb_dummy_fe_qpsk_attach(void) { @@ -153,7 +153,7 @@ struct dvb_frontend *dvb_dummy_fe_qpsk_attach(void) return &state->frontend; } -static struct dvb_frontend_ops dvb_dummy_fe_qam_ops; +static const struct dvb_frontend_ops dvb_dummy_fe_qam_ops; struct dvb_frontend *dvb_dummy_fe_qam_attach(void) { @@ -170,7 +170,7 @@ struct dvb_frontend *dvb_dummy_fe_qam_attach(void) return &state->frontend; } -static struct dvb_frontend_ops dvb_dummy_fe_ofdm_ops = { +static const struct dvb_frontend_ops dvb_dummy_fe_ofdm_ops = { .delsys = { SYS_DVBT }, .info = { .name = "Dummy DVB-T", @@ -201,7 +201,7 @@ static struct dvb_frontend_ops dvb_dummy_fe_ofdm_ops = { .read_ucblocks = dvb_dummy_fe_read_ucblocks, }; -static struct dvb_frontend_ops dvb_dummy_fe_qam_ops = { +static const struct dvb_frontend_ops dvb_dummy_fe_qam_ops = { .delsys = { SYS_DVBC_ANNEX_A }, .info = { .name = "Dummy DVB-C", @@ -230,7 +230,7 @@ static struct dvb_frontend_ops dvb_dummy_fe_qam_ops = { .read_ucblocks = dvb_dummy_fe_read_ucblocks, }; -static struct dvb_frontend_ops dvb_dummy_fe_qpsk_ops = { +static const struct dvb_frontend_ops dvb_dummy_fe_qpsk_ops = { .delsys = { SYS_DVBS }, .info = { .name = "Dummy DVB-S", diff --git a/drivers/media/dvb-frontends/ec100.c b/drivers/media/dvb-frontends/ec100.c index c9012e677cd1..d97ce21e26e1 100644 --- a/drivers/media/dvb-frontends/ec100.c +++ b/drivers/media/dvb-frontends/ec100.c @@ -280,7 +280,7 @@ static void ec100_release(struct dvb_frontend *fe) kfree(state); } -static struct dvb_frontend_ops ec100_ops; +static const struct dvb_frontend_ops ec100_ops; struct dvb_frontend *ec100_attach(const struct ec100_config *config, struct i2c_adapter *i2c) @@ -315,7 +315,7 @@ error: } EXPORT_SYMBOL(ec100_attach); -static struct dvb_frontend_ops ec100_ops = { +static const struct dvb_frontend_ops ec100_ops = { .delsys = { SYS_DVBT }, .info = { .name = "E3C EC100 DVB-T", diff --git a/drivers/media/dvb-frontends/gp8psk-fe.c b/drivers/media/dvb-frontends/gp8psk-fe.c index 93f59bfea092..efe015df7f1d 100644 --- a/drivers/media/dvb-frontends/gp8psk-fe.c +++ b/drivers/media/dvb-frontends/gp8psk-fe.c @@ -323,7 +323,7 @@ static void gp8psk_fe_release(struct dvb_frontend* fe) kfree(st); } -static struct dvb_frontend_ops gp8psk_fe_ops; +static const struct dvb_frontend_ops gp8psk_fe_ops; struct dvb_frontend *gp8psk_fe_attach(const struct gp8psk_fe_ops *ops, void *priv, bool is_rev1) @@ -351,7 +351,7 @@ struct dvb_frontend *gp8psk_fe_attach(const struct gp8psk_fe_ops *ops, } EXPORT_SYMBOL_GPL(gp8psk_fe_attach); -static struct dvb_frontend_ops gp8psk_fe_ops = { +static const struct dvb_frontend_ops gp8psk_fe_ops = { .delsys = { SYS_DVBS }, .info = { .name = "Genpix DVB-S", diff --git a/drivers/media/dvb-frontends/hd29l2.c b/drivers/media/dvb-frontends/hd29l2.c index 1c7eb477e2cd..8b53633cf325 100644 --- a/drivers/media/dvb-frontends/hd29l2.c +++ b/drivers/media/dvb-frontends/hd29l2.c @@ -793,7 +793,7 @@ static void hd29l2_release(struct dvb_frontend *fe) kfree(priv); } -static struct dvb_frontend_ops hd29l2_ops; +static const struct dvb_frontend_ops hd29l2_ops; struct dvb_frontend *hd29l2_attach(const struct hd29l2_config *config, struct i2c_adapter *i2c) @@ -828,7 +828,7 @@ err: } EXPORT_SYMBOL(hd29l2_attach); -static struct dvb_frontend_ops hd29l2_ops = { +static const struct dvb_frontend_ops hd29l2_ops = { .delsys = { SYS_DVBT }, .info = { .name = "HDIC HD29L2 DMB-TH", diff --git a/drivers/media/dvb-frontends/helene.c b/drivers/media/dvb-frontends/helene.c index dc43c5f6d0ea..ef35c2b30ea3 100644 --- a/drivers/media/dvb-frontends/helene.c +++ b/drivers/media/dvb-frontends/helene.c @@ -434,14 +434,13 @@ static int helene_init(struct dvb_frontend *fe) return helene_leave_power_save(priv); } -static int helene_release(struct dvb_frontend *fe) +static void helene_release(struct dvb_frontend *fe) { struct helene_priv *priv = fe->tuner_priv; dev_dbg(&priv->i2c->dev, "%s()\n", __func__); kfree(fe->tuner_priv); fe->tuner_priv = NULL; - return 0; } static int helene_sleep(struct dvb_frontend *fe) diff --git a/drivers/media/dvb-frontends/horus3a.c b/drivers/media/dvb-frontends/horus3a.c index 0c089b5986a1..94bb4f7a2298 100644 --- a/drivers/media/dvb-frontends/horus3a.c +++ b/drivers/media/dvb-frontends/horus3a.c @@ -151,14 +151,13 @@ static int horus3a_init(struct dvb_frontend *fe) return 0; } -static int horus3a_release(struct dvb_frontend *fe) +static void horus3a_release(struct dvb_frontend *fe) { struct horus3a_priv *priv = fe->tuner_priv; dev_dbg(&priv->i2c->dev, "%s()\n", __func__); kfree(fe->tuner_priv); fe->tuner_priv = NULL; - return 0; } static int horus3a_sleep(struct dvb_frontend *fe) diff --git a/drivers/media/dvb-frontends/itd1000.c b/drivers/media/dvb-frontends/itd1000.c index cadcae4cff89..475525134327 100644 --- a/drivers/media/dvb-frontends/itd1000.c +++ b/drivers/media/dvb-frontends/itd1000.c @@ -348,11 +348,10 @@ static int itd1000_sleep(struct dvb_frontend *fe) return 0; } -static int itd1000_release(struct dvb_frontend *fe) +static void itd1000_release(struct dvb_frontend *fe) { kfree(fe->tuner_priv); fe->tuner_priv = NULL; - return 0; } static const struct dvb_tuner_ops itd1000_tuner_ops = { diff --git a/drivers/media/dvb-frontends/ix2505v.c b/drivers/media/dvb-frontends/ix2505v.c index 2826bbb36b73..ca371680a69f 100644 --- a/drivers/media/dvb-frontends/ix2505v.c +++ b/drivers/media/dvb-frontends/ix2505v.c @@ -94,14 +94,13 @@ static int ix2505v_write(struct ix2505v_state *state, u8 buf[], u8 count) return 0; } -static int ix2505v_release(struct dvb_frontend *fe) +static void ix2505v_release(struct dvb_frontend *fe) { struct ix2505v_state *state = fe->tuner_priv; fe->tuner_priv = NULL; kfree(state); - return 0; } /** diff --git a/drivers/media/dvb-frontends/l64781.c b/drivers/media/dvb-frontends/l64781.c index 2f3d0519e19b..68923c84679a 100644 --- a/drivers/media/dvb-frontends/l64781.c +++ b/drivers/media/dvb-frontends/l64781.c @@ -496,7 +496,7 @@ static void l64781_release(struct dvb_frontend* fe) kfree(state); } -static struct dvb_frontend_ops l64781_ops; +static const struct dvb_frontend_ops l64781_ops; struct dvb_frontend* l64781_attach(const struct l64781_config* config, struct i2c_adapter* i2c) @@ -571,7 +571,7 @@ error: return NULL; } -static struct dvb_frontend_ops l64781_ops = { +static const struct dvb_frontend_ops l64781_ops = { .delsys = { SYS_DVBT }, .info = { .name = "LSI L64781 DVB-T", diff --git a/drivers/media/dvb-frontends/lg2160.c b/drivers/media/dvb-frontends/lg2160.c index f51a3a0b3949..3b31e5f20f46 100644 --- a/drivers/media/dvb-frontends/lg2160.c +++ b/drivers/media/dvb-frontends/lg2160.c @@ -1359,7 +1359,7 @@ static void lg216x_release(struct dvb_frontend *fe) kfree(state); } -static struct dvb_frontend_ops lg2160_ops = { +static const struct dvb_frontend_ops lg2160_ops = { .delsys = { SYS_ATSCMH }, .info = { .name = "LG Electronics LG2160 ATSC/MH Frontend", @@ -1387,7 +1387,7 @@ static struct dvb_frontend_ops lg2160_ops = { .release = lg216x_release, }; -static struct dvb_frontend_ops lg2161_ops = { +static const struct dvb_frontend_ops lg2161_ops = { .delsys = { SYS_ATSCMH }, .info = { .name = "LG Electronics LG2161 ATSC/MH Frontend", diff --git a/drivers/media/dvb-frontends/lgdt3305.c b/drivers/media/dvb-frontends/lgdt3305.c index 4503e8852fd1..9f5d9380bf5f 100644 --- a/drivers/media/dvb-frontends/lgdt3305.c +++ b/drivers/media/dvb-frontends/lgdt3305.c @@ -1103,8 +1103,8 @@ static void lgdt3305_release(struct dvb_frontend *fe) kfree(state); } -static struct dvb_frontend_ops lgdt3304_ops; -static struct dvb_frontend_ops lgdt3305_ops; +static const struct dvb_frontend_ops lgdt3304_ops; +static const struct dvb_frontend_ops lgdt3305_ops; struct dvb_frontend *lgdt3305_attach(const struct lgdt3305_config *config, struct i2c_adapter *i2c_adap) @@ -1164,7 +1164,7 @@ fail: } EXPORT_SYMBOL(lgdt3305_attach); -static struct dvb_frontend_ops lgdt3304_ops = { +static const struct dvb_frontend_ops lgdt3304_ops = { .delsys = { SYS_ATSC, SYS_DVBC_ANNEX_B }, .info = { .name = "LG Electronics LGDT3304 VSB/QAM Frontend", @@ -1187,7 +1187,7 @@ static struct dvb_frontend_ops lgdt3304_ops = { .release = lgdt3305_release, }; -static struct dvb_frontend_ops lgdt3305_ops = { +static const struct dvb_frontend_ops lgdt3305_ops = { .delsys = { SYS_ATSC, SYS_DVBC_ANNEX_B }, .info = { .name = "LG Electronics LGDT3305 VSB/QAM Frontend", diff --git a/drivers/media/dvb-frontends/lgdt3306a.c b/drivers/media/dvb-frontends/lgdt3306a.c index 0ca4e810e9d8..19dca46b1171 100644 --- a/drivers/media/dvb-frontends/lgdt3306a.c +++ b/drivers/media/dvb-frontends/lgdt3306a.c @@ -1767,7 +1767,7 @@ static void lgdt3306a_release(struct dvb_frontend *fe) kfree(state); } -static struct dvb_frontend_ops lgdt3306a_ops; +static const struct dvb_frontend_ops lgdt3306a_ops; struct dvb_frontend *lgdt3306a_attach(const struct lgdt3306a_config *config, struct i2c_adapter *i2c_adap) @@ -2103,7 +2103,7 @@ static void lgdt3306a_DumpRegs(struct lgdt3306a_state *state) -static struct dvb_frontend_ops lgdt3306a_ops = { +static const struct dvb_frontend_ops lgdt3306a_ops = { .delsys = { SYS_ATSC, SYS_DVBC_ANNEX_B }, .info = { .name = "LG Electronics LGDT3306A VSB/QAM Frontend", diff --git a/drivers/media/dvb-frontends/lgdt330x.c b/drivers/media/dvb-frontends/lgdt330x.c index 96bf254da21e..2f4a0316f89c 100644 --- a/drivers/media/dvb-frontends/lgdt330x.c +++ b/drivers/media/dvb-frontends/lgdt330x.c @@ -405,8 +405,7 @@ static int lgdt330x_set_parameters(struct dvb_frontend *fe) return -1; } if (err < 0) - printk(KERN_WARNING "lgdt330x: %s: error blasting " - "bytes to lgdt3303 for modulation type(%d)\n", + printk(KERN_WARNING "lgdt330x: %s: error blasting bytes to lgdt3303 for modulation type(%d)\n", __func__, p->modulation); /* @@ -729,8 +728,8 @@ static void lgdt330x_release(struct dvb_frontend* fe) kfree(state); } -static struct dvb_frontend_ops lgdt3302_ops; -static struct dvb_frontend_ops lgdt3303_ops; +static const struct dvb_frontend_ops lgdt3302_ops; +static const struct dvb_frontend_ops lgdt3303_ops; struct dvb_frontend* lgdt330x_attach(const struct lgdt330x_config* config, struct i2c_adapter* i2c) @@ -775,7 +774,7 @@ error: return NULL; } -static struct dvb_frontend_ops lgdt3302_ops = { +static const struct dvb_frontend_ops lgdt3302_ops = { .delsys = { SYS_ATSC, SYS_DVBC_ANNEX_B }, .info = { .name= "LG Electronics LGDT3302 VSB/QAM Frontend", @@ -798,7 +797,7 @@ static struct dvb_frontend_ops lgdt3302_ops = { .release = lgdt330x_release, }; -static struct dvb_frontend_ops lgdt3303_ops = { +static const struct dvb_frontend_ops lgdt3303_ops = { .delsys = { SYS_ATSC, SYS_DVBC_ANNEX_B }, .info = { .name= "LG Electronics LGDT3303 VSB/QAM Frontend", diff --git a/drivers/media/dvb-frontends/lgs8gl5.c b/drivers/media/dvb-frontends/lgs8gl5.c index fbfd87b5b803..970e42fdbc1b 100644 --- a/drivers/media/dvb-frontends/lgs8gl5.c +++ b/drivers/media/dvb-frontends/lgs8gl5.c @@ -376,7 +376,7 @@ lgs8gl5_release(struct dvb_frontend *fe) } -static struct dvb_frontend_ops lgs8gl5_ops; +static const struct dvb_frontend_ops lgs8gl5_ops; struct dvb_frontend* @@ -412,7 +412,7 @@ error: EXPORT_SYMBOL(lgs8gl5_attach); -static struct dvb_frontend_ops lgs8gl5_ops = { +static const struct dvb_frontend_ops lgs8gl5_ops = { .delsys = { SYS_DTMB }, .info = { .name = "Legend Silicon LGS-8GL5 DMB-TH", diff --git a/drivers/media/dvb-frontends/lgs8gxx.c b/drivers/media/dvb-frontends/lgs8gxx.c index 919daeb96747..6d2e62469d58 100644 --- a/drivers/media/dvb-frontends/lgs8gxx.c +++ b/drivers/media/dvb-frontends/lgs8gxx.c @@ -985,7 +985,7 @@ static int lgs8gxx_i2c_gate_ctrl(struct dvb_frontend *fe, int enable) return lgs8gxx_write_reg(priv, 0x01, 0); } -static struct dvb_frontend_ops lgs8gxx_ops = { +static const struct dvb_frontend_ops lgs8gxx_ops = { .delsys = { SYS_DTMB }, .info = { .name = "Legend Silicon LGS8913/LGS8GXX DMB-TH", diff --git a/drivers/media/dvb-frontends/m88ds3103.c b/drivers/media/dvb-frontends/m88ds3103.c index e0fe5bc9dbce..50bce68ffd66 100644 --- a/drivers/media/dvb-frontends/m88ds3103.c +++ b/drivers/media/dvb-frontends/m88ds3103.c @@ -16,7 +16,7 @@ #include "m88ds3103_priv.h" -static struct dvb_frontend_ops m88ds3103_ops; +static const struct dvb_frontend_ops m88ds3103_ops; /* write single register with mask */ static int m88ds3103_update_bits(struct m88ds3103_dev *dev, @@ -1295,7 +1295,7 @@ struct dvb_frontend *m88ds3103_attach(const struct m88ds3103_config *cfg, } EXPORT_SYMBOL(m88ds3103_attach); -static struct dvb_frontend_ops m88ds3103_ops = { +static const struct dvb_frontend_ops m88ds3103_ops = { .delsys = {SYS_DVBS, SYS_DVBS2}, .info = { .name = "Montage Technology M88DS3103", diff --git a/drivers/media/dvb-frontends/m88rs2000.c b/drivers/media/dvb-frontends/m88rs2000.c index ef79a4ec31e2..ce6c21d405ee 100644 --- a/drivers/media/dvb-frontends/m88rs2000.c +++ b/drivers/media/dvb-frontends/m88rs2000.c @@ -75,8 +75,8 @@ static int m88rs2000_writereg(struct m88rs2000_state *state, ret = i2c_transfer(state->i2c, &msg, 1); if (ret != 1) - deb_info("%s: writereg error (reg == 0x%02x, val == 0x%02x, " - "ret == %i)\n", __func__, reg, data, ret); + deb_info("%s: writereg error (reg == 0x%02x, val == 0x%02x, ret == %i)\n", + __func__, reg, data, ret); return (ret != 1) ? -EREMOTEIO : 0; } @@ -618,10 +618,9 @@ static int m88rs2000_set_frontend(struct dvb_frontend *fe) state->no_lock_count = 0; if (c->delivery_system != SYS_DVBS) { - deb_info("%s: unsupported delivery " - "system selected (%d)\n", - __func__, c->delivery_system); - return -EOPNOTSUPP; + deb_info("%s: unsupported delivery system selected (%d)\n", + __func__, c->delivery_system); + return -EOPNOTSUPP; } /* Set Tuner */ @@ -753,7 +752,7 @@ static void m88rs2000_release(struct dvb_frontend *fe) kfree(state); } -static struct dvb_frontend_ops m88rs2000_ops = { +static const struct dvb_frontend_ops m88rs2000_ops = { .delsys = { SYS_DVBS }, .info = { .name = "M88RS2000 DVB-S", diff --git a/drivers/media/dvb-frontends/mb86a16.c b/drivers/media/dvb-frontends/mb86a16.c index 79bc671e8769..9bb122c39c1b 100644 --- a/drivers/media/dvb-frontends/mb86a16.c +++ b/drivers/media/dvb-frontends/mb86a16.c @@ -1816,7 +1816,7 @@ static enum dvbfe_algo mb86a16_frontend_algo(struct dvb_frontend *fe) return DVBFE_ALGO_CUSTOM; } -static struct dvb_frontend_ops mb86a16_ops = { +static const struct dvb_frontend_ops mb86a16_ops = { .delsys = { SYS_DVBS }, .info = { .name = "Fujitsu MB86A16 DVB-S", diff --git a/drivers/media/dvb-frontends/mb86a20s.c b/drivers/media/dvb-frontends/mb86a20s.c index fe79358b035e..e8ac8c3e2ec0 100644 --- a/drivers/media/dvb-frontends/mb86a20s.c +++ b/drivers/media/dvb-frontends/mb86a20s.c @@ -1967,6 +1967,7 @@ static int mb86a20s_read_status_and_stats(struct dvb_frontend *fe, if (status_nr < 0) { dev_err(&state->i2c->dev, "%s: Can't read frontend lock status\n", __func__); + rc = status_nr; goto error; } @@ -2059,7 +2060,7 @@ static int mb86a20s_get_frontend_algo(struct dvb_frontend *fe) return DVBFE_ALGO_HW; } -static struct dvb_frontend_ops mb86a20s_ops; +static const struct dvb_frontend_ops mb86a20s_ops; struct dvb_frontend *mb86a20s_attach(const struct mb86a20s_config *config, struct i2c_adapter *i2c) @@ -2107,7 +2108,7 @@ error: } EXPORT_SYMBOL(mb86a20s_attach); -static struct dvb_frontend_ops mb86a20s_ops = { +static const struct dvb_frontend_ops mb86a20s_ops = { .delsys = { SYS_ISDBT }, /* Use dib8000 values per default */ .info = { diff --git a/drivers/media/dvb-frontends/mn88472.c b/drivers/media/dvb-frontends/mn88472.c index 18fb2df1e2bd..29dd13b36c28 100644 --- a/drivers/media/dvb-frontends/mn88472.c +++ b/drivers/media/dvb-frontends/mn88472.c @@ -411,7 +411,7 @@ err: return ret; } -static struct dvb_frontend_ops mn88472_ops = { +static const struct dvb_frontend_ops mn88472_ops = { .delsys = {SYS_DVBT, SYS_DVBT2, SYS_DVBC_ANNEX_A}, .info = { .name = "Panasonic MN88472", @@ -488,18 +488,6 @@ static int mn88472_probe(struct i2c_client *client, goto err_kfree; } - /* Check demod answers with correct chip id */ - ret = regmap_read(dev->regmap[0], 0xff, &utmp); - if (ret) - goto err_regmap_0_regmap_exit; - - dev_dbg(&client->dev, "chip id=%02x\n", utmp); - - if (utmp != 0x02) { - ret = -ENODEV; - goto err_regmap_0_regmap_exit; - } - /* * Chip has three I2C addresses for different register banks. Used * addresses are 0x18, 0x1a and 0x1c. We register two dummy clients, @@ -536,6 +524,18 @@ static int mn88472_probe(struct i2c_client *client, } i2c_set_clientdata(dev->client[2], dev); + /* Check demod answers with correct chip id */ + ret = regmap_read(dev->regmap[2], 0xff, &utmp); + if (ret) + goto err_regmap_2_regmap_exit; + + dev_dbg(&client->dev, "chip id=%02x\n", utmp); + + if (utmp != 0x02) { + ret = -ENODEV; + goto err_regmap_2_regmap_exit; + } + /* Sleep because chip is active by default */ ret = regmap_write(dev->regmap[2], 0x05, 0x3e); if (ret) diff --git a/drivers/media/dvb-frontends/mn88473.c b/drivers/media/dvb-frontends/mn88473.c index 451974a1d7ed..c221c7d2ac3e 100644 --- a/drivers/media/dvb-frontends/mn88473.c +++ b/drivers/media/dvb-frontends/mn88473.c @@ -239,62 +239,68 @@ static int mn88473_read_status(struct dvb_frontend *fe, enum fe_status *status) struct i2c_client *client = fe->demodulator_priv; struct mn88473_dev *dev = i2c_get_clientdata(client); struct dtv_frontend_properties *c = &fe->dtv_property_cache; - int ret; - unsigned int uitmp; + int ret, i, stmp; + unsigned int utmp, utmp1, utmp2; + u8 buf[5]; if (!dev->active) { ret = -EAGAIN; goto err; } - *status = 0; - + /* Lock detection */ switch (c->delivery_system) { case SYS_DVBT: - ret = regmap_read(dev->regmap[0], 0x62, &uitmp); + ret = regmap_read(dev->regmap[0], 0x62, &utmp); if (ret) goto err; - if (!(uitmp & 0xa0)) { - if ((uitmp & 0x0f) >= 0x09) + if (!(utmp & 0xa0)) { + if ((utmp & 0x0f) >= 0x09) *status = FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_VITERBI | FE_HAS_SYNC | FE_HAS_LOCK; - else if ((uitmp & 0x0f) >= 0x03) + else if ((utmp & 0x0f) >= 0x03) *status = FE_HAS_SIGNAL | FE_HAS_CARRIER; + } else { + *status = 0; } break; case SYS_DVBT2: - ret = regmap_read(dev->regmap[2], 0x8b, &uitmp); + ret = regmap_read(dev->regmap[2], 0x8b, &utmp); if (ret) goto err; - if (!(uitmp & 0x40)) { - if ((uitmp & 0x0f) >= 0x0d) + if (!(utmp & 0x40)) { + if ((utmp & 0x0f) >= 0x0d) *status = FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_VITERBI | FE_HAS_SYNC | FE_HAS_LOCK; - else if ((uitmp & 0x0f) >= 0x0a) + else if ((utmp & 0x0f) >= 0x0a) *status = FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_VITERBI; - else if ((uitmp & 0x0f) >= 0x07) + else if ((utmp & 0x0f) >= 0x07) *status = FE_HAS_SIGNAL | FE_HAS_CARRIER; + } else { + *status = 0; } break; case SYS_DVBC_ANNEX_A: - ret = regmap_read(dev->regmap[1], 0x85, &uitmp); + ret = regmap_read(dev->regmap[1], 0x85, &utmp); if (ret) goto err; - if (!(uitmp & 0x40)) { - ret = regmap_read(dev->regmap[1], 0x89, &uitmp); + if (!(utmp & 0x40)) { + ret = regmap_read(dev->regmap[1], 0x89, &utmp); if (ret) goto err; - if (uitmp & 0x01) + if (utmp & 0x01) *status = FE_HAS_SIGNAL | FE_HAS_CARRIER | - FE_HAS_VITERBI | FE_HAS_SYNC | - FE_HAS_LOCK; + FE_HAS_VITERBI | FE_HAS_SYNC | + FE_HAS_LOCK; + } else { + *status = 0; } break; default: @@ -302,6 +308,148 @@ static int mn88473_read_status(struct dvb_frontend *fe, enum fe_status *status) goto err; } + /* Signal strength */ + if (*status & FE_HAS_SIGNAL) { + for (i = 0; i < 2; i++) { + ret = regmap_bulk_read(dev->regmap[2], 0x86 + i, + &buf[i], 1); + if (ret) + goto err; + } + + /* AGCRD[15:6] gives us a 10bit value ([5:0] are always 0) */ + utmp1 = buf[0] << 8 | buf[1] << 0 | buf[0] >> 2; + dev_dbg(&client->dev, "strength=%u\n", utmp1); + + c->strength.stat[0].scale = FE_SCALE_RELATIVE; + c->strength.stat[0].uvalue = utmp1; + } else { + c->strength.stat[0].scale = FE_SCALE_NOT_AVAILABLE; + } + + /* CNR */ + if (*status & FE_HAS_VITERBI && c->delivery_system == SYS_DVBT) { + /* DVB-T CNR */ + ret = regmap_bulk_read(dev->regmap[0], 0x8f, buf, 2); + if (ret) + goto err; + + utmp = buf[0] << 8 | buf[1] << 0; + if (utmp) { + /* CNR[dB]: 10 * (log10(65536 / value) + 0.2) */ + /* log10(65536) = 80807124, 0.2 = 3355443 */ + stmp = div_u64(((u64)80807124 - intlog10(utmp) + + 3355443) * 10000, 1 << 24); + dev_dbg(&client->dev, "cnr=%d value=%u\n", stmp, utmp); + } else { + stmp = 0; + } + + c->cnr.stat[0].svalue = stmp; + c->cnr.stat[0].scale = FE_SCALE_DECIBEL; + } else if (*status & FE_HAS_VITERBI && + c->delivery_system == SYS_DVBT2) { + /* DVB-T2 CNR */ + for (i = 0; i < 3; i++) { + ret = regmap_bulk_read(dev->regmap[2], 0xb7 + i, + &buf[i], 1); + if (ret) + goto err; + } + + utmp = buf[1] << 8 | buf[2] << 0; + utmp1 = (buf[0] >> 2) & 0x01; /* 0=SISO, 1=MISO */ + if (utmp) { + if (utmp1) { + /* CNR[dB]: 10 * (log10(16384 / value) - 0.6) */ + /* log10(16384) = 70706234, 0.6 = 10066330 */ + stmp = div_u64(((u64)70706234 - intlog10(utmp) + - 10066330) * 10000, 1 << 24); + dev_dbg(&client->dev, "cnr=%d value=%u MISO\n", + stmp, utmp); + } else { + /* CNR[dB]: 10 * (log10(65536 / value) + 0.2) */ + /* log10(65536) = 80807124, 0.2 = 3355443 */ + stmp = div_u64(((u64)80807124 - intlog10(utmp) + + 3355443) * 10000, 1 << 24); + dev_dbg(&client->dev, "cnr=%d value=%u SISO\n", + stmp, utmp); + } + } else { + stmp = 0; + } + + c->cnr.stat[0].svalue = stmp; + c->cnr.stat[0].scale = FE_SCALE_DECIBEL; + } else if (*status & FE_HAS_VITERBI && + c->delivery_system == SYS_DVBC_ANNEX_A) { + /* DVB-C CNR */ + ret = regmap_bulk_read(dev->regmap[1], 0xa1, buf, 4); + if (ret) + goto err; + + utmp1 = buf[0] << 8 | buf[1] << 0; /* signal */ + utmp2 = buf[2] << 8 | buf[3] << 0; /* noise */ + if (utmp1 && utmp2) { + /* CNR[dB]: 10 * log10(8 * (signal / noise)) */ + /* log10(8) = 15151336 */ + stmp = div_u64(((u64)15151336 + intlog10(utmp1) + - intlog10(utmp2)) * 10000, 1 << 24); + dev_dbg(&client->dev, "cnr=%d signal=%u noise=%u\n", + stmp, utmp1, utmp2); + } else { + stmp = 0; + } + + c->cnr.stat[0].svalue = stmp; + c->cnr.stat[0].scale = FE_SCALE_DECIBEL; + } else { + c->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; + } + + /* BER */ + if (*status & FE_HAS_LOCK && (c->delivery_system == SYS_DVBT || + c->delivery_system == SYS_DVBC_ANNEX_A)) { + /* DVB-T & DVB-C BER */ + ret = regmap_bulk_read(dev->regmap[0], 0x92, buf, 5); + if (ret) + goto err; + + utmp1 = buf[0] << 16 | buf[1] << 8 | buf[2] << 0; + utmp2 = buf[3] << 8 | buf[4] << 0; + utmp2 = utmp2 * 8 * 204; + dev_dbg(&client->dev, "post_bit_error=%u post_bit_count=%u\n", + utmp1, utmp2); + + c->post_bit_error.stat[0].scale = FE_SCALE_COUNTER; + c->post_bit_error.stat[0].uvalue += utmp1; + c->post_bit_count.stat[0].scale = FE_SCALE_COUNTER; + c->post_bit_count.stat[0].uvalue += utmp2; + } else { + c->post_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; + c->post_bit_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; + } + + /* PER */ + if (*status & FE_HAS_LOCK) { + ret = regmap_bulk_read(dev->regmap[0], 0xdd, buf, 4); + if (ret) + goto err; + + utmp1 = buf[0] << 8 | buf[1] << 0; + utmp2 = buf[2] << 8 | buf[3] << 0; + dev_dbg(&client->dev, "block_error=%u block_count=%u\n", + utmp1, utmp2); + + c->block_error.stat[0].scale = FE_SCALE_COUNTER; + c->block_error.stat[0].uvalue += utmp1; + c->block_count.stat[0].scale = FE_SCALE_COUNTER; + c->block_count.stat[0].uvalue += utmp2; + } else { + c->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; + c->block_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; + } + return 0; err: dev_dbg(&client->dev, "failed=%d\n", ret); @@ -312,6 +460,7 @@ static int mn88473_init(struct dvb_frontend *fe) { struct i2c_client *client = fe->demodulator_priv; struct mn88473_dev *dev = i2c_get_clientdata(client); + struct dtv_frontend_properties *c = &fe->dtv_property_cache; int ret, len, remain; unsigned int uitmp; const struct firmware *fw; @@ -378,6 +527,20 @@ warm: dev->active = true; + /* init stats here to indicate which stats are supported */ + c->strength.len = 1; + c->strength.stat[0].scale = FE_SCALE_NOT_AVAILABLE; + c->cnr.len = 1; + c->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; + c->post_bit_error.len = 1; + c->post_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; + c->post_bit_count.len = 1; + c->post_bit_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; + c->block_error.len = 1; + c->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; + c->block_count.len = 1; + c->block_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; + return 0; err_release_firmware: release_firmware(fw); @@ -485,18 +648,6 @@ static int mn88473_probe(struct i2c_client *client, goto err_kfree; } - /* Check demod answers with correct chip id */ - ret = regmap_read(dev->regmap[0], 0xff, &uitmp); - if (ret) - goto err_regmap_0_regmap_exit; - - dev_dbg(&client->dev, "chip id=%02x\n", uitmp); - - if (uitmp != 0x03) { - ret = -ENODEV; - goto err_regmap_0_regmap_exit; - } - /* * Chip has three I2C addresses for different register banks. Used * addresses are 0x18, 0x1a and 0x1c. We register two dummy clients, @@ -533,6 +684,18 @@ static int mn88473_probe(struct i2c_client *client, } i2c_set_clientdata(dev->client[2], dev); + /* Check demod answers with correct chip id */ + ret = regmap_read(dev->regmap[2], 0xff, &uitmp); + if (ret) + goto err_regmap_2_regmap_exit; + + dev_dbg(&client->dev, "chip id=%02x\n", uitmp); + + if (uitmp != 0x03) { + ret = -ENODEV; + goto err_regmap_2_regmap_exit; + } + /* Sleep because chip is active by default */ ret = regmap_write(dev->regmap[2], 0x05, 0x3e); if (ret) diff --git a/drivers/media/dvb-frontends/mn88473_priv.h b/drivers/media/dvb-frontends/mn88473_priv.h index e6c65893e451..5fc463d147c8 100644 --- a/drivers/media/dvb-frontends/mn88473_priv.h +++ b/drivers/media/dvb-frontends/mn88473_priv.h @@ -18,7 +18,9 @@ #define MN88473_PRIV_H #include "dvb_frontend.h" +#include "dvb_math.h" #include "mn88473.h" +#include <linux/math64.h> #include <linux/firmware.h> #include <linux/regmap.h> diff --git a/drivers/media/dvb-frontends/mt312.c b/drivers/media/dvb-frontends/mt312.c index fc08429c99b7..961b9a2508e0 100644 --- a/drivers/media/dvb-frontends/mt312.c +++ b/drivers/media/dvb-frontends/mt312.c @@ -457,8 +457,8 @@ static int mt312_read_status(struct dvb_frontend *fe, enum fe_status *s) if (ret < 0) return ret; - dprintk("QPSK_STAT_H: 0x%02x, QPSK_STAT_L: 0x%02x," - " FEC_STATUS: 0x%02x\n", status[0], status[1], status[2]); + dprintk("QPSK_STAT_H: 0x%02x, QPSK_STAT_L: 0x%02x, FEC_STATUS: 0x%02x\n", + status[0], status[1], status[2]); if (status[0] & 0xc0) *s |= FE_HAS_SIGNAL; /* signal noise ratio */ @@ -748,7 +748,7 @@ static void mt312_release(struct dvb_frontend *fe) } #define MT312_SYS_CLK 90000000UL /* 90 MHz */ -static struct dvb_frontend_ops mt312_ops = { +static const struct dvb_frontend_ops mt312_ops = { .delsys = { SYS_DVBS }, .info = { .name = "Zarlink ???? DVB-S", @@ -827,8 +827,7 @@ struct dvb_frontend *mt312_attach(const struct mt312_config *config, state->freq_mult = 9; break; default: - printk(KERN_WARNING "Only Zarlink VP310/MT312/ZL10313" - " are supported chips.\n"); + printk(KERN_WARNING "Only Zarlink VP310/MT312/ZL10313 are supported chips.\n"); goto error; } diff --git a/drivers/media/dvb-frontends/mt352.c b/drivers/media/dvb-frontends/mt352.c index c0bb6328956b..48ea0408f02a 100644 --- a/drivers/media/dvb-frontends/mt352.c +++ b/drivers/media/dvb-frontends/mt352.c @@ -538,7 +538,7 @@ static void mt352_release(struct dvb_frontend* fe) kfree(state); } -static struct dvb_frontend_ops mt352_ops; +static const struct dvb_frontend_ops mt352_ops; struct dvb_frontend* mt352_attach(const struct mt352_config* config, struct i2c_adapter* i2c) @@ -566,7 +566,7 @@ error: return NULL; } -static struct dvb_frontend_ops mt352_ops = { +static const struct dvb_frontend_ops mt352_ops = { .delsys = { SYS_DVBT }, .info = { .name = "Zarlink MT352 DVB-T", diff --git a/drivers/media/dvb-frontends/nxt200x.c b/drivers/media/dvb-frontends/nxt200x.c index 79c3040912ab..2fe40372ca07 100644 --- a/drivers/media/dvb-frontends/nxt200x.c +++ b/drivers/media/dvb-frontends/nxt200x.c @@ -289,8 +289,7 @@ static void nxt200x_microcontroller_stop (struct nxt200x_state* state) counter++; } - pr_warn("Timeout waiting for nxt200x to stop. This is ok after " - "firmware upload.\n"); + pr_warn("Timeout waiting for nxt200x to stop. This is ok after firmware upload.\n"); return; } @@ -893,8 +892,8 @@ static int nxt2002_init(struct dvb_frontend* fe) state->i2c->dev.parent); pr_debug("%s: Waiting for firmware upload(2)...\n", __func__); if (ret) { - pr_err("%s: No firmware uploaded (timeout or file not found?)" - "\n", __func__); + pr_err("%s: No firmware uploaded (timeout or file not found?)\n", + __func__); return ret; } @@ -960,8 +959,8 @@ static int nxt2004_init(struct dvb_frontend* fe) state->i2c->dev.parent); pr_debug("%s: Waiting for firmware upload(2)...\n", __func__); if (ret) { - pr_err("%s: No firmware uploaded (timeout or file not found?)" - "\n", __func__); + pr_err("%s: No firmware uploaded (timeout or file not found?)\n", + __func__); return ret; } @@ -1150,7 +1149,7 @@ static void nxt200x_release(struct dvb_frontend* fe) kfree(state); } -static struct dvb_frontend_ops nxt200x_ops; +static const struct dvb_frontend_ops nxt200x_ops; struct dvb_frontend* nxt200x_attach(const struct nxt200x_config* config, struct i2c_adapter* i2c) @@ -1213,7 +1212,7 @@ error: return NULL; } -static struct dvb_frontend_ops nxt200x_ops = { +static const struct dvb_frontend_ops nxt200x_ops = { .delsys = { SYS_ATSC, SYS_DVBC_ANNEX_B }, .info = { .name = "Nextwave NXT200X VSB/QAM frontend", diff --git a/drivers/media/dvb-frontends/nxt6000.c b/drivers/media/dvb-frontends/nxt6000.c index 73f9505367ac..1ce5ea28489b 100644 --- a/drivers/media/dvb-frontends/nxt6000.c +++ b/drivers/media/dvb-frontends/nxt6000.c @@ -19,6 +19,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include <linux/init.h> #include <linux/kernel.h> #include <linux/module.h> @@ -39,7 +41,11 @@ struct nxt6000_state { }; static int debug; -#define dprintk if (debug) printk +#define dprintk(fmt, arg...) do { \ + if (debug) \ + printk(KERN_DEBUG pr_fmt("%s: " fmt), \ + __func__, ##arg); \ +} while (0) static int nxt6000_writereg(struct nxt6000_state* state, u8 reg, u8 data) { @@ -215,119 +221,129 @@ static void nxt6000_dump_status(struct nxt6000_state *state) { u8 val; -/* - printk("RS_COR_STAT: 0x%02X\n", nxt6000_readreg(fe, RS_COR_STAT)); - printk("VIT_SYNC_STATUS: 0x%02X\n", nxt6000_readreg(fe, VIT_SYNC_STATUS)); - printk("OFDM_COR_STAT: 0x%02X\n", nxt6000_readreg(fe, OFDM_COR_STAT)); - printk("OFDM_SYR_STAT: 0x%02X\n", nxt6000_readreg(fe, OFDM_SYR_STAT)); - printk("OFDM_TPS_RCVD_1: 0x%02X\n", nxt6000_readreg(fe, OFDM_TPS_RCVD_1)); - printk("OFDM_TPS_RCVD_2: 0x%02X\n", nxt6000_readreg(fe, OFDM_TPS_RCVD_2)); - printk("OFDM_TPS_RCVD_3: 0x%02X\n", nxt6000_readreg(fe, OFDM_TPS_RCVD_3)); - printk("OFDM_TPS_RCVD_4: 0x%02X\n", nxt6000_readreg(fe, OFDM_TPS_RCVD_4)); - printk("OFDM_TPS_RESERVED_1: 0x%02X\n", nxt6000_readreg(fe, OFDM_TPS_RESERVED_1)); - printk("OFDM_TPS_RESERVED_2: 0x%02X\n", nxt6000_readreg(fe, OFDM_TPS_RESERVED_2)); -*/ - printk("NXT6000 status:"); +#if 0 + pr_info("RS_COR_STAT: 0x%02X\n", + nxt6000_readreg(fe, RS_COR_STAT)); + pr_info("VIT_SYNC_STATUS: 0x%02X\n", + nxt6000_readreg(fe, VIT_SYNC_STATUS)); + pr_info("OFDM_COR_STAT: 0x%02X\n", + nxt6000_readreg(fe, OFDM_COR_STAT)); + pr_info("OFDM_SYR_STAT: 0x%02X\n", + nxt6000_readreg(fe, OFDM_SYR_STAT)); + pr_info("OFDM_TPS_RCVD_1: 0x%02X\n", + nxt6000_readreg(fe, OFDM_TPS_RCVD_1)); + pr_info("OFDM_TPS_RCVD_2: 0x%02X\n", + nxt6000_readreg(fe, OFDM_TPS_RCVD_2)); + pr_info("OFDM_TPS_RCVD_3: 0x%02X\n", + nxt6000_readreg(fe, OFDM_TPS_RCVD_3)); + pr_info("OFDM_TPS_RCVD_4: 0x%02X\n", + nxt6000_readreg(fe, OFDM_TPS_RCVD_4)); + pr_info("OFDM_TPS_RESERVED_1: 0x%02X\n", + nxt6000_readreg(fe, OFDM_TPS_RESERVED_1)); + pr_info("OFDM_TPS_RESERVED_2: 0x%02X\n", + nxt6000_readreg(fe, OFDM_TPS_RESERVED_2)); +#endif + pr_info("NXT6000 status:"); val = nxt6000_readreg(state, RS_COR_STAT); - printk(" DATA DESCR LOCK: %d,", val & 0x01); - printk(" DATA SYNC LOCK: %d,", (val >> 1) & 0x01); + pr_cont(" DATA DESCR LOCK: %d,", val & 0x01); + pr_cont(" DATA SYNC LOCK: %d,", (val >> 1) & 0x01); val = nxt6000_readreg(state, VIT_SYNC_STATUS); - printk(" VITERBI LOCK: %d,", (val >> 7) & 0x01); + pr_cont(" VITERBI LOCK: %d,", (val >> 7) & 0x01); switch ((val >> 4) & 0x07) { case 0x00: - printk(" VITERBI CODERATE: 1/2,"); + pr_cont(" VITERBI CODERATE: 1/2,"); break; case 0x01: - printk(" VITERBI CODERATE: 2/3,"); + pr_cont(" VITERBI CODERATE: 2/3,"); break; case 0x02: - printk(" VITERBI CODERATE: 3/4,"); + pr_cont(" VITERBI CODERATE: 3/4,"); break; case 0x03: - printk(" VITERBI CODERATE: 5/6,"); + pr_cont(" VITERBI CODERATE: 5/6,"); break; case 0x04: - printk(" VITERBI CODERATE: 7/8,"); + pr_cont(" VITERBI CODERATE: 7/8,"); break; default: - printk(" VITERBI CODERATE: Reserved,"); + pr_cont(" VITERBI CODERATE: Reserved,"); } val = nxt6000_readreg(state, OFDM_COR_STAT); - printk(" CHCTrack: %d,", (val >> 7) & 0x01); - printk(" TPSLock: %d,", (val >> 6) & 0x01); - printk(" SYRLock: %d,", (val >> 5) & 0x01); - printk(" AGCLock: %d,", (val >> 4) & 0x01); + pr_cont(" CHCTrack: %d,", (val >> 7) & 0x01); + pr_cont(" TPSLock: %d,", (val >> 6) & 0x01); + pr_cont(" SYRLock: %d,", (val >> 5) & 0x01); + pr_cont(" AGCLock: %d,", (val >> 4) & 0x01); switch (val & 0x0F) { case 0x00: - printk(" CoreState: IDLE,"); + pr_cont(" CoreState: IDLE,"); break; case 0x02: - printk(" CoreState: WAIT_AGC,"); + pr_cont(" CoreState: WAIT_AGC,"); break; case 0x03: - printk(" CoreState: WAIT_SYR,"); + pr_cont(" CoreState: WAIT_SYR,"); break; case 0x04: - printk(" CoreState: WAIT_PPM,"); + pr_cont(" CoreState: WAIT_PPM,"); break; case 0x01: - printk(" CoreState: WAIT_TRL,"); + pr_cont(" CoreState: WAIT_TRL,"); break; case 0x05: - printk(" CoreState: WAIT_TPS,"); + pr_cont(" CoreState: WAIT_TPS,"); break; case 0x06: - printk(" CoreState: MONITOR_TPS,"); + pr_cont(" CoreState: MONITOR_TPS,"); break; default: - printk(" CoreState: Reserved,"); + pr_cont(" CoreState: Reserved,"); } val = nxt6000_readreg(state, OFDM_SYR_STAT); - printk(" SYRLock: %d,", (val >> 4) & 0x01); - printk(" SYRMode: %s,", (val >> 2) & 0x01 ? "8K" : "2K"); + pr_cont(" SYRLock: %d,", (val >> 4) & 0x01); + pr_cont(" SYRMode: %s,", (val >> 2) & 0x01 ? "8K" : "2K"); switch ((val >> 4) & 0x03) { case 0x00: - printk(" SYRGuard: 1/32,"); + pr_cont(" SYRGuard: 1/32,"); break; case 0x01: - printk(" SYRGuard: 1/16,"); + pr_cont(" SYRGuard: 1/16,"); break; case 0x02: - printk(" SYRGuard: 1/8,"); + pr_cont(" SYRGuard: 1/8,"); break; case 0x03: - printk(" SYRGuard: 1/4,"); + pr_cont(" SYRGuard: 1/4,"); break; } @@ -336,77 +352,77 @@ static void nxt6000_dump_status(struct nxt6000_state *state) switch ((val >> 4) & 0x07) { case 0x00: - printk(" TPSLP: 1/2,"); + pr_cont(" TPSLP: 1/2,"); break; case 0x01: - printk(" TPSLP: 2/3,"); + pr_cont(" TPSLP: 2/3,"); break; case 0x02: - printk(" TPSLP: 3/4,"); + pr_cont(" TPSLP: 3/4,"); break; case 0x03: - printk(" TPSLP: 5/6,"); + pr_cont(" TPSLP: 5/6,"); break; case 0x04: - printk(" TPSLP: 7/8,"); + pr_cont(" TPSLP: 7/8,"); break; default: - printk(" TPSLP: Reserved,"); + pr_cont(" TPSLP: Reserved,"); } switch (val & 0x07) { case 0x00: - printk(" TPSHP: 1/2,"); + pr_cont(" TPSHP: 1/2,"); break; case 0x01: - printk(" TPSHP: 2/3,"); + pr_cont(" TPSHP: 2/3,"); break; case 0x02: - printk(" TPSHP: 3/4,"); + pr_cont(" TPSHP: 3/4,"); break; case 0x03: - printk(" TPSHP: 5/6,"); + pr_cont(" TPSHP: 5/6,"); break; case 0x04: - printk(" TPSHP: 7/8,"); + pr_cont(" TPSHP: 7/8,"); break; default: - printk(" TPSHP: Reserved,"); + pr_cont(" TPSHP: Reserved,"); } val = nxt6000_readreg(state, OFDM_TPS_RCVD_4); - printk(" TPSMode: %s,", val & 0x01 ? "8K" : "2K"); + pr_cont(" TPSMode: %s,", val & 0x01 ? "8K" : "2K"); switch ((val >> 4) & 0x03) { case 0x00: - printk(" TPSGuard: 1/32,"); + pr_cont(" TPSGuard: 1/32,"); break; case 0x01: - printk(" TPSGuard: 1/16,"); + pr_cont(" TPSGuard: 1/16,"); break; case 0x02: - printk(" TPSGuard: 1/8,"); + pr_cont(" TPSGuard: 1/8,"); break; case 0x03: - printk(" TPSGuard: 1/4,"); + pr_cont(" TPSGuard: 1/4,"); break; } @@ -416,8 +432,8 @@ static void nxt6000_dump_status(struct nxt6000_state *state) val = nxt6000_readreg(state, RF_AGC_STATUS); val = nxt6000_readreg(state, RF_AGC_STATUS); - printk(" RF AGC LOCK: %d,", (val >> 4) & 0x01); - printk("\n"); + pr_cont(" RF AGC LOCK: %d,", (val >> 4) & 0x01); + pr_cont("\n"); } static int nxt6000_read_status(struct dvb_frontend *fe, enum fe_status *status) @@ -548,7 +564,7 @@ static int nxt6000_i2c_gate_ctrl(struct dvb_frontend* fe, int enable) } } -static struct dvb_frontend_ops nxt6000_ops; +static const struct dvb_frontend_ops nxt6000_ops; struct dvb_frontend* nxt6000_attach(const struct nxt6000_config* config, struct i2c_adapter* i2c) @@ -576,7 +592,7 @@ error: return NULL; } -static struct dvb_frontend_ops nxt6000_ops = { +static const struct dvb_frontend_ops nxt6000_ops = { .delsys = { SYS_DVBT }, .info = { .name = "NxtWave NXT6000 DVB-T", diff --git a/drivers/media/dvb-frontends/or51132.c b/drivers/media/dvb-frontends/or51132.c index a165af990672..17bdadd7d0e1 100644 --- a/drivers/media/dvb-frontends/or51132.c +++ b/drivers/media/dvb-frontends/or51132.c @@ -342,15 +342,13 @@ static int or51132_set_parameters(struct dvb_frontend *fe) fwname); ret = request_firmware(&fw, fwname, state->i2c->dev.parent); if (ret) { - printk(KERN_WARNING "or51132: No firmware up" - "loaded(timeout or file not found?)\n"); + printk(KERN_WARNING "or51132: No firmware uploaded(timeout or file not found?)\n"); return ret; } ret = or51132_load_firmware(fe, fw); release_firmware(fw); if (ret) { - printk(KERN_WARNING "or51132: Writing firmware to " - "device failed!\n"); + printk(KERN_WARNING "or51132: Writing firmware to device failed!\n"); return ret; } printk("or51132: Firmware upload complete.\n"); @@ -561,7 +559,7 @@ static void or51132_release(struct dvb_frontend* fe) kfree(state); } -static struct dvb_frontend_ops or51132_ops; +static const struct dvb_frontend_ops or51132_ops; struct dvb_frontend* or51132_attach(const struct or51132_config* config, struct i2c_adapter* i2c) @@ -585,7 +583,7 @@ struct dvb_frontend* or51132_attach(const struct or51132_config* config, return &state->frontend; } -static struct dvb_frontend_ops or51132_ops = { +static const struct dvb_frontend_ops or51132_ops = { .delsys = { SYS_ATSC, SYS_DVBC_ANNEX_B }, .info = { .name = "Oren OR51132 VSB/QAM Frontend", diff --git a/drivers/media/dvb-frontends/or51211.c b/drivers/media/dvb-frontends/or51211.c index e82413b975e6..27eb73aa4f62 100644 --- a/drivers/media/dvb-frontends/or51211.c +++ b/drivers/media/dvb-frontends/or51211.c @@ -377,8 +377,7 @@ static int or51211_init(struct dvb_frontend* fe) OR51211_DEFAULT_FIRMWARE); pr_info("Got Hotplug firmware\n"); if (ret) { - pr_warn("No firmware uploaded " - "(timeout or file not found?)\n"); + pr_warn("No firmware uploaded (timeout or file not found?)\n"); return ret; } @@ -508,7 +507,7 @@ static void or51211_release(struct dvb_frontend* fe) kfree(state); } -static struct dvb_frontend_ops or51211_ops; +static const struct dvb_frontend_ops or51211_ops; struct dvb_frontend* or51211_attach(const struct or51211_config* config, struct i2c_adapter* i2c) @@ -532,7 +531,7 @@ struct dvb_frontend* or51211_attach(const struct or51211_config* config, return &state->frontend; } -static struct dvb_frontend_ops or51211_ops = { +static const struct dvb_frontend_ops or51211_ops = { .delsys = { SYS_ATSC, SYS_DVBC_ANNEX_B }, .info = { .name = "Oren OR51211 VSB Frontend", diff --git a/drivers/media/dvb-frontends/rtl2830.c b/drivers/media/dvb-frontends/rtl2830.c index 87226056f226..7bbfe11d11ed 100644 --- a/drivers/media/dvb-frontends/rtl2830.c +++ b/drivers/media/dvb-frontends/rtl2830.c @@ -548,7 +548,7 @@ static int rtl2830_read_signal_strength(struct dvb_frontend *fe, u16 *strength) return 0; } -static struct dvb_frontend_ops rtl2830_ops = { +static const struct dvb_frontend_ops rtl2830_ops = { .delsys = {SYS_DVBT}, .info = { .name = "Realtek RTL2830 (DVB-T)", diff --git a/drivers/media/dvb-frontends/rtl2832.c b/drivers/media/dvb-frontends/rtl2832.c index 0ced01f1012e..94bf5b7d6f3f 100644 --- a/drivers/media/dvb-frontends/rtl2832.c +++ b/drivers/media/dvb-frontends/rtl2832.c @@ -837,7 +837,7 @@ static int rtl2832_deselect(struct i2c_mux_core *muxc, u32 chan_id) return 0; } -static struct dvb_frontend_ops rtl2832_ops = { +static const struct dvb_frontend_ops rtl2832_ops = { .delsys = { SYS_DVBT }, .info = { .name = "Realtek RTL2832 (DVB-T)", diff --git a/drivers/media/dvb-frontends/s5h1409.c b/drivers/media/dvb-frontends/s5h1409.c index c68965ad97c0..f370c6df0a8b 100644 --- a/drivers/media/dvb-frontends/s5h1409.c +++ b/drivers/media/dvb-frontends/s5h1409.c @@ -321,8 +321,8 @@ static int s5h1409_writereg(struct s5h1409_state *state, u8 reg, u16 data) ret = i2c_transfer(state->i2c, &msg, 1); if (ret != 1) - printk(KERN_ERR "%s: error (reg == 0x%02x, val == 0x%04x, " - "ret == %i)\n", __func__, reg, data, ret); + printk(KERN_ERR "%s: error (reg == 0x%02x, val == 0x%04x, ret == %i)\n", + __func__, reg, data, ret); return (ret != 1) ? -1 : 0; } @@ -949,7 +949,7 @@ static void s5h1409_release(struct dvb_frontend *fe) kfree(state); } -static struct dvb_frontend_ops s5h1409_ops; +static const struct dvb_frontend_ops s5h1409_ops; struct dvb_frontend *s5h1409_attach(const struct s5h1409_config *config, struct i2c_adapter *i2c) @@ -995,7 +995,7 @@ error: } EXPORT_SYMBOL(s5h1409_attach); -static struct dvb_frontend_ops s5h1409_ops = { +static const struct dvb_frontend_ops s5h1409_ops = { .delsys = { SYS_ATSC, SYS_DVBC_ANNEX_B }, .info = { .name = "Samsung S5H1409 QAM/8VSB Frontend", diff --git a/drivers/media/dvb-frontends/s5h1411.c b/drivers/media/dvb-frontends/s5h1411.c index 90f86e82b087..f29750a96196 100644 --- a/drivers/media/dvb-frontends/s5h1411.c +++ b/drivers/media/dvb-frontends/s5h1411.c @@ -350,8 +350,8 @@ static int s5h1411_writereg(struct s5h1411_state *state, ret = i2c_transfer(state->i2c, &msg, 1); if (ret != 1) - printk(KERN_ERR "%s: writereg error 0x%02x 0x%02x 0x%04x, " - "ret == %i)\n", __func__, addr, reg, data, ret); + printk(KERN_ERR "%s: writereg error 0x%02x 0x%02x 0x%04x, ret == %i)\n", + __func__, addr, reg, data, ret); return (ret != 1) ? -1 : 0; } @@ -864,7 +864,7 @@ static void s5h1411_release(struct dvb_frontend *fe) kfree(state); } -static struct dvb_frontend_ops s5h1411_ops; +static const struct dvb_frontend_ops s5h1411_ops; struct dvb_frontend *s5h1411_attach(const struct s5h1411_config *config, struct i2c_adapter *i2c) @@ -914,7 +914,7 @@ error: } EXPORT_SYMBOL(s5h1411_attach); -static struct dvb_frontend_ops s5h1411_ops = { +static const struct dvb_frontend_ops s5h1411_ops = { .delsys = { SYS_ATSC, SYS_DVBC_ANNEX_B }, .info = { .name = "Samsung S5H1411 QAM/8VSB Frontend", diff --git a/drivers/media/dvb-frontends/s5h1420.c b/drivers/media/dvb-frontends/s5h1420.c index d7d0b7d57ad7..f9a18fe94d88 100644 --- a/drivers/media/dvb-frontends/s5h1420.c +++ b/drivers/media/dvb-frontends/s5h1420.c @@ -880,7 +880,7 @@ struct i2c_adapter *s5h1420_get_tuner_i2c_adapter(struct dvb_frontend *fe) } EXPORT_SYMBOL(s5h1420_get_tuner_i2c_adapter); -static struct dvb_frontend_ops s5h1420_ops; +static const struct dvb_frontend_ops s5h1420_ops; struct dvb_frontend *s5h1420_attach(const struct s5h1420_config *config, struct i2c_adapter *i2c) @@ -934,7 +934,7 @@ error: } EXPORT_SYMBOL(s5h1420_attach); -static struct dvb_frontend_ops s5h1420_ops = { +static const struct dvb_frontend_ops s5h1420_ops = { .delsys = { SYS_DVBS }, .info = { .name = "Samsung S5H1420/PnpNetwork PN1010 DVB-S", diff --git a/drivers/media/dvb-frontends/s5h1432.c b/drivers/media/dvb-frontends/s5h1432.c index 4215652f8eb7..a32fd9bc51a9 100644 --- a/drivers/media/dvb-frontends/s5h1432.c +++ b/drivers/media/dvb-frontends/s5h1432.c @@ -63,8 +63,8 @@ static int s5h1432_writereg(struct s5h1432_state *state, ret = i2c_transfer(state->i2c, &msg, 1); if (ret != 1) - printk(KERN_ERR "%s: writereg error 0x%02x 0x%02x 0x%04x, " - "ret == %i)\n", __func__, addr, reg, data, ret); + printk(KERN_ERR "%s: writereg error 0x%02x 0x%02x 0x%04x, ret == %i)\n", + __func__, addr, reg, data, ret); return (ret != 1) ? -1 : 0; } @@ -341,7 +341,7 @@ static void s5h1432_release(struct dvb_frontend *fe) kfree(state); } -static struct dvb_frontend_ops s5h1432_ops; +static const struct dvb_frontend_ops s5h1432_ops; struct dvb_frontend *s5h1432_attach(const struct s5h1432_config *config, struct i2c_adapter *i2c) @@ -370,7 +370,7 @@ struct dvb_frontend *s5h1432_attach(const struct s5h1432_config *config, } EXPORT_SYMBOL(s5h1432_attach); -static struct dvb_frontend_ops s5h1432_ops = { +static const struct dvb_frontend_ops s5h1432_ops = { .delsys = { SYS_DVBT }, .info = { .name = "Samsung s5h1432 DVB-T Frontend", diff --git a/drivers/media/dvb-frontends/s921.c b/drivers/media/dvb-frontends/s921.c index b5e3d90eba5e..274544a3ae0e 100644 --- a/drivers/media/dvb-frontends/s921.c +++ b/drivers/media/dvb-frontends/s921.c @@ -214,8 +214,8 @@ static int s921_i2c_writereg(struct s921_state *state, rc = i2c_transfer(state->i2c, &msg, 1); if (rc != 1) { - printk("%s: writereg rcor(rc == %i, reg == 0x%02x," - " data == 0x%02x)\n", __func__, rc, reg, data); + printk("%s: writereg rcor(rc == %i, reg == 0x%02x, data == 0x%02x)\n", + __func__, rc, reg, data); return rc; } @@ -477,7 +477,7 @@ static void s921_release(struct dvb_frontend *fe) kfree(state); } -static struct dvb_frontend_ops s921_ops; +static const struct dvb_frontend_ops s921_ops; struct dvb_frontend *s921_attach(const struct s921_config *config, struct i2c_adapter *i2c) @@ -505,7 +505,7 @@ struct dvb_frontend *s921_attach(const struct s921_config *config, } EXPORT_SYMBOL(s921_attach); -static struct dvb_frontend_ops s921_ops = { +static const struct dvb_frontend_ops s921_ops = { .delsys = { SYS_ISDBT }, /* Use dib8000 values per default */ .info = { diff --git a/drivers/media/dvb-frontends/si2165.c b/drivers/media/dvb-frontends/si2165.c index 78669ea68c61..528b82a5dd46 100644 --- a/drivers/media/dvb-frontends/si2165.c +++ b/drivers/media/dvb-frontends/si2165.c @@ -978,7 +978,7 @@ static int si2165_set_frontend(struct dvb_frontend *fe) return 0; } -static struct dvb_frontend_ops si2165_ops = { +static const struct dvb_frontend_ops si2165_ops = { .info = { .name = "Silicon Labs ", /* For DVB-C */ diff --git a/drivers/media/dvb-frontends/si21xx.c b/drivers/media/dvb-frontends/si21xx.c index 62ad7a7be9f8..4e8c3ac4303f 100644 --- a/drivers/media/dvb-frontends/si21xx.c +++ b/drivers/media/dvb-frontends/si21xx.c @@ -245,8 +245,8 @@ static int si21_writeregs(struct si21xx_state *state, u8 reg1, ret = i2c_transfer(state->i2c, &msg, 1); if (ret != 1) - dprintk("%s: writereg error (reg1 == 0x%02x, data == 0x%02x, " - "ret == %i)\n", __func__, reg1, data[0], ret); + dprintk("%s: writereg error (reg1 == 0x%02x, data == 0x%02x, ret == %i)\n", + __func__, reg1, data[0], ret); return (ret != 1) ? -EREMOTEIO : 0; } @@ -265,8 +265,8 @@ static int si21_writereg(struct si21xx_state *state, u8 reg, u8 data) ret = i2c_transfer(state->i2c, &msg, 1); if (ret != 1) - dprintk("%s: writereg error (reg == 0x%02x, data == 0x%02x, " - "ret == %i)\n", __func__, reg, data, ret); + dprintk("%s: writereg error (reg == 0x%02x, data == 0x%02x, ret == %i)\n", + __func__, reg, data, ret); return (ret != 1) ? -EREMOTEIO : 0; } @@ -866,7 +866,7 @@ static void si21xx_release(struct dvb_frontend *fe) kfree(state); } -static struct dvb_frontend_ops si21xx_ops = { +static const struct dvb_frontend_ops si21xx_ops = { .delsys = { SYS_DVBS }, .info = { .name = "SL SI21XX DVB-S", diff --git a/drivers/media/dvb-frontends/sp8870.c b/drivers/media/dvb-frontends/sp8870.c index e87ac30d7fb8..04454cb78467 100644 --- a/drivers/media/dvb-frontends/sp8870.c +++ b/drivers/media/dvb-frontends/sp8870.c @@ -551,7 +551,7 @@ static void sp8870_release(struct dvb_frontend* fe) kfree(state); } -static struct dvb_frontend_ops sp8870_ops; +static const struct dvb_frontend_ops sp8870_ops; struct dvb_frontend* sp8870_attach(const struct sp8870_config* config, struct i2c_adapter* i2c) @@ -580,7 +580,7 @@ error: return NULL; } -static struct dvb_frontend_ops sp8870_ops = { +static const struct dvb_frontend_ops sp8870_ops = { .delsys = { SYS_DVBT }, .info = { .name = "Spase SP8870 DVB-T", diff --git a/drivers/media/dvb-frontends/sp887x.c b/drivers/media/dvb-frontends/sp887x.c index 4378fe1b978e..7c511c3cd4ca 100644 --- a/drivers/media/dvb-frontends/sp887x.c +++ b/drivers/media/dvb-frontends/sp887x.c @@ -63,8 +63,7 @@ static int sp887x_writereg (struct sp887x_state* state, u16 reg, u16 data) if (!(reg == 0xf1a && data == 0x000 && (ret == -EREMOTEIO || ret == -EFAULT))) { - printk("%s: writereg error " - "(reg %03x, data %03x, ret == %i)\n", + printk("%s: writereg error (reg %03x, data %03x, ret == %i)\n", __func__, reg & 0xffff, data & 0xffff, ret); return ret; } @@ -562,7 +561,7 @@ static void sp887x_release(struct dvb_frontend* fe) kfree(state); } -static struct dvb_frontend_ops sp887x_ops; +static const struct dvb_frontend_ops sp887x_ops; struct dvb_frontend* sp887x_attach(const struct sp887x_config* config, struct i2c_adapter* i2c) @@ -591,7 +590,7 @@ error: return NULL; } -static struct dvb_frontend_ops sp887x_ops = { +static const struct dvb_frontend_ops sp887x_ops = { .delsys = { SYS_DVBT }, .info = { .name = "Spase SP887x DVB-T", diff --git a/drivers/media/dvb-frontends/stb0899_drv.c b/drivers/media/dvb-frontends/stb0899_drv.c index 3d171b0e00c2..02347598277a 100644 --- a/drivers/media/dvb-frontends/stb0899_drv.c +++ b/drivers/media/dvb-frontends/stb0899_drv.c @@ -485,15 +485,8 @@ int stb0899_read_regs(struct stb0899_state *state, unsigned int reg, u8 *buf, u3 (((reg & 0xff00) == 0xf200) || ((reg & 0xff00) == 0xf600))) _stb0899_read_reg(state, (reg | 0x00ff)); - if (unlikely(*state->verbose >= FE_DEBUGREG)) { - int i; - - printk(KERN_DEBUG "%s [0x%04x]:", __func__, reg); - for (i = 0; i < count; i++) { - printk(" %02x", buf[i]); - } - printk("\n"); - } + dprintk(state->verbose, FE_DEBUGREG, 1, + "%s [0x%04x]: %*ph", __func__, reg, count, buf); return 0; err: @@ -522,14 +515,8 @@ int stb0899_write_regs(struct stb0899_state *state, unsigned int reg, u8 *data, buf[1] = reg & 0xff; memcpy(&buf[2], data, count); - if (unlikely(*state->verbose >= FE_DEBUGREG)) { - int i; - - printk(KERN_DEBUG "%s [0x%04x]:", __func__, reg); - for (i = 0; i < count; i++) - printk(" %02x", data[i]); - printk("\n"); - } + dprintk(state->verbose, FE_DEBUGREG, 1, + "%s [0x%04x]: %*ph", __func__, reg, count, data); ret = i2c_transfer(state->i2c, &i2c_msg, 1); /* @@ -614,13 +601,19 @@ static int stb0899_postproc(struct stb0899_state *state, u8 ctl, int enable) return 0; } -static void stb0899_release(struct dvb_frontend *fe) +static void stb0899_detach(struct dvb_frontend *fe) { struct stb0899_state *state = fe->demodulator_priv; - dprintk(state->verbose, FE_DEBUG, 1, "Release Frontend"); /* post process event */ stb0899_postproc(state, STB0899_POSTPROC_GPIO_POWER, 0); +} + +static void stb0899_release(struct dvb_frontend *fe) +{ + struct stb0899_state *state = fe->demodulator_priv; + + dprintk(state->verbose, FE_DEBUG, 1, "Release Frontend"); kfree(state); } @@ -1586,7 +1579,7 @@ static enum dvbfe_algo stb0899_frontend_algo(struct dvb_frontend *fe) return DVBFE_ALGO_CUSTOM; } -static struct dvb_frontend_ops stb0899_ops = { +static const struct dvb_frontend_ops stb0899_ops = { .delsys = { SYS_DVBS, SYS_DVBS2, SYS_DSS }, .info = { .name = "STB0899 Multistandard", @@ -1603,6 +1596,7 @@ static struct dvb_frontend_ops stb0899_ops = { FE_CAN_QPSK }, + .detach = stb0899_detach, .release = stb0899_release, .init = stb0899_init, .sleep = stb0899_sleep, diff --git a/drivers/media/dvb-frontends/stb6000.c b/drivers/media/dvb-frontends/stb6000.c index 73347d51f340..69c03892f2da 100644 --- a/drivers/media/dvb-frontends/stb6000.c +++ b/drivers/media/dvb-frontends/stb6000.c @@ -41,11 +41,10 @@ struct stb6000_priv { u32 frequency; }; -static int stb6000_release(struct dvb_frontend *fe) +static void stb6000_release(struct dvb_frontend *fe) { kfree(fe->tuner_priv); fe->tuner_priv = NULL; - return 0; } static int stb6000_sleep(struct dvb_frontend *fe) diff --git a/drivers/media/dvb-frontends/stb6100.c b/drivers/media/dvb-frontends/stb6100.c index 5add1182c3ca..17a955d0031b 100644 --- a/drivers/media/dvb-frontends/stb6100.c +++ b/drivers/media/dvb-frontends/stb6100.c @@ -61,7 +61,7 @@ struct stb6100_lkup { u8 reg; }; -static int stb6100_release(struct dvb_frontend *fe); +static void stb6100_release(struct dvb_frontend *fe); static const struct stb6100_lkup lkup[] = { { 0, 950000, 0x0a }, @@ -560,14 +560,12 @@ struct dvb_frontend *stb6100_attach(struct dvb_frontend *fe, return fe; } -static int stb6100_release(struct dvb_frontend *fe) +static void stb6100_release(struct dvb_frontend *fe) { struct stb6100_state *state = fe->tuner_priv; fe->tuner_priv = NULL; kfree(state); - - return 0; } EXPORT_SYMBOL(stb6100_attach); diff --git a/drivers/media/dvb-frontends/stv0288.c b/drivers/media/dvb-frontends/stv0288.c index c93d9a45f7f7..45cbc898ad25 100644 --- a/drivers/media/dvb-frontends/stv0288.c +++ b/drivers/media/dvb-frontends/stv0288.c @@ -74,8 +74,8 @@ static int stv0288_writeregI(struct stv0288_state *state, u8 reg, u8 data) ret = i2c_transfer(state->i2c, &msg, 1); if (ret != 1) - dprintk("%s: writereg error (reg == 0x%02x, val == 0x%02x, " - "ret == %i)\n", __func__, reg, data, ret); + dprintk("%s: writereg error (reg == 0x%02x, val == 0x%02x, ret == %i)\n", + __func__, reg, data, ret); return (ret != 1) ? -EREMOTEIO : 0; } @@ -465,10 +465,9 @@ static int stv0288_set_frontend(struct dvb_frontend *fe) dprintk("%s : FE_SET_FRONTEND\n", __func__); if (c->delivery_system != SYS_DVBS) { - dprintk("%s: unsupported delivery " - "system selected (%d)\n", - __func__, c->delivery_system); - return -EOPNOTSUPP; + dprintk("%s: unsupported delivery system selected (%d)\n", + __func__, c->delivery_system); + return -EOPNOTSUPP; } if (state->config->set_ts_params) @@ -536,7 +535,7 @@ static void stv0288_release(struct dvb_frontend *fe) kfree(state); } -static struct dvb_frontend_ops stv0288_ops = { +static const struct dvb_frontend_ops stv0288_ops = { .delsys = { SYS_DVBS }, .info = { .name = "ST STV0288 DVB-S", diff --git a/drivers/media/dvb-frontends/stv0297.c b/drivers/media/dvb-frontends/stv0297.c index 81b27b7c0c96..db94d4d109f9 100644 --- a/drivers/media/dvb-frontends/stv0297.c +++ b/drivers/media/dvb-frontends/stv0297.c @@ -57,8 +57,8 @@ static int stv0297_writereg(struct stv0297_state *state, u8 reg, u8 data) ret = i2c_transfer(state->i2c, &msg, 1); if (ret != 1) - dprintk("%s: writereg error (reg == 0x%02x, val == 0x%02x, " - "ret == %i)\n", __func__, reg, data, ret); + dprintk("%s: writereg error (reg == 0x%02x, val == 0x%02x, ret == %i)\n", + __func__, reg, data, ret); return (ret != 1) ? -1 : 0; } @@ -658,7 +658,7 @@ static void stv0297_release(struct dvb_frontend *fe) kfree(state); } -static struct dvb_frontend_ops stv0297_ops; +static const struct dvb_frontend_ops stv0297_ops; struct dvb_frontend *stv0297_attach(const struct stv0297_config *config, struct i2c_adapter *i2c) @@ -690,7 +690,7 @@ error: return NULL; } -static struct dvb_frontend_ops stv0297_ops = { +static const struct dvb_frontend_ops stv0297_ops = { .delsys = { SYS_DVBC_ANNEX_A }, .info = { .name = "ST STV0297 DVB-C", diff --git a/drivers/media/dvb-frontends/stv0299.c b/drivers/media/dvb-frontends/stv0299.c index 7927fa925f2f..b36b21a13201 100644 --- a/drivers/media/dvb-frontends/stv0299.c +++ b/drivers/media/dvb-frontends/stv0299.c @@ -88,8 +88,8 @@ static int stv0299_writeregI (struct stv0299_state* state, u8 reg, u8 data) ret = i2c_transfer (state->i2c, &msg, 1); if (ret != 1) - dprintk("%s: writereg error (reg == 0x%02x, val == 0x%02x, " - "ret == %i)\n", __func__, reg, data, ret); + dprintk("%s: writereg error (reg == 0x%02x, val == 0x%02x, ret == %i)\n", + __func__, reg, data, ret); return (ret != 1) ? -EREMOTEIO : 0; } @@ -673,7 +673,7 @@ static void stv0299_release(struct dvb_frontend* fe) kfree(state); } -static struct dvb_frontend_ops stv0299_ops; +static const struct dvb_frontend_ops stv0299_ops; struct dvb_frontend* stv0299_attach(const struct stv0299_config* config, struct i2c_adapter* i2c) @@ -713,7 +713,7 @@ error: return NULL; } -static struct dvb_frontend_ops stv0299_ops = { +static const struct dvb_frontend_ops stv0299_ops = { .delsys = { SYS_DVBS }, .info = { .name = "ST STV0299 DVB-S", @@ -761,8 +761,7 @@ module_param(debug, int, 0644); MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off)."); MODULE_DESCRIPTION("ST STV0299 DVB Demodulator driver"); -MODULE_AUTHOR("Ralph Metzler, Holger Waechtler, Peter Schildmann, Felix Domke, " - "Andreas Oberritter, Andrew de Quincey, Kenneth Aafly"); +MODULE_AUTHOR("Ralph Metzler, Holger Waechtler, Peter Schildmann, Felix Domke, Andreas Oberritter, Andrew de Quincey, Kenneth Aafly"); MODULE_LICENSE("GPL"); EXPORT_SYMBOL(stv0299_attach); diff --git a/drivers/media/dvb-frontends/stv0367.c b/drivers/media/dvb-frontends/stv0367.c index abc379aea713..4ac1ce2831ba 100644 --- a/drivers/media/dvb-frontends/stv0367.c +++ b/drivers/media/dvb-frontends/stv0367.c @@ -2272,7 +2272,7 @@ static void stv0367_release(struct dvb_frontend *fe) kfree(state); } -static struct dvb_frontend_ops stv0367ter_ops = { +static const struct dvb_frontend_ops stv0367ter_ops = { .delsys = { SYS_DVBT }, .info = { .name = "ST STV0367 DVB-T", @@ -3390,7 +3390,7 @@ static int stv0367cab_read_ucblcks(struct dvb_frontend *fe, u32 *ucblocks) return 0; }; -static struct dvb_frontend_ops stv0367cab_ops = { +static const struct dvb_frontend_ops stv0367cab_ops = { .delsys = { SYS_DVBC_ANNEX_A }, .info = { .name = "ST STV0367 DVB-C", diff --git a/drivers/media/dvb-frontends/stv0900_core.c b/drivers/media/dvb-frontends/stv0900_core.c index f667005a6661..43a0f69b4b14 100644 --- a/drivers/media/dvb-frontends/stv0900_core.c +++ b/drivers/media/dvb-frontends/stv0900_core.c @@ -1875,7 +1875,7 @@ static int stv0900_get_frontend(struct dvb_frontend *fe, return 0; } -static struct dvb_frontend_ops stv0900_ops = { +static const struct dvb_frontend_ops stv0900_ops = { .delsys = { SYS_DVBS, SYS_DVBS2, SYS_DSS }, .info = { .name = "STV0900 frontend", diff --git a/drivers/media/dvb-frontends/stv0900_sw.c b/drivers/media/dvb-frontends/stv0900_sw.c index fa63a9e929ce..bded82774f4b 100644 --- a/drivers/media/dvb-frontends/stv0900_sw.c +++ b/drivers/media/dvb-frontends/stv0900_sw.c @@ -1485,8 +1485,7 @@ static u32 stv0900_search_srate_coarse(struct dvb_frontend *fe) current_step++; direction *= -1; - dprintk("lock: I2C_DEMOD_MODE_FIELD =0. Search started." - " tuner freq=%d agc2=0x%x srate_coarse=%d tmg_cpt=%d\n", + dprintk("lock: I2C_DEMOD_MODE_FIELD =0. Search started. tuner freq=%d agc2=0x%x srate_coarse=%d tmg_cpt=%d\n", tuner_freq, agc2_integr, coarse_srate, timingcpt); if ((timingcpt >= 5) && diff --git a/drivers/media/dvb-frontends/stv090x.c b/drivers/media/dvb-frontends/stv090x.c index 25bdf6e0f963..7ef469c0c866 100644 --- a/drivers/media/dvb-frontends/stv090x.c +++ b/drivers/media/dvb-frontends/stv090x.c @@ -739,14 +739,8 @@ static int stv090x_write_regs(struct stv090x_state *state, unsigned int reg, u8 buf[1] = reg & 0xff; memcpy(&buf[2], data, count); - if (unlikely(*state->verbose >= FE_DEBUGREG)) { - int i; - - printk(KERN_DEBUG "%s [0x%04x]:", __func__, reg); - for (i = 0; i < count; i++) - printk(" %02x", data[i]); - printk("\n"); - } + dprintk(FE_DEBUGREG, 1, "%s [0x%04x]: %*ph", + __func__, reg, count, data); ret = i2c_transfer(state->i2c, &i2c_msg, 1); if (ret != 1) { @@ -3698,9 +3692,12 @@ static int stv090x_read_cnr(struct dvb_frontend *fe, u16 *cnr) } val /= 16; last = ARRAY_SIZE(stv090x_s2cn_tab) - 1; - div = stv090x_s2cn_tab[0].read - - stv090x_s2cn_tab[last].read; - *cnr = 0xFFFF - ((val * 0xFFFF) / div); + div = stv090x_s2cn_tab[last].real - + stv090x_s2cn_tab[3].real; + val = stv090x_table_lookup(stv090x_s2cn_tab, last, val); + if (val < 0) + val = 0; + *cnr = val * 0xFFFF / div; } break; @@ -3720,9 +3717,10 @@ static int stv090x_read_cnr(struct dvb_frontend *fe, u16 *cnr) } val /= 16; last = ARRAY_SIZE(stv090x_s1cn_tab) - 1; - div = stv090x_s1cn_tab[0].read - - stv090x_s1cn_tab[last].read; - *cnr = 0xFFFF - ((val * 0xFFFF) / div); + div = stv090x_s1cn_tab[last].real - + stv090x_s1cn_tab[0].real; + val = stv090x_table_lookup(stv090x_s1cn_tab, last, val); + *cnr = val * 0xFFFF / div; } break; default: @@ -4886,7 +4884,7 @@ static int stv090x_set_gpio(struct dvb_frontend *fe, u8 gpio, u8 dir, return stv090x_write_reg(state, STV090x_GPIOxCFG(gpio), reg); } -static struct dvb_frontend_ops stv090x_ops = { +static const struct dvb_frontend_ops stv090x_ops = { .delsys = { SYS_DVBS, SYS_DVBS2, SYS_DSS }, .info = { .name = "STV090x Multistandard", diff --git a/drivers/media/dvb-frontends/stv6110.c b/drivers/media/dvb-frontends/stv6110.c index 66a5a7f2295c..6a72d0be2ec5 100644 --- a/drivers/media/dvb-frontends/stv6110.c +++ b/drivers/media/dvb-frontends/stv6110.c @@ -59,11 +59,10 @@ static s32 abssub(s32 a, s32 b) return b - a; }; -static int stv6110_release(struct dvb_frontend *fe) +static void stv6110_release(struct dvb_frontend *fe) { kfree(fe->tuner_priv); fe->tuner_priv = NULL; - return 0; } static int stv6110_write_regs(struct dvb_frontend *fe, u8 buf[], diff --git a/drivers/media/dvb-frontends/stv6110x.c b/drivers/media/dvb-frontends/stv6110x.c index c611ad210b5c..66eba38f1014 100644 --- a/drivers/media/dvb-frontends/stv6110x.c +++ b/drivers/media/dvb-frontends/stv6110x.c @@ -335,14 +335,12 @@ static int stv6110x_get_status(struct dvb_frontend *fe, u32 *status) } -static int stv6110x_release(struct dvb_frontend *fe) +static void stv6110x_release(struct dvb_frontend *fe) { struct stv6110x_state *stv6110x = fe->tuner_priv; fe->tuner_priv = NULL; kfree(stv6110x); - - return 0; } static const struct dvb_tuner_ops stv6110x_ops = { diff --git a/drivers/media/dvb-frontends/tc90522.c b/drivers/media/dvb-frontends/tc90522.c index 31cd32532387..4687e1546af2 100644 --- a/drivers/media/dvb-frontends/tc90522.c +++ b/drivers/media/dvb-frontends/tc90522.c @@ -656,7 +656,7 @@ tc90522_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) for (i = 0; i < num; i++) if (msgs[i].flags & I2C_M_RD) rd_num++; - new_msgs = kmalloc(sizeof(*new_msgs) * (num + rd_num), GFP_KERNEL); + new_msgs = kmalloc_array(num + rd_num, sizeof(*new_msgs), GFP_KERNEL); if (!new_msgs) return -ENOMEM; @@ -794,14 +794,13 @@ static int tc90522_probe(struct i2c_client *client, i2c_set_adapdata(adap, state); ret = i2c_add_adapter(adap); if (ret < 0) - goto err; + goto free_state; cfg->tuner_i2c = state->cfg.tuner_i2c = adap; i2c_set_clientdata(client, &state->cfg); dev_info(&client->dev, "Toshiba TC90522 attached.\n"); return 0; - -err: +free_state: kfree(state); return ret; } diff --git a/drivers/media/dvb-frontends/tda10021.c b/drivers/media/dvb-frontends/tda10021.c index 806c56691ca5..32ba8401e743 100644 --- a/drivers/media/dvb-frontends/tda10021.c +++ b/drivers/media/dvb-frontends/tda10021.c @@ -77,8 +77,7 @@ static int _tda10021_writereg (struct tda10021_state* state, u8 reg, u8 data) ret = i2c_transfer (state->i2c, &msg, 1); if (ret != 1) - printk("DVB: TDA10021(%d): %s, writereg error " - "(reg == 0x%02x, val == 0x%02x, ret == %i)\n", + printk("DVB: TDA10021(%d): %s, writereg error (reg == 0x%02x, val == 0x%02x, ret == %i)\n", state->frontend.dvb->num, __func__, reg, data, ret); msleep(10); @@ -444,7 +443,7 @@ static void tda10021_release(struct dvb_frontend* fe) kfree(state); } -static struct dvb_frontend_ops tda10021_ops; +static const struct dvb_frontend_ops tda10021_ops; struct dvb_frontend* tda10021_attach(const struct tda1002x_config* config, struct i2c_adapter* i2c, @@ -484,7 +483,7 @@ error: return NULL; } -static struct dvb_frontend_ops tda10021_ops = { +static const struct dvb_frontend_ops tda10021_ops = { .delsys = { SYS_DVBC_ANNEX_A, SYS_DVBC_ANNEX_C }, .info = { .name = "Philips TDA10021 DVB-C", diff --git a/drivers/media/dvb-frontends/tda10023.c b/drivers/media/dvb-frontends/tda10023.c index 3b8c7e499d0d..8028007c68eb 100644 --- a/drivers/media/dvb-frontends/tda10023.c +++ b/drivers/media/dvb-frontends/tda10023.c @@ -72,8 +72,7 @@ static u8 tda10023_readreg (struct tda10023_state* state, u8 reg) ret = i2c_transfer (state->i2c, msg, 2); if (ret != 2) { int num = state->frontend.dvb ? state->frontend.dvb->num : -1; - printk(KERN_ERR "DVB: TDA10023(%d): %s: readreg error " - "(reg == 0x%02x, ret == %i)\n", + printk(KERN_ERR "DVB: TDA10023(%d): %s: readreg error (reg == 0x%02x, ret == %i)\n", num, __func__, reg, ret); } return b1[0]; @@ -88,8 +87,7 @@ static int tda10023_writereg (struct tda10023_state* state, u8 reg, u8 data) ret = i2c_transfer (state->i2c, &msg, 1); if (ret != 1) { int num = state->frontend.dvb ? state->frontend.dvb->num : -1; - printk(KERN_ERR "DVB: TDA10023(%d): %s, writereg error " - "(reg == 0x%02x, val == 0x%02x, ret == %i)\n", + printk(KERN_ERR "DVB: TDA10023(%d): %s, writereg error (reg == 0x%02x, val == 0x%02x, ret == %i)\n", num, __func__, reg, data, ret); } return (ret != 1) ? -EREMOTEIO : 0; @@ -516,7 +514,7 @@ static void tda10023_release(struct dvb_frontend* fe) kfree(state); } -static struct dvb_frontend_ops tda10023_ops; +static const struct dvb_frontend_ops tda10023_ops; struct dvb_frontend *tda10023_attach(const struct tda10023_config *config, struct i2c_adapter *i2c, @@ -573,7 +571,7 @@ error: return NULL; } -static struct dvb_frontend_ops tda10023_ops = { +static const struct dvb_frontend_ops tda10023_ops = { .delsys = { SYS_DVBC_ANNEX_A, SYS_DVBC_ANNEX_C }, .info = { .name = "Philips TDA10023 DVB-C", diff --git a/drivers/media/dvb-frontends/tda10048.c b/drivers/media/dvb-frontends/tda10048.c index c2bf89d0b0b0..92ab34c3e0be 100644 --- a/drivers/media/dvb-frontends/tda10048.c +++ b/drivers/media/dvb-frontends/tda10048.c @@ -1063,38 +1063,34 @@ static void tda10048_establish_defaults(struct dvb_frontend *fe) /* Validate/default the config */ if (config->dtv6_if_freq_khz == 0) { config->dtv6_if_freq_khz = TDA10048_IF_4300; - printk(KERN_WARNING "%s() tda10048_config.dtv6_if_freq_khz " - "is not set (defaulting to %d)\n", + printk(KERN_WARNING "%s() tda10048_config.dtv6_if_freq_khz is not set (defaulting to %d)\n", __func__, config->dtv6_if_freq_khz); } if (config->dtv7_if_freq_khz == 0) { config->dtv7_if_freq_khz = TDA10048_IF_4300; - printk(KERN_WARNING "%s() tda10048_config.dtv7_if_freq_khz " - "is not set (defaulting to %d)\n", + printk(KERN_WARNING "%s() tda10048_config.dtv7_if_freq_khz is not set (defaulting to %d)\n", __func__, config->dtv7_if_freq_khz); } if (config->dtv8_if_freq_khz == 0) { config->dtv8_if_freq_khz = TDA10048_IF_4300; - printk(KERN_WARNING "%s() tda10048_config.dtv8_if_freq_khz " - "is not set (defaulting to %d)\n", + printk(KERN_WARNING "%s() tda10048_config.dtv8_if_freq_khz is not set (defaulting to %d)\n", __func__, config->dtv8_if_freq_khz); } if (config->clk_freq_khz == 0) { config->clk_freq_khz = TDA10048_CLK_16000; - printk(KERN_WARNING "%s() tda10048_config.clk_freq_khz " - "is not set (defaulting to %d)\n", + printk(KERN_WARNING "%s() tda10048_config.clk_freq_khz is not set (defaulting to %d)\n", __func__, config->clk_freq_khz); } } -static struct dvb_frontend_ops tda10048_ops; +static const struct dvb_frontend_ops tda10048_ops; struct dvb_frontend *tda10048_attach(const struct tda10048_config *config, struct i2c_adapter *i2c) @@ -1156,7 +1152,7 @@ error: } EXPORT_SYMBOL(tda10048_attach); -static struct dvb_frontend_ops tda10048_ops = { +static const struct dvb_frontend_ops tda10048_ops = { .delsys = { SYS_DVBT }, .info = { .name = "NXP TDA10048HN DVB-T", diff --git a/drivers/media/dvb-frontends/tda1004x.c b/drivers/media/dvb-frontends/tda1004x.c index b89848313fb9..e674508c349c 100644 --- a/drivers/media/dvb-frontends/tda1004x.c +++ b/drivers/media/dvb-frontends/tda1004x.c @@ -1245,7 +1245,7 @@ static void tda1004x_release(struct dvb_frontend* fe) kfree(state); } -static struct dvb_frontend_ops tda10045_ops = { +static const struct dvb_frontend_ops tda10045_ops = { .delsys = { SYS_DVBT }, .info = { .name = "Philips TDA10045H DVB-T", @@ -1315,7 +1315,7 @@ struct dvb_frontend* tda10045_attach(const struct tda1004x_config* config, return &state->frontend; } -static struct dvb_frontend_ops tda10046_ops = { +static const struct dvb_frontend_ops tda10046_ops = { .delsys = { SYS_DVBT }, .info = { .name = "Philips TDA10046H DVB-T", diff --git a/drivers/media/dvb-frontends/tda10071.c b/drivers/media/dvb-frontends/tda10071.c index 37ebeef2bbd0..a59f4fd09df6 100644 --- a/drivers/media/dvb-frontends/tda10071.c +++ b/drivers/media/dvb-frontends/tda10071.c @@ -20,7 +20,7 @@ #include "tda10071_priv.h" -static struct dvb_frontend_ops tda10071_ops; +static const struct dvb_frontend_ops tda10071_ops; /* * XXX: regmap_update_bits() does not fit our needs as it does not support @@ -1102,7 +1102,7 @@ static int tda10071_get_tune_settings(struct dvb_frontend *fe, return 0; } -static struct dvb_frontend_ops tda10071_ops = { +static const struct dvb_frontend_ops tda10071_ops = { .delsys = { SYS_DVBS, SYS_DVBS2 }, .info = { .name = "NXP TDA10071", diff --git a/drivers/media/dvb-frontends/tda10086.c b/drivers/media/dvb-frontends/tda10086.c index 31d0acb54fe8..b6d16c05904d 100644 --- a/drivers/media/dvb-frontends/tda10086.c +++ b/drivers/media/dvb-frontends/tda10086.c @@ -706,7 +706,7 @@ static void tda10086_release(struct dvb_frontend* fe) kfree(state); } -static struct dvb_frontend_ops tda10086_ops = { +static const struct dvb_frontend_ops tda10086_ops = { .delsys = { SYS_DVBS }, .info = { .name = "Philips TDA10086 DVB-S", diff --git a/drivers/media/dvb-frontends/tda18271c2dd.c b/drivers/media/dvb-frontends/tda18271c2dd.c index bc247f9b553a..6859fa5d5a85 100644 --- a/drivers/media/dvb-frontends/tda18271c2dd.c +++ b/drivers/media/dvb-frontends/tda18271c2dd.c @@ -1126,11 +1126,10 @@ static int init(struct dvb_frontend *fe) return 0; } -static int release(struct dvb_frontend *fe) +static void release(struct dvb_frontend *fe) { kfree(fe->tuner_priv); fe->tuner_priv = NULL; - return 0; } diff --git a/drivers/media/dvb-frontends/tda665x.c b/drivers/media/dvb-frontends/tda665x.c index 7ca965987f40..a63dec44295b 100644 --- a/drivers/media/dvb-frontends/tda665x.c +++ b/drivers/media/dvb-frontends/tda665x.c @@ -197,13 +197,12 @@ static int tda665x_set_params(struct dvb_frontend *fe) return 0; } -static int tda665x_release(struct dvb_frontend *fe) +static void tda665x_release(struct dvb_frontend *fe) { struct tda665x_state *state = fe->tuner_priv; fe->tuner_priv = NULL; kfree(state); - return 0; } static const struct dvb_tuner_ops tda665x_ops = { diff --git a/drivers/media/dvb-frontends/tda8083.c b/drivers/media/dvb-frontends/tda8083.c index 9072d6463094..aa3200d3c352 100644 --- a/drivers/media/dvb-frontends/tda8083.c +++ b/drivers/media/dvb-frontends/tda8083.c @@ -421,7 +421,7 @@ static void tda8083_release(struct dvb_frontend* fe) kfree(state); } -static struct dvb_frontend_ops tda8083_ops; +static const struct dvb_frontend_ops tda8083_ops; struct dvb_frontend* tda8083_attach(const struct tda8083_config* config, struct i2c_adapter* i2c) @@ -449,7 +449,7 @@ error: return NULL; } -static struct dvb_frontend_ops tda8083_ops = { +static const struct dvb_frontend_ops tda8083_ops = { .delsys = { SYS_DVBS }, .info = { .name = "Philips TDA8083 DVB-S", diff --git a/drivers/media/dvb-frontends/tda8261.c b/drivers/media/dvb-frontends/tda8261.c index e0df93191b9e..4eb294f330bc 100644 --- a/drivers/media/dvb-frontends/tda8261.c +++ b/drivers/media/dvb-frontends/tda8261.c @@ -152,13 +152,12 @@ static int tda8261_set_params(struct dvb_frontend *fe) return 0; } -static int tda8261_release(struct dvb_frontend *fe) +static void tda8261_release(struct dvb_frontend *fe) { struct tda8261_state *state = fe->tuner_priv; fe->tuner_priv = NULL; kfree(state); - return 0; } static const struct dvb_tuner_ops tda8261_ops = { diff --git a/drivers/media/dvb-frontends/tda826x.c b/drivers/media/dvb-frontends/tda826x.c index 2ec671df1441..da427b4c2aaa 100644 --- a/drivers/media/dvb-frontends/tda826x.c +++ b/drivers/media/dvb-frontends/tda826x.c @@ -41,11 +41,10 @@ struct tda826x_priv { u32 frequency; }; -static int tda826x_release(struct dvb_frontend *fe) +static void tda826x_release(struct dvb_frontend *fe) { kfree(fe->tuner_priv); fe->tuner_priv = NULL; - return 0; } static int tda826x_sleep(struct dvb_frontend *fe) diff --git a/drivers/media/dvb-frontends/ts2020.c b/drivers/media/dvb-frontends/ts2020.c index a9f6bbea6df3..931e5c98da8a 100644 --- a/drivers/media/dvb-frontends/ts2020.c +++ b/drivers/media/dvb-frontends/ts2020.c @@ -56,7 +56,7 @@ struct ts2020_reg_val { static void ts2020_stat_work(struct work_struct *work); -static int ts2020_release(struct dvb_frontend *fe) +static void ts2020_release(struct dvb_frontend *fe) { struct ts2020_priv *priv = fe->tuner_priv; struct i2c_client *client = priv->client; @@ -64,7 +64,6 @@ static int ts2020_release(struct dvb_frontend *fe) dev_dbg(&client->dev, "\n"); i2c_unregister_device(client); - return 0; } static int ts2020_sleep(struct dvb_frontend *fe) diff --git a/drivers/media/dvb-frontends/tua6100.c b/drivers/media/dvb-frontends/tua6100.c index 6da12b9e55eb..05ee16d29851 100644 --- a/drivers/media/dvb-frontends/tua6100.c +++ b/drivers/media/dvb-frontends/tua6100.c @@ -42,11 +42,10 @@ struct tua6100_priv { u32 frequency; }; -static int tua6100_release(struct dvb_frontend *fe) +static void tua6100_release(struct dvb_frontend *fe) { kfree(fe->tuner_priv); fe->tuner_priv = NULL; - return 0; } static int tua6100_sleep(struct dvb_frontend *fe) diff --git a/drivers/media/dvb-frontends/ves1820.c b/drivers/media/dvb-frontends/ves1820.c index b09fe88c40f8..178363704bd4 100644 --- a/drivers/media/dvb-frontends/ves1820.c +++ b/drivers/media/dvb-frontends/ves1820.c @@ -65,8 +65,8 @@ static int ves1820_writereg(struct ves1820_state *state, u8 reg, u8 data) ret = i2c_transfer(state->i2c, &msg, 1); if (ret != 1) - printk("ves1820: %s(): writereg error (reg == 0x%02x, " - "val == 0x%02x, ret == %i)\n", __func__, reg, data, ret); + printk("ves1820: %s(): writereg error (reg == 0x%02x, val == 0x%02x, ret == %i)\n", + __func__, reg, data, ret); return (ret != 1) ? -EREMOTEIO : 0; } @@ -84,8 +84,8 @@ static u8 ves1820_readreg(struct ves1820_state *state, u8 reg) ret = i2c_transfer(state->i2c, msg, 2); if (ret != 2) - printk("ves1820: %s(): readreg error (reg == 0x%02x, " - "ret == %i)\n", __func__, reg, ret); + printk("ves1820: %s(): readreg error (reg == 0x%02x, ret == %i)\n", + __func__, reg, ret); return b1[0]; } @@ -369,7 +369,7 @@ static void ves1820_release(struct dvb_frontend* fe) kfree(state); } -static struct dvb_frontend_ops ves1820_ops; +static const struct dvb_frontend_ops ves1820_ops; struct dvb_frontend* ves1820_attach(const struct ves1820_config* config, struct i2c_adapter* i2c, @@ -408,7 +408,7 @@ error: return NULL; } -static struct dvb_frontend_ops ves1820_ops = { +static const struct dvb_frontend_ops ves1820_ops = { .delsys = { SYS_DVBC_ANNEX_A }, .info = { .name = "VLSI VES1820 DVB-C", diff --git a/drivers/media/dvb-frontends/ves1x93.c b/drivers/media/dvb-frontends/ves1x93.c index ed113e216e14..d0ee52f66a8e 100644 --- a/drivers/media/dvb-frontends/ves1x93.c +++ b/drivers/media/dvb-frontends/ves1x93.c @@ -454,7 +454,7 @@ static int ves1x93_i2c_gate_ctrl(struct dvb_frontend* fe, int enable) } } -static struct dvb_frontend_ops ves1x93_ops; +static const struct dvb_frontend_ops ves1x93_ops; struct dvb_frontend* ves1x93_attach(const struct ves1x93_config* config, struct i2c_adapter* i2c) @@ -512,7 +512,7 @@ error: return NULL; } -static struct dvb_frontend_ops ves1x93_ops = { +static const struct dvb_frontend_ops ves1x93_ops = { .delsys = { SYS_DVBS }, .info = { .name = "VLSI VES1x93 DVB-S", diff --git a/drivers/media/dvb-frontends/zl10036.c b/drivers/media/dvb-frontends/zl10036.c index 7ed81315965f..a6d020fe9b8b 100644 --- a/drivers/media/dvb-frontends/zl10036.c +++ b/drivers/media/dvb-frontends/zl10036.c @@ -85,8 +85,8 @@ static int zl10036_read_status_reg(struct zl10036_state *state) deb_i2c("R(status): %02x [FL=%d]\n", status, (status & STATUS_FL) ? 1 : 0); if (status & STATUS_POR) - deb_info("%s: Power-On-Reset bit enabled - " - "need to initialize the tuner\n", __func__); + deb_info("%s: Power-On-Reset bit enabled - need to initialize the tuner\n", + __func__); return status; } @@ -134,14 +134,12 @@ static int zl10036_write(struct zl10036_state *state, u8 buf[], u8 count) return 0; } -static int zl10036_release(struct dvb_frontend *fe) +static void zl10036_release(struct dvb_frontend *fe) { struct zl10036_state *state = fe->tuner_priv; fe->tuner_priv = NULL; kfree(state); - - return 0; } static int zl10036_sleep(struct dvb_frontend *fe) diff --git a/drivers/media/dvb-frontends/zl10039.c b/drivers/media/dvb-frontends/zl10039.c index f8c271be196c..60a2954f8ff8 100644 --- a/drivers/media/dvb-frontends/zl10039.c +++ b/drivers/media/dvb-frontends/zl10039.c @@ -152,8 +152,7 @@ static int zl10039_init(struct dvb_frontend *fe) /* Reset logic */ ret = zl10039_writereg(state, GENERAL, 0x40); if (ret < 0) { - dprintk("Note: i2c write error normal when resetting the " - "tuner\n"); + dprintk("Note: i2c write error normal when resetting the tuner\n"); } /* Wake up */ ret = zl10039_writereg(state, GENERAL, 0x01); @@ -245,14 +244,13 @@ error: return ret; } -static int zl10039_release(struct dvb_frontend *fe) +static void zl10039_release(struct dvb_frontend *fe) { struct zl10039_state *state = fe->tuner_priv; dprintk("%s\n", __func__); kfree(state); fe->tuner_priv = NULL; - return 0; } static const struct dvb_tuner_ops zl10039_ops = { diff --git a/drivers/media/dvb-frontends/zl10353.c b/drivers/media/dvb-frontends/zl10353.c index 3b08176d7bec..4f3ff3e853ac 100644 --- a/drivers/media/dvb-frontends/zl10353.c +++ b/drivers/media/dvb-frontends/zl10353.c @@ -602,7 +602,7 @@ static void zl10353_release(struct dvb_frontend *fe) kfree(state); } -static struct dvb_frontend_ops zl10353_ops; +static const struct dvb_frontend_ops zl10353_ops; struct dvb_frontend *zl10353_attach(const struct zl10353_config *config, struct i2c_adapter *i2c) @@ -634,7 +634,7 @@ error: return NULL; } -static struct dvb_frontend_ops zl10353_ops = { +static const struct dvb_frontend_ops zl10353_ops = { .delsys = { SYS_DVBT }, .info = { .name = "Zarlink ZL10353 DVB-T", |