On Friday, June 20, 2014 at 06:07:02 AM, Simon Glass wrote: > Hi Marek, > > On 17 June 2014 23:36, Simon Glass <s...@chromium.org> wrote: > > Hi Marek, > > > > On 17 June 2014 16:42, Marek Vasut <ma...@denx.de> wrote: > >> On Thursday, June 12, 2014 at 05:26:50 AM, Simon Glass wrote: > >>> Hi Marek, > >>> > >>> On 8 June 2014 01:00, Marek Vasut <ma...@denx.de> wrote: > >>> > On Friday, June 06, 2014 at 09:13:26 PM, Simon Glass wrote: > >>> >> In a very few cases we need to adjust the driver model root device, > >>> >> such as when setting it up at initialisation. Add a macro to make > >>> >> this easier. > >>> >> > >>> >> Signed-off-by: Simon Glass <s...@chromium.org> > >>> >> --- > >>> > > >>> > [...] > >>> > > >>> >> - ret = device_bind_by_name(NULL, &root_info, &gd->dm_root); > >>> >> + ret = device_bind_by_name(NULL, &root_info, &DM_ROOT()); > >>> > > >>> > [...] > >>> > > >>> >> +/* Cast away any volatile pointer */ > >>> >> +#define DM_ROOT() (((gd_t *)gd)->dm_root) > >>> >> +#define DM_UCLASS_ROOT() (((gd_t *)gd)->uclass_root) > >>> > > >>> > Can you implement this "DM_ROOT()" macro as a function instead ? I > >>> > believe that'd be much nicer , would have typechecking etc., usual > >>> > stuff. > >>> > >>> I had a look at this. I don't see how I can do it, but you might have > >>> ideas. > >>> > >>> In this function call I need to pass a pointer without its const bit. > >>> I made it const since nothing should change the dm root except driver > >>> model itself. > >> > >> All right, I will just be doing a little guesswork here. Shall you not > >> have some functions to change the DM root then instead of exposing the > >> DM root ? Such functions shall not be exported publicly , but available > >> via separate header file too ? > > > > Firstly I should retitle the commit - it is of course the volatile > > that I'm trying to get rid of as it says in the commit message. I > > might have just been trying to confuse everyone. > > > > I have code like this: > > > > INIT_LIST_HEAD(&gd->uclass_root); > > > > I don't see how I can turn this into a function. I suppose I could > > init the list head in a temporary variable and then assign it to > > gd->uclass_root, perhaps with memcpy(), but that doesn't really seem > > any better to me. > > > >> Sorry, I might be completely wrong. > > > > Well I'm not saying it's pretty, so if you have time and come up with > > a better option please let me know. > > > > Also, this is not exported 'publicly'. It is in device-internal.h > > Please let me know on this one. If you have a better option please let me > know. > > Otherwise I'd like to do a dm pull request soon to get these fixes > into the release.
Ah, please get the PR out. We can tweak this later I'm sure. Apologies for holding you and the PR. _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot