linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Slaby <jslaby@suse.cz>
To: gregkh@linuxfoundation.org
Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
	Jiri Slaby <jslaby@suse.cz>
Subject: [PATCH 04/24] n_hdlc: put init/exit strings directly to prints
Date: Wed, 19 Feb 2020 09:40:58 +0100	[thread overview]
Message-ID: <20200219084118.26491-4-jslaby@suse.cz> (raw)
In-Reply-To: <20200219084118.26491-1-jslaby@suse.cz>

These strings were put aside from prints to save some bytes after module
load or when built-in -- they were freed after module load (__init ones) or
when the driver is selected as built-in (__exit ones).

The savings are negligible, but the code readability is worse by the
order of magnitude. So put the strings where they belong. Note that it
also used to make little sense putting const data in .data (the __exit
case).

While at it, switch to pr_info, pr_err, not using the KERN_INFO and _ERR
directly.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/tty/n_hdlc.c | 28 ++++++----------------------
 1 file changed, 6 insertions(+), 22 deletions(-)

diff --git a/drivers/tty/n_hdlc.c b/drivers/tty/n_hdlc.c
index e37dab2528a1..b651b5ba64ee 100644
--- a/drivers/tty/n_hdlc.c
+++ b/drivers/tty/n_hdlc.c
@@ -889,13 +889,6 @@ static struct n_hdlc_buf *n_hdlc_buf_get(struct n_hdlc_buf_list *buf_list)
 	return buf;
 }	/* end of n_hdlc_buf_get() */
 
-static const char hdlc_banner[] __initconst =
-	KERN_INFO "HDLC line discipline maxframe=%u\n";
-static const char hdlc_register_ok[] __initconst =
-	KERN_INFO "N_HDLC line discipline registered.\n";
-static const char hdlc_register_fail[] __initconst =
-	KERN_ERR "error registering line discipline: %d\n";
-
 static int __init n_hdlc_init(void)
 {
 	int status;
@@ -906,37 +899,28 @@ static int __init n_hdlc_init(void)
 	else if (maxframe > 65535)
 		maxframe = 65535;
 
-	printk(hdlc_banner, maxframe);
+	pr_info("HDLC line discipline maxframe=%d\n", maxframe);
 
 	status = tty_register_ldisc(N_HDLC, &n_hdlc_ldisc);
 	if (!status)
-		printk(hdlc_register_ok);
+		pr_info("N_HDLC line discipline registered.\n");
 	else
-		printk(hdlc_register_fail, status);
+		pr_err("error registering line discipline: %d\n", status);
 
 	return status;
 	
 }	/* end of init_module() */
 
-#ifdef CONFIG_SPARC
-#undef __exitdata
-#define __exitdata
-#endif
-
-static const char hdlc_unregister_ok[] __exitdata =
-	KERN_INFO "N_HDLC: line discipline unregistered\n";
-static const char hdlc_unregister_fail[] __exitdata =
-	KERN_ERR "N_HDLC: can't unregister line discipline (err = %d)\n";
-
 static void __exit n_hdlc_exit(void)
 {
 	/* Release tty registration of line discipline */
 	int status = tty_unregister_ldisc(N_HDLC);
 
 	if (status)
-		printk(hdlc_unregister_fail, status);
+		pr_err("N_HDLC: can't unregister line discipline (err = %d)\n",
+				status);
 	else
-		printk(hdlc_unregister_ok);
+		pr_info("N_HDLC: line discipline unregistered\n");
 }
 
 module_init(n_hdlc_init);
-- 
2.25.0


  parent reply	other threads:[~2020-02-19  8:43 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-19  8:40 [PATCH 01/24] n_hdlc: remove tracing debug prints Jiri Slaby
2020-02-19  8:40 ` [PATCH 02/24] n_hdlc: remove unused macros Jiri Slaby
2020-02-19  8:40 ` [PATCH 03/24] n_hdlc: convert debuglevel use to pr_debug Jiri Slaby
2020-02-19 12:20   ` Joe Perches
2020-02-20 12:45     ` Greg KH
2020-02-21  8:16     ` Jiri Slaby
2020-02-19  8:40 ` Jiri Slaby [this message]
2020-02-19  8:40 ` [PATCH 05/24] n_hdlc: cleanup messages during registration Jiri Slaby
2020-02-19  8:41 ` [PATCH 06/24] n_hdlc: use clamp() for maxframe Jiri Slaby
2020-02-19  8:41 ` [PATCH 07/24] n_hdlc: simplify freeing of buffer list Jiri Slaby
2020-02-19  8:41 ` [PATCH 08/24] n_hdlc: invert conditions in n_hdlc_tty_close and n_hdlc_tty_poll Jiri Slaby
2020-02-19  8:41 ` [PATCH 09/24] n_hdlc: remove unused flags Jiri Slaby
2020-02-19  8:41 ` [PATCH 10/24] n_hdlc: remove unused backup_tty Jiri Slaby
2020-02-19  8:41 ` [PATCH 11/24] n_hdlc: expand tty2n_hdlc macro Jiri Slaby
2020-02-19  8:41 ` [PATCH 12/24] n_hdlc: inline n_hdlc_release Jiri Slaby
2020-02-19  8:41 ` [PATCH 13/24] n_hdlc: remove cached tty Jiri Slaby
2020-02-19  8:41 ` [PATCH 14/24] n_hdlc: remove checking of n_hdlc Jiri Slaby
2020-02-19  8:41 ` [PATCH 15/24] n_hdlc: add helper for buffers allocation Jiri Slaby
2020-02-19  8:41 ` [PATCH 16/24] n_hdlc: move tty_ldisc_ops to the bottom Jiri Slaby
2020-02-19  8:41 ` [PATCH 17/24] n_hdlc: switch tbusy and woke_up to bools Jiri Slaby
2020-02-19  8:41 ` [PATCH 18/24] n_hdlc: remove unneeded ifdef Jiri Slaby
2020-02-19  8:41 ` [PATCH 19/24] n_hdlc: use __func__ and pr_ print helpers Jiri Slaby
2020-02-19  8:41 ` [PATCH 20/24] n_hdlc: remove useless whitespace at line wraps Jiri Slaby
2020-02-19  8:41 ` [PATCH 21/24] n_hdlc: remove spaces between function name and ( Jiri Slaby
2020-02-19  8:41 ` [PATCH 22/24] n_hdlc: add missing spaces after commas Jiri Slaby
2020-02-19  8:41 ` [PATCH 23/24] n_hdlc: fix whitespace around binary operators Jiri Slaby
2020-02-19  8:41 ` [PATCH 24/24] n_hdlc: wrap a comment properly Jiri Slaby

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200219084118.26491-4-jslaby@suse.cz \
    --to=jslaby@suse.cz \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).