Hi Stefan,
On 2015年11月02日 16:20, Stefan Roese wrote:
@@ -2315,6 +2329,7 @@ unsigned long flash_init (void)
{
unsigned long size = 0;
int i;
+ struct udevice *dev;
I'm seeing this warning while compiling for some powerpc boards
(e.g. canyonlands):
drivers/mtd/cfi_flash.c: In function 'flash_init':
drivers/mtd/cfi_flash.c:2332:18: warning: unused variable 'dev'
[-Wunused-variable]
Perhaps an "__maybe_unused" needed here.
#ifdef CONFIG_SYS_FLASH_PROTECTION
/* read environment from EEPROM */
@@ -2322,6 +2337,14 @@ unsigned long flash_init (void)
getenv_f("unlock", s, sizeof(s));
#endif
+#ifdef CONFIG_CFI_FLASH /* for driver model */
+ cfi_flash_num_flash_banks = 0;
+ /* probe every MTD device */
+ for (uclass_first_device(UCLASS_MTD, &dev);
+ dev;
+ uclass_next_device(&dev)) {
+ }
+#endif
What is this loop above exactly doing?
I want to get the cfi-flash device probed and flash_info[] got
initialized. So I look in every mtd uclass device.
I will use CONFIG_IS_ENABLED to remove the warning above.
if (CONFIG_IS_ENABLED(CFI_FLASH)) {
struct udevice *dev;
cfi_flash_num_flash_banks = 0;
/* probe every MTD device to find cfi-flash device */
for (uclass_first_device(UCLASS_MTD, &dev);
dev;
uclass_next_device(&dev)) {
}
}
Thanks a lot.
Best regards,
Thomas
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot