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

[media] dvb-core: use pr_foo() instead of printk()

The dvb-core directly calls printk() without using the modern
printk macros, or using the proper printk levels. Change it
to use pr_foo().
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent e428744a
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
* *
*/ */
#define pr_fmt(fmt) "dmxdev: " fmt
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/slab.h> #include <linux/slab.h>
...@@ -36,7 +38,11 @@ static int debug; ...@@ -36,7 +38,11 @@ static int debug;
module_param(debug, int, 0644); module_param(debug, int, 0644);
MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off)."); MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off).");
#define dprintk if (debug) printk #define dprintk(fmt, arg...) do { \
if (debug) \
printk(KERN_DEBUG pr_fmt("%s: " fmt), \
__func__, ##arg); \
} while (0)
static int dvb_dmxdev_buffer_write(struct dvb_ringbuffer *buf, static int dvb_dmxdev_buffer_write(struct dvb_ringbuffer *buf,
const u8 *src, size_t len) const u8 *src, size_t len)
...@@ -50,7 +56,7 @@ static int dvb_dmxdev_buffer_write(struct dvb_ringbuffer *buf, ...@@ -50,7 +56,7 @@ static int dvb_dmxdev_buffer_write(struct dvb_ringbuffer *buf,
free = dvb_ringbuffer_free(buf); free = dvb_ringbuffer_free(buf);
if (len > free) { if (len > free) {
dprintk("dmxdev: buffer overflow\n"); dprintk("buffer overflow\n");
return -EOVERFLOW; return -EOVERFLOW;
} }
...@@ -126,7 +132,7 @@ static int dvb_dvr_open(struct inode *inode, struct file *file) ...@@ -126,7 +132,7 @@ static int dvb_dvr_open(struct inode *inode, struct file *file)
struct dmxdev *dmxdev = dvbdev->priv; struct dmxdev *dmxdev = dvbdev->priv;
struct dmx_frontend *front; struct dmx_frontend *front;
dprintk("function : %s\n", __func__); dprintk("%s\n", __func__);
if (mutex_lock_interruptible(&dmxdev->mutex)) if (mutex_lock_interruptible(&dmxdev->mutex))
return -ERESTARTSYS; return -ERESTARTSYS;
...@@ -258,7 +264,7 @@ static int dvb_dvr_set_buffer_size(struct dmxdev *dmxdev, ...@@ -258,7 +264,7 @@ static int dvb_dvr_set_buffer_size(struct dmxdev *dmxdev,
void *newmem; void *newmem;
void *oldmem; void *oldmem;
dprintk("function : %s\n", __func__); dprintk("%s\n", __func__);
if (buf->size == size) if (buf->size == size)
return 0; return 0;
...@@ -367,7 +373,7 @@ static int dvb_dmxdev_section_callback(const u8 *buffer1, size_t buffer1_len, ...@@ -367,7 +373,7 @@ static int dvb_dmxdev_section_callback(const u8 *buffer1, size_t buffer1_len,
return 0; return 0;
} }
del_timer(&dmxdevfilter->timer); del_timer(&dmxdevfilter->timer);
dprintk("dmxdev: section callback %*ph\n", 6, buffer1); dprintk("section callback %*ph\n", 6, buffer1);
ret = dvb_dmxdev_buffer_write(&dmxdevfilter->buffer, buffer1, ret = dvb_dmxdev_buffer_write(&dmxdevfilter->buffer, buffer1,
buffer1_len); buffer1_len);
if (ret == buffer1_len) { if (ret == buffer1_len) {
...@@ -655,7 +661,7 @@ static int dvb_dmxdev_filter_start(struct dmxdev_filter *filter) ...@@ -655,7 +661,7 @@ static int dvb_dmxdev_filter_start(struct dmxdev_filter *filter)
secfeed, secfeed,
dvb_dmxdev_section_callback); dvb_dmxdev_section_callback);
if (ret < 0) { if (ret < 0) {
printk("DVB (%s): could not alloc feed\n", pr_err("DVB (%s): could not alloc feed\n",
__func__); __func__);
return ret; return ret;
} }
...@@ -663,7 +669,7 @@ static int dvb_dmxdev_filter_start(struct dmxdev_filter *filter) ...@@ -663,7 +669,7 @@ static int dvb_dmxdev_filter_start(struct dmxdev_filter *filter)
ret = (*secfeed)->set(*secfeed, para->pid, 32768, ret = (*secfeed)->set(*secfeed, para->pid, 32768,
(para->flags & DMX_CHECK_CRC) ? 1 : 0); (para->flags & DMX_CHECK_CRC) ? 1 : 0);
if (ret < 0) { if (ret < 0) {
printk("DVB (%s): could not set feed\n", pr_err("DVB (%s): could not set feed\n",
__func__); __func__);
dvb_dmxdev_feed_restart(filter); dvb_dmxdev_feed_restart(filter);
return ret; return ret;
...@@ -844,7 +850,7 @@ static int dvb_dmxdev_filter_set(struct dmxdev *dmxdev, ...@@ -844,7 +850,7 @@ static int dvb_dmxdev_filter_set(struct dmxdev *dmxdev,
struct dmxdev_filter *dmxdevfilter, struct dmxdev_filter *dmxdevfilter,
struct dmx_sct_filter_params *params) struct dmx_sct_filter_params *params)
{ {
dprintk("function : %s, PID=0x%04x, flags=%02x, timeout=%d\n", dprintk("%s: PID=0x%04x, flags=%02x, timeout=%d\n",
__func__, params->pid, params->flags, params->timeout); __func__, params->pid, params->flags, params->timeout);
dvb_dmxdev_filter_stop(dmxdevfilter); dvb_dmxdev_filter_stop(dmxdevfilter);
...@@ -1184,7 +1190,7 @@ static unsigned int dvb_dvr_poll(struct file *file, poll_table *wait) ...@@ -1184,7 +1190,7 @@ static unsigned int dvb_dvr_poll(struct file *file, poll_table *wait)
struct dmxdev *dmxdev = dvbdev->priv; struct dmxdev *dmxdev = dvbdev->priv;
unsigned int mask = 0; unsigned int mask = 0;
dprintk("function : %s\n", __func__); dprintk("%s\n", __func__);
if (dmxdev->exit) if (dmxdev->exit)
return POLLERR; return POLLERR;
......
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
* Or, point your browser to http://www.gnu.org/copyleft/gpl.html * Or, point your browser to http://www.gnu.org/copyleft/gpl.html
*/ */
#define pr_fmt(fmt) "dvb_ca_en50221: " fmt
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/list.h> #include <linux/list.h>
...@@ -46,7 +48,10 @@ static int dvb_ca_en50221_debug; ...@@ -46,7 +48,10 @@ static int dvb_ca_en50221_debug;
module_param_named(cam_debug, dvb_ca_en50221_debug, int, 0644); module_param_named(cam_debug, dvb_ca_en50221_debug, int, 0644);
MODULE_PARM_DESC(cam_debug, "enable verbose debug messages"); MODULE_PARM_DESC(cam_debug, "enable verbose debug messages");
#define dprintk if (dvb_ca_en50221_debug) printk #define dprintk(fmt, arg...) do { \
if (dvb_ca_en50221_debug) \
printk(KERN_DEBUG pr_fmt("%s: " fmt), __func__, ##arg);\
} while (0)
#define INIT_TIMEOUT_SECS 10 #define INIT_TIMEOUT_SECS 10
...@@ -298,7 +303,8 @@ static int dvb_ca_en50221_wait_if_status(struct dvb_ca_private *ca, int slot, ...@@ -298,7 +303,8 @@ static int dvb_ca_en50221_wait_if_status(struct dvb_ca_private *ca, int slot,
/* if we got the flags, it was successful! */ /* if we got the flags, it was successful! */
if (res & waitfor) { if (res & waitfor) {
dprintk("%s succeeded timeout:%lu\n", __func__, jiffies - start); dprintk("%s succeeded timeout:%lu\n",
__func__, jiffies - start);
return 0; return 0;
} }
...@@ -519,8 +525,9 @@ static int dvb_ca_en50221_parse_attributes(struct dvb_ca_private *ca, int slot) ...@@ -519,8 +525,9 @@ static int dvb_ca_en50221_parse_attributes(struct dvb_ca_private *ca, int slot)
/* is it a version we support? */ /* is it a version we support? */
if (strncmp(dvb_str + 8, "1.00", 4)) { if (strncmp(dvb_str + 8, "1.00", 4)) {
printk("dvb_ca adapter %d: Unsupported DVB CAM module version %c%c%c%c\n", pr_err("dvb_ca adapter %d: Unsupported DVB CAM module version %c%c%c%c\n",
ca->dvbdev->adapter->num, dvb_str[8], dvb_str[9], dvb_str[10], dvb_str[11]); ca->dvbdev->adapter->num, dvb_str[8], dvb_str[9],
dvb_str[10], dvb_str[11]);
return -EINVAL; return -EINVAL;
} }
...@@ -557,8 +564,8 @@ static int dvb_ca_en50221_parse_attributes(struct dvb_ca_private *ca, int slot) ...@@ -557,8 +564,8 @@ static int dvb_ca_en50221_parse_attributes(struct dvb_ca_private *ca, int slot)
break; break;
default: /* Unknown tuple type - just skip this tuple and move to the next one */ default: /* Unknown tuple type - just skip this tuple and move to the next one */
dprintk("dvb_ca: Skipping unknown tuple type:0x%x length:0x%x\n", tupleType, dprintk("dvb_ca: Skipping unknown tuple type:0x%x length:0x%x\n",
tupleLength); tupleType, tupleLength);
break; break;
} }
} }
...@@ -567,7 +574,8 @@ static int dvb_ca_en50221_parse_attributes(struct dvb_ca_private *ca, int slot) ...@@ -567,7 +574,8 @@ static int dvb_ca_en50221_parse_attributes(struct dvb_ca_private *ca, int slot)
return -EINVAL; return -EINVAL;
dprintk("Valid DVB CAM detected MANID:%x DEVID:%x CONFIGBASE:0x%x CONFIGOPTION:0x%x\n", dprintk("Valid DVB CAM detected MANID:%x DEVID:%x CONFIGBASE:0x%x CONFIGOPTION:0x%x\n",
manfid, devid, ca->slot_info[slot].config_base, ca->slot_info[slot].config_option); manfid, devid, ca->slot_info[slot].config_base,
ca->slot_info[slot].config_option);
// success! // success!
return 0; return 0;
...@@ -661,14 +669,15 @@ static int dvb_ca_en50221_read_data(struct dvb_ca_private *ca, int slot, u8 * eb ...@@ -661,14 +669,15 @@ static int dvb_ca_en50221_read_data(struct dvb_ca_private *ca, int slot, u8 * eb
/* check it will fit */ /* check it will fit */
if (ebuf == NULL) { if (ebuf == NULL) {
if (bytes_read > ca->slot_info[slot].link_buf_size) { if (bytes_read > ca->slot_info[slot].link_buf_size) {
printk("dvb_ca adapter %d: CAM tried to send a buffer larger than the link buffer size (%i > %i)!\n", pr_err("dvb_ca adapter %d: CAM tried to send a buffer larger than the link buffer size (%i > %i)!\n",
ca->dvbdev->adapter->num, bytes_read, ca->slot_info[slot].link_buf_size); ca->dvbdev->adapter->num, bytes_read,
ca->slot_info[slot].link_buf_size);
ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_LINKINIT; ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_LINKINIT;
status = -EIO; status = -EIO;
goto exit; goto exit;
} }
if (bytes_read < 2) { if (bytes_read < 2) {
printk("dvb_ca adapter %d: CAM sent a buffer that was less than 2 bytes!\n", pr_err("dvb_ca adapter %d: CAM sent a buffer that was less than 2 bytes!\n",
ca->dvbdev->adapter->num); ca->dvbdev->adapter->num);
ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_LINKINIT; ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_LINKINIT;
status = -EIO; status = -EIO;
...@@ -676,7 +685,7 @@ static int dvb_ca_en50221_read_data(struct dvb_ca_private *ca, int slot, u8 * eb ...@@ -676,7 +685,7 @@ static int dvb_ca_en50221_read_data(struct dvb_ca_private *ca, int slot, u8 * eb
} }
} else { } else {
if (bytes_read > ecount) { if (bytes_read > ecount) {
printk("dvb_ca adapter %d: CAM tried to send a buffer larger than the ecount size!\n", pr_err("dvb_ca adapter %d: CAM tried to send a buffer larger than the ecount size!\n",
ca->dvbdev->adapter->num); ca->dvbdev->adapter->num);
status = -EIO; status = -EIO;
goto exit; goto exit;
...@@ -1062,7 +1071,7 @@ static int dvb_ca_en50221_thread(void *data) ...@@ -1062,7 +1071,7 @@ static int dvb_ca_en50221_thread(void *data)
case DVB_CA_SLOTSTATE_WAITREADY: case DVB_CA_SLOTSTATE_WAITREADY:
if (time_after(jiffies, ca->slot_info[slot].timeout)) { if (time_after(jiffies, ca->slot_info[slot].timeout)) {
printk("dvb_ca adaptor %d: PC card did not respond :(\n", pr_err("dvb_ca adaptor %d: PC card did not respond :(\n",
ca->dvbdev->adapter->num); ca->dvbdev->adapter->num);
ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_INVALID; ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_INVALID;
dvb_ca_en50221_thread_update_delay(ca); dvb_ca_en50221_thread_update_delay(ca);
...@@ -1084,14 +1093,14 @@ static int dvb_ca_en50221_thread(void *data) ...@@ -1084,14 +1093,14 @@ static int dvb_ca_en50221_thread(void *data)
} }
} }
printk("dvb_ca adapter %d: Invalid PC card inserted :(\n", pr_err("dvb_ca adapter %d: Invalid PC card inserted :(\n",
ca->dvbdev->adapter->num); ca->dvbdev->adapter->num);
ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_INVALID; ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_INVALID;
dvb_ca_en50221_thread_update_delay(ca); dvb_ca_en50221_thread_update_delay(ca);
break; break;
} }
if (dvb_ca_en50221_set_configoption(ca, slot) != 0) { if (dvb_ca_en50221_set_configoption(ca, slot) != 0) {
printk("dvb_ca adapter %d: Unable to initialise CAM :(\n", pr_err("dvb_ca adapter %d: Unable to initialise CAM :(\n",
ca->dvbdev->adapter->num); ca->dvbdev->adapter->num);
ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_INVALID; ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_INVALID;
dvb_ca_en50221_thread_update_delay(ca); dvb_ca_en50221_thread_update_delay(ca);
...@@ -1099,7 +1108,7 @@ static int dvb_ca_en50221_thread(void *data) ...@@ -1099,7 +1108,7 @@ static int dvb_ca_en50221_thread(void *data)
} }
if (ca->pub->write_cam_control(ca->pub, slot, if (ca->pub->write_cam_control(ca->pub, slot,
CTRLIF_COMMAND, CMDREG_RS) != 0) { CTRLIF_COMMAND, CMDREG_RS) != 0) {
printk("dvb_ca adapter %d: Unable to reset CAM IF\n", pr_err("dvb_ca adapter %d: Unable to reset CAM IF\n",
ca->dvbdev->adapter->num); ca->dvbdev->adapter->num);
ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_INVALID; ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_INVALID;
dvb_ca_en50221_thread_update_delay(ca); dvb_ca_en50221_thread_update_delay(ca);
...@@ -1114,7 +1123,7 @@ static int dvb_ca_en50221_thread(void *data) ...@@ -1114,7 +1123,7 @@ static int dvb_ca_en50221_thread(void *data)
case DVB_CA_SLOTSTATE_WAITFR: case DVB_CA_SLOTSTATE_WAITFR:
if (time_after(jiffies, ca->slot_info[slot].timeout)) { if (time_after(jiffies, ca->slot_info[slot].timeout)) {
printk("dvb_ca adapter %d: DVB CAM did not respond :(\n", pr_err("dvb_ca adapter %d: DVB CAM did not respond :(\n",
ca->dvbdev->adapter->num); ca->dvbdev->adapter->num);
ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_INVALID; ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_INVALID;
dvb_ca_en50221_thread_update_delay(ca); dvb_ca_en50221_thread_update_delay(ca);
...@@ -1141,7 +1150,8 @@ static int dvb_ca_en50221_thread(void *data) ...@@ -1141,7 +1150,8 @@ static int dvb_ca_en50221_thread(void *data)
} }
} }
printk("dvb_ca adapter %d: DVB CAM link initialisation failed :(\n", ca->dvbdev->adapter->num); pr_err("dvb_ca adapter %d: DVB CAM link initialisation failed :(\n",
ca->dvbdev->adapter->num);
ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_INVALID; ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_INVALID;
dvb_ca_en50221_thread_update_delay(ca); dvb_ca_en50221_thread_update_delay(ca);
break; break;
...@@ -1150,7 +1160,8 @@ static int dvb_ca_en50221_thread(void *data) ...@@ -1150,7 +1160,8 @@ static int dvb_ca_en50221_thread(void *data)
if (ca->slot_info[slot].rx_buffer.data == NULL) { if (ca->slot_info[slot].rx_buffer.data == NULL) {
rxbuf = vmalloc(RX_BUFFER_SIZE); rxbuf = vmalloc(RX_BUFFER_SIZE);
if (rxbuf == NULL) { if (rxbuf == NULL) {
printk("dvb_ca adapter %d: Unable to allocate CAM rx buffer :(\n", ca->dvbdev->adapter->num); pr_err("dvb_ca adapter %d: Unable to allocate CAM rx buffer :(\n",
ca->dvbdev->adapter->num);
ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_INVALID; ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_INVALID;
dvb_ca_en50221_thread_update_delay(ca); dvb_ca_en50221_thread_update_delay(ca);
break; break;
...@@ -1161,7 +1172,8 @@ static int dvb_ca_en50221_thread(void *data) ...@@ -1161,7 +1172,8 @@ static int dvb_ca_en50221_thread(void *data)
ca->pub->slot_ts_enable(ca->pub, slot); ca->pub->slot_ts_enable(ca->pub, slot);
ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_RUNNING; ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_RUNNING;
dvb_ca_en50221_thread_update_delay(ca); dvb_ca_en50221_thread_update_delay(ca);
printk("dvb_ca adapter %d: DVB CAM detected and initialised successfully\n", ca->dvbdev->adapter->num); pr_err("dvb_ca adapter %d: DVB CAM detected and initialised successfully\n",
ca->dvbdev->adapter->num);
break; break;
case DVB_CA_SLOTSTATE_RUNNING: case DVB_CA_SLOTSTATE_RUNNING:
...@@ -1497,7 +1509,8 @@ static ssize_t dvb_ca_en50221_io_read(struct file *file, char __user * buf, ...@@ -1497,7 +1509,8 @@ static ssize_t dvb_ca_en50221_io_read(struct file *file, char __user * buf,
pktlen = 2; pktlen = 2;
do { do {
if (idx == -1) { if (idx == -1) {
printk("dvb_ca adapter %d: BUG: read packet ended before last_fragment encountered\n", ca->dvbdev->adapter->num); pr_err("dvb_ca adapter %d: BUG: read packet ended before last_fragment encountered\n",
ca->dvbdev->adapter->num);
status = -EIO; status = -EIO;
goto exit; goto exit;
} }
...@@ -1755,7 +1768,7 @@ int dvb_ca_en50221_init(struct dvb_adapter *dvb_adapter, ...@@ -1755,7 +1768,7 @@ int dvb_ca_en50221_init(struct dvb_adapter *dvb_adapter,
ca->dvbdev->adapter->num, ca->dvbdev->id); ca->dvbdev->adapter->num, ca->dvbdev->id);
if (IS_ERR(ca->thread)) { if (IS_ERR(ca->thread)) {
ret = PTR_ERR(ca->thread); ret = PTR_ERR(ca->thread);
printk("dvb_ca_init: failed to start kernel_thread (%d)\n", pr_err("dvb_ca_init: failed to start kernel_thread (%d)\n",
ret); ret);
goto unregister_device; goto unregister_device;
} }
......
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
* *
*/ */
#define pr_fmt(fmt) "dvb_demux: " fmt
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/slab.h> #include <linux/slab.h>
...@@ -55,10 +57,13 @@ module_param(dvb_demux_feed_err_pkts, int, 0644); ...@@ -55,10 +57,13 @@ module_param(dvb_demux_feed_err_pkts, int, 0644);
MODULE_PARM_DESC(dvb_demux_feed_err_pkts, MODULE_PARM_DESC(dvb_demux_feed_err_pkts,
"when set to 0, drop packets with the TEI bit set (1 by default)"); "when set to 0, drop packets with the TEI bit set (1 by default)");
#define dprintk(fmt, arg...) \
printk(KERN_DEBUG pr_fmt("%s: " fmt), __func__, ##arg)
#define dprintk_tscheck(x...) do { \ #define dprintk_tscheck(x...) do { \
if (dvb_demux_tscheck && printk_ratelimit()) \ if (dvb_demux_tscheck && printk_ratelimit()) \
printk(x); \ dprintk(x); \
} while (0) } while (0)
/****************************************************************************** /******************************************************************************
* static inlined helper functions * static inlined helper functions
...@@ -122,7 +127,7 @@ static inline int dvb_dmx_swfilter_payload(struct dvb_demux_feed *feed, ...@@ -122,7 +127,7 @@ static inline int dvb_dmx_swfilter_payload(struct dvb_demux_feed *feed,
ccok = ((feed->cc + 1) & 0x0f) == cc; ccok = ((feed->cc + 1) & 0x0f) == cc;
feed->cc = cc; feed->cc = cc;
if (!ccok) if (!ccok)
printk("missed packet!\n"); dprintk("missed packet!\n");
*/ */
if (buf[1] & 0x40) // PUSI ? if (buf[1] & 0x40) // PUSI ?
...@@ -199,12 +204,12 @@ static void dvb_dmx_swfilter_section_new(struct dvb_demux_feed *feed) ...@@ -199,12 +204,12 @@ static void dvb_dmx_swfilter_section_new(struct dvb_demux_feed *feed)
* but just first and last. * but just first and last.
*/ */
if (sec->secbuf[0] != 0xff || sec->secbuf[n - 1] != 0xff) { if (sec->secbuf[0] != 0xff || sec->secbuf[n - 1] != 0xff) {
printk("dvb_demux.c section ts padding loss: %d/%d\n", dprintk("dvb_demux.c section ts padding loss: %d/%d\n",
n, sec->tsfeedp); n, sec->tsfeedp);
printk("dvb_demux.c pad data:"); dprintk("dvb_demux.c pad data:");
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
printk(" %02x", sec->secbuf[i]); pr_cont(" %02x", sec->secbuf[i]);
printk("\n"); pr_cont("\n");
} }
} }
#endif #endif
...@@ -243,7 +248,7 @@ static int dvb_dmx_swfilter_section_copy_dump(struct dvb_demux_feed *feed, ...@@ -243,7 +248,7 @@ static int dvb_dmx_swfilter_section_copy_dump(struct dvb_demux_feed *feed,
if (sec->tsfeedp + len > DMX_MAX_SECFEED_SIZE) { if (sec->tsfeedp + len > DMX_MAX_SECFEED_SIZE) {
#ifdef DVB_DEMUX_SECTION_LOSS_LOG #ifdef DVB_DEMUX_SECTION_LOSS_LOG
printk("dvb_demux.c section buffer full loss: %d/%d\n", dprintk("dvb_demux.c section buffer full loss: %d/%d\n",
sec->tsfeedp + len - DMX_MAX_SECFEED_SIZE, sec->tsfeedp + len - DMX_MAX_SECFEED_SIZE,
DMX_MAX_SECFEED_SIZE); DMX_MAX_SECFEED_SIZE);
#endif #endif
...@@ -278,7 +283,7 @@ static int dvb_dmx_swfilter_section_copy_dump(struct dvb_demux_feed *feed, ...@@ -278,7 +283,7 @@ static int dvb_dmx_swfilter_section_copy_dump(struct dvb_demux_feed *feed,
dvb_dmx_swfilter_section_feed(feed); dvb_dmx_swfilter_section_feed(feed);
#ifdef DVB_DEMUX_SECTION_LOSS_LOG #ifdef DVB_DEMUX_SECTION_LOSS_LOG
else else
printk("dvb_demux.c pusi not seen, discarding section data\n"); dprintk("dvb_demux.c pusi not seen, discarding section data\n");
#endif #endif
sec->secbufp += seclen; /* secbufp and secbuf moving together is */ sec->secbufp += seclen; /* secbufp and secbuf moving together is */
sec->secbuf += seclen; /* redundant but saves pointer arithmetic */ sec->secbuf += seclen; /* redundant but saves pointer arithmetic */
...@@ -313,7 +318,7 @@ static int dvb_dmx_swfilter_section_packet(struct dvb_demux_feed *feed, ...@@ -313,7 +318,7 @@ static int dvb_dmx_swfilter_section_packet(struct dvb_demux_feed *feed,
if (!ccok || dc_i) { if (!ccok || dc_i) {
#ifdef DVB_DEMUX_SECTION_LOSS_LOG #ifdef DVB_DEMUX_SECTION_LOSS_LOG
printk("dvb_demux.c discontinuity detected %d bytes lost\n", dprintk("dvb_demux.c discontinuity detected %d bytes lost\n",
count); count);
/* /*
* those bytes under sume circumstances will again be reported * those bytes under sume circumstances will again be reported
...@@ -346,7 +351,8 @@ static int dvb_dmx_swfilter_section_packet(struct dvb_demux_feed *feed, ...@@ -346,7 +351,8 @@ static int dvb_dmx_swfilter_section_packet(struct dvb_demux_feed *feed,
} }
#ifdef DVB_DEMUX_SECTION_LOSS_LOG #ifdef DVB_DEMUX_SECTION_LOSS_LOG
else if (count > 0) else if (count > 0)
printk("dvb_demux.c PUSI=1 but %d bytes lost\n", count); dprintk("dvb_demux.c PUSI=1 but %d bytes lost\n",
count);
#endif #endif
} else { } else {
/* PUSI=0 (is not set), no section boundary */ /* PUSI=0 (is not set), no section boundary */
...@@ -415,7 +421,7 @@ static void dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf) ...@@ -415,7 +421,7 @@ static void dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf)
1024); 1024);
speed_timedelta = ktime_ms_delta(cur_time, speed_timedelta = ktime_ms_delta(cur_time,
demux->speed_last_time); demux->speed_last_time);
printk(KERN_INFO "TS speed %llu Kbits/sec \n", dprintk("TS speed %llu Kbits/sec \n",
div64_u64(speed_bytes, div64_u64(speed_bytes,
speed_timedelta)); speed_timedelta));
} }
...@@ -634,7 +640,7 @@ static void dvb_demux_feed_add(struct dvb_demux_feed *feed) ...@@ -634,7 +640,7 @@ static void dvb_demux_feed_add(struct dvb_demux_feed *feed)
{ {
spin_lock_irq(&feed->demux->lock); spin_lock_irq(&feed->demux->lock);
if (dvb_demux_feed_find(feed)) { if (dvb_demux_feed_find(feed)) {
printk(KERN_ERR "%s: feed already in list (type=%x state=%x pid=%x)\n", pr_err("%s: feed already in list (type=%x state=%x pid=%x)\n",
__func__, feed->type, feed->state, feed->pid); __func__, feed->type, feed->state, feed->pid);
goto out; goto out;
} }
...@@ -648,7 +654,7 @@ static void dvb_demux_feed_del(struct dvb_demux_feed *feed) ...@@ -648,7 +654,7 @@ static void dvb_demux_feed_del(struct dvb_demux_feed *feed)
{ {
spin_lock_irq(&feed->demux->lock); spin_lock_irq(&feed->demux->lock);
if (!(dvb_demux_feed_find(feed))) { if (!(dvb_demux_feed_find(feed))) {
printk(KERN_ERR "%s: feed not in list (type=%x state=%x pid=%x)\n", pr_err("%s: feed not in list (type=%x state=%x pid=%x)\n",
__func__, feed->type, feed->state, feed->pid); __func__, feed->type, feed->state, feed->pid);
goto out; goto out;
} }
...@@ -1267,7 +1273,7 @@ int dvb_dmx_init(struct dvb_demux *dvbdemux) ...@@ -1267,7 +1273,7 @@ int dvb_dmx_init(struct dvb_demux *dvbdemux)
dvbdemux->cnt_storage = vmalloc(MAX_PID + 1); dvbdemux->cnt_storage = vmalloc(MAX_PID + 1);
if (!dvbdemux->cnt_storage) if (!dvbdemux->cnt_storage)
printk(KERN_WARNING "Couldn't allocate memory for TS/TEI check. Disabling it\n"); pr_warn("Couldn't allocate memory for TS/TEI check. Disabling it\n");
INIT_LIST_HEAD(&dvbdemux->frontend_list); INIT_LIST_HEAD(&dvbdemux->frontend_list);
......
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
/* Enables DVBv3 compatibility bits at the headers */ /* Enables DVBv3 compatibility bits at the headers */
#define __DVB_CORE__ #define __DVB_CORE__
#define pr_fmt(fmt) "dvb_frontend: " fmt
#include <linux/string.h> #include <linux/string.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/sched.h> #include <linux/sched.h>
...@@ -67,6 +69,9 @@ MODULE_PARM_DESC(dvb_powerdown_on_sleep, "0: do not power down, 1: turn LNB volt ...@@ -67,6 +69,9 @@ MODULE_PARM_DESC(dvb_powerdown_on_sleep, "0: do not power down, 1: turn LNB volt
module_param(dvb_mfe_wait_time, int, 0644); module_param(dvb_mfe_wait_time, int, 0644);
MODULE_PARM_DESC(dvb_mfe_wait_time, "Wait up to <mfe_wait_time> seconds on open() for multi-frontend to become available (default:5 seconds)"); MODULE_PARM_DESC(dvb_mfe_wait_time, "Wait up to <mfe_wait_time> seconds on open() for multi-frontend to become available (default:5 seconds)");
#define dprintk(fmt, arg...) \
printk(KERN_DEBUG pr_fmt("%s: " fmt), __func__, ##arg)
#define FESTATE_IDLE 1 #define FESTATE_IDLE 1
#define FESTATE_RETUNE 2 #define FESTATE_RETUNE 2
#define FESTATE_TUNING_FAST 4 #define FESTATE_TUNING_FAST 4
...@@ -2356,7 +2361,8 @@ static int dvb_frontend_ioctl_legacy(struct file *file, ...@@ -2356,7 +2361,8 @@ static int dvb_frontend_ioctl_legacy(struct file *file,
int i; int i;
u8 last = 1; u8 last = 1;
if (dvb_frontend_debug) if (dvb_frontend_debug)
printk("%s switch command: 0x%04lx\n", __func__, swcmd); dprintk("%s switch command: 0x%04lx\n",
__func__, swcmd);
nexttime = ktime_get_boottime(); nexttime = ktime_get_boottime();
if (dvb_frontend_debug) if (dvb_frontend_debug)
tv[0] = nexttime; tv[0] = nexttime;
...@@ -2379,10 +2385,10 @@ static int dvb_frontend_ioctl_legacy(struct file *file, ...@@ -2379,10 +2385,10 @@ static int dvb_frontend_ioctl_legacy(struct file *file,
dvb_frontend_sleep_until(&nexttime, 8000); dvb_frontend_sleep_until(&nexttime, 8000);
} }
if (dvb_frontend_debug) { if (dvb_frontend_debug) {
printk("%s(%d): switch delay (should be 32k followed by all 8k\n", dprintk("%s(%d): switch delay (should be 32k followed by all 8k)\n",
__func__, fe->dvb->num); __func__, fe->dvb->num);
for (i = 1; i < 10; i++) for (i = 1; i < 10; i++)
printk("%d: %d\n", i, pr_info("%d: %d\n", i,
(int) ktime_us_delta(tv[i], tv[i-1])); (int) ktime_us_delta(tv[i], tv[i-1]));
} }
err = 0; err = 0;
......
This diff is collapsed.
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
* *
*/ */
#define pr_fmt(fmt) "dvbdev: " fmt
#include <linux/types.h> #include <linux/types.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/string.h> #include <linux/string.h>
...@@ -43,7 +45,11 @@ static int dvbdev_debug; ...@@ -43,7 +45,11 @@ static int dvbdev_debug;
module_param(dvbdev_debug, int, 0644); module_param(dvbdev_debug, int, 0644);
MODULE_PARM_DESC(dvbdev_debug, "Turn on/off device debugging (default:off)."); MODULE_PARM_DESC(dvbdev_debug, "Turn on/off device debugging (default:off).");
#define dprintk if (dvbdev_debug) printk #define dprintk(fmt, arg...) do { \
if (dvbdev_debug) \
printk(KERN_DEBUG pr_fmt("%s: " fmt), \
__func__, ##arg); \
} while (0)
static LIST_HEAD(dvb_adapter_list); static LIST_HEAD(dvb_adapter_list);
static DEFINE_MUTEX(dvbdev_register_lock); static DEFINE_MUTEX(dvbdev_register_lock);
...@@ -354,7 +360,7 @@ static int dvb_create_media_entity(struct dvb_device *dvbdev, ...@@ -354,7 +360,7 @@ static int dvb_create_media_entity(struct dvb_device *dvbdev,
if (ret) if (ret)
return ret; return ret;
printk(KERN_DEBUG "%s: media entity '%s' registered.\n", pr_info("%s: media entity '%s' registered.\n",
__func__, dvbdev->entity->name); __func__, dvbdev->entity->name);
return 0; return 0;
...@@ -438,7 +444,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, ...@@ -438,7 +444,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,
if ((id = dvbdev_get_free_id (adap, type)) < 0){ if ((id = dvbdev_get_free_id (adap, type)) < 0){
mutex_unlock(&dvbdev_register_lock); mutex_unlock(&dvbdev_register_lock);
*pdvbdev = NULL; *pdvbdev = NULL;
printk(KERN_ERR "%s: couldn't find free device id\n", __func__); pr_err("%s: couldn't find free device id\n", __func__);
return -ENFILE; return -ENFILE;
} }
...@@ -493,8 +499,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, ...@@ -493,8 +499,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,
ret = dvb_register_media_device(dvbdev, type, minor, demux_sink_pads); ret = dvb_register_media_device(dvbdev, type, minor, demux_sink_pads);
if (ret) { if (ret) {
printk(KERN_ERR pr_err("%s: dvb_register_media_device failed to create the mediagraph\n",
"%s: dvb_register_media_device failed to create the mediagraph\n",
__func__); __func__);
dvb_media_device_free(dvbdev); dvb_media_device_free(dvbdev);
...@@ -511,11 +516,11 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, ...@@ -511,11 +516,11 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,
MKDEV(DVB_MAJOR, minor), MKDEV(DVB_MAJOR, minor),
dvbdev, "dvb%d.%s%d", adap->num, dnames[type], id); dvbdev, "dvb%d.%s%d", adap->num, dnames[type], id);
if (IS_ERR(clsdev)) { if (IS_ERR(clsdev)) {
printk(KERN_ERR "%s: failed to create device dvb%d.%s%d (%ld)\n", pr_err("%s: failed to create device dvb%d.%s%d (%ld)\n",
__func__, adap->num, dnames[type], id, PTR_ERR(clsdev)); __func__, adap->num, dnames[type], id, PTR_ERR(clsdev));
return PTR_ERR(clsdev); return PTR_ERR(clsdev);
} }
dprintk(KERN_DEBUG "DVB: register adapter%d/%s%d @ minor: %i (0x%02x)\n", dprintk("DVB: register adapter%d/%s%d @ minor: %i (0x%02x)\n",
adap->num, dnames[type], id, minor, minor); adap->num, dnames[type], id, minor, minor);
return 0; return 0;
...@@ -808,7 +813,7 @@ int dvb_register_adapter(struct dvb_adapter *adap, const char *name, ...@@ -808,7 +813,7 @@ int dvb_register_adapter(struct dvb_adapter *adap, const char *name,
memset (adap, 0, sizeof(struct dvb_adapter)); memset (adap, 0, sizeof(struct dvb_adapter));
INIT_LIST_HEAD (&adap->device_list); INIT_LIST_HEAD (&adap->device_list);
printk(KERN_INFO "DVB: registering new adapter (%s)\n", name); pr_info("DVB: registering new adapter (%s)\n", name);
adap->num = num; adap->num = num;
adap->name = name; adap->name = name;
...@@ -926,13 +931,13 @@ static int __init init_dvbdev(void) ...@@ -926,13 +931,13 @@ static int __init init_dvbdev(void)
dev_t dev = MKDEV(DVB_MAJOR, 0); dev_t dev = MKDEV(DVB_MAJOR, 0);
if ((retval = register_chrdev_region(dev, MAX_DVB_MINORS, "DVB")) != 0) { if ((retval = register_chrdev_region(dev, MAX_DVB_MINORS, "DVB")) != 0) {
printk(KERN_ERR "dvb-core: unable to get major %d\n", DVB_MAJOR); pr_err("dvb-core: unable to get major %d\n", DVB_MAJOR);
return retval; return retval;
} }
cdev_init(&dvb_device_cdev, &dvb_device_fops); cdev_init(&dvb_device_cdev, &dvb_device_fops);
if ((retval = cdev_add(&dvb_device_cdev, dev, MAX_DVB_MINORS)) != 0) { if ((retval = cdev_add(&dvb_device_cdev, dev, MAX_DVB_MINORS)) != 0) {
printk(KERN_ERR "dvb-core: unable register character device\n"); pr_err("dvb-core: unable register character device\n");
goto error; goto error;
} }
......
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