mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Robert Jarzmik <robert.jarzmik@free.fr>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH V2 3/8] drivers/mtd: transfer NAND notions to MTD core
Date: Mon, 19 Dec 2011 10:49:32 +0100	[thread overview]
Message-ID: <20111219094932.GC27267@pengutronix.de> (raw)
In-Reply-To: <1324072234-31634-4-git-send-email-robert.jarzmik@free.fr>

On Fri, Dec 16, 2011 at 10:50:29PM +0100, Robert Jarzmik wrote:

>  
>  if MTD
>
> +config MTD_WRITE
> +	bool
> +	default y
> +	prompt "Support writing to MTD devices"
> +
> +config MTD_READ_OOB
> +	bool
> +	default y
> +	prompt "Create a device for reading the OOB data"
> +

This one is a rename...

>  
> -config NAND_READ_OOB
> -	bool
> -	default y
> -	prompt "create a device for reading the OOB data"
> -

from this one, but not all references to it were renamed.

This revealed a bug which was present before this patch. The following
fixes this, see the commit log for more details. Can you rebase your
series on this patch?
Otherwise your series seems to work properly.

Sascha

8<--------------------------------------------------

mtd nand: fix oob compile time option

The NAND_READ_OOB Kconfig option is used to

a) creating a cdev for reading OOB data
b) compiling in mtd->read_oob support

The former was intended and that's also what the Kconfig help
says. The latter though was implicit and wrong. mtd->read_oob
is also used by the bbt code which resulted in a NULL pointer
deref when compiled with BBT but without NAND_READ_OOB.
To fix this, split the option into two. The now invisible
option NAND_OOB_DEVICE is only responsible for b) and gets
selected when necessary.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/mtd/nand/Kconfig |    7 ++++++-
 drivers/mtd/nand/nand.c  |    2 +-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
index 20f9f33..1cc29a8 100644
--- a/drivers/mtd/nand/Kconfig
+++ b/drivers/mtd/nand/Kconfig
@@ -41,16 +41,21 @@ config NAND_INFO
 	  Show informational strings about the vendor and nand flash type
 	  during startup
 
+config NAND_READ_OOB
+	bool
+
 config NAND_BBT
 	bool
+	select NAND_READ_OOB
 	default y
 	prompt "support bad block tables"
 	help
 	  Say y here to include support for bad block tables. This speeds
 	  up the process of checking for bad blocks
 
-config NAND_READ_OOB
+config NAND_OOB_DEVICE
 	bool
+	select NAND_READ_OOB
 	default y
 	prompt "create a device for reading the OOB data"
 
diff --git a/drivers/mtd/nand/nand.c b/drivers/mtd/nand/nand.c
index 6db21d6..130e2af 100644
--- a/drivers/mtd/nand/nand.c
+++ b/drivers/mtd/nand/nand.c
@@ -186,7 +186,7 @@ static struct file_operations nand_ops = {
 	.lseek  = dev_lseek_default,
 };
 
-#ifdef CONFIG_NAND_READ_OOB
+#ifdef CONFIG_NAND_OOB_DEVICE
 static ssize_t nand_read_oob(struct cdev *cdev, void *buf, size_t count, ulong offset, ulong flags)
 {
 	struct mtd_info *info = cdev->priv;
-- 
1.7.7.3

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

  reply	other threads:[~2011-12-19  9:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-16 21:50 [PATCH V2 0/8] mtd framework rework Robert Jarzmik
2011-12-16 21:50 ` [PATCH V2 1/8] drivers/mtd: move nand.c into core.c Robert Jarzmik
2011-12-16 21:50 ` [PATCH V2 2/8] drivers/mtd: cosmetic changes Robert Jarzmik
2011-12-16 21:50 ` [PATCH V2 3/8] drivers/mtd: transfer NAND notions to MTD core Robert Jarzmik
2011-12-19  9:49   ` Sascha Hauer [this message]
2011-12-19 10:48     ` Robert Jarzmik
2011-12-19 11:08       ` Sascha Hauer
2011-12-16 21:50 ` [PATCH V2 4/8] drivers/mtd: recover NAND default device name "nand" Robert Jarzmik
2011-12-16 21:50 ` [PATCH V2 5/8] drivers/mtd: fix core multiple MTD registrations Robert Jarzmik
2011-12-16 21:50 ` [PATCH V2 6/8] drivers/mtd: add mtd core hooks Robert Jarzmik
2011-12-16 21:50 ` [PATCH V2 7/8] mtd/drivers: split mtd mtdoob devices Robert Jarzmik
2011-12-19  9:50   ` Sascha Hauer
2011-12-19 10:50     ` Robert Jarzmik
2011-12-16 21:50 ` [PATCH V2 8/8] drivers/mtd: add the mtdraw device (data+oob) Robert Jarzmik

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=20111219094932.GC27267@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=robert.jarzmik@free.fr \
    /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