From: Andreas S. <sc...@su...> - 2007-05-26 16:19:26
|
Joseph Jezak <jo...@ge...> writes: > I've already fixed this in SVN. Please try that and let me know if > it works for you. The changes in find_physical_rom are not complete, AFAIK. I don't think you can use dn->next for finding the next node, instead you have to repeat of_find_by_name or of_find_by_name, resp. Also, there are calls to of_node_put missing. Andreas. --- dev.c +++ dev.c @@ -72,18 +72,27 @@ find_physical_rom( int *base, int *size #ifndef CONFIG_AMIGAONE struct device_node *dn; int len, *p; + int by_type = 0; - if( !(dn=find_devices("boot-rom")) && !(dn=find_type_devices("rom")) ) + dn = of_find_node_by_name(NULL, "boot-rom"); + if (!dn) { + by_type = 1; + dn = of_find_node_by_type(NULL, "rom"); + } + if (!dn) return 0; do { - if( !(p=(int*)get_property(dn, "reg", &len)) || len != sizeof(int[2]) ) + if( !(p=(int*)get_property(dn, "reg", &len)) || len != sizeof(int[2]) ) { + of_node_put(dn); return 0; + } if( (unsigned int)(0xfff00100 - p[0]) < (unsigned int)p[1] ) { *base = p[0]; *size = p[1]; + of_node_put(dn); return 1; } - dn = dn->next; + dn = by_type ? of_find_node_by_type(dn, "rom") : of_find_node_by_name(dn, "boot-rom"); } while( dn ); #endif -- Andreas Schwab, SuSE Labs, sc...@su... SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." |