public inbox for linux-m68k@lists.linux-m68k.org
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: linux-m68k@lists.linux-m68k.org
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
	Petr Stehlik <pstehlik@sophics.cz>
Subject: [PATCH 3/4] m68k/atari: ARAnyM - Prepare nfcon for submission
Date: Sun, 23 Jan 2011 17:31:33 +0100	[thread overview]
Message-ID: <1295800294-13216-3-git-send-email-geert@linux-m68k.org> (raw)
In-Reply-To: <1295800294-13216-1-git-send-email-geert@linux-m68k.org>

  - Break too long lines,
  - Make needlessly global functions static,
  - Use pr_*(),
  - Extract nfputs(), to avoid code duplication in nfcon_write() and
    nfcon_tty_write().

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Petr Stehlik <pstehlik@sophics.cz>
---
 arch/m68k/emu/nfcon.c |   30 ++++++++++++------------------
 1 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/arch/m68k/emu/nfcon.c b/arch/m68k/emu/nfcon.c
index f82af58..ab20dc0 100644
--- a/arch/m68k/emu/nfcon.c
+++ b/arch/m68k/emu/nfcon.c
@@ -21,7 +21,7 @@
 static int stderr_id;
 static struct tty_driver *nfcon_tty_driver;
 
-static void nfcon_write(struct console *con, const char *str, unsigned int count)
+static void nfputs(const char *str, unsigned int count)
 {
 	char buf[68];
 
@@ -37,7 +37,13 @@ static void nfcon_write(struct console *con, const char *str, unsigned int count
 	nf_call(stderr_id, buf);
 }
 
-struct tty_driver *nfcon_device(struct console *con, int *index)
+static void nfcon_write(struct console *con, const char *str,
+			unsigned int count)
+{
+	nfputs(str, count);
+}
+
+static struct tty_driver *nfcon_device(struct console *con, int *index)
 {
 	*index = 0;
 	return (con->flags & CON_ENABLED) ? nfcon_tty_driver : NULL;
@@ -61,22 +67,10 @@ static void nfcon_tty_close(struct tty_struct *tty, struct file *filp)
 {
 }
 
-static int nfcon_tty_write(struct tty_struct *tty, const unsigned char *buf, int count)
+static int nfcon_tty_write(struct tty_struct *tty, const unsigned char *buf,
+			   int count)
 {
-	char temp[68];
-	int i = count;
-
-	temp[64] = 0;
-	while (i > 64) {
-		memcpy(temp, buf, 64);
-		nf_call(stderr_id, temp);
-		buf += 64;
-		i -= 64;
-	}
-	memcpy(temp, buf, i);
-	temp[i] = 0;
-	nf_call(stderr_id, temp);
-
+	nfputs(buf, count);
 	return count;
 }
 
@@ -144,7 +138,7 @@ static int __init nfcon_init(void)
 	tty_set_operations(nfcon_tty_driver, &nfcon_tty_ops);
 	res = tty_register_driver(nfcon_tty_driver);
 	if (res) {
-		printk(KERN_ERR "failed to register nfcon tty driver\n");
+		pr_err("failed to register nfcon tty driver\n");
 		put_tty_driver(nfcon_tty_driver);
 		return res;
 	}
-- 
1.7.0.4

  parent reply	other threads:[~2011-01-23 16:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-23 16:31 [PATCH 1/4] m68k/atari: ARAnyM - Remove bogus line from Kconfig help Geert Uytterhoeven
2011-01-23 16:31 ` [PATCH 2/4] m68k/atari: ARAnyM - Prepare nfblock for submission Geert Uytterhoeven
2011-01-23 16:31 ` Geert Uytterhoeven [this message]
2011-01-23 16:31 ` [PATCH 4/4] m68k/atari: ARAnyM - Prepare nfeth " Geert Uytterhoeven
2011-02-05 15:35   ` Geert Uytterhoeven

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=1295800294-13216-3-git-send-email-geert@linux-m68k.org \
    --to=geert@linux-m68k.org \
    --cc=linux-m68k@lists.linux-m68k.org \
    --cc=pstehlik@sophics.cz \
    /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