mediatek: update patches
[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 diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
18 index 5a9d1d4..a4839b3 100644
19 --- a/include/linux/mtd/nand.h
20 +++ b/include/linux/mtd/nand.h
21 @@ -719,6 +719,11 @@ struct nand_chip {
22 void *priv;
23 };
24
25 +static inline struct nand_chip *mtd_to_nand(struct mtd_info *mtd)
26 +{
27 + return mtd->priv;
28 +}
29 +
30 /*
31 * NAND Flash Manufacturer ID Codes
32 */
33 --
34 1.7.10.4
35