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

Showing the changes to include/linux (1 of 1 file). Show all

Unified · Split

include/linux/mtd/rawnand.h+6−4
@@ -20,6 +20,7 @@ · 19 unmodified lines
20#include <linux/mtd/flashchip.h>20#include <linux/mtd/flashchip.h>
21#include <linux/mtd/bbm.h>21#include <linux/mtd/bbm.h>
22#include <linux/mtd/jedec.h>22#include <linux/mtd/jedec.h>
23#include <linux/mtd/nand.h>
23#include <linux/mtd/onfi.h>24#include <linux/mtd/onfi.h>
24#include <linux/mutex.h>25#include <linux/mutex.h>
25#include <linux/of.h>26#include <linux/of.h>
@@ -860,6 +861,7 @@ struct nand_operation { · 834 unmodified lines
860int nand_op_parser_exec_op(struct nand_chip *chip,861int nand_op_parser_exec_op(struct nand_chip *chip,
861 const struct nand_op_parser *parser,862 const struct nand_op_parser *parser,
862 const struct nand_operation *op, bool check_only);863 const struct nand_operation *op, bool check_only);
864
863/**865/**
864 * struct nand_controller_ops - Controller operations866 * struct nand_controller_ops - Controller operations
865 *867 *
@@ -962,7 +964,7 @@ struct nand_legacy { · 96 unmodified lines
962 964
963/**965/**
964 * struct nand_chip - NAND Private Flash Chip Data966 * struct nand_chip - NAND Private Flash Chip Data
965 * @mtd: MTD device registered to the MTD framework967 * @base: Inherit from the generic NAND device
966 * @legacy: All legacy fields/hooks. If you develop a new driver,968 * @legacy: All legacy fields/hooks. If you develop a new driver,
967 * don't even try to use any of these fields/hooks, and if969 * don't even try to use any of these fields/hooks, and if
968 * you're modifying an existing driver that is using those970 * you're modifying an existing driver that is using those
@@ -1041,7 +1043,7 @@ struct nand_legacy { · 72 unmodified lines
1041 */1043 */
1042 1044
1043struct nand_chip {1045struct nand_chip {
1044 struct mtd_info mtd;1046 struct nand_device base;
1045 1047
1046 struct nand_legacy legacy;1048 struct nand_legacy legacy;
1047 1049
@@ -1107,12 +1109,12 @@ extern const struct mtd_ooblayout_ops nand_ooblayout_lp_ops; · 59 unmodified lines
1107 1109
1108static inline struct nand_chip *mtd_to_nand(struct mtd_info *mtd)1110static inline struct nand_chip *mtd_to_nand(struct mtd_info *mtd)
1109{1111{
1110 return container_of(mtd, struct nand_chip, mtd);1112 return container_of(mtd, struct nand_chip, base.mtd);
1111}1113}
1112 1114
1113static inline struct mtd_info *nand_to_mtd(struct nand_chip *chip)1115static inline struct mtd_info *nand_to_mtd(struct nand_chip *chip)
1114{1116{
1115 return &chip->mtd;1117 return &chip->base.mtd;
1116}1118}
1117 1119
1118static inline void *nand_get_controller_data(struct nand_chip *chip)1120static 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