Skip to contentSkip to conversation

console/device: rework function naming

RFC PATCH New Jean-Christophe PLAGNIOL-VILLARD 3 participants 8 messages May 3, 2009

Subsystems (8)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 console/device: rework function naming

actually the console API use the following naming convention

---Extract---
typedef struct device_t;

int    device_register (device_t * dev);
int    devices_init (void);
int    device_deregister(char *devname);

struct list_head* device_get_list(void);
device_t* device_get_by_name(char* name);
device_t* device_clone(device_t *dev);
---

which is not console dependent and is confusing instead of using device_XX

we now switch to console_XX and console_device_t

this will also allow to add later a generic device mecanism in order to have multi generic device support and driver instance

---
 board/MAI/AmigaOneG3SE/ps2kbd.c               |    6 +-
 board/MAI/AmigaOneG3SE/video.c                |    6 +-
 board/ads5121/ads5121_diu.c                   |    2 +-
 board/bf527-ezkit/video.c                     |    6 +-
 board/bf533-stamp/video.c                     |    6 +-
 board/bf548-ezkit/video.c                     |    6 +-
 board/bmw/bmw.c                               |    2 +-
 board/freescale/mpc8610hpcd/mpc8610hpcd_diu.c |    2 +-
 board/mpl/common/common_util.c                |    4 +-
 board/mpl/common/isa.c                        |    2 +-
 board/mpl/common/kbd.c                        |    6 +-
 board/mpl/pati/pati.c                         |    6 +-
 board/netphone/phone_console.c                |    6 +-
 board/rbc823/kbd.c                            |    6 +-
 board/trab/vfd.c                              |    2 +-
 common/cmd_console.c                          |    6 +-
 common/cmd_log.c                              |    6 +-
 common/cmd_terminal.c                         |    6 +-
 common/console.c                              |   32 +++---
 common/devices.c                              |   42 ++++----
 common/iomux.c                                |   14 ++--
 common/lcd.c                                  |    6 +-
 common/serial.c                               |    8 +-
 common/usb_kbd.c                              |   12 +-
 cpu/blackfin/jtag-console.c                   |    6 +-
 cpu/mpc8xx/lcd.c                              |    2 +-
 cpu/mpc8xx/video.c                            |    6 +-
 cpu/pxa/pxafb.c                               |    2 +-
 drivers/input/keyboard.c                      |    6 +-
 drivers/mtd/ubi/build.c                       |    2 +-
 drivers/mtd/ubi/vmt.c                         |    4 +-
 drivers/net/netconsole.c                      |    6 +-
 drivers/serial/arm_dcc.c                      |    6 +-
 drivers/serial/usbtty.c                       |    6 +-
 drivers/usb/musb/musb_hcd.c                   |    4 +-
 drivers/usb/musb/musb_hcd.h                   |    2 +-
 drivers/video/cfb_console.c                   |    8 +-
 include/configs/AmigaOneG3SE.h                |    2 +-
 include/configs/MIP405.h                      |    2 +-
 include/configs/MPC8610HPCD.h                 |    2 +-
 include/configs/MPC8641HPCN.h                 |    2 +-
 include/configs/PIP405.h                      |    2 +-
 include/configs/VCMA9.h                       |    2 +-
 include/configs/gr_ep2s60.h                   |    2 +-
 include/configs/mp2usb.h                      |    2 +-
 include/console.h                             |  101 +++++++++++++++++++-
 include/devices.h                             |  126 -------------------------
 include/iomux.h                               |    6 +-
 include/serial.h                              |    2 +-
 lib_arm/board.c                               |    4 +-
 lib_avr32/board.c                             |    4 +-
 lib_blackfin/board.c                          |    4 +-
 lib_i386/board.c                              |    4 +-
 lib_i386/video.c                              |   10 +-
 lib_m68k/board.c                              |    4 +-
 lib_mips/board.c                              |    4 +-
 lib_nios/board.c                              |    4 +-
 lib_nios2/board.c                             |    4 +-
 lib_ppc/board.c                               |    4 +-
 lib_sh/board.c                                |    4 +-
 lib_sparc/board.c                             |    4 +-
 61 files changed, 264 insertions(+), 301 deletions(-)
 delete mode 100644 include/devices.h
board/MAI/AmigaOneG3SE/ps2kbd.c +3 -3
index a297005..404d9da 100644
@@ -34,7 +34,7 @@
  */
 #include <common.h>
 #include <asm/processor.h>
-#include <devices.h>
+#include <console.h>
 #include "ps2kbd.h"
 
 
