common/console.c
Hello Jean-Christophe,
I compilied actual u-boot for the muas3001 board and tried to start it, but it crashes in common/console.c console_init_r () ...
After reversing your Patch:
http://git.denx.de/?p=u-boot.git;a=commitdiff;h=c1de7a6daf9c657484e1c6d433f01fccd49a7f48#patch4
it works again fine.
It seems to me, that in console_init_r ()
struct list_head *list = device_get_list();
list points after device_get_list() not to a valid list ...
at least for MPC8260 systems!
bye
Heiko
Signature · 2 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
PATCH 1/1 device: clone device on register
to prevent that the pointer will not be use for an other register
--- common/devices.c | 24 +++++++++++++++++++++++- include/devices.h | 1 + 2 files changed, 24 insertions(+), 1 deletions(-)
common/devices.c +23 -1
@@ -130,10 +130,32 @@ 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 (&(_dev->list), &(devs.list));return 0 ; }
include/devices.h +1 -0
@@ -94,6 +94,7 @@ 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);#ifdef CONFIG_LCD int drv_lcd_init (void );
Signature · 1 line
1.5.6.3
PATCH 1/1 device: clone device on register
Quoted 3 lines · Jean-Christophe PLAGNIOL-VILLARD
to prevent that the pointer will not be use for an other register
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>
Er. What? If a device is registered multiple times, that sounds like something which should be fixed, not papered over like this...
Btw, while I'm all for getting rid of common/lists.c, your cryptic one-line commit message is a shooting offense to anyone who tries to understand WTF is going on...
Haavard
PATCH 1/1 device: clone device on register
Quoted 7 lines · Haavard Skinnemoen
Quoted 3 lines · Jean-Christophe PLAGNIOL-VILLARD
to prevent that the pointer will not be use for an other register
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>Er. What? If a device is registered multiple times, that sounds like something which should be fixed, not papered over like this...
I take that back. I didn't realize how much of a f***ing trainwreck the device system is...apparently the callers expect device_register() to clone the device, but this fact was hidden well within the old list implementation. Your patches makes this much more apparent, which is obviously good.
Oh, and your patch fixes the breakage I was seeing on avr32. Thanks.
Haavard
PATCH 1/1 device: clone device on register
Quoted 9 lines · Haavard Skinnemoen
Quoted 7 lines · Haavard Skinnemoen
Quoted 3 lines · Jean-Christophe PLAGNIOL-VILLARD
to prevent that the pointer will not be use for an other register
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>Er. What? If a device is registered multiple times, that sounds like something which should be fixed, not papered over like this...
Quoted 7 lines
I take that back. I didn't realize how much of a f***ing trainwreck the device system is...apparently the callers expect
device_register()to clone the device, but this fact was hidden well within the old list implementation. Your patches makes this much more apparent, which is obviously good.Oh, and your patch fixes the breakage I was seeing on avr32. Thanks.
I've plan to cleanup this part during next release.
and redesign console management to simplify it and reduce its code.
I'm currently designing a generic bus/device/driver mecanism that will simplify the implementation without increase the size.
I'll send a announce about it
Best Regards,
J.
PATCH 1/1 device: clone device on register
Quoted 6 lines · Jean-Christophe PLAGNIOL-VILLARD
I've plan to cleanup this part during next release.
and redesign console management to simplify it and reduce its code.
I'm currently designing a generic bus/device/driver mecanism that will simplify the implementation without increase the size.
Cool. Something like that is definitely needed.
Haavard
PATCH 1/1 device: clone device on register
In reply to Haavard SkinnemoenDear Jean-Christophe,
In message <[email protected]>
Quoted 11 lines · Haavard Skinnemoen
Quoted 4 lines
to prevent that the pointer will not be use for an other register
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>Er. What? If a device is registered multiple times, that sounds like something which should be fixed, not papered over like this...
Btw, while I'm all for getting rid of
common/lists.c, your cryptic one-line commit message is a shooting offense to anyone who tries to understand WTF is going on...
I agree with Haavard on both accounts.
Can you please look into this again? Thanks
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 The human race is a race of cowards; and I am not only marching in that procession but carrying a banner. - Mark Twain
PATCH 1/1 device: clone device on register
Quoted 7 lines · I wrote:
Quoted 7 lines
Quoted 3 lines
to prevent that the pointer will not be use for an other register
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>Er. What? If a device is registered multiple times, that sounds like something which should be fixed, not papered over like this...
Quoted 7 lines
Quoted 3 lines
Btw, while I'm all for getting rid of
common/lists.c, your cryptic one-line commit message is a shooting offense to anyone who tries to understand WTF is going on...I agree with Haavard on both accounts.
Can you please look into this again? Thanks
OK, I learned that item (1) was actually a non-issue.
But can we please use a commit message that can be understood? I cannot parse the current one.
Best regards,
Wolfgang Denk
Signature · 6 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 The universe, they said, depended for its operation on the balance of four forces which they identified as charm, persuasion, uncertainty and bloody-mindedness. -- Terry Pratchett, "The Light Fantastic"