Commit f57e9618 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

[media] ivtv: use pr_foo() instead of calling printk() directly

pr_foo() provides a convenient way for printk's, enforcing
that they'll all prepend the error message with the driver's
name.

Use it inside ivtv.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
Acked-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent bbdba43f
...@@ -29,10 +29,11 @@ ...@@ -29,10 +29,11 @@
int ivtv_alsa_debug; int ivtv_alsa_debug;
static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
#define IVTV_DEBUG_ALSA_INFO(fmt, arg...) \ #define IVTV_DEBUG_ALSA_INFO(__fmt, __arg...) \
do { \ do { \
if (ivtv_alsa_debug & 2) \ if (ivtv_alsa_debug & 2) \
pr_info("%s: " fmt, "ivtv-alsa", ## arg); \ printk(KERN_INFO pr_fmt("%s: alsa:" __fmt), \
__func__, ##__arg); \
} while (0) } while (0)
module_param_named(debug, ivtv_alsa_debug, int, 0644); module_param_named(debug, ivtv_alsa_debug, int, 0644);
...@@ -221,8 +222,7 @@ static int ivtv_alsa_load(struct ivtv *itv) ...@@ -221,8 +222,7 @@ static int ivtv_alsa_load(struct ivtv *itv)
s = &itv->streams[IVTV_ENC_STREAM_TYPE_PCM]; s = &itv->streams[IVTV_ENC_STREAM_TYPE_PCM];
if (s->vdev.v4l2_dev == NULL) { if (s->vdev.v4l2_dev == NULL) {
IVTV_DEBUG_ALSA_INFO("%s: PCM stream for card is disabled - skipping\n", IVTV_DEBUG_ALSA_INFO("PCM stream for card is disabled - skipping\n");
__func__);
return 0; return 0;
} }
...@@ -236,8 +236,7 @@ static int ivtv_alsa_load(struct ivtv *itv) ...@@ -236,8 +236,7 @@ static int ivtv_alsa_load(struct ivtv *itv)
IVTV_ALSA_ERR("%s: failed to create struct snd_ivtv_card\n", IVTV_ALSA_ERR("%s: failed to create struct snd_ivtv_card\n",
__func__); __func__);
} else { } else {
IVTV_DEBUG_ALSA_INFO("%s: created ivtv ALSA interface instance \n", IVTV_DEBUG_ALSA_INFO("created ivtv ALSA interface instance\n");
__func__);
} }
return 0; return 0;
} }
......
...@@ -1452,7 +1452,7 @@ static void ivtv_remove(struct pci_dev *pdev) ...@@ -1452,7 +1452,7 @@ static void ivtv_remove(struct pci_dev *pdev)
for (i = 0; i < IVTV_VBI_FRAMES; i++) for (i = 0; i < IVTV_VBI_FRAMES; i++)
kfree(itv->vbi.sliced_mpeg_data[i]); kfree(itv->vbi.sliced_mpeg_data[i]);
printk(KERN_INFO "ivtv: Removed %s\n", itv->card_name); pr_info("Removed %s\n", itv->card_name);
v4l2_device_unregister(&itv->v4l2_dev); v4l2_device_unregister(&itv->v4l2_dev);
kfree(itv); kfree(itv);
...@@ -1468,25 +1468,25 @@ static struct pci_driver ivtv_pci_driver = { ...@@ -1468,25 +1468,25 @@ static struct pci_driver ivtv_pci_driver = {
static int __init module_start(void) static int __init module_start(void)
{ {
printk(KERN_INFO "ivtv: Start initialization, version %s\n", IVTV_VERSION); pr_info("Start initialization, version %s\n", IVTV_VERSION);
/* Validate parameters */ /* Validate parameters */
if (ivtv_first_minor < 0 || ivtv_first_minor >= IVTV_MAX_CARDS) { if (ivtv_first_minor < 0 || ivtv_first_minor >= IVTV_MAX_CARDS) {
printk(KERN_ERR "ivtv: Exiting, ivtv_first_minor must be between 0 and %d\n", pr_err("Exiting, ivtv_first_minor must be between 0 and %d\n",
IVTV_MAX_CARDS - 1); IVTV_MAX_CARDS - 1);
return -1; return -1;
} }
if (ivtv_debug < 0 || ivtv_debug > 2047) { if (ivtv_debug < 0 || ivtv_debug > 2047) {
ivtv_debug = 0; ivtv_debug = 0;
printk(KERN_INFO "ivtv: Debug value must be >= 0 and <= 2047\n"); pr_info("Debug value must be >= 0 and <= 2047\n");
} }
if (pci_register_driver(&ivtv_pci_driver)) { if (pci_register_driver(&ivtv_pci_driver)) {
printk(KERN_ERR "ivtv: Error detecting PCI card\n"); pr_err("Error detecting PCI card\n");
return -ENODEV; return -ENODEV;
} }
printk(KERN_INFO "ivtv: End initialization\n"); pr_info("End initialization\n");
return 0; return 0;
} }
......
...@@ -1270,7 +1270,7 @@ static int __init ivtvfb_init(void) ...@@ -1270,7 +1270,7 @@ static int __init ivtvfb_init(void)
if (ivtvfb_card_id < -1 || ivtvfb_card_id >= IVTV_MAX_CARDS) { if (ivtvfb_card_id < -1 || ivtvfb_card_id >= IVTV_MAX_CARDS) {
printk(KERN_ERR "ivtvfb: ivtvfb_card_id parameter is out of range (valid range: -1 - %d)\n", pr_err("ivtvfb_card_id parameter is out of range (valid range: -1 - %d)\n",
IVTV_MAX_CARDS - 1); IVTV_MAX_CARDS - 1);
return -EINVAL; return -EINVAL;
} }
...@@ -1279,7 +1279,7 @@ static int __init ivtvfb_init(void) ...@@ -1279,7 +1279,7 @@ static int __init ivtvfb_init(void)
err = driver_for_each_device(drv, NULL, &registered, ivtvfb_callback_init); err = driver_for_each_device(drv, NULL, &registered, ivtvfb_callback_init);
(void)err; /* suppress compiler warning */ (void)err; /* suppress compiler warning */
if (!registered) { if (!registered) {
printk(KERN_ERR "ivtvfb: no cards found\n"); pr_err("no cards found\n");
return -ENODEV; return -ENODEV;
} }
return 0; return 0;
...@@ -1290,7 +1290,7 @@ static void ivtvfb_cleanup(void) ...@@ -1290,7 +1290,7 @@ static void ivtvfb_cleanup(void)
struct device_driver *drv; struct device_driver *drv;
int err; int err;
printk(KERN_INFO "ivtvfb: Unloading framebuffer module\n"); pr_info("Unloading framebuffer module\n");
drv = driver_find("ivtv", &pci_bus_type); drv = driver_find("ivtv", &pci_bus_type);
err = driver_for_each_device(drv, NULL, NULL, ivtvfb_callback_cleanup); err = driver_for_each_device(drv, NULL, NULL, ivtvfb_callback_cleanup);
......
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