From: Jan Luebbe <jlu@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 2/2] drivers/nor/cfi_flash: use IS_ENABLED instead of an ifdef
Date: Mon, 10 Sep 2012 10:55:47 +0200 [thread overview]
Message-ID: <1347267347-9739-2-git-send-email-jlu@pengutronix.de> (raw)
In-Reply-To: <1347267347-9739-1-git-send-email-jlu@pengutronix.de>
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
---
drivers/nor/cfi_flash.c | 8 +++-----
drivers/nor/cfi_flash.h | 2 --
2 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/drivers/nor/cfi_flash.c b/drivers/nor/cfi_flash.c
index 16885c0..d9347b2 100644
--- a/drivers/nor/cfi_flash.c
+++ b/drivers/nor/cfi_flash.c
@@ -917,7 +917,6 @@ struct file_operations cfi_ops = {
.memmap = generic_memmap_ro,
};
-#ifdef CONFIG_PARTITION_NEED_MTD
static int cfi_mtd_read(struct mtd_info *mtd, loff_t from, size_t len,
size_t *retlen, u_char *buf)
{
@@ -977,7 +976,6 @@ static void cfi_init_mtd(struct flash_info *info)
mtd->flags = MTD_CAP_NORFLASH;
info->cdev.mtd = mtd;
}
-#endif
static int cfi_probe (struct device_d *dev)
{
@@ -1006,9 +1004,9 @@ static int cfi_probe (struct device_d *dev)
info->cdev.ops = &cfi_ops;
info->cdev.priv = info;
-#ifdef CONFIG_PARTITION_NEED_MTD
- cfi_init_mtd(info);
-#endif
+ if (IS_ENABLED(CONFIG_PARTITION_NEED_MTD))
+ cfi_init_mtd(info);
+
devfs_create(&info->cdev);
return 0;
diff --git a/drivers/nor/cfi_flash.h b/drivers/nor/cfi_flash.h
index fec0894..1bfe81c 100644
--- a/drivers/nor/cfi_flash.h
+++ b/drivers/nor/cfi_flash.h
@@ -75,9 +75,7 @@ struct flash_info {
ulong addr_unlock2; /* unlock address 2 for AMD flash roms */
struct cfi_cmd_set *cfi_cmd_set;
struct cdev cdev;
-#ifdef CONFIG_PARTITION_NEED_MTD
struct mtd_info mtd;
-#endif
int numeraseregions;
struct mtd_erase_region_info *eraseregions;
void *base;
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2012-09-10 8:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-10 8:55 [PATCH 1/2] drivers/nor/m25p80: add MTD support Jan Luebbe
2012-09-10 8:55 ` Jan Luebbe [this message]
2012-09-10 16:04 ` 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=1347267347-9739-2-git-send-email-jlu@pengutronix.de \
--to=jlu@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