]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
mtd: nand: import nand_hw_control_init()
authorMarc Gonzalez <marc_gonzalez@sigmadesigns.com>
Fri, 15 Mar 2019 14:14:31 +0000 (15:14 +0100)
committerTom Rini <trini@konsulko.com>
Mon, 22 Apr 2019 15:55:58 +0000 (11:55 -0400)
Linux commit d45bc58dd3b ("mtd: nand: import nand_hw_control_init()")

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@sigmadesigns.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
[Philippe Reynes: adapt code to u-boot and only keep new function]

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
include/linux/mtd/rawnand.h

index e2bd598240281bf8d66d9ac8b23c4db98a828094..96b584704b53a393c99b5233c3f9eaefb1abeebf 100644 (file)
@@ -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