Commit 7cda4c5b authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

[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: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 8ca2e927
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include <linux/module.h> #include <linux/module.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -45,22 +44,9 @@ MODULE_DESCRIPTION("i2c Hauppauge eeprom decoder driver"); ...@@ -45,22 +44,9 @@ MODULE_DESCRIPTION("i2c Hauppauge eeprom decoder driver");
MODULE_AUTHOR("John Klar"); MODULE_AUTHOR("John Klar");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
static int debug;
module_param(debug, int, 0644);
MODULE_PARM_DESC(debug, "Debug level (0-1)");
#define STRM(array, i) \ #define STRM(array, i) \
(i < sizeof(array) / sizeof(char *) ? array[i] : "unknown") (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 * 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, ...@@ -510,18 +496,13 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
len = eeprom_data[i] & 0x07; len = eeprom_data[i] & 0x07;
++i; ++i;
} else { } 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]); eeprom_data[i]);
return; return;
} }
if (debug) { dev_dbg(&c->dev, "Tag [%02x] + %d bytes: %*ph\n",
tveeprom_info("Tag [%02x] + %d bytes:", eeprom_data[i], len - 1, len, &eeprom_data[i]);
eeprom_data[i], len - 1);
for (j = 1; j < len; j++)
printk(KERN_CONT " %02x", eeprom_data[i + j]);
printk(KERN_CONT "\n");
}
/* process by tag */ /* process by tag */
tag = eeprom_data[i]; tag = eeprom_data[i];
...@@ -661,14 +642,14 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee, ...@@ -661,14 +642,14 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
/* case 0x12: tag 'InfoBits' */ /* case 0x12: tag 'InfoBits' */
default: 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); tag);
/* dump the rest of the packet? */ /* dump the rest of the packet? */
} }
} }
if (!done) { if (!done) {
tveeprom_warn("Ran out of data!\n"); dev_warn(&c->dev, "Ran out of data!\n");
return; return;
} }
...@@ -681,8 +662,8 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee, ...@@ -681,8 +662,8 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
} }
if (hasRadioTuner(tuner1) && !tvee->has_radio) { if (hasRadioTuner(tuner1) && !tvee->has_radio) {
tveeprom_info("The eeprom says no radio is present, but the tuner type\n"); dev_info(&c->dev, "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, "indicates otherwise. I will assume that radio is present.\n");
tvee->has_radio = 1; tvee->has_radio = 1;
} }
...@@ -717,46 +698,46 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee, ...@@ -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); tvee->model, tvee->rev_str, tvee->serial_number);
if (tvee->has_MAC_address == 1) if (tvee->has_MAC_address == 1)
tveeprom_info("MAC address is %pM\n", tvee->MAC_address); dev_info(&c->dev, "MAC address is %pM\n", tvee->MAC_address);
tveeprom_info("tuner model is %s (idx %d, type %d)\n", dev_info(&c->dev, "tuner model is %s (idx %d, type %d)\n",
t_name1, tuner1, tvee->tuner_type); 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[0], t_fmt_name1[1], t_fmt_name1[2],
t_fmt_name1[3], t_fmt_name1[4], t_fmt_name1[5], t_fmt_name1[3], t_fmt_name1[4], t_fmt_name1[5],
t_fmt_name1[6], t_fmt_name1[7], t_format1); t_fmt_name1[6], t_fmt_name1[7], t_format1);
if (tuner2) 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); t_name2, tuner2, tvee->tuner2_type);
if (t_format2) 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[0], t_fmt_name2[1], t_fmt_name2[2],
t_fmt_name2[3], t_fmt_name2[4], t_fmt_name2[5], t_fmt_name2[3], t_fmt_name2[4], t_fmt_name2[5],
t_fmt_name2[6], t_fmt_name2[7], t_format2); t_fmt_name2[6], t_fmt_name2[7], t_format2);
if (audioic < 0) { 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; tvee->audio_processor = TVEEPROM_AUDPROC_OTHER;
} else { } else {
if (audioic < ARRAY_SIZE(audio_ic)) 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); audio_ic[audioic].name, audioic);
else else
tveeprom_info("audio processor is unknown (idx %d)\n", dev_info(&c->dev, "audio processor is unknown (idx %d)\n",
audioic); audioic);
} }
if (tvee->decoder_processor) 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), STRM(decoderIC, tvee->decoder_processor),
tvee->decoder_processor); tvee->decoder_processor);
if (tvee->has_ir) 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_radio ? "" : "no ",
(tvee->has_ir & 2) ? "" : "no ", (tvee->has_ir & 2) ? "" : "no ",
(tvee->has_ir & 4) ? "" : "no "); (tvee->has_ir & 4) ? "" : "no ");
else else
tveeprom_info("has %sradio\n", dev_info(&c->dev, "has %sradio\n",
tvee->has_radio ? "" : "no "); tvee->has_radio ? "" : "no ");
} }
EXPORT_SYMBOL(tveeprom_hauppauge_analog); EXPORT_SYMBOL(tveeprom_hauppauge_analog);
...@@ -772,26 +753,17 @@ int tveeprom_read(struct i2c_client *c, unsigned char *eedata, int len) ...@@ -772,26 +753,17 @@ int tveeprom_read(struct i2c_client *c, unsigned char *eedata, int len)
buf = 0; buf = 0;
err = i2c_master_send(c, &buf, 1); err = i2c_master_send(c, &buf, 1);
if (err != 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; return -1;
} }
err = i2c_master_recv(c, eedata, len); err = i2c_master_recv(c, eedata, len);
if (err != 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; return -1;
} }
if (debug) {
int i; print_hex_dump_debug("full 256-byte eeprom dump:", DUMP_PREFIX_NONE,
16, 1, eedata, len, true);
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");
}
}
return 0; return 0;
} }
EXPORT_SYMBOL(tveeprom_read); EXPORT_SYMBOL(tveeprom_read);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment