diff options
author | Rafał Miłecki <rafal@milecki.pl> | 2017-01-31 14:21:53 +0100 |
---|---|---|
committer | Rafał Miłecki <rafal@milecki.pl> | 2017-01-31 14:45:52 +0100 |
commit | e3849823e046a3c5f16d3f31e2b0b6d62351f8c2 (patch) | |
tree | 8fa757a01d8dca26ddeb7244e38c3a4919e829f6 /target/linux/generic | |
parent | 5f2a1ac59aa996cf749e27cea30aca4270a4ef9c (diff) | |
download | mtk-20170518-e3849823e046a3c5f16d3f31e2b0b6d62351f8c2.zip mtk-20170518-e3849823e046a3c5f16d3f31e2b0b6d62351f8c2.tar.gz mtk-20170518-e3849823e046a3c5f16d3f31e2b0b6d62351f8c2.tar.bz2 |
kernel: update bcma to fix devm memory leaks
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Diffstat (limited to 'target/linux/generic')
-rw-r--r-- | target/linux/generic/patches-4.4/023-bcma-from-4.9.patch | 26 | ||||
-rw-r--r-- | target/linux/generic/patches-4.4/025-bcma-from-4.11.patch | 105 |
2 files changed, 131 insertions, 0 deletions
diff --git a/target/linux/generic/patches-4.4/023-bcma-from-4.9.patch b/target/linux/generic/patches-4.4/023-bcma-from-4.9.patch index 0391bcb..027054c 100644 --- a/target/linux/generic/patches-4.4/023-bcma-from-4.9.patch +++ b/target/linux/generic/patches-4.4/023-bcma-from-4.9.patch @@ -80,3 +80,29 @@ /* Board types (on PCI usually equals to the subsystem dev id) */ /* BCM4313 */ +--- a/drivers/bcma/main.c ++++ b/drivers/bcma/main.c +@@ -209,6 +209,8 @@ static void bcma_of_fill_device(struct p + core->dev.of_node = node; + + core->irq = bcma_of_get_irq(parent, core, 0); ++ ++ of_dma_configure(&core->dev, node); + } + + unsigned int bcma_core_irq(struct bcma_device *core, int num) +@@ -248,12 +250,12 @@ void bcma_prepare_core(struct bcma_bus * + core->irq = bus->host_pci->irq; + break; + case BCMA_HOSTTYPE_SOC: +- core->dev.dma_mask = &core->dev.coherent_dma_mask; +- if (bus->host_pdev) { ++ if (IS_ENABLED(CONFIG_OF) && bus->host_pdev) { + core->dma_dev = &bus->host_pdev->dev; + core->dev.parent = &bus->host_pdev->dev; + bcma_of_fill_device(bus->host_pdev, core); + } else { ++ core->dev.dma_mask = &core->dev.coherent_dma_mask; + core->dma_dev = &core->dev; + } + break; diff --git a/target/linux/generic/patches-4.4/025-bcma-from-4.11.patch b/target/linux/generic/patches-4.4/025-bcma-from-4.11.patch new file mode 100644 index 0000000..d5bdd2d --- /dev/null +++ b/target/linux/generic/patches-4.4/025-bcma-from-4.11.patch @@ -0,0 +1,105 @@ +--- a/drivers/bcma/main.c ++++ b/drivers/bcma/main.c +@@ -136,17 +136,17 @@ static bool bcma_is_core_needed_early(u1 + return false; + } + +-static struct device_node *bcma_of_find_child_device(struct platform_device *parent, ++static struct device_node *bcma_of_find_child_device(struct device *parent, + struct bcma_device *core) + { + struct device_node *node; + u64 size; + const __be32 *reg; + +- if (!parent || !parent->dev.of_node) ++ if (!parent->of_node) + return NULL; + +- for_each_child_of_node(parent->dev.of_node, node) { ++ for_each_child_of_node(parent->of_node, node) { + reg = of_get_address(node, 0, &size, NULL); + if (!reg) + continue; +@@ -156,7 +156,7 @@ static struct device_node *bcma_of_find_ + return NULL; + } + +-static int bcma_of_irq_parse(struct platform_device *parent, ++static int bcma_of_irq_parse(struct device *parent, + struct bcma_device *core, + struct of_phandle_args *out_irq, int num) + { +@@ -169,7 +169,7 @@ static int bcma_of_irq_parse(struct plat + return rc; + } + +- out_irq->np = parent->dev.of_node; ++ out_irq->np = parent->of_node; + out_irq->args_count = 1; + out_irq->args[0] = num; + +@@ -177,13 +177,13 @@ static int bcma_of_irq_parse(struct plat + return of_irq_parse_raw(laddr, out_irq); + } + +-static unsigned int bcma_of_get_irq(struct platform_device *parent, ++static unsigned int bcma_of_get_irq(struct device *parent, + struct bcma_device *core, int num) + { + struct of_phandle_args out_irq; + int ret; + +- if (!IS_ENABLED(CONFIG_OF_IRQ) || !parent || !parent->dev.of_node) ++ if (!IS_ENABLED(CONFIG_OF_IRQ) || !parent->of_node) + return 0; + + ret = bcma_of_irq_parse(parent, core, &out_irq, num); +@@ -196,7 +196,7 @@ static unsigned int bcma_of_get_irq(stru + return irq_create_of_mapping(&out_irq); + } + +-static void bcma_of_fill_device(struct platform_device *parent, ++static void bcma_of_fill_device(struct device *parent, + struct bcma_device *core) + { + struct device_node *node; +@@ -227,7 +227,7 @@ unsigned int bcma_core_irq(struct bcma_d + return mips_irq <= 4 ? mips_irq + 2 : 0; + } + if (bus->host_pdev) +- return bcma_of_get_irq(bus->host_pdev, core, num); ++ return bcma_of_get_irq(&bus->host_pdev->dev, core, num); + return 0; + case BCMA_HOSTTYPE_SDIO: + return 0; +@@ -253,7 +253,8 @@ void bcma_prepare_core(struct bcma_bus * + if (IS_ENABLED(CONFIG_OF) && bus->host_pdev) { + core->dma_dev = &bus->host_pdev->dev; + core->dev.parent = &bus->host_pdev->dev; +- bcma_of_fill_device(bus->host_pdev, core); ++ if (core->dev.parent) ++ bcma_of_fill_device(core->dev.parent, core); + } else { + core->dev.dma_mask = &core->dev.coherent_dma_mask; + core->dma_dev = &core->dev; +@@ -633,8 +634,11 @@ static int bcma_device_probe(struct devi + drv); + int err = 0; + ++ get_device(dev); + if (adrv->probe) + err = adrv->probe(core); ++ if (err) ++ put_device(dev); + + return err; + } +@@ -647,6 +651,7 @@ static int bcma_device_remove(struct dev + + if (adrv->remove) + adrv->remove(core); ++ put_device(dev); + + return 0; + } |