History

mtd: rawnand: Prepare things to reuse the generic NAND layer

The generic NAND layer provides abstraction of NAND devices no matter the bus that is used to communicate with the chip. Basing the raw NAND core on this generic layer should avoid duplication of common operations, like iterating over all pages/blocks for MTD IO/erase operations. In order to re-use this layer, we must first inherit from nand_device and then initialize the nand_device struct appropriately. This patch is taking care of the former.

Boris Brezillon committed 8 years ago

Commit 3020e301 parent 080d66e1 file · +6 −4Browse files

Unified · Split

include/linux/mtd/rawnand.h+6−4
@@ -20,6 +20,7 @@ · 19 unmodified lines
2020 #include <linux/mtd/flashchip.h>
2121 #include <linux/mtd/bbm.h>
2222 #include <linux/mtd/jedec.h>
23+#include <linux/mtd/nand.h>
2324 #include <linux/mtd/onfi.h>
2425 #include <linux/mutex.h>
2526 #include <linux/of.h>
@@ -860,6 +861,7 @@ struct nand_operation { · 834 unmodified lines
860861 int nand_op_parser_exec_op(struct nand_chip *chip,
861862 const struct nand_op_parser *parser,
862863 const struct nand_operation *op, bool check_only);
864+
863865 /**
864866 * struct nand_controller_ops - Controller operations
865867 *
@@ -962,7 +964,7 @@ struct nand_legacy { · 96 unmodified lines
962964
963965 /**
964966 * struct nand_chip - NAND Private Flash Chip Data
965− * @mtd: MTD device registered to the MTD framework
967+ * @base: Inherit from the generic NAND device
966968 * @legacy: All legacy fields/hooks. If you develop a new driver,
967969 * don't even try to use any of these fields/hooks, and if
968970 * you're modifying an existing driver that is using those
@@ -1041,7 +1043,7 @@ struct nand_legacy { · 72 unmodified lines
10411043 */
10421044
10431045 struct nand_chip {
1044− struct mtd_info mtd;
1046+ struct nand_device base;
10451047
10461048 struct nand_legacy legacy;
10471049
@@ -1107,12 +1109,12 @@ extern const struct mtd_ooblayout_ops nand_ooblayout_lp_ops; · 59 unmodified lines
11071109
11081110 static inline struct nand_chip *mtd_to_nand(struct mtd_info *mtd)
11091111 {
1110− return container_of(mtd, struct nand_chip, mtd);
1112+ return container_of(mtd, struct nand_chip, base.mtd);
11111113 }
11121114
11131115 static inline struct mtd_info *nand_to_mtd(struct nand_chip *chip)
11141116 {
1115− return &chip->mtd;
1117+ return &chip->base.mtd;
11161118 }
11171119
11181120 static inline void *nand_get_controller_data(struct nand_chip *chip)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t