From 91d0be1dd845913ba276e041dc11d1297390de11 Mon Sep 17 00:00:00 2001
From: Simon Glass <sjg@chromium.org>
Date: Wed, 23 Jul 2014 06:54:58 -0600
Subject: [PATCH] stdio: Remove redundant code around stdio_register() calls

There is no point in setting a structure's memory to NULL when it has
already been zeroed with memset().

Also, there is no need to create a stub function for stdio to call - if the
function is NULL it will not be called.

This is a clean-up, with no change in functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Marek Vasut <marex@denx.de>
---
 arch/x86/lib/video.c        |  4 ----
 board/bf527-ezkit/video.c   | 10 ----------
 board/bf548-ezkit/video.c   | 10 ----------
 board/cm-bf548/video.c      | 10 ----------
 board/mpl/common/kbd.c      |  2 --
 common/usb_kbd.c            |  2 --
 drivers/input/keyboard.c    |  2 --
 drivers/video/cfb_console.c |  2 --
 8 files changed, 42 deletions(-)

diff --git a/arch/x86/lib/video.c b/arch/x86/lib/video.c
index dfd2a8496e..eb9c595a4e 100644
--- a/arch/x86/lib/video.c
+++ b/arch/x86/lib/video.c
@@ -178,8 +178,6 @@ int video_init(void)
 	vga_dev.flags = DEV_FLAGS_OUTPUT | DEV_FLAGS_SYSTEM;
 	vga_dev.putc  = video_putc;        /* 'putc' function */
 	vga_dev.puts  = video_puts;        /* 'puts' function */
-	vga_dev.tstc  = NULL;              /* 'tstc' function */
-	vga_dev.getc  = NULL;              /* 'getc' function */
 
 	if (stdio_register(&vga_dev) == 0)
 		return 1;
@@ -191,8 +189,6 @@ int video_init(void)
 	strcpy(kbd_dev.name, "kbd");
 	kbd_dev.ext   = 0;
 	kbd_dev.flags = DEV_FLAGS_INPUT | DEV_FLAGS_SYSTEM;
-	kbd_dev.putc  = NULL;        /* 'putc' function */
-	kbd_dev.puts  = NULL;        /* 'puts' function */
 	kbd_dev.tstc  = i8042_tstc;  /* 'tstc' function */
 	kbd_dev.getc  = i8042_getc;  /* 'getc' function */
 
diff --git a/board/bf527-ezkit/video.c b/board/bf527-ezkit/video.c
index 5d8a0910de..c2bf145013 100644
--- a/board/bf527-ezkit/video.c
+++ b/board/bf527-ezkit/video.c
@@ -391,14 +391,6 @@ void video_stop(void)
 #endif
 }
 
-void video_putc(const char c)
-{
-}
-
-void video_puts(const char *s)
-{
-}
-
 int drv_video_init(void)
 {
 	int error, devices = 1;
@@ -448,8 +440,6 @@ int drv_video_init(void)
 	strcpy(videodev.name, "video");
 	videodev.ext = DEV_EXT_VIDEO;	/* Video extensions */
 	videodev.flags = DEV_FLAGS_SYSTEM;	/* No Output */
-	videodev.putc = video_putc;	/* 'putc' function */
-	videodev.puts = video_puts;	/* 'puts' function */
 
 	error = stdio_register(&videodev);
 
diff --git a/board/bf548-ezkit/video.c b/board/bf548-ezkit/video.c
index 6737ac1628..47e68c6a97 100644
--- a/board/bf548-ezkit/video.c
+++ b/board/bf548-ezkit/video.c
@@ -281,14 +281,6 @@ static void dma_bitblit(void *dst, fastimage_t *logo, int x, int y)
 
 }
 
