summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2015-06-19 09:42:45 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2015-06-22 09:16:40 +0200
commit25b42d1fe7cd9d5847294dc320536d591b5f34ef (patch)
tree5fffdde97355dba4fbbd72c49b83593060a49366 /drivers
parent2ec3921248b2eb5031107b1680ef748e0bef64f5 (diff)
downloadbarebox-25b42d1fe7cd9d5847294dc320536d591b5f34ef.tar.gz
barebox-25b42d1fe7cd9d5847294dc320536d591b5f34ef.tar.xz
mtd: cfi-flash: replace ifdef with IS_ENABLED
TO get rid of some ifdefs. While at it add the vendor code of the unsupported vendor to the error message. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mtd/nor/cfi_flash.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/mtd/nor/cfi_flash.c b/drivers/mtd/nor/cfi_flash.c
index caa93b6898..98ce7914e5 100644
--- a/drivers/mtd/nor/cfi_flash.c
+++ b/drivers/mtd/nor/cfi_flash.c
@@ -329,22 +329,23 @@ static ulong flash_get_size (struct flash_info *info)
#endif
switch (info->vendor) {
-#ifdef CONFIG_DRIVER_CFI_INTEL
case CFI_CMDSET_INTEL_EXTENDED:
case CFI_CMDSET_INTEL_STANDARD:
- info->cfi_cmd_set = &cfi_cmd_set_intel;
+ if (IS_ENABLED(CONFIG_DRIVER_CFI_INTEL))
+ info->cfi_cmd_set = &cfi_cmd_set_intel;
break;
-#endif
-#ifdef CONFIG_DRIVER_CFI_AMD
case CFI_CMDSET_AMD_STANDARD:
case CFI_CMDSET_AMD_EXTENDED:
- info->cfi_cmd_set = &cfi_cmd_set_amd;
+ if (IS_ENABLED(CONFIG_DRIVER_CFI_AMD))
+ info->cfi_cmd_set = &cfi_cmd_set_amd;
break;
-#endif
- default:
- dev_err(info->dev, "unsupported vendor\n");
+ }
+
+ if (!info->cfi_cmd_set) {
+ dev_err(info->dev, "unsupported vendor 0x%04x\n", info->vendor);
return 0;
}
+
info->cfi_cmd_set->flash_read_jedec_ids (info);
flash_write_cmd (info, 0, info->cfi_offset, FLASH_CMD_CFI);