diff options
| author | Haavard Skinnemoen <haavard.skinnemoen@atmel.com> | 2008-12-17 16:53:07 +0100 | 
|---|---|---|
| committer | Haavard Skinnemoen <haavard.skinnemoen@atmel.com> | 2008-12-17 16:53:07 +0100 | 
| commit | cb5473205206c7f14cbb1e747f28ec75b48826e2 (patch) | |
| tree | 8f4808d60917100b18a10b05230f7638a0a9bbcc /common/devices.c | |
| parent | baf449fc5ff96f071bb0e3789fd3265f6d4fd9a0 (diff) | |
| parent | 92c78a3bbcb2ce508b4bf1c4a1e0940406a024bb (diff) | |
| download | olio-uboot-2014.01-cb5473205206c7f14cbb1e747f28ec75b48826e2.tar.xz olio-uboot-2014.01-cb5473205206c7f14cbb1e747f28ec75b48826e2.zip  | |
Merge branch 'fixes' into cleanups
Conflicts:
	board/atmel/atngw100/atngw100.c
	board/atmel/atstk1000/atstk1000.c
	cpu/at32ap/at32ap700x/gpio.c
	include/asm-avr32/arch-at32ap700x/clk.h
	include/configs/atngw100.h
	include/configs/atstk1002.h
	include/configs/atstk1003.h
	include/configs/atstk1004.h
	include/configs/atstk1006.h
	include/configs/favr-32-ezkit.h
	include/configs/hammerhead.h
	include/configs/mimc200.h
Diffstat (limited to 'common/devices.c')
| -rw-r--r-- | common/devices.c | 38 | 
1 files changed, 30 insertions, 8 deletions
diff --git a/common/devices.c b/common/devices.c index 297743642..ce3b7a00f 100644 --- a/common/devices.c +++ b/common/devices.c @@ -40,12 +40,12 @@ static device_t devs;  device_t *stdio_devices[] = { NULL, NULL, NULL };  char *stdio_names[MAX_FILES] = { "stdin", "stdout", "stderr" }; -#if defined(CONFIG_SPLASH_SCREEN) && !defined(CFG_DEVICE_NULLDEV) -#define	CFG_DEVICE_NULLDEV	1 +#if defined(CONFIG_SPLASH_SCREEN) && !defined(CONFIG_SYS_DEVICE_NULLDEV) +#define	CONFIG_SYS_DEVICE_NULLDEV	1  #endif -#ifdef CFG_DEVICE_NULLDEV +#ifdef CONFIG_SYS_DEVICE_NULLDEV  void nulldev_putc(const char c)  {  	/* nulldev is empty! */ @@ -90,7 +90,7 @@ static void drv_system_init (void)  	device_register (&dev); -#ifdef CFG_DEVICE_NULLDEV +#ifdef CONFIG_SYS_DEVICE_NULLDEV  	memset (&dev, 0, sizeof (dev));  	strcpy (dev.name, "nulldev"); @@ -130,17 +130,39 @@ device_t* device_get_by_name(char* name)  	return NULL;  } +device_t* device_clone(device_t *dev) +{ +	device_t *_dev; + +	if(!dev) +		return NULL; + +	_dev = calloc(1, sizeof(device_t)); + +	if(!_dev) +		return NULL; + +	memcpy(_dev, dev, sizeof(device_t)); +	strncpy(_dev->name, dev->name, 16); + +	return _dev; +}  int device_register (device_t * dev)  { -	list_add(&(dev->list), &(devs.list)); +	device_t *_dev; + +	_dev = device_clone(dev); +	if(!_dev) +		return -1; +	list_add_tail(&(_dev->list), &(devs.list));  	return 0;  }  /* deregister the device "devname".   * returns 0 if success, -1 if device is assigned and 1 if devname not found   */ -#ifdef	CFG_DEVICE_DEREGISTER +#ifdef	CONFIG_SYS_DEVICE_DEREGISTER  int device_deregister(char *devname)  {  	int l; @@ -175,7 +197,7 @@ int device_deregister(char *devname)  	}  	return 0;  } -#endif	/* CFG_DEVICE_DEREGISTER */ +#endif	/* CONFIG_SYS_DEVICE_DEREGISTER */  int devices_init (void)  { @@ -194,7 +216,7 @@ int devices_init (void)  	INIT_LIST_HEAD(&(devs.list));  #if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C) -	i2c_init (CFG_I2C_SPEED, CFG_I2C_SLAVE); +	i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);  #endif  #ifdef CONFIG_LCD  	drv_lcd_init ();  |