From 7cda4c5bae46ffca3abeadc4c1882d9325ee3102 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 13 Oct 2016 10:51:20 -0300 Subject: [PATCH] [media] tveeprom: use dev_foo() for printk messages Instead of calling a V4L-specific macro, do the right thing and use the dev_foo() macros. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tveeprom.c | 76 +++++++++++---------------------- 1 file changed, 24 insertions(+), 52 deletions(-) diff --git a/drivers/media/common/tveeprom.c b/drivers/media/common/tveeprom.c index e0e2cb706087..e7d0d86f19aa 100644 --- a/drivers/media/common/tveeprom.c +++ b/drivers/media/common/tveeprom.c @@ -28,7 +28,6 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - #include #include #include @@ -45,22 +44,9 @@ MODULE_DESCRIPTION("i2c Hauppauge eeprom decoder driver"); MODULE_AUTHOR("John Klar"); MODULE_LICENSE("GPL"); -static int debug; -module_param(debug, int, 0644); -MODULE_PARM_DESC(debug, "Debug level (0-1)"); - #define STRM(array, i) \ (i < sizeof(array) / sizeof(char *) ? array[i] : "unknown") -#define tveeprom_info(fmt, arg...) \ - v4l_printk(KERN_INFO, "tveeprom", c->adapter, c->addr, fmt , ## arg) -#define tveeprom_warn(fmt, arg...) \ - v4l_printk(KERN_WARNING, "tveeprom", c->adapter, c->addr, fmt , ## arg) -#define tveeprom_dbg(fmt, arg...) do { \ - if (debug) \ - v4l_printk(KERN_DEBUG, "tveeprom", \ - c->adapter, c->addr, fmt , ## arg); \ - } while (0) /* * The Hauppauge eeprom uses an 8bit field to determine which @@ -510,18 +496,13 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee, len = eeprom_data[i] & 0x07; ++i; } else { - tveeprom_warn("Encountered bad packet header [%02x]. Corrupt or not a Hauppauge eeprom.\n", + dev_warn(&c->dev, "Encountered bad packet header [%02x]. Corrupt or not a Hauppauge eeprom.\n", eeprom_data[i]); return; } - if (debug) { - tveeprom_info("Tag [%02x] + %d bytes:", - eeprom_data[i], len - 1); - for (j = 1; j < len; j++) - printk(KERN_CONT " %02x", eeprom_data[i + j]); - printk(KERN_CONT "\n"); - } + dev_dbg(&c->dev, "Tag [%02x] + %d bytes: %*ph\n", + eeprom_data[i], len - 1, len, &eeprom_data[i]); /* process by tag */ tag = eeprom_data[i]; @@ -661,14 +642,14 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee, /* case 0x12: tag 'InfoBits' */ default: - tveeprom_dbg("Not sure what to do with tag [%02x]\n", + dev_dbg(&c->dev, "Not sure what to do with tag [%02x]\n", tag); /* dump the rest of the packet? */ } } if (!done) { - tveeprom_warn("Ran out of data!\n"); + dev_warn(&c->dev, "Ran out of data!\n"); return; } @@ -681,8 +662,8 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee, } if (hasRadioTuner(tuner1) && !tvee->has_radio) { - tveeprom_info("The eeprom says no radio is present, but the tuner type\n"); - tveeprom_info("indicates otherwise. I will assume that radio is present.\n"); + dev_info(&c->dev, "The eeprom says no radio is present, but the tuner type\n"); + dev_info(&c->dev, "indicates otherwise. I will assume that radio is present.\n"); tvee->has_radio = 1; } @@ -717,46 +698,46 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee, } } - tveeprom_info("Hauppauge model %d, rev %s, serial# %u\n", + dev_info(&c->dev, "Hauppauge model %d, rev %s, serial# %u\n", tvee->model, tvee->rev_str, tvee->serial_number); if (tvee->has_MAC_address == 1) - tveeprom_info("MAC address is %pM\n", tvee->MAC_address); - tveeprom_info("tuner model is %s (idx %d, type %d)\n", + dev_info(&c->dev, "MAC address is %pM\n", tvee->MAC_address); + dev_info(&c->dev, "tuner model is %s (idx %d, type %d)\n", t_name1, tuner1, tvee->tuner_type); - tveeprom_info("TV standards%s%s%s%s%s%s%s%s (eeprom 0x%02x)\n", + dev_info(&c->dev, "TV standards%s%s%s%s%s%s%s%s (eeprom 0x%02x)\n", t_fmt_name1[0], t_fmt_name1[1], t_fmt_name1[2], t_fmt_name1[3], t_fmt_name1[4], t_fmt_name1[5], t_fmt_name1[6], t_fmt_name1[7], t_format1); if (tuner2) - tveeprom_info("second tuner model is %s (idx %d, type %d)\n", + dev_info(&c->dev, "second tuner model is %s (idx %d, type %d)\n", t_name2, tuner2, tvee->tuner2_type); if (t_format2) - tveeprom_info("TV standards%s%s%s%s%s%s%s%s (eeprom 0x%02x)\n", + dev_info(&c->dev, "TV standards%s%s%s%s%s%s%s%s (eeprom 0x%02x)\n", t_fmt_name2[0], t_fmt_name2[1], t_fmt_name2[2], t_fmt_name2[3], t_fmt_name2[4], t_fmt_name2[5], t_fmt_name2[6], t_fmt_name2[7], t_format2); if (audioic < 0) { - tveeprom_info("audio processor is unknown (no idx)\n"); + dev_info(&c->dev, "audio processor is unknown (no idx)\n"); tvee->audio_processor = TVEEPROM_AUDPROC_OTHER; } else { if (audioic < ARRAY_SIZE(audio_ic)) - tveeprom_info("audio processor is %s (idx %d)\n", + dev_info(&c->dev, "audio processor is %s (idx %d)\n", audio_ic[audioic].name, audioic); else - tveeprom_info("audio processor is unknown (idx %d)\n", + dev_info(&c->dev, "audio processor is unknown (idx %d)\n", audioic); } if (tvee->decoder_processor) - tveeprom_info("decoder processor is %s (idx %d)\n", + dev_info(&c->dev, "decoder processor is %s (idx %d)\n", STRM(decoderIC, tvee->decoder_processor), tvee->decoder_processor); if (tvee->has_ir) - tveeprom_info("has %sradio, has %sIR receiver, has %sIR transmitter\n", + dev_info(&c->dev, "has %sradio, has %sIR receiver, has %sIR transmitter\n", tvee->has_radio ? "" : "no ", (tvee->has_ir & 2) ? "" : "no ", (tvee->has_ir & 4) ? "" : "no "); else - tveeprom_info("has %sradio\n", + dev_info(&c->dev, "has %sradio\n", tvee->has_radio ? "" : "no "); } EXPORT_SYMBOL(tveeprom_hauppauge_analog); @@ -772,26 +753,17 @@ int tveeprom_read(struct i2c_client *c, unsigned char *eedata, int len) buf = 0; err = i2c_master_send(c, &buf, 1); if (err != 1) { - tveeprom_info("Huh, no eeprom present (err=%d)?\n", err); + dev_info(&c->dev, "Huh, no eeprom present (err=%d)?\n", err); return -1; } err = i2c_master_recv(c, eedata, len); if (err != len) { - tveeprom_warn("i2c eeprom read error (err=%d)\n", err); + dev_warn(&c->dev, "i2c eeprom read error (err=%d)\n", err); return -1; } - if (debug) { - int i; - - tveeprom_info("full 256-byte eeprom dump:\n"); - for (i = 0; i < len; i++) { - if (0 == (i % 16)) - tveeprom_info("%02x:", i); - printk(KERN_CONT " %02x", eedata[i]); - if (15 == (i % 16)) - printk(KERN_CONT "\n"); - } - } + + print_hex_dump_debug("full 256-byte eeprom dump:", DUMP_PREFIX_NONE, + 16, 1, eedata, len, true); return 0; } EXPORT_SYMBOL(tveeprom_read); -- 2.39.2