This patch fixes the following checkpatch warnings: WARNING:PREFER_PR_LEVEL: Prefer [subsystem eg: netdev]_dbg([subsystem]dev, ... then dev_dbg(dev, ... then pr_debug(... to printk(KERN_DEBUG ... WARNING:PRINTK_WITHOUT_KERN_LEVEL: printk() should include KERN_<LEVEL> facility level WARNING:TRACING_LOGGING: Unnecessary ftrace-like logging - prefer using ftrace ERROR:TRAILING_STATEMENTS: trailing statements should be on next line Convert logging to the recommend pr_* macros. Signed-off-by: Stefan Herdler <herdler@xxxxxxxxxxxxxx> --- drivers/staging/media/av7110/sp8870.c | 46 +++++++++++++++------------ drivers/staging/media/av7110/sp8870.h | 2 +- 2 files changed, 27 insertions(+), 21 deletions(-) diff --git a/drivers/staging/media/av7110/sp8870.c b/drivers/staging/media/av7110/sp8870.c index 282beb157..0c813860f 100644 --- a/drivers/staging/media/av7110/sp8870.c +++ b/drivers/staging/media/av7110/sp8870.c @@ -11,6 +11,12 @@ * download/extract it, and then copy it to /usr/lib/hotplug/firmware * or /lib/firmware (depending on configuration of firmware hotplug). */ + +#ifdef pr_fmt +#undef pr_fmt +#endif +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #define SP8870_DEFAULT_FIRMWARE "dvb-fe-sp8870.fw" #include <linux/init.h> @@ -36,9 +42,10 @@ struct sp8870_state { }; static int debug; -#define dprintk(args...) \ +#define dprintk(fmt, arg...) \ do { \ - if (debug) printk(KERN_DEBUG "sp8870: " args); \ + if (debug) \ + pr_info("%s(): " fmt, __func__, ##arg); \ } while (0) /* firmware size for sp8870 */ @@ -61,7 +68,7 @@ static int sp8870_writereg(struct sp8870_state *state, u16 reg, u16 data) err = i2c_transfer(state->i2c, &msg, 1); if (err != 1) { - dprintk ("%s: writereg error (err == %i, reg == 0x%02x, data == 0x%02x)\n", __func__, err, reg, data); + dprintk("writereg error (err == %i, reg == 0x%02x, data == 0x%02x)\n", err, reg, data); return -EREMOTEIO; } @@ -81,7 +88,7 @@ static int sp8870_readreg(struct sp8870_state *state, u16 reg) ret = i2c_transfer(state->i2c, msg, 2); if (ret != 2) { - dprintk("%s: readreg error (ret == %i)\n", __func__, ret); + dprintk("readreg error (ret == %i)\n", ret); return -1; } @@ -97,7 +104,7 @@ static int sp8870_firmware_upload(struct sp8870_state *state, const struct firmw int tx_len; int err = 0; - dprintk ("%s: ...\n", __func__); + dprintk("start firmware upload...\n"); if (fw->size < SP8870_FIRMWARE_SIZE + SP8870_FIRMWARE_OFFSET) return -EINVAL; @@ -126,14 +133,14 @@ static int sp8870_firmware_upload(struct sp8870_state *state, const struct firmw msg.len = tx_len + 2; err = i2c_transfer(state->i2c, &msg, 1); if (err != 1) { - printk("%s: firmware upload failed!\n", __func__); - printk ("%s: i2c error (err == %i)\n", __func__, err); + pr_err("%s(): firmware upload failed!\n", __func__); + pr_err("%s(): i2c error (err == %i)\n", __func__, err); return err; } fw_pos += tx_len; } - dprintk ("%s: done!\n", __func__); + dprintk("firmware upload successful!\n"); return 0; }; @@ -310,22 +317,22 @@ static int sp8870_init(struct dvb_frontend *fe) return 0; state->initialised = 1; - dprintk ("%s\n", __func__); + dprintk("initialising frontend...\n"); /* request the firmware, this will block until someone uploads it */ - printk("sp8870: waiting for firmware upload (%s)...\n", SP8870_DEFAULT_FIRMWARE); + pr_info("waiting for firmware upload (%s)...\n", SP8870_DEFAULT_FIRMWARE); if (state->config->request_firmware(fe, &fw, SP8870_DEFAULT_FIRMWARE)) { - printk("sp8870: no firmware upload (timeout or file not found?)\n"); + pr_err("no firmware upload (timeout or file not found?)\n"); return -EIO; } if (sp8870_firmware_upload(state, fw)) { - printk("sp8870: writing firmware to device failed\n"); + pr_err("writing firmware to device failed\n"); release_firmware(fw); return -EIO; } release_firmware(fw); - printk("sp8870: firmware upload complete\n"); + pr_info("firmware upload complete\n"); /* enable TS output and interface pins */ sp8870_writereg(state, 0xc18, 0x00d); @@ -475,7 +482,7 @@ static int sp8870_set_frontend(struct dvb_frontend *fe) int trials = 0; int check_count = 0; - dprintk("%s: frequency = %i\n", __func__, p->frequency); + dprintk("frequency = %i\n", p->frequency); for (trials = 1; trials <= MAXTRIALS; trials++) { err = sp8870_set_frontend_parameters(fe); @@ -486,8 +493,7 @@ static int sp8870_set_frontend(struct dvb_frontend *fe) // valid = ((sp8870_readreg(i2c, 0x0200) & 4) == 0); valid = sp8870_read_data_valid_signal(state); if (valid) { - dprintk("%s: delay = %i usec\n", - __func__, check_count * 10); + dprintk("delay = %i usec\n", check_count * 10); break; } udelay(10); @@ -497,20 +503,20 @@ static int sp8870_set_frontend(struct dvb_frontend *fe) } if (!valid) { - printk("%s: firmware crash!!!!!!\n", __func__); + pr_err("%s(): firmware crash!!!!!!\n", __func__); return -EIO; } if (debug) { if (valid) { if (trials > 1) { - printk("%s: firmware lockup!!!\n", __func__); - printk("%s: recovered after %i trial(s))\n", __func__, trials - 1); + pr_info("%s(): firmware lockup!!!\n", __func__); + pr_info("%s(): recovered after %i trial(s))\n", __func__, trials - 1); lockups++; } } switches++; - printk("%s: switches = %i lockups = %i\n", __func__, switches, lockups); + pr_info("%s(): switches = %i lockups = %i\n", __func__, switches, lockups); } return 0; diff --git a/drivers/staging/media/av7110/sp8870.h b/drivers/staging/media/av7110/sp8870.h index 3f566671c..3323d1dfa 100644 --- a/drivers/staging/media/av7110/sp8870.h +++ b/drivers/staging/media/av7110/sp8870.h @@ -25,7 +25,7 @@ struct dvb_frontend *sp8870_attach(const struct sp8870_config *config, struct i2 static inline struct dvb_frontend *sp8870_attach(const struct sp8870_config *config, struct i2c_adapter *i2c) { - printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); + pr_warn(KBUILD_MODNAME ": %s(): driver disabled by Kconfig\n", __func__); return NULL; } #endif // CONFIG_DVB_SP8870 -- 2.34.0