Update toolchain/gdb to 7.12.1
[librecmc/librecmc.git] / target / linux / generic / patches-4.4 / 025-bcma-from-4.11.patch
1 --- a/drivers/bcma/main.c
2 +++ b/drivers/bcma/main.c
3 @@ -136,17 +136,17 @@ static bool bcma_is_core_needed_early(u1
4         return false;
5  }
6  
7 -static struct device_node *bcma_of_find_child_device(struct platform_device *parent,
8 +static struct device_node *bcma_of_find_child_device(struct device *parent,
9                                                      struct bcma_device *core)
10  {
11         struct device_node *node;
12         u64 size;
13         const __be32 *reg;
14  
15 -       if (!parent || !parent->dev.of_node)
16 +       if (!parent->of_node)
17                 return NULL;
18  
19 -       for_each_child_of_node(parent->dev.of_node, node) {
20 +       for_each_child_of_node(parent->of_node, node) {
21                 reg = of_get_address(node, 0, &size, NULL);
22                 if (!reg)
23                         continue;
24 @@ -156,7 +156,7 @@ static struct device_node *bcma_of_find_
25         return NULL;
26  }
27  
28 -static int bcma_of_irq_parse(struct platform_device *parent,
29 +static int bcma_of_irq_parse(struct device *parent,
30                              struct bcma_device *core,
31                              struct of_phandle_args *out_irq, int num)
32  {
33 @@ -169,7 +169,7 @@ static int bcma_of_irq_parse(struct plat
34                         return rc;
35         }
36  
37 -       out_irq->np = parent->dev.of_node;
38 +       out_irq->np = parent->of_node;
39         out_irq->args_count = 1;
40         out_irq->args[0] = num;
41  
42 @@ -177,13 +177,13 @@ static int bcma_of_irq_parse(struct plat
43         return of_irq_parse_raw(laddr, out_irq);
44  }
45  
46 -static unsigned int bcma_of_get_irq(struct platform_device *parent,
47 +static unsigned int bcma_of_get_irq(struct device *parent,
48                                     struct bcma_device *core, int num)
49  {
50         struct of_phandle_args out_irq;
51         int ret;
52  
53 -       if (!IS_ENABLED(CONFIG_OF_IRQ) || !parent || !parent->dev.of_node)
54 +       if (!IS_ENABLED(CONFIG_OF_IRQ) || !parent->of_node)
55                 return 0;
56  
57         ret = bcma_of_irq_parse(parent, core, &out_irq, num);
58 @@ -196,7 +196,7 @@ static unsigned int bcma_of_get_irq(stru
59         return irq_create_of_mapping(&out_irq);
60  }
61  
62 -static void bcma_of_fill_device(struct platform_device *parent,
63 +static void bcma_of_fill_device(struct device *parent,
64                                 struct bcma_device *core)
65  {
66         struct device_node *node;
67 @@ -227,7 +227,7 @@ unsigned int bcma_core_irq(struct bcma_d
68                         return mips_irq <= 4 ? mips_irq + 2 : 0;
69                 }
70                 if (bus->host_pdev)
71 -                       return bcma_of_get_irq(bus->host_pdev, core, num);
72 +                       return bcma_of_get_irq(&bus->host_pdev->dev, core, num);
73                 return 0;
74         case BCMA_HOSTTYPE_SDIO:
75                 return 0;
76 @@ -253,7 +253,8 @@ void bcma_prepare_core(struct bcma_bus *
77                 if (IS_ENABLED(CONFIG_OF) && bus->host_pdev) {
78                         core->dma_dev = &bus->host_pdev->dev;
79                         core->dev.parent = &bus->host_pdev->dev;
80 -                       bcma_of_fill_device(bus->host_pdev, core);
81 +                       if (core->dev.parent)
82 +                               bcma_of_fill_device(core->dev.parent, core);
83                 } else {
84                         core->dev.dma_mask = &core->dev.coherent_dma_mask;
85                         core->dma_dev = &core->dev;
86 @@ -633,8 +634,11 @@ static int bcma_device_probe(struct devi
87                                                drv);
88         int err = 0;
89  
90 +       get_device(dev);
91         if (adrv->probe)
92                 err = adrv->probe(core);
93 +       if (err)
94 +               put_device(dev);
95  
96         return err;
97  }
98 @@ -647,6 +651,7 @@ static int bcma_device_remove(struct dev
99  
100         if (adrv->remove)
101                 adrv->remove(core);
102 +       put_device(dev);
103  
104         return 0;
105  }