@@ -226,7 +226,7 @@ int overwrite_console (void)
 int drv_isa_kbd_init (void)
 {
 	int error;
-	device_t kbddev ;
+	console_device_t kbddev ;
 	char *stdinname  = getenv ("stdin");
 
 	if(isa_kbd_init() == -1)
@@ -239,7 +239,7 @@ int drv_isa_kbd_init (void)
 	kbddev.getc = kbd_getc ;
 	kbddev.tstc = kbd_testc ;
 
-	error = device_register (&kbddev);
+	error = console_register (&kbddev);
 	if(error==0) {
 		/* check if this is the standard input device */
 		if(strcmp(stdinname,DEVNAME)==0) {
board/MAI/AmigaOneG3SE/video.c +3 -3
index fc27c68..23a8b72 100644
@@ -22,7 +22,7 @@
  */
 
 #include <common.h>
-#include <devices.h>
+#include <console.h>
 #include "memio.h"
 #include <part.h>
 
@@ -98,7 +98,7 @@ int video_inited = 0;
 int drv_video_init(void)
 {
     int error, devices = 1 ;
-    device_t vgadev ;
+    console_device_t vgadev ;
     if (video_inited) return 1;
     video_inited = 1;
     video_init();
@@ -112,7 +112,7 @@ int drv_video_init(void)
     vgadev.tstc = NULL;
     vgadev.start = video_start;
 
-    error = device_register (&vgadev);
+    error = console_register (&vgadev);
 
     if (error == 0)
     {
board/ads5121/ads5121_diu.c +1 -1
index 41a1353..46fb9c3 100644
@@ -33,7 +33,7 @@
 #include "../freescale/common/fsl_diu_fb.h"
 
 #if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
-#include <devices.h>
+#include <console.h>
 #include <video_fb.h>
 #endif
 
board/bf527-ezkit/video.c +3 -3
index 2df6717..ec24ff3 100644
@@ -14,7 +14,7 @@
 #include <asm/mach-common/bits/dma.h>
 #include <i2c.h>
 #include <linux/types.h>
-#include <devices.h>
+#include <console.h>
 
 int gunzip(void *, int, unsigned char *, unsigned long *);
 
@@ -272,7 +272,7 @@ void video_puts(const char *s)
 int drv_video_init(void)
 {
 	int error, devices = 1;
-	device_t videodev;
+	console_device_t videodev;
 
 	u8 *dst;
 	u32 fbmem_size = LCD_X_RES * LCD_Y_RES * LCD_PIXEL_SIZE + ACTIVE_VIDEO_MEM_OFFSET;
@@ -311,7 +311,7 @@ int drv_video_init(void)
 	videodev.putc = video_putc;	/* 'putc' function */
 	videodev.puts = video_puts;	/* 'puts' function */
 
-	error = device_register(&videodev);
+	error = console_register(&videodev);
 
 	return (error == 0) ? devices : error;
 }
board/bf533-stamp/video.c +3 -3
index 3c15eaa..e3fae30 100644
@@ -18,7 +18,7 @@
 #include <asm/mach-common/bits/dma.h>
 #include <i2c.h>
 #include <linux/types.h>
-#include <devices.h>
+#include <console.h>
 
 int gunzip(void *, int, unsigned char *, unsigned long *);
 
@@ -154,7 +154,7 @@ static void video_init(char *NTSCFrame)
 
 int drv_video_init(void)
 {
-	device_t videodev;
+	console_device_t videodev;
 
 	video_init((void *)NTSC_FRAME_ADDR);
 
@@ -163,5 +163,5 @@ int drv_video_init(void)
 	videodev.ext = DEV_EXT_VIDEO;
 	videodev.flags = DEV_FLAGS_SYSTEM;
 
-	return device_register(&videodev);
+	return console_register(&videodev);
 }
board/bf548-ezkit/video.c +3 -3
index a6f52bd..f8689d6 100644
@@ -14,7 +14,7 @@
 #include <asm/mach-common/bits/dma.h>
 #include <i2c.h>
 #include <linux/types.h>
-#include <devices.h>
+#include <console.h>
 
 int gunzip(void *, int, unsigned char *, unsigned long *);
 
@@ -282,7 +282,7 @@ void video_puts(const char *s)
 int drv_video_init(void)
 {
 	int error, devices = 1;
-	device_t videodev;
+	console_device_t videodev;
 
 	u8 *dst;
 	u32 fbmem_size = LCD_X_RES * LCD_Y_RES * LCD_PIXEL_SIZE + ACTIVE_VIDEO_MEM_OFFSET;
@@ -321,7 +321,7 @@ int drv_video_init(void)
 	videodev.putc = video_putc;	/* 'putc' function */
 	videodev.puts = video_puts;	/* 'puts' function */
 
-	error = device_register(&videodev);
+	error = console_register(&videodev);
 
 	return (error == 0) ? devices : error;
 }
board/bmw/bmw.c +1 -1
index 41ce14f..6cca017 100644
@@ -26,7 +26,7 @@
 #include <watchdog.h>
 #include <command.h>
 #include <malloc.h>
-#include <devices.h>
+#include <console.h>
 #include <net.h>
 #include <timestamp.h>
 #include <dtt.h>
board/freescale/mpc8610hpcd/mpc8610hpcd_diu.c +1 -1
index 2b2d5d7..fb9371e 100644
@@ -33,7 +33,7 @@
 #include "../common/fsl_diu_fb.h"
 
 #if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
-#include <devices.h>
+#include <console.h>
 #include <video_fb.h>
 #endif
 
board/mpl/common/common_util.c +2 -2
index d169391..aa37370 100644
@@ -29,7 +29,7 @@
 #include <asm/processor.h>
 #include <asm/byteorder.h>
 #include <i2c.h>
-#include <devices.h>
+#include <console.h>
 #include <pci.h>
 #include <malloc.h>
 #include <bzlib.h>
@@ -429,7 +429,7 @@ void check_env(void)
 }
 
 
-extern device_t *stdio_devices[];
+extern console_device_t *stdio_devices[];
 extern char *stdio_names[];
 
 void show_stdio_dev(void)
board/mpl/common/isa.c +1 -1
index 91829d4..40ace1f 100644
@@ -26,7 +26,7 @@
 
 #include <common.h>
 #include <asm/processor.h>
-#include <devices.h>
+#include <console.h>
 #include "isa.h"
 #include "piix4_pci.h"
 #include "kbd.h"
board/mpl/common/kbd.c +3 -3
index a457635..262e656 100644
@@ -28,7 +28,7 @@
  */
 #include <common.h>
 #include <asm/processor.h>
-#include <devices.h>
+#include <console.h>
 #include "isa.h"
 #include "kbd.h"
 
@@ -215,7 +215,7 @@ int overwrite_console (void)
 int drv_isa_kbd_init (void)
 {
 	int error;
-	device_t kbddev ;
+	console_device_t kbddev ;
 	char *stdinname  = getenv ("stdin");
 
 	if(isa_kbd_init()==-1)
@@ -228,7 +228,7 @@ int drv_isa_kbd_init (void)
 	kbddev.getc = kbd_getc ;
 	kbddev.tstc = kbd_testc ;
 
-	error = device_register (&kbddev);
+	error = console_register (&kbddev);
 	if(error==0) {
 		/* check if this is the standard input device */
 		if(strcmp(stdinname,DEVNAME)==0) {
board/mpl/pati/pati.c +3 -3
index 85c5af9..a814903 100644
@@ -46,7 +46,7 @@
 
 #include <common.h>
 #include <mpc5xx.h>
-#include <devices.h>
+#include <console.h>
 #include <pci_ids.h>
 #define PLX9056_LOC
 #include "plx9056.h"
@@ -447,7 +447,7 @@ int checkboard (void)
 int recbuf[REC_BUFFER_SIZE];
 static int r_ptr = 0;
 int w_ptr;
-device_t pci_con_dev;
+console_device_t pci_con_dev;
 int conn=0;
 int buff_full=0;
 
@@ -584,7 +584,7 @@ void pci_con_connect(void)
 	pci_con_dev.puts = pci_con_puts;
 	pci_con_dev.getc = pci_con_getc;
 	pci_con_dev.tstc = pci_con_tstc;
-	device_register (&pci_con_dev);
+	console_register (&pci_con_dev);
 	printf("PATI ready for PCI connection, type ctrl-c for exit\n");
 	do {
 		udelay(10);
board/netphone/phone_console.c +3 -3
index d9b0ad3..85eea29 100644
@@ -37,7 +37,7 @@
 
 #include <version.h>
 #include <linux/types.h>
-#include <devices.h>
+#include <console.h>
 
 #include <sed156x.h>
 
@@ -325,7 +325,7 @@ int phone_getc(void)
 
 int drv_phone_init(void)
 {
-	device_t console_dev;
+	console_device_t console_dev;
 
 	console_init();
 
@@ -340,7 +340,7 @@ int drv_phone_init(void)
 	console_dev.tstc = phone_tstc;	/* 'tstc' function */
 	console_dev.getc = phone_getc;	/* 'getc' function */
 
-	if (device_register(&console_dev) == 0)
+	if (console_register(&console_dev) == 0)
 		return 1;
 
 	return 0;
board/rbc823/kbd.c +3 -3
index 1d48f6d..dbb2063 100644
@@ -30,7 +30,7 @@
 #include <common.h>
 #include <watchdog.h>
 #include <commproc.h>
-#include <devices.h>
+#include <console.h>
 #include <lcd.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -249,7 +249,7 @@ int smc1_tstc(void)
 int drv_keyboard_init(void)
 {
 	int error = 0;
-	device_t kbd_dev;
+	console_device_t kbd_dev;
 
 	if (0) {
 		/* register the keyboard */
@@ -260,7 +260,7 @@ int drv_keyboard_init(void)
 		kbd_dev.puts = NULL;
 		kbd_dev.getc = smc1_getc;
 		kbd_dev.tstc = smc1_tstc;
-		error = device_register (&kbd_dev);
+		error = console_register (&kbd_dev);
 	} else {
 		lcd_is_enabled = 0;
 		lcd_disable();
board/trab/vfd.c +1 -1
index 37d3aa4..cc13f30 100644
@@ -36,7 +36,7 @@
 #include <version.h>
 #include <stdarg.h>
 #include <linux/types.h>
-#include <devices.h>
+#include <console.h>
 #include <s3c2400.h>
 
 DECLARE_GLOBAL_DATA_PTR;
common/cmd_console.c +3 -3
index f861f83..fd7a65d 100644
@@ -26,15 +26,15 @@
  */
 #include <common.h>
 #include <command.h>
-#include <devices.h>
+#include <console.h>
 
 extern void _do_coninfo (void);
 int do_coninfo (cmd_tbl_t * cmd, int flag, int argc, char *argv[])
 {
 	int l;
-	struct list_head *list = device_get_list();
+	struct list_head *list = console_get_list();
 	struct list_head *pos;
-	device_t *dev;
+	console_device_t *dev;
 
 	/* Scan for valid output and input devices */
 
common/cmd_log.c +3 -3
index a03835d..a3c06b8 100644
@@ -42,7 +42,7 @@
 
 #include <common.h>
 #include <command.h>
-#include <devices.h>
+#include <console.h>
 #include <post.h>
 #include <logbuff.h>
 
@@ -142,7 +142,7 @@ void logbuff_reset (void)
 
 int drv_logbuff_init (void)
 {
-	device_t logdev;
+	console_device_t logdev;
 	int rc;
 
 	/* Device initialization */
@@ -154,7 +154,7 @@ int drv_logbuff_init (void)
 	logdev.putc  = logbuff_putc;		/* 'putc' function */
 	logdev.puts  = logbuff_puts;		/* 'puts' function */
 
-	rc = device_register (&logdev);
+	rc = console_register (&logdev);
 
 	return (rc == 0) ? 1 : rc;
 }
common/cmd_terminal.c +3 -3
index fd3dd48..4586d6d 100644
@@ -26,19 +26,19 @@
  */
 #include <common.h>
 #include <command.h>
-#include <devices.h>
+#include <console.h>
 #include <serial.h>
 
 int do_terminal(cmd_tbl_t * cmd, int flag, int argc, char *argv[])
 {
 	int last_tilde = 0;
-	device_t *dev = NULL;
+	console_device_t *dev = NULL;
 
 	if (argc < 1)
 		return -1;
 
 	/* Scan for selected output/input device */
-	dev = device_get_by_name(argv[1]);
+	dev = console_get_by_name(argv[1]);
 	if (!dev)
 		return -1;
 
common/console.c +16 -16
index 2add047..ff06a76 100644
@@ -48,7 +48,7 @@ extern int overwrite_console(void);
 
 #endif /* CONFIG_SYS_CONSOLE_IS_IN_ENV */
 
-static int console_setfile(int file, device_t * dev)
+static int console_setfile(int file, console_device_t * dev)
 {
 	int error = 0;
 
@@ -96,8 +96,8 @@ static int console_setfile(int file, device_t * dev)
 #if defined(CONFIG_CONSOLE_MUX)
 /** Console I/O multiplexing *******************************************/
 
-static device_t *tstcdev;
-device_t **console_devices[MAX_FILES];
+static console_device_t *tstcdev;
+console_device_t **console_devices[MAX_FILES];
 int cd_count[MAX_FILES];
 
 /*
@@ -119,7 +119,7 @@ static int console_getc(int file)
 static int console_tstc(int file)
 {
 	int i, ret;
-	device_t *dev;
+	console_device_t *dev;
 
 	disable_ctrlc(1);
 	for (i = 0; i < cd_count[file]; i++) {
@@ -141,7 +141,7 @@ static int console_tstc(int file)
 static void console_putc(int file, const char c)
 {
 	int i;
-	device_t *dev;
+	console_device_t *dev;
 
 	for (i = 0; i < cd_count[file]; i++) {
 		dev = console_devices[file][i];
@@ -153,7 +153,7 @@ static void console_putc(int file, const char c)
 static void console_puts(int file, const char *s)
 {
 	int i;
-	device_t *dev;
+	console_device_t *dev;
 
 	for (i = 0; i < cd_count[file]; i++) {
 		dev = console_devices[file][i];
@@ -167,7 +167,7 @@ static inline void console_printdevs(int file)
 	iomux_printdevs(file);
 }
 
-static inline void console_doenv(int file, device_t *dev)
+static inline void console_doenv(int file, console_device_t *dev)
 {
 	iomux_doenv(file, dev->name);
 }
@@ -197,7 +197,7 @@ static inline void console_printdevs(int file)
 	printf("%s\n", stdio_devices[file]->name);
 }
 
-static inline void console_doenv(int file, device_t *dev)
+static inline void console_doenv(int file, console_device_t *dev)
 {
 	console_setfile(file, dev);
 }
@@ -479,11 +479,11 @@ inline void dbg(const char *fmt, ...)
 
 /** U-Boot INIT FUNCTIONS *************************************************/
 
-device_t *search_device(int flags, char *name)
+console_device_t *search_device(int flags, char *name)
 {
-	device_t *dev;
+	console_device_t *dev;
 
-	dev = device_get_by_name(name);
+	dev = console_get_by_name(name);
 
 	if (dev && (dev->flags & flags))
 		return dev;
@@ -494,7 +494,7 @@ device_t *search_device(int flags, char *name)
 int console_assign(int file, char *devname)
 {
 	int flag;
-	device_t *dev;
+	console_device_t *dev;
 
 	/* Check for valid file */
 	switch (file) {
@@ -537,7 +537,7 @@ int console_init_f(void)
 int console_init_r(void)
 {
 	char *stdinname, *stdoutname, *stderrname;
-	device_t *inputdev = NULL, *outputdev = NULL, *errdev = NULL;
+	console_device_t *inputdev = NULL, *outputdev = NULL, *errdev = NULL;
 #ifdef CONFIG_SYS_CONSOLE_ENV_OVERWRITE
 	int i;
 #endif /* CONFIG_SYS_CONSOLE_ENV_OVERWRITE */
@@ -645,11 +645,11 @@ done:
 /* Called after the relocation - use desired console functions */
 int console_init_r(void)
 {
-	device_t *inputdev = NULL, *outputdev = NULL;
+	console_device_t *inputdev = NULL, *outputdev = NULL;
 	int i;
-	struct list_head *list = device_get_list();
+	struct list_head *list = console_get_list();
 	struct list_head *pos;
-	device_t *dev;
+	console_device_t *dev;
 
 #ifdef CONFIG_SPLASH_SCREEN
 	/*
common/devices.c +21 -21

123 lines not on this page · raw message

common/iomux.c +7 -7
index bdcc853..18e7d8d 100644
@@ -29,7 +29,7 @@
 void iomux_printdevs(const int console)
 {
 	int i;
-	device_t *dev;
+	console_device_t *dev;
 
 	for (i = 0; i < cd_count[console]; i++) {
 		dev = console_devices[console][i];
@@ -43,8 +43,8 @@ int iomux_doenv(const int console, const char *arg)
 {
 	char *console_args, *temp, **start;
 	int i, j, k, io_flag, cs_idx, repeat;
-	device_t *dev;
-	device_t **cons_set;
+	console_device_t *dev;
+	console_device_t **cons_set;
 
 	console_args = strdup(arg);
 	if (console_args == NULL)
@@ -85,7 +85,7 @@ int iomux_doenv(const int console, const char *arg)
 		*temp = '\0';
 		start[i] = temp + 1;
 	}
-	cons_set = (device_t **)calloc(i, sizeof(device_t *));
+	cons_set = (console_device_t **)calloc(i, sizeof(console_device_t *));
 	if (cons_set == NULL) {
 		free(start);
 		free(console_args);
@@ -158,14 +158,14 @@ int iomux_doenv(const int console, const char *arg)
 	} else {
 		/* Works even if console_devices[console] is NULL. */
 		console_devices[console] =
-			(device_t **)realloc(console_devices[console],
-			cs_idx * sizeof(device_t *));
+			(console_device_t **)realloc(console_devices[console],
+			cs_idx * sizeof(console_device_t *));
 		if (console_devices[console] == NULL) {
 			free(cons_set);
 			return 1;
 		}
 		memcpy(console_devices[console], cons_set, cs_idx *
-			sizeof(device_t *));
+			sizeof(console_device_t *));
 
 		cd_count[console] = cs_idx;
 	}
common/lcd.c +3 -3
index 4155170..04b870e 100644
@@ -34,7 +34,7 @@
 #include <command.h>
 #include <stdarg.h>
 #include <linux/types.h>
-#include <devices.h>
+#include <console.h>
 #if defined(CONFIG_POST)
 #include <post.h>
 #endif
@@ -355,7 +355,7 @@ static void test_pattern (void)
 
 int drv_lcd_init (void)
 {
-	device_t lcddev;
+	console_device_t lcddev;
 	int rc;
 
 	lcd_base = (void *)(gd->fb_base);
@@ -373,7 +373,7 @@ int drv_lcd_init (void)
 	lcddev.putc  = lcd_putc;		/* 'putc' function */
 	lcddev.puts  = lcd_puts;		/* 'puts' function */
 
-	rc = device_register (&lcddev);
+	rc = console_register (&lcddev);
 
 	return (rc == 0) ? 1 : rc;
 }
common/serial.c +4 -4
index 09385d0..7bf797c 100644
@@ -23,7 +23,7 @@
 
 #include <common.h>
 #include <serial.h>
-#include <devices.h>
+#include <console.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -139,9 +139,9 @@ void serial_initialize (void)
 	serial_assign (default_serial_console ()->name);
 }
 
-void serial_devices_init (void)
+void serial_consoles_init (void)
 {
-	device_t dev;
+	console_device_t dev;
 	struct serial_device *s = serial_devices;
 
 	while (s) {
@@ -156,7 +156,7 @@ void serial_devices_init (void)
 		dev.getc = s->getc;
 		dev.tstc = s->tstc;
 
-		device_register (&dev);
+		console_register (&dev);
 
 		s = s->next;
 	}
common/usb_kbd.c +6 -6
index e0d006c..c52192b 100644
@@ -25,7 +25,7 @@
  *
  */
 #include <common.h>
-#include <devices.h>
+#include <console.h>
 #include <asm/byteorder.h>
 
 #include <usb.h>
@@ -153,7 +153,7 @@ static int usb_kbd_probe(struct usb_device *dev, unsigned int ifnum);
 int drv_usb_kbd_init(void)
 {
 	int error,i;
-	device_t usb_kbd_dev,*old_dev;
+	console_device_t usb_kbd_dev,*old_dev;
 	struct usb_device *dev;
 	char *stdinname  = getenv ("stdin");
 
@@ -168,7 +168,7 @@ int drv_usb_kbd_init(void)
 			if(usb_kbd_probe(dev,0)==1) { /* Ok, we found a keyboard */
 				/* check, if it is already registered */
 				USB_KBD_PRINTF("USB KBD found set up device.\n");
-				old_dev = device_get_by_name(DEVNAME);
+				old_dev = console_get_by_name(DEVNAME);
 				if(old_dev) {
 					/* ok, already registered, just return ok */
 					USB_KBD_PRINTF("USB KBD is already registered.\n");
@@ -184,7 +184,7 @@ int drv_usb_kbd_init(void)
 				usb_kbd_dev.getc = usb_kbd_getc;
 				usb_kbd_dev.tstc = usb_kbd_testc;
 				usb_kbd_dev.priv = (void *)dev;
-				error = device_register (&usb_kbd_dev);
+				error = console_register (&usb_kbd_dev);
 				if(error==0) {
 					/* check if this is the standard input device */
 					if(strcmp(stdinname,DEVNAME)==0) {
@@ -212,8 +212,8 @@ int drv_usb_kbd_init(void)
 /* deregistering the keyboard */
 int usb_kbd_deregister(void)
 {
-#ifdef CONFIG_SYS_DEVICE_DEREGISTER
-	return device_deregister(DEVNAME);
+#ifdef CONFIG_SYS_CONSOLE_DEREGISTER
+	return console_deregister(DEVNAME);
 #else
 	return 1;
 #endif
cpu/blackfin/jtag-console.c +3 -3
index d58582f..a12a643 100644
@@ -7,7 +7,7 @@
  */
 
 #include <common.h>
-#include <devices.h>
+#include <console.h>
 #include <asm/blackfin.h>
 
 #ifndef CONFIG_JTAG_CONSOLE_TIMEOUT
@@ -105,7 +105,7 @@ static int jtag_getc(void)
 
 int drv_jtag_console_init(void)
 {
-	device_t dev;
+	console_device_t dev;
 	int ret;
 
 	memset(&dev, 0x00, sizeof(dev));
@@ -116,7 +116,7 @@ int drv_jtag_console_init(void)
 	dev.tstc = jtag_tstc;
 	dev.getc = jtag_getc;
 
-	ret = device_register(&dev);
+	ret = console_register(&dev);
 	return (ret == 0 ? 1 : ret);
 }
 
cpu/mpc8xx/lcd.c +1 -1
index 4474e24..2c0e555 100644
@@ -35,7 +35,7 @@
 #include <stdarg.h>
 #include <lcdvideo.h>
 #include <linux/types.h>
-#include <devices.h>
+#include <console.h>
 #if defined(CONFIG_POST)
 #include <post.h>
 #endif
cpu/mpc8xx/video.c +3 -3
index 4a59927..9f91e82 100644
@@ -36,7 +36,7 @@
 #include <timestamp.h>
 #include <i2c.h>
 #include <linux/types.h>
-#include <devices.h>
+#include <console.h>
 
 #ifdef CONFIG_VIDEO
 
@@ -1287,7 +1287,7 @@ int drv_video_init (void)
 {
 	int error, devices = 1;
 
-	device_t videodev;
+	console_device_t videodev;
 
 	video_init ((void *)(gd->fb_base));	/* Video initialization */
 
@@ -1301,7 +1301,7 @@ int drv_video_init (void)
 	videodev.putc = video_putc;	/* 'putc' function */
 	videodev.puts = video_puts;	/* 'puts' function */
 
-	error = device_register (&videodev);
+	error = console_register (&videodev);
 
 	return (error == 0) ? devices : error;
 }
cpu/pxa/pxafb.c +1 -1
index 97efcb6..9f913e9 100644
@@ -32,7 +32,7 @@
 #include <version.h>
 #include <stdarg.h>
 #include <linux/types.h>
-#include <devices.h>
+#include <console.h>
 #include <lcd.h>
 #include <asm/arch/pxa-regs.h>
 
drivers/input/keyboard.c +3 -3
index 512b9f2..41dca98 100644
@@ -11,7 +11,7 @@
 
 #include <common.h>
 
-#include <devices.h>
+#include <console.h>
 #include <keyboard.h>
 
 #undef KBG_DEBUG
@@ -268,7 +268,7 @@ extern int overwrite_console (void);
 int kbd_init (void)
 {
 	int error;
-	device_t kbddev ;
+	console_device_t kbddev ;
 	char *stdinname  = getenv ("stdin");
 
 	if(kbd_init_hw()==-1)
@@ -281,7 +281,7 @@ int kbd_init (void)
 	kbddev.getc = kbd_getc ;
 	kbddev.tstc = kbd_testc ;
 
-	error = device_register (&kbddev);
+	error = console_register (&kbddev);
 	if(error==0) {
 		/* check if this is the standard input device */
 		if(strcmp(stdinname,DEVNAME)==0) {
drivers/mtd/ubi/build.c +1 -1
index f4b01a9..9b94ddc 100644
@@ -291,7 +291,7 @@ static int ubi_sysfs_init(struct ubi_device *ubi)
 	ubi->dev.devt = ubi->cdev.dev;
 	ubi->dev.class = ubi_class;
 	sprintf(&ubi->dev.bus_id[0], UBI_NAME_STR"%d", ubi->ubi_num);
-	err = device_register(&ubi->dev);
+	err = console_register(&ubi->dev);
 	if (err)
 		return err;
 
drivers/mtd/ubi/vmt.c +2 -2
index 061da64..2b6b137 100644
@@ -337,7 +337,7 @@ int ubi_create_volume(struct ubi_device *ubi, struct ubi_mkvol_req *req)
 	vol->dev.class = ubi_class;
 
 	sprintf(&vol->dev.bus_id[0], "%s_%d", ubi->ubi_name, vol->vol_id);
-	err = device_register(&vol->dev);
+	err = console_register(&vol->dev);
 	if (err) {
 		ubi_err("cannot register device");
 		goto out_gluebi;
@@ -646,7 +646,7 @@ int ubi_add_volume(struct ubi_device *ubi, struct ubi_volume *vol)
 	vol->dev.devt = dev;
 	vol->dev.class = ubi_class;
 	sprintf(&vol->dev.bus_id[0], "%s_%d", ubi->ubi_name, vol->vol_id);
-	err = device_register(&vol->dev);
+	err = console_register(&vol->dev);
 	if (err)
 		goto out_gluebi;
 
drivers/net/netconsole.c +3 -3
index b2ee5ea..f1644ce 100644
@@ -23,7 +23,7 @@
 
 #include <common.h>
 #include <command.h>
-#include <devices.h>
+#include <console.h>
 #include <net.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -243,7 +243,7 @@ int nc_tstc (void)
 
 int drv_nc_init (void)
 {
-	device_t dev;
+	console_device_t dev;
 	int rc;
 
 	memset (&dev, 0, sizeof (dev));
@@ -256,7 +256,7 @@ int drv_nc_init (void)
 	dev.getc = nc_getc;
 	dev.tstc = nc_tstc;
 
-	rc = device_register (&dev);
+	rc = console_register (&dev);
 
 	return (rc == 0) ? 1 : rc;
 }
drivers/serial/arm_dcc.c +3 -3
index dca73b9..8439037 100644
@@ -27,7 +27,7 @@
  */
 
 #include <common.h>
-#include <devices.h>
+#include <console.h>
 
 #if defined(CONFIG_CPU_V6)
 /*
@@ -148,7 +148,7 @@ int arm_dcc_tstc(void)
 }
 
 #ifdef CONFIG_ARM_DCC_MULTI
-static device_t arm_dcc_dev;
+static console_device_t arm_dcc_dev;
 
 int drv_arm_dcc_init(void)
 {
@@ -165,6 +165,6 @@ int drv_arm_dcc_init(void)
 	arm_dcc_dev.putc = arm_dcc_putc;	/* 'putc' function */
 	arm_dcc_dev.puts = arm_dcc_puts;	/* 'puts' function */
 
-	return device_register(&arm_dcc_dev);
+	return console_register(&arm_dcc_dev);
 }
 #endif
drivers/serial/usbtty.c +3 -3
index f711d0b..88a5651 100644
@@ -24,7 +24,7 @@
 #include <common.h>
 #include <config.h>
 #include <circbuf.h>
-#include <devices.h>
+#include <console.h>
 #include "usbtty.h"
 #include "usb_cdc_acm.h"
 #include "usbdescriptors.h"
@@ -70,7 +70,7 @@ static circbuf_t usbtty_output;
 /*
  * Instance variables
  */
-static device_t usbttydev;
+static console_device_t usbttydev;
 static struct usb_device_instance device_instance[1];
 static struct usb_bus_instance bus_instance[1];
 static struct usb_configuration_instance config_instance[NUM_CONFIGS];
@@ -570,7 +570,7 @@ int drv_usbtty_init (void)
 	usbttydev.putc = usbtty_putc;	/* 'putc' function */
 	usbttydev.puts = usbtty_puts;	/* 'puts' function */
 
-	rc = device_register (&usbttydev);
+	rc = console_register (&usbttydev);
 
 	return (rc == 0) ? 1 : rc;
 }
drivers/usb/musb/musb_hcd.c +2 -2
index 352a0d4..273ff0a 100644
@@ -770,7 +770,7 @@ int submit_int_msg(struct usb_device *dev, unsigned long pipe,
  */
 void usb_event_poll()
 {
-	device_t *dev;
+	console_device_t *dev;
 	struct usb_device *usb_kbd_dev;
 	struct usb_interface_descriptor *iface;
 	struct usb_endpoint_descriptor *ep;
@@ -778,7 +778,7 @@ void usb_event_poll()
 	int maxp;
 
 	/* Get the pointer to USB Keyboard device pointer */
-	dev = device_get_by_name("usbkbd");
+	dev = console_get_by_name("usbkbd");
 	usb_kbd_dev = (struct usb_device *)dev->priv;
 	iface = &usb_kbd_dev->config.if_desc[0];
 	ep = &iface->ep_desc[0];
drivers/usb/musb/musb_hcd.h +1 -1
index bb83311..dadf284 100644
@@ -26,7 +26,7 @@
 
 #include "musb_core.h"
 #ifdef CONFIG_USB_KEYBOARD
-#include <devices.h>
+#include <console.h>
 extern unsigned char new[];
 #endif
 
drivers/video/cfb_console.c +4 -4
index 5ee2314..13ebb4e 100644
@@ -183,7 +183,7 @@ CONFIG_VIDEO_HW_CURSOR:	     - Uses the hardware cursor capability of the
 
 #include <version.h>
 #include <linux/types.h>
-#include <devices.h>
+#include <console.h>
 #include <video_font.h>
 
 #if defined(CONFIG_CMD_DATE)
@@ -1333,7 +1333,7 @@ static int video_init (void)
 int drv_video_init (void)
 {
 	int skip_dev_init;
-	device_t console_dev;
+	console_device_t console_dev;
 
 	skip_dev_init = 0;
 
@@ -1354,7 +1354,7 @@ int drv_video_init (void)
 		console_dev.tstc = NULL;	/* 'tstc' function */
 		console_dev.getc = NULL;	/* 'getc' function */
 
-		if (device_register (&console_dev) == 0)
+		if (console_register (&console_dev) == 0)
 			return 1;
 	}
 #else
@@ -1373,7 +1373,7 @@ int drv_video_init (void)
 		console_dev.tstc = VIDEO_TSTC_FCT;	/* 'tstc' function */
 		console_dev.getc = VIDEO_GETC_FCT;	/* 'getc' function */
 
-		if (device_register (&console_dev) == 0)
+		if (console_register (&console_dev) == 0)
 			return 1;
 	}
 #endif /* CONFIG_VGA_AS_SINGLE_DEVICE */
include/configs/AmigaOneG3SE.h +1 -1
index fe04f27..bfd8257 100644
@@ -363,7 +363,7 @@
 #define CONFIG_USB_UHCI		1
 #define CONFIG_USB_STORAGE	1
 #define CONFIG_USB_KEYBOARD	1
-#define CONFIG_SYS_DEVICE_DEREGISTER	1 /* needed by CONFIG_USB_KEYBOARD */
+#define CONFIG_SYS_CONSOLE_DEREGISTER	1 /* needed by CONFIG_USB_KEYBOARD */
 
 /*
  * Autoboot stuff
include/configs/MIP405.h +1 -1
index a3869c8..79cc774 100644
@@ -414,7 +414,7 @@
 #define CONFIG_USB_STORAGE
 
 /* Enable needed helper functions */
-#define CONFIG_SYS_DEVICE_DEREGISTER		/* needs device_deregister */
+#define CONFIG_SYS_CONSOLE_DEREGISTER		/* needs console_deregister */
 #endif
 /************************************************************
  * Debug support
include/configs/MPC8610HPCD.h +1 -1
index 1091043..84d1b66 100644
@@ -321,7 +321,7 @@
 #define CONFIG_PCI_OHCI		1
 #define CONFIG_USB_OHCI_NEW		1
 #define CONFIG_USB_KEYBOARD	1
-#define CONFIG_SYS_DEVICE_DEREGISTER
+#define CONFIG_SYS_CONSOLE_DEREGISTER
 #define CONFIG_SYS_USB_EVENT_POLL	1
 #define CONFIG_SYS_USB_OHCI_SLOT_NAME	"ohci_pci"
 #define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS 15
include/configs/MPC8641HPCN.h +1 -1
index d8042fb..ecaf558 100644
@@ -395,7 +395,7 @@ extern unsigned long get_board_sys_clk(unsigned long dummy);
 #define CONFIG_PCI_OHCI			1
 #define CONFIG_USB_OHCI_NEW		1
 #define CONFIG_USB_KEYBOARD		1
-#define CONFIG_SYS_DEVICE_DEREGISTER
+#define CONFIG_SYS_CONSOLE_DEREGISTER
 #define CONFIG_SYS_USB_EVENT_POLL		1
 #define CONFIG_SYS_USB_OHCI_SLOT_NAME		"ohci_pci"
 #define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS	15
include/configs/PIP405.h +1 -1
index 5c4d69b..2db18d3 100644
@@ -360,7 +360,7 @@
 #define CONFIG_USB_STORAGE
 
 /* Enable needed helper functions */
-#define CONFIG_SYS_DEVICE_DEREGISTER		/* needs device_deregister */
+#define CONFIG_SYS_CONSOLE_DEREGISTER		/* needs console_deregister */
 
 /************************************************************
  * Debug support
include/configs/VCMA9.h +1 -1
index 547167f..db68b98 100644
@@ -130,7 +130,7 @@
 #define CONFIG_DOS_PARTITION	1
 
 /* Enable needed helper functions */
-#define CONFIG_SYS_DEVICE_DEREGISTER		/* needs device_deregister */
+#define CONFIG_SYS_CONSOLE_DEREGISTER		/* needs console_deregister */
 
 /************************************************************
  * RTC
include/configs/gr_ep2s60.h +1 -1
index 6f58bac..68c96c6 100644
@@ -87,7 +87,7 @@
 #define CONFIG_CMD_USB
 #define CONFIG_USB_STORAGE
 /* Enable needed helper functions */
-#define CONFIG_SYS_DEVICE_DEREGISTER	/* needs device_deregister */
+#define CONFIG_SYS_CONSOLE_DEREGISTER	/* needs console_deregister */
 #endif
 
 /*
include/configs/mp2usb.h +1 -1
index 3225ce7..60ee0ef 100644
@@ -216,7 +216,7 @@
 #define CONFIG_SYS_MAXARGS		32		/* max number of command args */
 #define CONFIG_SYS_PBSIZE		(CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16) /* Print Buffer Size */
 
-#define CONFIG_SYS_DEVICE_DEREGISTER           /* needs device_deregister */
+#define CONFIG_SYS_CONSOLE_DEREGISTER           /* needs console_deregister */
 
 #define CONFIG_SYS_HZ 1000
 #define CONFIG_SYS_HZ_CLOCK (AT91C_MASTER_CLOCK/2)	/* AT91C_TC0_CMR is implicitly set to */
include/console.h +95 -6

110 lines not on this page · raw message

include/devices.h deleted +0 -126

126 lines not on this page · raw message

include/iomux.h +3 -3
index 257c1f7..2eb566c 100644
@@ -24,7 +24,7 @@
 #ifndef _IO_MUX_H
 #define _IO_MUX_H
 
-#include <devices.h>
+#include <console.h>
 
 /*
  * Stuff required to support console multiplexing.
@@ -34,7 +34,7 @@
  * Pointers to devices used for each file type.  Defined in console.c
  * but storage is allocated in iomux.c.
  */
-extern device_t **console_devices[MAX_FILES];
+extern console_device_t **console_devices[MAX_FILES];
 /*
  * The count of devices assigned to each FILE.  Defined in console.c
  * and populated in iomux.c.
@@ -43,6 +43,6 @@ extern int cd_count[MAX_FILES];
 
 int iomux_doenv(const int, const char *);
 void iomux_printdevs(const int);
-device_t *search_device(int, char *);
+console_device_t *search_device(int, char *);
 
 #endif /* _IO_MUX_H */
include/serial.h +1 -1
index e3d8b36..b756e61 100644
@@ -47,7 +47,7 @@ extern struct serial_device serial_btuart_device;
 extern struct serial_device serial_stuart_device;
 
 extern void serial_initialize(void);
-extern void serial_devices_init(void);
+extern void serial_consoles_init(void);
 extern int serial_assign(char * name);
 extern void serial_reinit_all(void);
 
lib_arm/board.c +2 -2
index 9fbb4bf..8d17e96 100644
@@ -41,7 +41,7 @@
 #include <common.h>
 #include <command.h>
 #include <malloc.h>
-#include <devices.h>
+#include <console.h>
 #include <timestamp.h>
 #include <version.h>
 #include <net.h>
@@ -388,7 +388,7 @@ void start_armboot (void)
 	/* IP Address */
 	gd->bd->bi_ip_addr = getenv_IPaddr ("ipaddr");
 
-	devices_init ();	/* get the devices list going. */
+	consoles_init ();	/* get the devices list going. */
 
 	jumptable_init ();
 
lib_avr32/board.c +2 -2
index 57115df..bef5de4 100644
@@ -22,7 +22,7 @@
 #include <common.h>
 #include <command.h>
 #include <malloc.h>
-#include <devices.h>
+#include <console.h>
 #include <timestamp.h>
 #include <version.h>
 #include <net.h>
@@ -350,7 +350,7 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)
 
 	bd->bi_ip_addr = getenv_IPaddr ("ipaddr");
 
-	devices_init();
+	consoles_init();
 	jumptable_init();
 	console_init_r();
 
lib_blackfin/board.c +2 -2
index 49465d2..27c06e3 100644
@@ -11,7 +11,7 @@
 
 #include <common.h>
 #include <command.h>
-#include <devices.h>
+#include <console.h>
 #include <environment.h>
 #include <malloc.h>
 #include <net.h>
@@ -354,7 +354,7 @@ void board_init_r(gd_t * id, ulong dest_addr)
 	env_relocate();
 
 	/* Initialize devices */
-	devices_init();
+	consoles_init();
 	jumptable_init();
 
 	/* Initialize the console (after the relocation and devices init) */
lib_i386/board.c +2 -2
index e18dfa5..50d490f 100644
@@ -31,7 +31,7 @@
 #include <common.h>
 #include <watchdog.h>
 #include <command.h>
-#include <devices.h>
+#include <console.h>
 #include <timestamp.h>
 #include <version.h>
 #include <malloc.h>
@@ -299,7 +299,7 @@ void start_i386boot (void)
 	show_boot_progress(0x27);
 
 
-	devices_init ();
+	consoles_init ();
 
 	jumptable_init ();
 
lib_i386/video.c +5 -5
index cd89457..f6145d3 100644
@@ -23,7 +23,7 @@
 
 #include <common.h>
 #include <pci.h>
-#include <devices.h>
+#include <console.h>
 #include <i8042.h>
 #include <asm/ptrace.h>
 #include <asm/realmode.h>
@@ -168,8 +168,8 @@ int video_init(void)
 {
 	u16 pos;
 
-	static device_t vga_dev;
-	static device_t kbd_dev;
+	static console_device_t vga_dev;
+	static console_device_t kbd_dev;
 
 	vidmem = (char *) 0xb8000;
 	vidport = 0x3d4;
@@ -203,7 +203,7 @@ int video_init(void)
 	vga_dev.tstc  = NULL;              /* 'tstc' function */
 	vga_dev.getc  = NULL;              /* 'getc' function */
 
-	if (device_register(&vga_dev) == 0) {
+	if (console_register(&vga_dev) == 0) {
 	    return 1;
 	}
 
@@ -220,7 +220,7 @@ int video_init(void)
 	kbd_dev.tstc  = i8042_tstc;  /* 'tstc' function */
 	kbd_dev.getc  = i8042_getc;  /* 'getc' function */
 
-	if (device_register(&kbd_dev) == 0) {
+	if (console_register(&kbd_dev) == 0) {
 	    return 1;
 	}
 	return 0;
lib_m68k/board.c +2 -2
index db45b00..2f41833 100644
@@ -28,7 +28,7 @@
 #include <watchdog.h>
 #include <command.h>
 #include <malloc.h>
-#include <devices.h>
+#include <console.h>
 
 #include <asm/immap.h>
 
@@ -597,7 +597,7 @@ void board_init_r (gd_t *id, ulong dest_addr)
 
 	/** leave this here (after malloc(), environment and PCI are working) **/
 	/* Initialize devices */
-	devices_init ();
+	consoles_init ();
 
 	/* Initialize the jump table for applications */
 	jumptable_init ();
lib_mips/board.c +2 -2
index 6fc4845..f2eafd3 100644
@@ -24,7 +24,7 @@
 #include <common.h>
 #include <command.h>
 #include <malloc.h>
-#include <devices.h>
+#include <console.h>
 #include <timestamp.h>
 #include <version.h>
 #include <net.h>
@@ -413,7 +413,7 @@ void board_init_r (gd_t *id, ulong dest_addr)
 
 /** leave this here (after malloc(), environment and PCI are working) **/
 	/* Initialize devices */
-	devices_init ();
+	consoles_init ();
 
 	jumptable_init ();
 
lib_nios/board.c +2 -2
index 63e79ae..a032624 100644
@@ -25,7 +25,7 @@
  */
 
 #include <common.h>
-#include <devices.h>
+#include <console.h>
 #include <watchdog.h>
 #include <net.h>
 #ifdef CONFIG_STATUS_LED
@@ -153,7 +153,7 @@ void board_init (void)
 	bd->bi_ip_addr = getenv_IPaddr ("ipaddr");
 
 	WATCHDOG_RESET ();
-	devices_init();
+	consoles_init();
 	jumptable_init();
 	console_init_r();
 	/*
lib_nios2/board.c +2 -2
index 70fad1b..f21c075 100644
@@ -25,7 +25,7 @@
  */
 
 #include <common.h>
-#include <devices.h>
+#include <console.h>
 #include <watchdog.h>
 #include <net.h>
 #ifdef CONFIG_STATUS_LED
@@ -159,7 +159,7 @@ void board_init (void)
 	bd->bi_ip_addr = getenv_IPaddr ("ipaddr");
 
 	WATCHDOG_RESET ();
-	devices_init();
+	consoles_init();
 	jumptable_init();
 	console_init_r();
 
lib_ppc/board.c +2 -2
index 9e944fa..46eabde 100644
@@ -25,7 +25,7 @@
 #include <watchdog.h>
 #include <command.h>
 #include <malloc.h>
-#include <devices.h>
+#include <console.h>
 #ifdef CONFIG_8xx
 #include <mpc8xx.h>
 #endif
@@ -933,7 +933,7 @@ void board_init_r (gd_t *id, ulong dest_addr)
 
 /** leave this here (after malloc(), environment and PCI are working) **/
 	/* Initialize devices */
-	devices_init ();
+	consoles_init ();
 
 	/* Initialize the jump table for applications */
 	jumptable_init ();
lib_sh/board.c +2 -2
index 2fd213b..4c059be 100644
@@ -21,7 +21,7 @@
 #include <common.h>
 #include <command.h>
 #include <malloc.h>
-#include <devices.h>
+#include <console.h>
 #include <timestamp.h>
 #include <version.h>
 #include <watchdog.h>
@@ -150,7 +150,7 @@ init_fnc_t *init_sequence[] =
 	sh_mem_env_init,
 	INIT_FUNC_NAND_INIT/* Flash memory (NAND) init */
 	INIT_FUNC_PCI_INIT	/* PCI init */
-	devices_init,
+	consoles_init,
 	console_init_r,
 	interrupt_init,
 #ifdef BOARD_LATE_INIT
lib_sparc/board.c +2 -2
index 2f3e673..c2fc8e6 100644
@@ -28,7 +28,7 @@
 #include <common.h>
 #include <command.h>
 #include <malloc.h>
-#include <devices.h>
+#include <console.h>
 #include <config.h>
 #if defined(CONFIG_CMD_IDE)
 #include <ide.h>
@@ -404,7 +404,7 @@ void board_init_f(ulong bootflag)
 #endif
 
 	/* Initialize devices */
-	devices_init();
+	consoles_init();
 
 	/* Initialize the jump table for applications */
 	jumptable_init();
Signature · 1 line
1.6.1.3
#1 lore raw

RFC PATCH 1/1 console/device: rework function naming

Hi Jean-Christophe,

2009/5/3 Jean-Christophe PLAGNIOL-VILLARD <[email protected]>:

drivers/mtd/ubi/build.c static int ubi_sysfs_init(struct ubi_device *ubi) · line 294

Quoted 10 lines
drivers/mtd/ubi/build.c +1 -1
index f4b01a9..9b94ddc 100644
@@ -291,7 +291,7 @@ static int ubi_sysfs_init(struct ubi_device *ubi)
 ? ? ? ?ubi->dev.devt = ubi->cdev.dev;
 ? ? ? ?ubi->dev.class = ubi_class;
 ? ? ? ?sprintf(&ubi->dev.bus_id[0], UBI_NAME_STR"%d", ubi->ubi_num);
- ? ? ? err = device_register(&ubi->dev);
+ ? ? ? err = console_register(&ubi->dev);

I'm not that familiar with device_*() in U-boot, but it surprised me to see the above change which is in the UBI layer and should not have anything to do with consoles. Also the above code is within a #ifdef UBI_LINUX block and is not used in U-boot.

Quoted 14 lines
drivers/mtd/ubi/vmt.c +1 -1
index 061da64..2b6b137 100644
@@ -337,7 +337,7 @@ int ubi_create_volume(struct ubi_device *ubi, struct ubi_mkvol_req *req)
 ? ? ? ?vol->dev.class = ubi_class;
 
 ? ? ? ?sprintf(&vol->dev.bus_id[0], "%s_%d", ubi->ubi_name, vol->vol_id);
- ? ? ? err = device_register(&vol->dev);
+ ? ? ? err = console_register(&vol->dev);
 ? ? ? ?if (err) {
 ? ? ? ? ? ? ? ?ubi_err("cannot register device");
 ? ? ? ? ? ? ? ?goto out_gluebi;

drivers/mtd/ubi/vmt.c int ubi_add_volume(struct ubi_device *ubi, struct ubi_volume *vol) · line 649

Quoted 5 lines
drivers/mtd/ubi/vmt.c +1 -1
@@ -646,7 +646,7 @@ int ubi_add_volume(struct ubi_device *ubi, struct ubi_volume *vol)
 ? ? ? ?vol->dev.devt = dev;
 ? ? ? ?vol->dev.class = ubi_class;
 ? ? ? ?sprintf(&vol->dev.bus_id[0], "%s_%d", ubi->ubi_name, vol->vol_id);
- ? ? ? err = device_register(&vol->dev);
+ ? ? ? err = console_register(&vol->dev);

Again a bit surprised to find anything about consoles in the UBI code. In contrast to my earlier comment, this code seems to be compiled (i.e. it's not within #ifdef UBI_LINUX).
I'm guessing you did a global search/replace for device_register=>console_register?

Regards, Magnus

#2 lore raw

RFC PATCH 1/1 console/device: rework function naming

Quoted 18 lines · Magnus Lilja

Hi Jean-Christophe,

Quoted 17 lines
drivers/mtd/ubi/vmt.c +1 -1
index 061da64..2b6b137 100644
@@ -337,7 +337,7 @@ int ubi_create_volume(struct ubi_device *ubi, struct ubi_mkvol_req *req)
 ? ? ? ?vol->dev.class = ubi_class;
 
 ? ? ? ?sprintf(&vol->dev.bus_id[0], "%s_%d", ubi->ubi_name, vol->vol_id);
- ? ? ? err = device_register(&vol->dev);
+ ? ? ? err = console_register(&vol->dev);
 ? ? ? ?if (err) {
 ? ? ? ? ? ? ? ?ubi_err("cannot register device");
 ? ? ? ? ? ? ? ?goto out_gluebi;
@@ -646,7 +646,7 @@ int ubi_add_volume(struct ubi_device *ubi, struct ubi_volume *vol)
 ? ? ? ?vol->dev.devt = dev;
 ? ? ? ?vol->dev.class = ubi_class;
 ? ? ? ?sprintf(&vol->dev.bus_id[0], "%s_%d", ubi->ubi_name, vol->vol_id);
Quoted 8 lines

drivers/mtd/ubi/vmt.c int ubi_add_volume(struct ubi_device *ubi, struct ubi_volume *vol) · line 649

Quoted 2 lines
drivers/mtd/ubi/vmt.c +1 -1
- ? ? ? err = device_register(&vol->dev);
+ ? ? ? err = console_register(&vol->dev);

Again a bit surprised to find anything about consoles in the UBI code. In contrast to my earlier comment, this code seems to be compiled (i.e. it's not within #ifdef UBI_LINUX).
I'm guessing you did a global search/replace for device_register=>console_register?

yes
I've use script to generate the patch for the RFC

For ubi the device_register is replace via macro by 0

this will not been touch by the final patch

and fully check before

btw this is one of the confusing point of the current implementation

Best Regards,
J.

#3 lore raw

RFC PATCH 1/1 console/device: rework function naming

Dear Jean-Christophe PLAGNIOL-VILLARD,

Quoted 2 lines · In message <[email protected]> you wrote:

I've use script to generate the patch for the RFC

Hmm... you should have looked at the results before posting, it seems.

Quoted 1 line

btw this is one of the confusing point of the current implementation

Well, see my previous message - your suggested patch solves confusion here and creates new confusion there, and I'd have hard times if I was to decide which was better. This needs more caerful preparation.

Best regards,

Wolfgang Denk

Signature · 8 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
You speak of courage. Obviously you do not know the  difference  bet-
ween  courage and foolhardiness. Always it is the brave ones who die,
the soldiers.
	-- Kor, the Klingon Commander, "Errand of Mercy",
	   stardate 3201.7
#4 lore raw

RFC PATCH 1/1 console/device: rework function naming

In reply to Jean-Christophe PLAGNIOL-VILLARD

Dear Jean-Christophe PLAGNIOL-VILLARD,

Quoted 13 lines · In message <[email protected]> you wrote:

actually the console API use the following naming convention

---Extract---
typedef struct device_t;

int    device_register (device_t * dev);
int    devices_init (void);
int    device_deregister(char *devname);

struct list_head* device_get_list(void);
device_t* device_get_by_name(char* name);
device_t* device_clone(device_t *dev);
---

Quoted 4 lines

which is not console dependent and is confusing
instead of using device_XX

we now switch to console_XX and console_device_t

Please be careful. "console" is a name (or prefex) that is already taken, and there are other (globally visible) identifiers, so con- fusion might become a problem - see for example overwrite_console(), console_changed(), console_buffer[], get_console_port(), console_init_f(), env-var console_nr, consoles[], next_cons_choice(), console_assign(), console, console_init(), console_dev, default_serial_console, cur_console, console_chan, ... etc. etc.

Also, we have common/console.c with lots of console_* names.

Actually there is even a direct name conflict - console_init() is already in use (in board/netphone/phone_console.c), and your patch fails to resolve this conflict.

All together: NAK.

Maybe "stdio" would be a better choice than "console" here?

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Democracy is mob rule, but with income taxes.
#5 lore raw

RFC PATCH 1/1 console/device: rework function naming

Quoted 29 lines · Wolfgang Denk

Dear Jean-Christophe PLAGNIOL-VILLARD,

Quoted 13 lines · In message <[email protected]> you wrote:

actually the console API use the following naming convention

---Extract---
typedef struct device_t;

int    device_register (device_t * dev);
int    devices_init (void);
int    device_deregister(char *devname);

struct list_head* device_get_list(void);
device_t* device_get_by_name(char* name);
device_t* device_clone(device_t *dev);
---

Quoted 4 lines

which is not console dependent and is confusing
instead of using device_XX

we now switch to console_XX and console_device_t

Please be careful. "console" is a name (or prefex) that is already taken, and there are other (globally visible) identifiers, so con- fusion might become a problem - see for example overwrite_console(), console_changed(), console_buffer[], get_console_port(), console_init_f(), env-var console_nr, consoles[], next_cons_choice(), console_assign(), console, console_init(), console_dev, default_serial_console, cur_console, console_chan, ... etc. etc.

Quoted 5 lines

Also, we have common/console.c with lots of console_* names.

Actually there is even a direct name conflict - console_init() is already in use (in board/netphone/phone_console.c), and your patch fails to resolve this conflict.

it does, it's call consoles_init()

Quoted 3 lines

Maybe "stdio" would be a better choice than "console" here?

why not

I'll wait other comment before write the true patch

Best Regards,
J.

#6 lore raw

RFC PATCH 1/1 console/device: rework function naming

Dear Jean-Christophe PLAGNIOL-VILLARD,

Quoted 2 lines · In message <[email protected]> you wrote:
Quoted 2 lines
Quoted 2 lines

we now switch to console_XX and console_device_t

-----------------------^^^^^^^^^^

Quoted 5 lines
Quoted 4 lines

Actually there is even a direct name conflict - console_init() is already in use (in board/netphone/phone_console.c), and your patch fails to resolve this conflict.

it does, it's call consoles_init()

Then your comment (see above) and the code disagree.

Quoted 2 lines
Quoted 1 line

Maybe "stdio" would be a better choice than "console" here?

why not

Hm... actually checking the code tells that stdio is already taken, too - see show_stdio_dev(), stdio_devices[], stdio_names[].

But at least thesere are only few identifiers, so this could be delt with.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Where there's no emotion, there's no motive for violence.
	-- Spock, "Dagger of the Mind", stardate 2715.1
#7 lore raw

RFC PATCH 1/1 console/device: rework function naming

Quoted 12 lines · Wolfgang Denk

Dear Jean-Christophe PLAGNIOL-VILLARD,

Quoted 2 lines · In message <[email protected]> you wrote:
Quoted 2 lines
Quoted 2 lines

we now switch to console_XX and console_device_t

-----------------------^^^^^^^^^^

Quoted 5 lines
Quoted 4 lines

Actually there is even a direct name conflict - console_init() is already in use (in board/netphone/phone_console.c), and your patch fails to resolve this conflict.

it does, it's call consoles_init()

Quoted 7 lines

Then your comment (see above) and the code disagree.

Quoted 2 lines
Quoted 1 line

Maybe "stdio" would be a better choice than "console" here?

why not

Hm... actually checking the code tells that stdio is already taken, too - see show_stdio_dev(), stdio_devices[], stdio_names[].

btw we could stop to export the table

for show_stdio_dev it's just a copy of the common/console.c ligne 604

so we can merge it

Quoted 3 lines

But at least thesere are only few identifiers, so this could be delt with.

so no problem

Best Regards,
J.