-void video_putc(const char c)
-{
-}
-
-void video_puts(const char *s)
-{
-}
-
 int drv_video_init(void)
 {
 	int error, devices = 1;
@@ -338,8 +330,6 @@ int drv_video_init(void)
 	strcpy(videodev.name, "video");
 	videodev.ext = DEV_EXT_VIDEO;	/* Video extensions */
 	videodev.flags = DEV_FLAGS_SYSTEM;	/* No Output */
-	videodev.putc = video_putc;	/* 'putc' function */
-	videodev.puts = video_puts;	/* 'puts' function */
 
 	error = stdio_register(&videodev);
 
diff --git a/board/cm-bf548/video.c b/board/cm-bf548/video.c
index c35d285070..b098615d4c 100644
--- a/board/cm-bf548/video.c
+++ b/board/cm-bf548/video.c
@@ -283,14 +283,6 @@ static void dma_bitblit(void *dst, fastimage_t *logo, int x, int y)
 
 }
 
-void video_putc(const char c)
-{
-}
-
-void video_puts(const char *s)
-{
-}
-
 int drv_video_init(void)
 {
 	int error, devices = 1;
@@ -342,8 +334,6 @@ int drv_video_init(void)
 	strcpy(videodev.name, "video");
 	videodev.ext = DEV_EXT_VIDEO;	/* Video extensions */
 	videodev.flags = DEV_FLAGS_SYSTEM;	/* No Output */
-	videodev.putc = video_putc;	/* 'putc' function */
-	videodev.puts = video_puts;	/* 'puts' function */
 
 	error = stdio_register(&videodev);
 
diff --git a/board/mpl/common/kbd.c b/board/mpl/common/kbd.c
index 1b5487b144..f56545ec03 100644
--- a/board/mpl/common/kbd.c
+++ b/board/mpl/common/kbd.c
@@ -204,8 +204,6 @@ int drv_isa_kbd_init (void)
 	memset (&kbddev, 0, sizeof(kbddev));
 	strcpy(kbddev.name, DEVNAME);
 	kbddev.flags =  DEV_FLAGS_INPUT | DEV_FLAGS_SYSTEM;
-	kbddev.putc = NULL ;
-	kbddev.puts = NULL ;
 	kbddev.getc = kbd_getc ;
 	kbddev.tstc = kbd_testc ;
 
diff --git a/common/usb_kbd.c b/common/usb_kbd.c
index 0b77c16c5f..371e5bc144 100644
--- a/common/usb_kbd.c
+++ b/common/usb_kbd.c
@@ -522,8 +522,6 @@ int drv_usb_kbd_init(void)
 		memset(&usb_kbd_dev, 0, sizeof(struct stdio_dev));
 		strcpy(usb_kbd_dev.name, DEVNAME);
 		usb_kbd_dev.flags =  DEV_FLAGS_INPUT | DEV_FLAGS_SYSTEM;
-		usb_kbd_dev.putc = NULL;
-		usb_kbd_dev.puts = NULL;
 		usb_kbd_dev.getc = usb_kbd_getc;
 		usb_kbd_dev.tstc = usb_kbd_testc;
 		usb_kbd_dev.priv = (void *)dev;
diff --git a/drivers/input/keyboard.c b/drivers/input/keyboard.c
index 614592ef3c..5ef1cc06ed 100644
--- a/drivers/input/keyboard.c
+++ b/drivers/input/keyboard.c
@@ -275,8 +275,6 @@ int kbd_init (void)
 	memset (&kbddev, 0, sizeof(kbddev));
 	strcpy(kbddev.name, DEVNAME);
 	kbddev.flags =  DEV_FLAGS_INPUT | DEV_FLAGS_SYSTEM;
-	kbddev.putc = NULL ;
-	kbddev.puts = NULL ;
 	kbddev.getc = kbd_getc ;
 	kbddev.tstc = kbd_testc ;
 
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c
index b52e9edd25..1cf8660510 100644
--- a/drivers/video/cfb_console.c
+++ b/drivers/video/cfb_console.c
@@ -2279,8 +2279,6 @@ int drv_video_init(void)
 	console_dev.flags = DEV_FLAGS_OUTPUT | DEV_FLAGS_SYSTEM;
 	console_dev.putc = video_putc;	/* 'putc' function */
 	console_dev.puts = video_puts;	/* 'puts' function */
-	console_dev.tstc = NULL;	/* 'tstc' function */
-	console_dev.getc = NULL;	/* 'getc' function */
 
 #if !defined(CONFIG_VGA_AS_SINGLE_DEVICE)
 	/* Also init console device */
-- 
2.39.5