[U-Boot] [RFC][PATCH v0 2/7] mtd: nand: import nand_hw_control_init()

Philippe Reynes philippe.reynes at softathome.com
Fri Nov 16 13:56:59 UTC 2018


From: Marc Gonzalez <marc_gonzalez at sigmadesigns.com>

The code to initialize a struct nand_hw_control is duplicated across
several drivers. Factorize it using an inline function.

Signed-off-by: Marc Gonzalez <marc_gonzalez at sigmadesigns.com>
Signed-off-by: Boris Brezillon <boris.brezillon at free-electrons.com>
[Linux commit: d45bc58dd3bdcaabc1d7d8d9b0b8dee826635cc6]
[Philippe Reynes: adapt code to u-boot and only keep new function]
Signed-off-by: Philippe Reynes <philippe.reynes at softathome.com>

Signed-off-by: Philippe Reynes <philippe.reynes at softathome.com>
---
 include/linux/mtd/rawnand.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h
index e2bd598..96b5847 100644
--- a/include/linux/mtd/rawnand.h
+++ b/include/linux/mtd/rawnand.h
@@ -499,6 +499,13 @@ struct nand_hw_control {
 	struct nand_chip *active;
 };
 
+static inline void nand_hw_control_init(struct nand_hw_control *nfc)
+{
+	nfc->active = NULL;
+	spin_lock_init(&nfc->lock);
+	init_waitqueue_head(&nfc->wq);
+}
+
 /**
  * struct nand_ecc_step_info - ECC step information of ECC engine
  * @stepsize: data bytes per ECC step
-- 
2.7.4



More information about the U-Boot mailing list