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>
master
Simon Glass 11 years ago
parent eb9ef5fee7
commit 91d0be1dd8
  1. 4
      arch/x86/lib/video.c
  2. 10
      board/bf527-ezkit/video.c
  3. 10
      board/bf548-ezkit/video.c
  4. 10
      board/cm-bf548/video.c
  5. 2
      board/mpl/common/kbd.c
  6. 2
      common/usb_kbd.c
  7. 2
      drivers/input/keyboard.c
  8. 2
      drivers/video/cfb_console.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 */

@ -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);

@ -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);

@ -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);

@ -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 ;

@ -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;

@ -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 ;

@ -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 */

Loading…
Cancel
Save