2
0

025-bcma-from-4.11.patch 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. -static struct device_node *bcma_of_find_child_device(struct platform_device *parent,
  7. +static struct device_node *bcma_of_find_child_device(struct device *parent,
  8. struct bcma_device *core)
  9. {
  10. struct device_node *node;
  11. u64 size;
  12. const __be32 *reg;
  13. - if (!parent || !parent->dev.of_node)
  14. + if (!parent->of_node)
  15. return NULL;
  16. - for_each_child_of_node(parent->dev.of_node, node) {
  17. + for_each_child_of_node(parent->of_node, node) {
  18. reg = of_get_address(node, 0, &size, NULL);
  19. if (!reg)
  20. continue;
  21. @@ -156,7 +156,7 @@ static struct device_node *bcma_of_find_
  22. return NULL;
  23. }
  24. -static int bcma_of_irq_parse(struct platform_device *parent,
  25. +static int bcma_of_irq_parse(struct device *parent,
  26. struct bcma_device *core,
  27. struct of_phandle_args *out_irq, int num)
  28. {
  29. @@ -169,7 +169,7 @@ static int bcma_of_irq_parse(struct plat
  30. return rc;
  31. }
  32. - out_irq->np = parent->dev.of_node;
  33. + out_irq->np = parent->of_node;
  34. out_irq->args_count = 1;
  35. out_irq->args[0] = num;
  36. @@ -177,13 +177,13 @@ static int bcma_of_irq_parse(struct plat
  37. return of_irq_parse_raw(laddr, out_irq);
  38. }
  39. -static unsigned int bcma_of_get_irq(struct platform_device *parent,
  40. +static unsigned int bcma_of_get_irq(struct device *parent,
  41. struct bcma_device *core, int num)
  42. {
  43. struct of_phandle_args out_irq;
  44. int ret;
  45. - if (!IS_ENABLED(CONFIG_OF_IRQ) || !parent || !parent->dev.of_node)
  46. + if (!IS_ENABLED(CONFIG_OF_IRQ) || !parent->of_node)
  47. return 0;
  48. ret = bcma_of_irq_parse(parent, core, &out_irq, num);
  49. @@ -196,7 +196,7 @@ static unsigned int bcma_of_get_irq(stru
  50. return irq_create_of_mapping(&out_irq);
  51. }
  52. -static void bcma_of_fill_device(struct platform_device *parent,
  53. +static void bcma_of_fill_device(struct device *parent,
  54. struct bcma_device *core)
  55. {
  56. struct device_node *node;
  57. @@ -227,7 +227,7 @@ unsigned int bcma_core_irq(struct bcma_d
  58. return mips_irq <= 4 ? mips_irq + 2 : 0;
  59. }
  60. if (bus->host_pdev)
  61. - return bcma_of_get_irq(bus->host_pdev, core, num);
  62. + return bcma_of_get_irq(&bus->host_pdev->dev, core, num);
  63. return 0;
  64. case BCMA_HOSTTYPE_SDIO:
  65. return 0;
  66. @@ -253,7 +253,8 @@ void bcma_prepare_core(struct bcma_bus *
  67. if (IS_ENABLED(CONFIG_OF) && bus->host_pdev) {
  68. core->dma_dev = &bus->host_pdev->dev;
  69. core->dev.parent = &bus->host_pdev->dev;
  70. - bcma_of_fill_device(bus->host_pdev, core);
  71. + if (core->dev.parent)
  72. + bcma_of_fill_device(core->dev.parent, core);
  73. } else {
  74. core->dev.dma_mask = &core->dev.coherent_dma_mask;
  75. core->dma_dev = &core->dev;
  76. @@ -633,8 +634,11 @@ static int bcma_device_probe(struct devi
  77. drv);
  78. int err = 0;
  79. + get_device(dev);
  80. if (adrv->probe)
  81. err = adrv->probe(core);
  82. + if (err)
  83. + put_device(dev);
  84. return err;
  85. }
  86. @@ -647,6 +651,7 @@ static int bcma_device_remove(struct dev
  87. if (adrv->remove)
  88. adrv->remove(core);
  89. + put_device(dev);
  90. return 0;
  91. }