[U-Boot] [PATCH v2 03/29] stdio: Remove redundant code around stdio_register() calls

Simon Glass sjg at chromium.org
Wed Jul 9 05:37:53 CEST 2014


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 at chromium.org>
Acked-by: Marek Vasut <marex at denx.de>
---

Changes in v2:
- Remove change to board/rbc823/kbd.c, since it has been deleted
- Reformat commit message slightly

 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 dfd2a84..eb9c595 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 5d8a091..c2bf145 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 6737ac1..47e68c6 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 c35d285..b098615 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 1b5487b..f56545e 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 0b77c16..371e5bc 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 614592e..5ef1cc0 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 b52e9ed..1cf8660 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.0.0.526.g5318336



More information about the U-Boot mailing list