From: Ben Dooks <ben@simtec.co.uk>
To: linux-mtd@lists.infradead.org
Cc: Simtec Linux Team <linux@simtec.co.uk>
Subject: NAND: Add flags to the probe calls to control scan behaviour
Date: Tue, 13 Oct 2009 10:00:19 +0100 [thread overview]
Message-ID: <20091013090019.091262272@fluff.org.uk> (raw)
[-- Attachment #1: nand-update-probe2.patch --]
[-- Type: text/plain, Size: 5387 bytes --]
Add a flags field to the two scan calls to control the behaviour of the
scan process. Currently the only flag we define is NAND_PROBE_SPECULATIVE
to stop the user-worrying messages 'No NAND device found!!!'. This message
often worries users (was three exclamation marks really necessary?) and is
even worse in systems such as the Simtec Osiris where there may be optional
NAND devices which are not known until probe time.
The approach is to change nand_scan_ident and nand_scan to have a new flags
field, and add wrapper functions to the header files so that we do not have
to get around all the drivers doing a search and replace. If we where to
change all the call sites for nand_scan() and nand_scan_ident() we would
touch about 40 drivers.
Signed-off-by: Ben Dooks <ben@simtec.co.uk>
Signed-off-by: Simtec Linux Team <linux@simtec.co.uk>
---
drivers/mtd/nand/nand_base.c | 18 ++++++++++--------
include/linux/mtd/nand.h | 32 ++++++++++++++++++++++++++++++--
2 files changed, 40 insertions(+), 10 deletions(-)
Index: b/drivers/mtd/nand/nand_base.c
===================================================================
--- a/drivers/mtd/nand/nand_base.c 2009-10-12 19:12:56.000000000 +0100
+++ b/drivers/mtd/nand/nand_base.c 2009-10-12 19:23:41.000000000 +0100
@@ -2615,7 +2615,7 @@ static struct nand_flash_dev *nand_get_f
}
/**
- * nand_scan_ident - [NAND Interface] Scan for the NAND device
+ * nand_scan_ident_flags - [NAND Interface] Scan for the NAND device
* @mtd: MTD device structure
* @maxchips: Number of chips to scan for
*
@@ -2624,7 +2624,7 @@ static struct nand_flash_dev *nand_get_f
*
* The mtd->owner field must be set to the module of the caller.
*/
-int nand_scan_ident(struct mtd_info *mtd, int maxchips)
+int nand_scan_ident_flags(struct mtd_info *mtd, int maxchips, unsigned flags)
{
int i, busw, nand_maf_id;
struct nand_chip *chip = mtd->priv;
@@ -2639,7 +2639,8 @@ int nand_scan_ident(struct mtd_info *mtd
type = nand_get_flash_type(mtd, chip, busw, &nand_maf_id);
if (IS_ERR(type)) {
- printk(KERN_WARNING "No NAND device found!!!\n");
+ if (!(flags & NAND_PROBE_SPECULATIVE))
+ printk(KERN_WARNING "No NAND device found!!!\n");
chip->select_chip(mtd, -1);
return PTR_ERR(type);
}
@@ -2903,9 +2904,10 @@ int nand_scan_tail(struct mtd_info *mtd)
#endif
/**
- * nand_scan - [NAND Interface] Scan for the NAND device
+ * nand_scan_flags - [NAND Interface] Scan for the NAND device
* @mtd: MTD device structure
* @maxchips: Number of chips to scan for
+ * @flags: The flags to pass to nand_scan_ident_flags().
*
* This fills out all the uninitialized function pointers
* with the defaults.
@@ -2914,7 +2916,7 @@ int nand_scan_tail(struct mtd_info *mtd)
* The mtd->owner field must be set to the module of the caller
*
*/
-int nand_scan(struct mtd_info *mtd, int maxchips)
+int nand_scan_flags(struct mtd_info *mtd, int maxchips, unsigned flags)
{
int ret;
@@ -2925,7 +2927,7 @@ int nand_scan(struct mtd_info *mtd, int
BUG();
}
- ret = nand_scan_ident(mtd, maxchips);
+ ret = nand_scan_ident_flags(mtd, maxchips, flags);
if (!ret)
ret = nand_scan_tail(mtd);
return ret;
@@ -2952,8 +2954,8 @@ void nand_release(struct mtd_info *mtd)
kfree(chip->buffers);
}
-EXPORT_SYMBOL_GPL(nand_scan);
-EXPORT_SYMBOL_GPL(nand_scan_ident);
+EXPORT_SYMBOL_GPL(nand_scan_flags);
+EXPORT_SYMBOL_GPL(nand_scan_ident_flags);
EXPORT_SYMBOL_GPL(nand_scan_tail);
EXPORT_SYMBOL_GPL(nand_release);
Index: b/include/linux/mtd/nand.h
===================================================================
--- a/include/linux/mtd/nand.h 2009-10-12 19:13:45.000000000 +0100
+++ b/include/linux/mtd/nand.h 2009-10-12 19:23:14.000000000 +0100
@@ -22,14 +22,42 @@
#include <linux/spinlock.h>
#include <linux/mtd/mtd.h>
+/* probe is only looking for the possibility of a chip, do not print
+ * authorative errors, etc. */
+#define NAND_PROBE_SPECULATIVE (1 << 0)
+
struct mtd_info;
/* Scan and identify a NAND device */
-extern int nand_scan (struct mtd_info *mtd, int max_chips);
+extern int nand_scan_flags(struct mtd_info *mtd, int max_chips, unsigned flags);
/* Separate phases of nand_scan(), allowing board driver to intervene
* and override command or ECC setup according to flash type */
-extern int nand_scan_ident(struct mtd_info *mtd, int max_chips);
+extern int nand_scan_ident_flags(struct mtd_info *mtd, int max_chips, unsigned flags);
extern int nand_scan_tail(struct mtd_info *mtd);
+/**
+ * nand_scan - [NAND Interface] Scan for the NAND device
+ * @mtd: MTD device structure
+ * @maxchips: Number of chips to scan for
+ *
+ * Wrapper for nand_scan_flags() with flags set to zero (nothing).
+ */
+static inline int nand_scan(struct mtd_info *mtd, int max_chips)
+{
+ return nand_scan_flags(mtd, max_chips, 0);
+}
+
+/**
+ * nand_scan_ident - [NAND Interface] Scan for the NAND device
+ * @mtd: MTD device structure
+ * @maxchips: Number of chips to scan for
+ *
+ * Wrapper for nand_scan_ident_flags() with flags set to zero (nothing).
+ */
+static inline int nand_scan_ident(struct mtd_info *mtd, int maxchips)
+{
+ return nand_scan_ident_flags(mtd, maxchips, 0);
+}
+
/* Free resources held by the NAND device */
extern void nand_release (struct mtd_info *mtd);
--
Ben (ben@fluff.org, http://www.fluff.org/)
'a smiley only costs 4 bytes'
next reply other threads:[~2009-10-13 9:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-13 9:00 Ben Dooks [this message]
2009-10-14 15:37 ` NAND: Add flags to the probe calls to control scan behaviour Artem Bityutskiy
2009-10-19 10:36 ` Ben Dooks
2009-10-20 12:06 ` Artem Bityutskiy
2009-10-20 13:11 ` Ben Dooks
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=20091013090019.091262272@fluff.org.uk \
--to=ben@simtec.co.uk \
--cc=linux-mtd@lists.infradead.org \
--cc=linux@simtec.co.uk \
/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