Commit 2a96f60e authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

[media] em28xx: convert the remaining printks to pr_foo

There are still several places with printk's called directly.

Convert them to pr_foo() macros, except for the debug printk's,
as those are enabled via modprobe vars.

While here, realign the pr_foo() arguments to match the
recommended CodingStyle.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 8314d402
......@@ -56,9 +56,8 @@ MODULE_PARM_DESC(debug, "activates debug info");
#define dprintk(fmt, arg...) do { \
if (debug) \
printk(KERN_INFO "em28xx-audio %s: " fmt, \
__func__, ##arg); \
} while (0)
printk(KERN_DEBUG pr_fmt("audio: %s: " fmt), \
__func__, ##arg); } while (0)
static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
......@@ -902,9 +901,8 @@ static int em28xx_audio_init(struct em28xx *dev)
kref_get(&dev->ref);
printk(KERN_INFO "em28xx-audio.c: Copyright (C) 2006 Markus Rechberger\n");
printk(KERN_INFO
"em28xx-audio.c: Copyright (C) 2007-2016 Mauro Carvalho Chehab\n");
pr_info("em28xx-audio.c: Copyright (C) 2006 Markus Rechberger\n");
pr_info("em28xx-audio.c: Copyright (C) 2007-2016 Mauro Carvalho Chehab\n");
err = snd_card_new(&dev->udev->dev, index[devnr], "Em28xx Audio",
THIS_MODULE, 0, &card);
......
......@@ -180,8 +180,7 @@ static int em28xx_probe_sensor_micron(struct em28xx *dev)
dev->em28xx_sensor = EM28XX_MT9M001;
break;
default:
pr_info("unknown Micron sensor detected: 0x%04x\n",
id);
pr_info("unknown Micron sensor detected: 0x%04x\n", id);
return 0;
}
......
......@@ -2882,8 +2882,7 @@ static int em28xx_hint_board(struct em28xx *dev)
pr_err("Here is a list of valid choices for the card=<n> insmod option:\n");
for (i = 0; i < em28xx_bcount; i++) {
pr_err(" card=%d -> %s\n",
i, em28xx_boards[i].name);
pr_err(" card=%d -> %s\n", i, em28xx_boards[i].name);
}
return -1;
}
......@@ -3318,14 +3317,12 @@ static int em28xx_init_dev(struct em28xx *dev, struct usb_device *udev,
dev->eeprom_addrwidth_16bit = 1;
break;
default:
printk(KERN_INFO DRIVER_NAME
": unknown em28xx chip ID (%d)\n", dev->chip_id);
pr_info("unknown em28xx chip ID (%d)\n", dev->chip_id);
}
}
if (chip_name != default_chip_name)
printk(KERN_INFO DRIVER_NAME
": chip ID is %s\n", chip_name);
pr_info("chip ID is %s\n", chip_name);
/*
* For em2820/em2710, the name may change latter, after checking
......@@ -3418,8 +3415,7 @@ static int em28xx_usb_probe(struct usb_interface *interface,
nr = find_first_zero_bit(em28xx_devused, EM28XX_MAXBOARDS);
if (nr >= EM28XX_MAXBOARDS) {
/* No free device slots */
printk(DRIVER_NAME
": Supports only %i em28xx boards.\n",
pr_err("Driver supports up to %i em28xx boards.\n",
EM28XX_MAXBOARDS);
retval = -ENOMEM;
goto err_no_slot;
......@@ -3428,8 +3424,7 @@ static int em28xx_usb_probe(struct usb_interface *interface,
/* Don't register audio interfaces */
if (interface->altsetting[0].desc.bInterfaceClass == USB_CLASS_AUDIO) {
pr_err(DRIVER_NAME
" audio device (%04x:%04x): interface %i, class %i\n",
pr_err("audio device (%04x:%04x): interface %i, class %i\n",
le16_to_cpu(udev->descriptor.idVendor),
le16_to_cpu(udev->descriptor.idProduct),
ifnum,
......@@ -3489,8 +3484,7 @@ static int em28xx_usb_probe(struct usb_interface *interface,
if (usb_endpoint_xfer_isoc(e)) {
has_vendor_audio = true;
} else {
printk(KERN_INFO DRIVER_NAME
": error: skipping audio endpoint 0x83, because it uses bulk transfers !\n");
pr_err("error: skipping audio endpoint 0x83, because it uses bulk transfers !\n");
}
break;
case 0x84:
......@@ -3563,8 +3557,7 @@ static int em28xx_usb_probe(struct usb_interface *interface,
speed = "unknown";
}
printk(KERN_INFO DRIVER_NAME
": New device %s %s @ %s Mbps (%04x:%04x, interface %d, class %d)\n",
pr_info("New device %s %s @ %s Mbps (%04x:%04x, interface %d, class %d)\n",
udev->manufacturer ? udev->manufacturer : "",
udev->product ? udev->product : "",
speed,
......@@ -3579,8 +3572,8 @@ static int em28xx_usb_probe(struct usb_interface *interface,
* not enough even for most Digital TV streams.
*/
if (udev->speed != USB_SPEED_HIGH && disable_usb_speed_check == 0) {
printk(DRIVER_NAME ": Device initialization failed.\n");
printk(DRIVER_NAME ": Device must be connected to a high-speed USB 2.0 port.\n");
pr_err("Device initialization failed.\n");
pr_err("Device must be connected to a high-speed USB 2.0 port.\n");
retval = -ENODEV;
goto err_free;
}
......@@ -3593,8 +3586,7 @@ static int em28xx_usb_probe(struct usb_interface *interface,
dev->ifnum = ifnum;
if (has_vendor_audio) {
printk(KERN_INFO DRIVER_NAME ": Audio interface %i found %s\n",
ifnum, "(Vendor Class)");
pr_info("Audio interface %i found (Vendor Class)\n", ifnum);
dev->usb_audio_type = EM28XX_USB_AUDIO_VENDOR;
}
/* Checks if audio is provided by a USB Audio Class interface */
......@@ -3611,14 +3603,12 @@ static int em28xx_usb_probe(struct usb_interface *interface,
}
if (has_video)
printk(KERN_INFO DRIVER_NAME
": Video interface %i found:%s%s\n",
pr_info("Video interface %i found:%s%s\n",
ifnum,
dev->analog_ep_bulk ? " bulk" : "",
dev->analog_ep_isoc ? " isoc" : "");
if (has_dvb)
printk(KERN_INFO DRIVER_NAME
": DVB interface %i found:%s%s\n",
pr_info("DVB interface %i found:%s%s\n",
ifnum,
dev->dvb_ep_bulk ? " bulk" : "",
dev->dvb_ep_isoc ? " isoc" : "");
......@@ -3650,8 +3640,7 @@ static int em28xx_usb_probe(struct usb_interface *interface,
/* Disable V4L2 if the device doesn't have a decoder */
if (has_video &&
dev->board.decoder == EM28XX_NODECODER && !dev->board.is_webcam) {
printk(DRIVER_NAME
": Currently, V4L2 is not supported on this model\n");
pr_err("Currently, V4L2 is not supported on this model\n");
has_video = false;
dev->has_video = false;
}
......
......@@ -48,12 +48,12 @@ MODULE_VERSION(EM28XX_VERSION);
static unsigned int core_debug;
module_param(core_debug, int, 0644);
MODULE_PARM_DESC(core_debug, "enable debug messages [core]");
MODULE_PARM_DESC(core_debug, "enable debug messages [core and isoc]");
#define em28xx_coredbg(fmt, arg...) do {\
if (core_debug) \
printk(KERN_INFO "%s %s :"fmt, \
dev->name, __func__ , ##arg); } while (0)
printk(KERN_DEBUG pr_fmt("core: %s: " fmt), \
__func__, ##arg); } while (0)
static unsigned int reg_debug;
module_param(reg_debug, int, 0644);
......@@ -61,14 +61,14 @@ MODULE_PARM_DESC(reg_debug, "enable debug messages [URB reg]");
#define em28xx_regdbg(fmt, arg...) do {\
if (reg_debug) \
printk(KERN_INFO "%s %s :"fmt, \
dev->name, __func__ , ##arg); } while (0)
printk(KERN_DEBUG pr_fmt("reg: %s: " fmt), \
__func__, ##arg); } while (0)
/* FIXME */
#define em28xx_isocdbg(fmt, arg...) do {\
if (core_debug) \
printk(KERN_INFO "%s %s :"fmt, \
dev->name, __func__ , ##arg); } while (0)
printk(KERN_DEBUG pr_fmt("isoc: %s: " fmt), \
__func__, ##arg); } while (0)
/*
* em28xx_read_reg_req()
......@@ -102,7 +102,7 @@ int em28xx_read_reg_req_len(struct em28xx *dev, u8 req, u16 reg,
0x0000, reg, dev->urb_buf, len, HZ);
if (ret < 0) {
if (reg_debug)
printk(KERN_CONT " failed!\n");
pr_cont(" failed!\n");
mutex_unlock(&dev->ctrl_urb_lock);
return usb_translate_errors(ret);
}
......@@ -115,10 +115,10 @@ int em28xx_read_reg_req_len(struct em28xx *dev, u8 req, u16 reg,
if (reg_debug) {
int byte;
printk(KERN_CONT "<<<");
pr_cont("<<<");
for (byte = 0; byte < len; byte++)
printk(KERN_CONT " %02x", (unsigned char)buf[byte]);
printk(KERN_CONT "\n");
pr_cont(" %02x", (unsigned char)buf[byte]);
pr_cont("\n");
}
return ret;
......@@ -174,8 +174,8 @@ int em28xx_write_regs_req(struct em28xx *dev, u8 req, u16 reg, char *buf,
len & 0xff, len >> 8);
for (byte = 0; byte < len; byte++)
printk(KERN_CONT " %02x", (unsigned char)buf[byte]);
printk(KERN_CONT "\n");
pr_cont(" %02x", (unsigned char)buf[byte]);
pr_cont("\n");
}
mutex_lock(&dev->ctrl_urb_lock);
......@@ -1037,8 +1037,7 @@ int em28xx_init_usb_xfer(struct em28xx *dev, enum em28xx_mode mode,
for (i = 0; i < usb_bufs->num_bufs; i++) {
rc = usb_submit_urb(usb_bufs->urb[i], GFP_ATOMIC);
if (rc) {
pr_err("submit of urb %i failed (error=%i)\n", i,
rc);
pr_err("submit of urb %i failed (error=%i)\n", i, rc);
em28xx_uninit_usb_xfer(dev, mode);
return rc;
}
......@@ -1071,7 +1070,7 @@ int em28xx_register_extension(struct em28xx_ops *ops)
ops->init(dev);
}
mutex_unlock(&em28xx_devlist_mutex);
printk(KERN_INFO "em28xx: Registered (%s) extension\n", ops->name);
pr_info("em28xx: Registered (%s) extension\n", ops->name);
return 0;
}
EXPORT_SYMBOL(em28xx_register_extension);
......@@ -1086,7 +1085,7 @@ void em28xx_unregister_extension(struct em28xx_ops *ops)
}
list_del(&ops->next);
mutex_unlock(&em28xx_devlist_mutex);
printk(KERN_INFO "Em28xx: Removed (%s) extension\n", ops->name);
pr_info("Em28xx: Removed (%s) extension\n", ops->name);
}
EXPORT_SYMBOL(em28xx_unregister_extension);
......
......@@ -935,19 +935,19 @@ static int em28xx_attach_xc3028(u8 addr, struct em28xx *dev)
cfg.ctrl = &ctl;
if (!dev->dvb->fe[0]) {
pr_err("/2: dvb frontend not attached. Can't attach xc3028\n");
pr_err("dvb frontend not attached. Can't attach xc3028\n");
return -EINVAL;
}
fe = dvb_attach(xc2028_attach, dev->dvb->fe[0], &cfg);
if (!fe) {
pr_err("/2: xc3028 attach failed\n");
pr_err("xc3028 attach failed\n");
dvb_frontend_detach(dev->dvb->fe[0]);
dev->dvb->fe[0] = NULL;
return -EINVAL;
}
pr_info("%s/2: xc3028 attached\n", dev->name);
pr_info("xc3028 attached\n");
return 0;
}
......@@ -966,8 +966,8 @@ static int em28xx_register_dvb(struct em28xx_dvb *dvb, struct module *module,
result = dvb_register_adapter(&dvb->adapter, dev->name, module, device,
adapter_nr);
if (result < 0) {
printk(KERN_WARNING "%s: dvb_register_adapter failed (errno = %d)\n",
dev->name, result);
pr_warn("dvb_register_adapter failed (errno = %d)\n",
result);
goto fail_adapter;
}
#ifdef CONFIG_MEDIA_CONTROLLER_DVB
......@@ -984,8 +984,8 @@ static int em28xx_register_dvb(struct em28xx_dvb *dvb, struct module *module,
/* register frontend */
result = dvb_register_frontend(&dvb->adapter, dvb->fe[0]);
if (result < 0) {
printk(KERN_WARNING "%s: dvb_register_frontend failed (errno = %d)\n",
dev->name, result);
pr_warn("dvb_register_frontend failed (errno = %d)\n",
result);
goto fail_frontend0;
}
......@@ -993,8 +993,8 @@ static int em28xx_register_dvb(struct em28xx_dvb *dvb, struct module *module,
if (dvb->fe[1]) {
result = dvb_register_frontend(&dvb->adapter, dvb->fe[1]);
if (result < 0) {
printk(KERN_WARNING "%s: 2nd dvb_register_frontend failed (errno = %d)\n",
dev->name, result);
pr_warn("2nd dvb_register_frontend failed (errno = %d)\n",
result);
goto fail_frontend1;
}
}
......@@ -1011,8 +1011,7 @@ static int em28xx_register_dvb(struct em28xx_dvb *dvb, struct module *module,
result = dvb_dmx_init(&dvb->demux);
if (result < 0) {
printk(KERN_WARNING "%s: dvb_dmx_init failed (errno = %d)\n",
dev->name, result);
pr_warn("dvb_dmx_init failed (errno = %d)\n", result);
goto fail_dmx;
}
......@@ -1021,31 +1020,29 @@ static int em28xx_register_dvb(struct em28xx_dvb *dvb, struct module *module,
dvb->dmxdev.capabilities = 0;
result = dvb_dmxdev_init(&dvb->dmxdev, &dvb->adapter);
if (result < 0) {
printk(KERN_WARNING "%s: dvb_dmxdev_init failed (errno = %d)\n",
dev->name, result);
pr_warn("dvb_dmxdev_init failed (errno = %d)\n", result);
goto fail_dmxdev;
}
dvb->fe_hw.source = DMX_FRONTEND_0;
result = dvb->demux.dmx.add_frontend(&dvb->demux.dmx, &dvb->fe_hw);
if (result < 0) {
printk(KERN_WARNING "%s: add_frontend failed (DMX_FRONTEND_0, errno = %d)\n",
dev->name, result);
pr_warn("add_frontend failed (DMX_FRONTEND_0, errno = %d)\n",
result);
goto fail_fe_hw;
}
dvb->fe_mem.source = DMX_MEMORY_FE;
result = dvb->demux.dmx.add_frontend(&dvb->demux.dmx, &dvb->fe_mem);
if (result < 0) {
printk(KERN_WARNING "%s: add_frontend failed (DMX_MEMORY_FE, errno = %d)\n",
dev->name, result);
pr_warn("add_frontend failed (DMX_MEMORY_FE, errno = %d)\n",
result);
goto fail_fe_mem;
}
result = dvb->demux.dmx.connect_frontend(&dvb->demux.dmx, &dvb->fe_hw);
if (result < 0) {
printk(KERN_WARNING "%s: connect_frontend failed (errno = %d)\n",
dev->name, result);
pr_warn("connect_frontend failed (errno = %d)\n", result);
goto fail_fe_conn;
}
......@@ -1936,11 +1933,11 @@ static int em28xx_dvb_init(struct em28xx *dev)
}
break;
default:
pr_err("/2: The frontend of your DVB/ATSC card isn't supported yet\n");
pr_err("The frontend of your DVB/ATSC card isn't supported yet\n");
break;
}
if (NULL == dvb->fe[0]) {
pr_err("/2: frontend initialization failed\n");
pr_err("frontend initialization failed\n");
result = -EINVAL;
goto out_free;
}
......
......@@ -544,11 +544,11 @@ static int em28xx_i2c_xfer(struct i2c_adapter *i2c_adap,
if (rc < 0) {
if (rc == -ENXIO) {
if (i2c_debug > 1)
printk(KERN_CONT " no device\n");
pr_cont(" no device\n");
rc = -ENODEV;
} else {
if (i2c_debug > 1)
printk(KERN_CONT " ERROR: %i\n", rc);
pr_cont(" ERROR: %i\n", rc);
}
rt_mutex_unlock(&dev->i2c_bus_lock);
return rc;
......@@ -558,11 +558,11 @@ static int em28xx_i2c_xfer(struct i2c_adapter *i2c_adap,
rc = i2c_recv_bytes(i2c_bus, msgs[i]);
if (i2c_debug > 1 && rc >= 0)
printk(KERN_CONT " %*ph",
pr_cont(" %*ph",
msgs[i].len, msgs[i].buf);
} else {
if (i2c_debug > 1)
printk(KERN_CONT " %*ph",
pr_cont(" %*ph",
msgs[i].len, msgs[i].buf);
/* write bytes */
......@@ -570,12 +570,12 @@ static int em28xx_i2c_xfer(struct i2c_adapter *i2c_adap,
}
if (rc < 0) {
if (i2c_debug > 1)
printk(KERN_CONT " ERROR: %i\n", rc);
pr_cont(" ERROR: %i\n", rc);
rt_mutex_unlock(&dev->i2c_bus_lock);
return rc;
}
if (i2c_debug > 1)
printk(KERN_CONT "\n");
pr_cont("\n");
}
rt_mutex_unlock(&dev->i2c_bus_lock);
......
......@@ -458,7 +458,7 @@ static int em28xx_ir_change_protocol(struct rc_dev *rc_dev, u64 *rc_type)
case CHIP_ID_EM28178:
return em2874_ir_change_protocol(rc_dev, rc_type);
default:
printk("Unrecognized em28xx chip id 0x%02x: IR not supported\n",
pr_err("Unrecognized em28xx chip id 0x%02x: IR not supported\n",
dev->chip_id);
return -EINVAL;
}
......
......@@ -21,12 +21,13 @@
02110-1301, USA.
*/
#include "em28xx.h"
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/hardirq.h>
#include <linux/init.h>
#include "em28xx.h"
#include "em28xx-v4l.h"
/* ------------------------------------------------------------------ */
......@@ -63,7 +64,7 @@ static int vbi_buffer_prepare(struct vb2_buffer *vb)
size = v4l2->vbi_width * v4l2->vbi_height * 2;
if (vb2_plane_size(vb, 0) < size) {
printk(KERN_INFO "%s data will not fit into plane (%lu < %lu)\n",
pr_info("%s data will not fit into plane (%lu < %lu)\n",
__func__, vb2_plane_size(vb, 0), size);
return -EINVAL;
}
......
......@@ -66,16 +66,13 @@ MODULE_PARM_DESC(alt, "alternate setting to use for video endpoint");
#define em28xx_videodbg(fmt, arg...) do {\
if (video_debug) \
printk(KERN_INFO "%s %s :"fmt, \
dev->name, __func__ , ##arg); } while (0)
printk(KERN_DEBUG pr_fmt("video: %s: " fmt), \
__func__, ##arg); } while (0)
#define em28xx_isocdbg(fmt, arg...) \
do {\
if (isoc_debug) { \
printk(KERN_INFO "%s %s :"fmt, \
dev->name, __func__ , ##arg); \
} \
} while (0)
#define em28xx_isocdbg(fmt, arg...) do {\
if (isoc_debug) \
printk(KERN_DEBUG pr_fmt("isoc: %s: " fmt), \
__func__, ##arg); } while (0)
MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC " - v4l2 interface");
......@@ -2662,8 +2659,7 @@ static int em28xx_v4l2_init(struct em28xx *dev)
ret = video_register_device(&v4l2->vdev, VFL_TYPE_GRABBER,
video_nr[dev->devno]);
if (ret) {
pr_err("unable to register video device (error=%i).\n",
ret);
pr_err("unable to register video device (error=%i).\n", ret);
goto unregister_dev;
}
......
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