d9324c25953ef90ca0a4f046c1fee51930fbc804
[openwrt/staging/blogic.git] /
1 From: Florian Fainelli <f.fainelli@gmail.com>
2 Subject: [PATCH v3 3/9] mtd: rawnand: brcmnand: Avoid pdev in brcmnand_init_cs()
3 Date: Fri, 07 Jan 2022 10:46:08 -0800
4 Content-Type: text/plain; charset="utf-8"
5
6 In preparation for encapsulating more of what the loop calling
7 brcmnand_init_cs() does, avoid using platform_device when it is the
8 device behind platform_device that we are using for printing errors.
9
10 No functional changes introduced.
11
12 Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
13 ---
14 drivers/mtd/nand/raw/brcmnand/brcmnand.c | 8 ++++----
15 1 file changed, 4 insertions(+), 4 deletions(-)
16
17 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c
18 +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
19 @@ -2722,7 +2722,7 @@ static const struct nand_controller_ops
20 static int brcmnand_init_cs(struct brcmnand_host *host, struct device_node *dn)
21 {
22 struct brcmnand_controller *ctrl = host->ctrl;
23 - struct platform_device *pdev = host->pdev;
24 + struct device *dev = ctrl->dev;
25 struct mtd_info *mtd;
26 struct nand_chip *chip;
27 int ret;
28 @@ -2730,7 +2730,7 @@ static int brcmnand_init_cs(struct brcmn
29
30 ret = of_property_read_u32(dn, "reg", &host->cs);
31 if (ret) {
32 - dev_err(&pdev->dev, "can't get chip-select\n");
33 + dev_err(dev, "can't get chip-select\n");
34 return -ENXIO;
35 }
36
37 @@ -2739,13 +2739,13 @@ static int brcmnand_init_cs(struct brcmn
38
39 nand_set_flash_node(chip, dn);
40 nand_set_controller_data(chip, host);
41 - mtd->name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "brcmnand.%d",
42 + mtd->name = devm_kasprintf(dev, GFP_KERNEL, "brcmnand.%d",
43 host->cs);
44 if (!mtd->name)
45 return -ENOMEM;
46
47 mtd->owner = THIS_MODULE;
48 - mtd->dev.parent = &pdev->dev;
49 + mtd->dev.parent = dev;
50
51 chip->legacy.cmd_ctrl = brcmnand_cmd_ctrl;
52 chip->legacy.cmdfunc = brcmnand_cmdfunc;