Skip to content

Commit

Permalink
n_hdlc: use __func__ and pr_ print helpers
Browse files Browse the repository at this point in the history
* we mark the message in n_hdlc_tty_receive as error
* we use __func__ instead of explicit function name
* we switch the remaining prints to pr_* helpers

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20200219084118.26491-19-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Jiri Slaby authored and Greg Kroah-Hartman committed Feb 21, 2020
1 parent b9c010d commit d86b05c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions drivers/tty/n_hdlc.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ static void n_hdlc_tty_close(struct tty_struct *tty)
struct n_hdlc *n_hdlc = tty->disc_data;

if (n_hdlc->magic != HDLC_MAGIC) {
printk(KERN_WARNING "n_hdlc: trying to close unopened tty!\n");
pr_warn("n_hdlc: trying to close unopened tty!\n");
return;
}
#if defined(TTY_NO_WRITE_SPLIT)
Expand Down Expand Up @@ -231,13 +231,13 @@ static int n_hdlc_tty_open (struct tty_struct *tty)

/* There should not be an existing table for this slot. */
if (n_hdlc) {
printk (KERN_ERR"n_hdlc_tty_open:tty already associated!\n" );
pr_err("%s: tty already associated!\n", __func__);
return -EEXIST;
}

n_hdlc = n_hdlc_alloc();
if (!n_hdlc) {
printk (KERN_ERR "n_hdlc_alloc failed\n");
pr_err("%s: n_hdlc_alloc failed\n", __func__);
return -ENFILE;
}

Expand Down Expand Up @@ -371,8 +371,8 @@ static void n_hdlc_tty_receive(struct tty_struct *tty, const __u8 *data,

/* verify line is using HDLC discipline */
if (n_hdlc->magic != HDLC_MAGIC) {
printk("%s(%d) line not using HDLC discipline\n",
__FILE__,__LINE__);
pr_err("%s(%d) line not using HDLC discipline\n",
__FILE__, __LINE__);
return;
}

Expand Down Expand Up @@ -431,8 +431,8 @@ static ssize_t n_hdlc_tty_read(struct tty_struct *tty, struct file *file,

/* verify user access to buffer */
if (!access_ok(buf, nr)) {
printk(KERN_WARNING "%s(%d) n_hdlc_tty_read() can't verify user "
"buffer\n", __FILE__, __LINE__);
pr_warn("%s(%d) %s() can't verify user buffer\n",
__FILE__, __LINE__, __func__);
return -EFAULT;
}

Expand Down

0 comments on commit d86b05c

Please sign in to comment.