mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 04/11] mtd: cfi-flash: replace ifdef with IS_ENABLED
Date: Mon, 22 Jun 2015 10:40:59 +0200	[thread overview]
Message-ID: <1434962466-23590-5-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1434962466-23590-1-git-send-email-s.hauer@pengutronix.de>

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>
---
 drivers/mtd/nor/cfi_flash.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/mtd/nor/cfi_flash.c b/drivers/mtd/nor/cfi_flash.c
index caa93b6..98ce791 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);
 
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2015-06-22  8:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-22  8:40 cfi-flash cleanups Sascha Hauer
2015-06-22  8:40 ` [PATCH 01/11] mtd: cfi-flash: We can print longlongs Sascha Hauer
2015-06-22  8:40 ` [PATCH 02/11] mtd: cfi-flash: save indention level Sascha Hauer
2015-06-22  8:40 ` [PATCH 03/11] mtd: cfi-flash: statically initialize instead of memset Sascha Hauer
2015-06-22  8:40 ` Sascha Hauer [this message]
2015-06-22  8:41 ` [PATCH 05/11] mtd: cfi-flash: remove unnecessary ifdefs Sascha Hauer
2015-06-22  8:41 ` [PATCH 06/11] mtd: cfi-flash: make flash_detect_width more readable Sascha Hauer
2015-06-22  8:41 ` [PATCH 07/11] mtd: cfi-flash: return 0 for success Sascha Hauer
2015-06-22  8:41 ` [PATCH 08/11] mtd: cfi-flash: turn some messages into vdbg Sascha Hauer
2015-06-22  8:41 ` [PATCH 09/11] mtd: cfi-flash: use unaligned accessor functions Sascha Hauer
2015-06-22  8:41 ` [PATCH 10/11] mtd: cfi-flash: Coding style cleanup Sascha Hauer
2015-06-22  8:41 ` [PATCH 11/11] mtd: cfi-flash: remove dead code Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1434962466-23590-5-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox