Commit be4aa815 authored by Aya Mahfouz's avatar Aya Mahfouz Committed by Greg Kroah-Hartman

staging: media: lirc: lirc_zilog.c: replace custom print macros with dev_* and pr_*

This patch removes the custom printk macros dprintk, zilog_notify,
zilog_error, and zilog_info. All the calls to these macros were
replaced by dev_dbg, dev_notice, dev_err, and dev_info respectively
whenever possible. There were cases in which pr_debug, pr_notice,
pr_err and pr_info were used. It was when the calling function did
not provide an appropiate dev variable.

Applying this patch will trigger the out of memory checkpatch warning
for two lines. It will be fixed in a separate patch.
Signed-off-by: default avatarAya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 346b0d4a
...@@ -152,23 +152,12 @@ struct tx_data_struct { ...@@ -152,23 +152,12 @@ struct tx_data_struct {
static struct tx_data_struct *tx_data; static struct tx_data_struct *tx_data;
static struct mutex tx_data_lock; static struct mutex tx_data_lock;
#define zilog_notify(s, args...) printk(KERN_NOTICE KBUILD_MODNAME ": " s, \
## args)
#define zilog_error(s, args...) printk(KERN_ERR KBUILD_MODNAME ": " s, ## args)
#define zilog_info(s, args...) printk(KERN_INFO KBUILD_MODNAME ": " s, ## args)
/* module parameters */ /* module parameters */
static bool debug; /* debug output */ static bool debug; /* debug output */
static bool tx_only; /* only handle the IR Tx function */ static bool tx_only; /* only handle the IR Tx function */
static int minor = -1; /* minor number */ static int minor = -1; /* minor number */
#define dprintk(fmt, args...) \
do { \
if (debug) \
printk(KERN_DEBUG KBUILD_MODNAME ": " fmt, \
## args); \
} while (0)
/* struct IR reference counting */ /* struct IR reference counting */
static struct IR *get_ir_device(struct IR *ir, bool ir_devices_lock_held) static struct IR *get_ir_device(struct IR *ir, bool ir_devices_lock_held)
...@@ -333,7 +322,7 @@ static int add_to_buf(struct IR *ir) ...@@ -333,7 +322,7 @@ static int add_to_buf(struct IR *ir)
struct IR_tx *tx; struct IR_tx *tx;
if (lirc_buffer_full(rbuf)) { if (lirc_buffer_full(rbuf)) {
dprintk("buffer overflow\n"); dev_dbg(ir->l.dev, "buffer overflow\n");
return -EOVERFLOW; return -EOVERFLOW;
} }
...@@ -379,16 +368,17 @@ static int add_to_buf(struct IR *ir) ...@@ -379,16 +368,17 @@ static int add_to_buf(struct IR *ir)
*/ */
ret = i2c_master_send(rx->c, sendbuf, 1); ret = i2c_master_send(rx->c, sendbuf, 1);
if (ret != 1) { if (ret != 1) {
zilog_error("i2c_master_send failed with %d\n", ret); dev_err(ir->l.dev, "i2c_master_send failed with %d\n",
ret);
if (failures >= 3) { if (failures >= 3) {
mutex_unlock(&ir->ir_lock); mutex_unlock(&ir->ir_lock);
zilog_error("unable to read from the IR chip " dev_err(ir->l.dev, "unable to read from the IR chip "
"after 3 resets, giving up\n"); "after 3 resets, giving up\n");
break; break;
} }
/* Looks like the chip crashed, reset it */ /* Looks like the chip crashed, reset it */
zilog_error("polling the IR receiver chip failed, " dev_err(ir->l.dev, "polling the IR receiver chip failed, "
"trying reset\n"); "trying reset\n");
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
...@@ -415,13 +405,14 @@ static int add_to_buf(struct IR *ir) ...@@ -415,13 +405,14 @@ static int add_to_buf(struct IR *ir)
ret = i2c_master_recv(rx->c, keybuf, sizeof(keybuf)); ret = i2c_master_recv(rx->c, keybuf, sizeof(keybuf));
mutex_unlock(&ir->ir_lock); mutex_unlock(&ir->ir_lock);
if (ret != sizeof(keybuf)) { if (ret != sizeof(keybuf)) {
zilog_error("i2c_master_recv failed with %d -- " dev_err(ir->l.dev, "i2c_master_recv failed with %d -- "
"keeping last read buffer\n", ret); "keeping last read buffer\n", ret);
} else { } else {
rx->b[0] = keybuf[3]; rx->b[0] = keybuf[3];
rx->b[1] = keybuf[4]; rx->b[1] = keybuf[4];
rx->b[2] = keybuf[5]; rx->b[2] = keybuf[5];
dprintk("key (0x%02x/0x%02x)\n", rx->b[0], rx->b[1]); dev_dbg(ir->l.dev, "key (0x%02x/0x%02x)\n",
rx->b[0], rx->b[1]);
} }
/* key pressed ? */ /* key pressed ? */
...@@ -472,7 +463,7 @@ static int lirc_thread(void *arg) ...@@ -472,7 +463,7 @@ static int lirc_thread(void *arg)
struct IR *ir = arg; struct IR *ir = arg;
struct lirc_buffer *rbuf = ir->l.rbuf; struct lirc_buffer *rbuf = ir->l.rbuf;
dprintk("poll thread started\n"); dev_dbg(ir->l.dev, "poll thread started\n");
while (!kthread_should_stop()) { while (!kthread_should_stop()) {
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
...@@ -500,7 +491,7 @@ static int lirc_thread(void *arg) ...@@ -500,7 +491,7 @@ static int lirc_thread(void *arg)
wake_up_interruptible(&rbuf->wait_poll); wake_up_interruptible(&rbuf->wait_poll);
} }
dprintk("poll thread ended\n"); dev_dbg(ir->l.dev, "poll thread ended\n");
return 0; return 0;
} }
...@@ -644,7 +635,7 @@ static int get_key_data(unsigned char *buf, ...@@ -644,7 +635,7 @@ static int get_key_data(unsigned char *buf,
return -EPROTO; return -EPROTO;
corrupt: corrupt:
zilog_error("firmware is corrupt\n"); pr_err("firmware is corrupt\n");
return -EFAULT; return -EFAULT;
} }
...@@ -662,10 +653,11 @@ static int send_data_block(struct IR_tx *tx, unsigned char *data_block) ...@@ -662,10 +653,11 @@ static int send_data_block(struct IR_tx *tx, unsigned char *data_block)
buf[0] = (unsigned char)(i + 1); buf[0] = (unsigned char)(i + 1);
for (j = 0; j < tosend; ++j) for (j = 0; j < tosend; ++j)
buf[1 + j] = data_block[i + j]; buf[1 + j] = data_block[i + j];
dprintk("%*ph", 5, buf); dev_dbg(tx->ir->l.dev, "%*ph", 5, buf);
ret = i2c_master_send(tx->c, buf, tosend + 1); ret = i2c_master_send(tx->c, buf, tosend + 1);
if (ret != tosend + 1) { if (ret != tosend + 1) {
zilog_error("i2c_master_send failed with %d\n", ret); dev_err(tx->ir->l.dev, "i2c_master_send failed with %d\n",
ret);
return ret < 0 ? ret : -EFAULT; return ret < 0 ? ret : -EFAULT;
} }
i += tosend; i += tosend;
...@@ -689,7 +681,7 @@ static int send_boot_data(struct IR_tx *tx) ...@@ -689,7 +681,7 @@ static int send_boot_data(struct IR_tx *tx)
buf[1] = 0x20; buf[1] = 0x20;
ret = i2c_master_send(tx->c, buf, 2); ret = i2c_master_send(tx->c, buf, 2);
if (ret != 2) { if (ret != 2) {
zilog_error("i2c_master_send failed with %d\n", ret); dev_err(tx->ir->l.dev, "i2c_master_send failed with %d\n", ret);
return ret < 0 ? ret : -EFAULT; return ret < 0 ? ret : -EFAULT;
} }
...@@ -706,21 +698,22 @@ static int send_boot_data(struct IR_tx *tx) ...@@ -706,21 +698,22 @@ static int send_boot_data(struct IR_tx *tx)
} }
if (ret != 1) { if (ret != 1) {
zilog_error("i2c_master_send failed with %d\n", ret); dev_err(tx->ir->l.dev, "i2c_master_send failed with %d\n", ret);
return ret < 0 ? ret : -EFAULT; return ret < 0 ? ret : -EFAULT;
} }
/* Here comes the firmware version... (hopefully) */ /* Here comes the firmware version... (hopefully) */
ret = i2c_master_recv(tx->c, buf, 4); ret = i2c_master_recv(tx->c, buf, 4);
if (ret != 4) { if (ret != 4) {
zilog_error("i2c_master_recv failed with %d\n", ret); dev_err(tx->ir->l.dev, "i2c_master_recv failed with %d\n", ret);
return 0; return 0;
} }
if ((buf[0] != 0x80) && (buf[0] != 0xa0)) { if ((buf[0] != 0x80) && (buf[0] != 0xa0)) {
zilog_error("unexpected IR TX init response: %02x\n", buf[0]); dev_err(tx->ir->l.dev, "unexpected IR TX init response: %02x\n",
buf[0]);
return 0; return 0;
} }
zilog_notify("Zilog/Hauppauge IR blaster firmware version " dev_notice(tx->ir->l.dev, "Zilog/Hauppauge IR blaster firmware version "
"%d.%d.%d loaded\n", buf[1], buf[2], buf[3]); "%d.%d.%d loaded\n", buf[1], buf[2], buf[3]);
return 0; return 0;
...@@ -738,7 +731,7 @@ static void fw_unload_locked(void) ...@@ -738,7 +731,7 @@ static void fw_unload_locked(void)
vfree(tx_data); vfree(tx_data);
tx_data = NULL; tx_data = NULL;
dprintk("successfully unloaded IR blaster firmware\n"); pr_debug("successfully unloaded IR blaster firmware\n");
} }
} }
...@@ -768,17 +761,17 @@ static int fw_load(struct IR_tx *tx) ...@@ -768,17 +761,17 @@ static int fw_load(struct IR_tx *tx)
/* Request codeset data file */ /* Request codeset data file */
ret = request_firmware(&fw_entry, "haup-ir-blaster.bin", tx->ir->l.dev); ret = request_firmware(&fw_entry, "haup-ir-blaster.bin", tx->ir->l.dev);
if (ret != 0) { if (ret != 0) {
zilog_error("firmware haup-ir-blaster.bin not available (%d)\n", dev_err(tx->ir->l.dev, "firmware haup-ir-blaster.bin not available (%d)\n",
ret); ret);
ret = ret < 0 ? ret : -EFAULT; ret = ret < 0 ? ret : -EFAULT;
goto out; goto out;
} }
dprintk("firmware of size %zu loaded\n", fw_entry->size); dev_dbg(tx->ir->l.dev, "firmware of size %zu loaded\n", fw_entry->size);
/* Parse the file */ /* Parse the file */
tx_data = vmalloc(sizeof(*tx_data)); tx_data = vmalloc(sizeof(*tx_data));
if (tx_data == NULL) { if (tx_data == NULL) {
zilog_error("out of memory\n"); dev_err(tx->ir->l.dev, "out of memory\n");
release_firmware(fw_entry); release_firmware(fw_entry);
ret = -ENOMEM; ret = -ENOMEM;
goto out; goto out;
...@@ -788,7 +781,7 @@ static int fw_load(struct IR_tx *tx) ...@@ -788,7 +781,7 @@ static int fw_load(struct IR_tx *tx)
/* Copy the data so hotplug doesn't get confused and timeout */ /* Copy the data so hotplug doesn't get confused and timeout */
tx_data->datap = vmalloc(fw_entry->size); tx_data->datap = vmalloc(fw_entry->size);
if (tx_data->datap == NULL) { if (tx_data->datap == NULL) {
zilog_error("out of memory\n"); dev_err(tx->ir->l.dev, "out of memory\n");
release_firmware(fw_entry); release_firmware(fw_entry);
vfree(tx_data); vfree(tx_data);
ret = -ENOMEM; ret = -ENOMEM;
...@@ -803,7 +796,7 @@ static int fw_load(struct IR_tx *tx) ...@@ -803,7 +796,7 @@ static int fw_load(struct IR_tx *tx)
if (!read_uint8(&data, tx_data->endp, &version)) if (!read_uint8(&data, tx_data->endp, &version))
goto corrupt; goto corrupt;
if (version != 1) { if (version != 1) {
zilog_error("unsupported code set file version (%u, expected" dev_err(tx->ir->l.dev, "unsupported code set file version (%u, expected"
"1) -- please upgrade to a newer driver", "1) -- please upgrade to a newer driver",
version); version);
fw_unload_locked(); fw_unload_locked();
...@@ -820,7 +813,8 @@ static int fw_load(struct IR_tx *tx) ...@@ -820,7 +813,8 @@ static int fw_load(struct IR_tx *tx)
&tx_data->num_code_sets)) &tx_data->num_code_sets))
goto corrupt; goto corrupt;
dprintk("%u IR blaster codesets loaded\n", tx_data->num_code_sets); dev_dbg(tx->ir->l.dev, "%u IR blaster codesets loaded\n",
tx_data->num_code_sets);
tx_data->code_sets = vmalloc( tx_data->code_sets = vmalloc(
tx_data->num_code_sets * sizeof(char *)); tx_data->num_code_sets * sizeof(char *));
...@@ -884,7 +878,7 @@ static int fw_load(struct IR_tx *tx) ...@@ -884,7 +878,7 @@ static int fw_load(struct IR_tx *tx)
goto out; goto out;
corrupt: corrupt:
zilog_error("firmware is corrupt\n"); dev_err(tx->ir->l.dev, "firmware is corrupt\n");
fw_unload_locked(); fw_unload_locked();
ret = -EFAULT; ret = -EFAULT;
...@@ -904,9 +898,9 @@ static ssize_t read(struct file *filep, char __user *outbuf, size_t n, ...@@ -904,9 +898,9 @@ static ssize_t read(struct file *filep, char __user *outbuf, size_t n,
unsigned int m; unsigned int m;
DECLARE_WAITQUEUE(wait, current); DECLARE_WAITQUEUE(wait, current);
dprintk("read called\n"); dev_dbg(ir->l.dev, "read called\n");
if (n % rbuf->chunk_size) { if (n % rbuf->chunk_size) {
dprintk("read result = -EINVAL\n"); dev_dbg(ir->l.dev, "read result = -EINVAL\n");
return -EINVAL; return -EINVAL;
} }
...@@ -950,7 +944,7 @@ static ssize_t read(struct file *filep, char __user *outbuf, size_t n, ...@@ -950,7 +944,7 @@ static ssize_t read(struct file *filep, char __user *outbuf, size_t n,
unsigned char buf[MAX_XFER_SIZE]; unsigned char buf[MAX_XFER_SIZE];
if (rbuf->chunk_size > sizeof(buf)) { if (rbuf->chunk_size > sizeof(buf)) {
zilog_error("chunk_size is too big (%d)!\n", dev_err(ir->l.dev, "chunk_size is too big (%d)!\n",
rbuf->chunk_size); rbuf->chunk_size);
ret = -EINVAL; ret = -EINVAL;
break; break;
...@@ -964,7 +958,7 @@ static ssize_t read(struct file *filep, char __user *outbuf, size_t n, ...@@ -964,7 +958,7 @@ static ssize_t read(struct file *filep, char __user *outbuf, size_t n,
retries++; retries++;
} }
if (retries >= 5) { if (retries >= 5) {
zilog_error("Buffer read failed!\n"); dev_err(ir->l.dev, "Buffer read failed!\n");
ret = -EIO; ret = -EIO;
} }
} }
...@@ -974,7 +968,8 @@ static ssize_t read(struct file *filep, char __user *outbuf, size_t n, ...@@ -974,7 +968,8 @@ static ssize_t read(struct file *filep, char __user *outbuf, size_t n,
put_ir_rx(rx, false); put_ir_rx(rx, false);
set_current_state(TASK_RUNNING); set_current_state(TASK_RUNNING);
dprintk("read result = %d (%s)\n", ret, ret ? "Error" : "OK"); dev_dbg(ir->l.dev, "read result = %d (%s)\n",
ret, ret ? "Error" : "OK");
return ret ? ret : written; return ret ? ret : written;
} }
...@@ -990,7 +985,7 @@ static int send_code(struct IR_tx *tx, unsigned int code, unsigned int key) ...@@ -990,7 +985,7 @@ static int send_code(struct IR_tx *tx, unsigned int code, unsigned int key)
ret = get_key_data(data_block, code, key); ret = get_key_data(data_block, code, key);
if (ret == -EPROTO) { if (ret == -EPROTO) {
zilog_error("failed to get data for code %u, key %u -- check " dev_err(tx->ir->l.dev, "failed to get data for code %u, key %u -- check "
"lircd.conf entries\n", code, key); "lircd.conf entries\n", code, key);
return ret; return ret;
} else if (ret != 0) } else if (ret != 0)
...@@ -1006,7 +1001,7 @@ static int send_code(struct IR_tx *tx, unsigned int code, unsigned int key) ...@@ -1006,7 +1001,7 @@ static int send_code(struct IR_tx *tx, unsigned int code, unsigned int key)
buf[1] = 0x40; buf[1] = 0x40;
ret = i2c_master_send(tx->c, buf, 2); ret = i2c_master_send(tx->c, buf, 2);
if (ret != 2) { if (ret != 2) {
zilog_error("i2c_master_send failed with %d\n", ret); dev_err(tx->ir->l.dev, "i2c_master_send failed with %d\n", ret);
return ret < 0 ? ret : -EFAULT; return ret < 0 ? ret : -EFAULT;
} }
...@@ -1019,18 +1014,18 @@ static int send_code(struct IR_tx *tx, unsigned int code, unsigned int key) ...@@ -1019,18 +1014,18 @@ static int send_code(struct IR_tx *tx, unsigned int code, unsigned int key)
} }
if (ret != 1) { if (ret != 1) {
zilog_error("i2c_master_send failed with %d\n", ret); dev_err(tx->ir->l.dev, "i2c_master_send failed with %d\n", ret);
return ret < 0 ? ret : -EFAULT; return ret < 0 ? ret : -EFAULT;
} }
/* Send finished download? */ /* Send finished download? */
ret = i2c_master_recv(tx->c, buf, 1); ret = i2c_master_recv(tx->c, buf, 1);
if (ret != 1) { if (ret != 1) {
zilog_error("i2c_master_recv failed with %d\n", ret); dev_err(tx->ir->l.dev, "i2c_master_recv failed with %d\n", ret);
return ret < 0 ? ret : -EFAULT; return ret < 0 ? ret : -EFAULT;
} }
if (buf[0] != 0xA0) { if (buf[0] != 0xA0) {
zilog_error("unexpected IR TX response #1: %02x\n", dev_err(tx->ir->l.dev, "unexpected IR TX response #1: %02x\n",
buf[0]); buf[0]);
return -EFAULT; return -EFAULT;
} }
...@@ -1040,7 +1035,7 @@ static int send_code(struct IR_tx *tx, unsigned int code, unsigned int key) ...@@ -1040,7 +1035,7 @@ static int send_code(struct IR_tx *tx, unsigned int code, unsigned int key)
buf[1] = 0x80; buf[1] = 0x80;
ret = i2c_master_send(tx->c, buf, 2); ret = i2c_master_send(tx->c, buf, 2);
if (ret != 2) { if (ret != 2) {
zilog_error("i2c_master_send failed with %d\n", ret); dev_err(tx->ir->l.dev, "i2c_master_send failed with %d\n", ret);
return ret < 0 ? ret : -EFAULT; return ret < 0 ? ret : -EFAULT;
} }
...@@ -1050,7 +1045,7 @@ static int send_code(struct IR_tx *tx, unsigned int code, unsigned int key) ...@@ -1050,7 +1045,7 @@ static int send_code(struct IR_tx *tx, unsigned int code, unsigned int key)
* going to skip this whole mess and say we're done on the HD PVR * going to skip this whole mess and say we're done on the HD PVR
*/ */
if (!tx->post_tx_ready_poll) { if (!tx->post_tx_ready_poll) {
dprintk("sent code %u, key %u\n", code, key); dev_dbg(tx->ir->l.dev, "sent code %u, key %u\n", code, key);
return 0; return 0;
} }
...@@ -1066,11 +1061,11 @@ static int send_code(struct IR_tx *tx, unsigned int code, unsigned int key) ...@@ -1066,11 +1061,11 @@ static int send_code(struct IR_tx *tx, unsigned int code, unsigned int key)
ret = i2c_master_send(tx->c, buf, 1); ret = i2c_master_send(tx->c, buf, 1);
if (ret == 1) if (ret == 1)
break; break;
dprintk("NAK expected: i2c_master_send " dev_dbg(tx->ir->l.dev, "NAK expected: i2c_master_send "
"failed with %d (try %d)\n", ret, i+1); "failed with %d (try %d)\n", ret, i+1);
} }
if (ret != 1) { if (ret != 1) {
zilog_error("IR TX chip never got ready: last i2c_master_send " dev_err(tx->ir->l.dev, "IR TX chip never got ready: last i2c_master_send "
"failed with %d\n", ret); "failed with %d\n", ret);
return ret < 0 ? ret : -EFAULT; return ret < 0 ? ret : -EFAULT;
} }
...@@ -1078,16 +1073,17 @@ static int send_code(struct IR_tx *tx, unsigned int code, unsigned int key) ...@@ -1078,16 +1073,17 @@ static int send_code(struct IR_tx *tx, unsigned int code, unsigned int key)
/* Seems to be an 'ok' response */ /* Seems to be an 'ok' response */
i = i2c_master_recv(tx->c, buf, 1); i = i2c_master_recv(tx->c, buf, 1);
if (i != 1) { if (i != 1) {
zilog_error("i2c_master_recv failed with %d\n", ret); dev_err(tx->ir->l.dev, "i2c_master_recv failed with %d\n", ret);
return -EFAULT; return -EFAULT;
} }
if (buf[0] != 0x80) { if (buf[0] != 0x80) {
zilog_error("unexpected IR TX response #2: %02x\n", buf[0]); dev_err(tx->ir->l.dev, "unexpected IR TX response #2: %02x\n",
buf[0]);
return -EFAULT; return -EFAULT;
} }
/* Oh good, it worked */ /* Oh good, it worked */
dprintk("sent code %u, key %u\n", code, key); dev_dbg(tx->ir->l.dev, "sent code %u, key %u\n", code, key);
return 0; return 0;
} }
...@@ -1173,11 +1169,11 @@ static ssize_t write(struct file *filep, const char __user *buf, size_t n, ...@@ -1173,11 +1169,11 @@ static ssize_t write(struct file *filep, const char __user *buf, size_t n,
*/ */
if (ret != 0) { if (ret != 0) {
/* Looks like the chip crashed, reset it */ /* Looks like the chip crashed, reset it */
zilog_error("sending to the IR transmitter chip " dev_err(tx->ir->l.dev, "sending to the IR transmitter chip "
"failed, trying reset\n"); "failed, trying reset\n");
if (failures >= 3) { if (failures >= 3) {
zilog_error("unable to send to the IR chip " dev_err(tx->ir->l.dev, "unable to send to the IR chip "
"after 3 resets, giving up\n"); "after 3 resets, giving up\n");
mutex_unlock(&ir->ir_lock); mutex_unlock(&ir->ir_lock);
mutex_unlock(&tx->client_lock); mutex_unlock(&tx->client_lock);
...@@ -1212,7 +1208,7 @@ static unsigned int poll(struct file *filep, poll_table *wait) ...@@ -1212,7 +1208,7 @@ static unsigned int poll(struct file *filep, poll_table *wait)
struct lirc_buffer *rbuf = ir->l.rbuf; struct lirc_buffer *rbuf = ir->l.rbuf;
unsigned int ret; unsigned int ret;
dprintk("poll called\n"); dev_dbg(ir->l.dev, "poll called\n");
rx = get_ir_rx(ir); rx = get_ir_rx(ir);
if (rx == NULL) { if (rx == NULL) {
...@@ -1220,7 +1216,7 @@ static unsigned int poll(struct file *filep, poll_table *wait) ...@@ -1220,7 +1216,7 @@ static unsigned int poll(struct file *filep, poll_table *wait)
* Revisit this, if our poll function ever reports writeable * Revisit this, if our poll function ever reports writeable
* status for Tx * status for Tx
*/ */
dprintk("poll result = POLLERR\n"); dev_dbg(ir->l.dev, "poll result = POLLERR\n");
return POLLERR; return POLLERR;
} }
...@@ -1233,7 +1229,8 @@ static unsigned int poll(struct file *filep, poll_table *wait) ...@@ -1233,7 +1229,8 @@ static unsigned int poll(struct file *filep, poll_table *wait)
/* Indicate what ops could happen immediately without blocking */ /* Indicate what ops could happen immediately without blocking */
ret = lirc_buffer_empty(rbuf) ? 0 : (POLLIN|POLLRDNORM); ret = lirc_buffer_empty(rbuf) ? 0 : (POLLIN|POLLRDNORM);
dprintk("poll result = %s\n", ret ? "POLLIN|POLLRDNORM" : "none"); dev_dbg(ir->l.dev, "poll result = %s\n",
ret ? "POLLIN|POLLRDNORM" : "none");
return ret; return ret;
} }
...@@ -1340,7 +1337,7 @@ static int close(struct inode *node, struct file *filep) ...@@ -1340,7 +1337,7 @@ static int close(struct inode *node, struct file *filep)
struct IR *ir = filep->private_data; struct IR *ir = filep->private_data;
if (ir == NULL) { if (ir == NULL) {
zilog_error("close: no private_data attached to the file!\n"); dev_err(ir->l.dev, "close: no private_data attached to the file!\n");
return -ENODEV; return -ENODEV;
} }
...@@ -1452,7 +1449,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) ...@@ -1452,7 +1449,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
int ret; int ret;
bool tx_probe = false; bool tx_probe = false;
dprintk("%s: %s on i2c-%d (%s), client addr=0x%02x\n", pr_debug("%s: %s on i2c-%d (%s), client addr=0x%02x\n",
__func__, id->name, adap->nr, adap->name, client->addr); __func__, id->name, adap->nr, adap->name, client->addr);
/* /*
...@@ -1465,7 +1462,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) ...@@ -1465,7 +1462,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
else if (tx_only) /* module option */ else if (tx_only) /* module option */
return -ENXIO; return -ENXIO;
zilog_info("probing IR %s on %s (i2c-%d)\n", pr_info("probing IR %s on %s (i2c-%d)\n",
tx_probe ? "Tx" : "Rx", adap->name, adap->nr); tx_probe ? "Tx" : "Rx", adap->name, adap->nr);
mutex_lock(&ir_devices_lock); mutex_lock(&ir_devices_lock);
...@@ -1547,7 +1544,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) ...@@ -1547,7 +1544,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
/* Proceed only if the Rx client is also ready or not needed */ /* Proceed only if the Rx client is also ready or not needed */
if (rx == NULL && !tx_only) { if (rx == NULL && !tx_only) {
zilog_info("probe of IR Tx on %s (i2c-%d) done. Waiting" dev_info(tx->ir->l.dev, "probe of IR Tx on %s (i2c-%d) done. Waiting"
" on IR Rx.\n", adap->name, adap->nr); " on IR Rx.\n", adap->name, adap->nr);
goto out_ok; goto out_ok;
} }
...@@ -1586,7 +1583,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) ...@@ -1586,7 +1583,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
"zilog-rx-i2c-%d", adap->nr); "zilog-rx-i2c-%d", adap->nr);
if (IS_ERR(rx->task)) { if (IS_ERR(rx->task)) {
ret = PTR_ERR(rx->task); ret = PTR_ERR(rx->task);
zilog_error("%s: could not start IR Rx polling thread" dev_err(tx->ir->l.dev, "%s: could not start IR Rx polling thread"
"\n", __func__); "\n", __func__);
/* Failed kthread, so put back the ir ref */ /* Failed kthread, so put back the ir ref */
put_ir_device(ir, true); put_ir_device(ir, true);
...@@ -1599,7 +1596,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) ...@@ -1599,7 +1596,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
/* Proceed only if the Tx client is also ready */ /* Proceed only if the Tx client is also ready */
if (tx == NULL) { if (tx == NULL) {
zilog_info("probe of IR Rx on %s (i2c-%d) done. Waiting" pr_info("probe of IR Rx on %s (i2c-%d) done. Waiting"
" on IR Tx.\n", adap->name, adap->nr); " on IR Tx.\n", adap->name, adap->nr);
goto out_ok; goto out_ok;
} }
...@@ -1609,12 +1606,12 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) ...@@ -1609,12 +1606,12 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
ir->l.minor = minor; /* module option: user requested minor number */ ir->l.minor = minor; /* module option: user requested minor number */
ir->l.minor = lirc_register_driver(&ir->l); ir->l.minor = lirc_register_driver(&ir->l);
if (ir->l.minor < 0 || ir->l.minor >= MAX_IRCTL_DEVICES) { if (ir->l.minor < 0 || ir->l.minor >= MAX_IRCTL_DEVICES) {
zilog_error("%s: \"minor\" must be between 0 and %d (%d)!\n", dev_err(tx->ir->l.dev, "%s: \"minor\" must be between 0 and %d (%d)!\n",
__func__, MAX_IRCTL_DEVICES-1, ir->l.minor); __func__, MAX_IRCTL_DEVICES-1, ir->l.minor);
ret = -EBADRQC; ret = -EBADRQC;
goto out_put_xx; goto out_put_xx;
} }
zilog_info("IR unit on %s (i2c-%d) registered as lirc%d and ready\n", dev_info(ir->l.dev, "IR unit on %s (i2c-%d) registered as lirc%d and ready\n",
adap->name, adap->nr, ir->l.minor); adap->name, adap->nr, ir->l.minor);
out_ok: out_ok:
...@@ -1623,7 +1620,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) ...@@ -1623,7 +1620,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
if (tx != NULL) if (tx != NULL)
put_ir_tx(tx, true); put_ir_tx(tx, true);
put_ir_device(ir, true); put_ir_device(ir, true);
zilog_info("probe of IR %s on %s (i2c-%d) done\n", dev_info(ir->l.dev, "probe of IR %s on %s (i2c-%d) done\n",
tx_probe ? "Tx" : "Rx", adap->name, adap->nr); tx_probe ? "Tx" : "Rx", adap->name, adap->nr);
mutex_unlock(&ir_devices_lock); mutex_unlock(&ir_devices_lock);
return 0; return 0;
...@@ -1636,7 +1633,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) ...@@ -1636,7 +1633,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
out_put_ir: out_put_ir:
put_ir_device(ir, true); put_ir_device(ir, true);
out_no_ir: out_no_ir:
zilog_error("%s: probing IR %s on %s (i2c-%d) failed with %d\n", dev_err(ir->l.dev, "%s: probing IR %s on %s (i2c-%d) failed with %d\n",
__func__, tx_probe ? "Tx" : "Rx", adap->name, adap->nr, __func__, tx_probe ? "Tx" : "Rx", adap->name, adap->nr,
ret); ret);
mutex_unlock(&ir_devices_lock); mutex_unlock(&ir_devices_lock);
...@@ -1647,7 +1644,7 @@ static int __init zilog_init(void) ...@@ -1647,7 +1644,7 @@ static int __init zilog_init(void)
{ {
int ret; int ret;
zilog_notify("Zilog/Hauppauge IR driver initializing\n"); pr_notice("Zilog/Hauppauge IR driver initializing\n");
mutex_init(&tx_data_lock); mutex_init(&tx_data_lock);
...@@ -1655,9 +1652,9 @@ static int __init zilog_init(void) ...@@ -1655,9 +1652,9 @@ static int __init zilog_init(void)
ret = i2c_add_driver(&driver); ret = i2c_add_driver(&driver);
if (ret) if (ret)
zilog_error("initialization failed\n"); pr_err("initialization failed\n");
else else
zilog_notify("initialization complete\n"); pr_notice("initialization complete\n");
return ret; return ret;
} }
...@@ -1667,7 +1664,7 @@ static void __exit zilog_exit(void) ...@@ -1667,7 +1664,7 @@ static void __exit zilog_exit(void)
i2c_del_driver(&driver); i2c_del_driver(&driver);
/* if loaded */ /* if loaded */
fw_unload(); fw_unload();
zilog_notify("Zilog/Hauppauge IR driver unloaded\n"); pr_notice("Zilog/Hauppauge IR driver unloaded\n");
} }
module_init(zilog_init); module_init(zilog_init);
......
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