a68eaa459427d8d6d9df52648365d9f2cfd166fd
[openwrt/staging/wigyori.git] / target / linux / generic / pending-4.4 / 042-0005-mtd-bcm47xxsflash-use-platform_-set-get-_drvdata.patch
1 From be5e5099183301fb7920f8f6b66bd3ac1f820a97 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
3 Date: Mon, 16 Jan 2017 17:28:18 +0100
4 Subject: [PATCH] mtd: bcm47xxsflash: use platform_(set|get)_drvdata
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 We have generic place & helpers for storing platform driver data so
10 there is no reason for using custom priv pointer.
11
12 This allows cleaning up struct bcma_sflash from unneeded fields.
13
14 Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
15 Acked-by: Kalle Valo <kvalo@codeaurora.org>
16 Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
17 Signed-off-by: Brian Norris <computersforpeace@gmail.com>
18 ---
19 drivers/mtd/devices/bcm47xxsflash.c | 6 +++---
20 include/linux/bcma/bcma_driver_chipcommon.h | 3 ---
21 2 files changed, 3 insertions(+), 6 deletions(-)
22
23 --- a/drivers/mtd/devices/bcm47xxsflash.c
24 +++ b/drivers/mtd/devices/bcm47xxsflash.c
25 @@ -284,7 +284,6 @@ static int bcm47xxsflash_bcma_probe(stru
26 b47s = devm_kzalloc(dev, sizeof(*b47s), GFP_KERNEL);
27 if (!b47s)
28 return -ENOMEM;
29 - sflash->priv = b47s;
30
31 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
32 if (!res) {
33 @@ -334,6 +333,8 @@ static int bcm47xxsflash_bcma_probe(stru
34 b47s->size = sflash->size;
35 bcm47xxsflash_fill_mtd(b47s, &pdev->dev);
36
37 + platform_set_drvdata(pdev, b47s);
38 +
39 err = mtd_device_parse_register(&b47s->mtd, probes, NULL, NULL, 0);
40 if (err) {
41 pr_err("Failed to register MTD device: %d\n", err);
42 @@ -349,8 +350,7 @@ static int bcm47xxsflash_bcma_probe(stru
43
44 static int bcm47xxsflash_bcma_remove(struct platform_device *pdev)
45 {
46 - struct bcma_sflash *sflash = dev_get_platdata(&pdev->dev);
47 - struct bcm47xxsflash *b47s = sflash->priv;
48 + struct bcm47xxsflash *b47s = platform_get_drvdata(pdev);
49
50 mtd_device_unregister(&b47s->mtd);
51 iounmap(b47s->window);
52 --- a/include/linux/bcma/bcma_driver_chipcommon.h
53 +++ b/include/linux/bcma/bcma_driver_chipcommon.h
54 @@ -591,9 +591,6 @@ struct bcma_sflash {
55 u32 blocksize;
56 u16 numblocks;
57 u32 size;
58 -
59 - struct mtd_info *mtd;
60 - void *priv;
61 };
62 #endif
63