259699edf22f99f372fe13d967cede1e5eee13a6
[openwrt/staging/chunkeey.git] / target / linux / mediatek / patches-4.4 / 0052-mtd-nand-add-an-mtd_to_nand-helper.patch
1 From 17b9724cf84aa32f15334c23d5df34ad3cb885f3 Mon Sep 17 00:00:00 2001
2 From: Boris BREZILLON <boris.brezillon@free-electrons.com>
3 Date: Mon, 16 Nov 2015 14:37:35 +0100
4 Subject: [PATCH 52/81] mtd: nand: add an mtd_to_nand() helper
5
6 Some drivers are retrieving the nand_chip pointer using the container_of
7 macro on a struct wrapping both the nand_chip and the mtd_info struct while
8 the standard way of retrieving this pointer is through mtd->priv.
9 Provide an helper to do that.
10
11 Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
12 Signed-off-by: Brian Norris <computersforpeace@gmail.com>
13 ---
14 include/linux/mtd/nand.h | 5 +++++
15 1 file changed, 5 insertions(+)
16
17 --- a/include/linux/mtd/nand.h
18 +++ b/include/linux/mtd/nand.h
19 @@ -719,6 +719,11 @@ struct nand_chip {
20 void *priv;
21 };
22
23 +static inline struct nand_chip *mtd_to_nand(struct mtd_info *mtd)
24 +{
25 + return mtd->priv;
26 +}
27 +
28 /*
29 * NAND Flash Manufacturer ID Codes
30 */