850-0023-PCI-aardvark-Make-main-irq_chip-structure-a-static-d.patch 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. From 663b9f99bb35dbc0c7b685f71ee3668a60d31320 Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Marek=20Beh=C3=BAn?= <[email protected]>
  3. Date: Mon, 10 Jan 2022 02:02:00 +0100
  4. Subject: [PATCH] PCI: aardvark: Make main irq_chip structure a static driver
  5. structure
  6. MIME-Version: 1.0
  7. Content-Type: text/plain; charset=UTF-8
  8. Content-Transfer-Encoding: 8bit
  9. Marc Zyngier says [1] that we should use struct irq_chip as a global
  10. static struct in the driver. Even though the structure currently
  11. contains a dynamic member (parent_device), Marc says [2] that he plans
  12. to kill it and make the structure completely static.
  13. We have already converted others irq_chip structures in this driver in
  14. this way, but we omitted this one because the .name member is
  15. dynamically created from device's name, and the name is displayed in
  16. sysfs, so changing it would break sysfs ABI.
  17. The rationale for changing the name (to "advk-INT") in spite of sysfs
  18. ABI, and thus allowing to convert to a static structure, is that after
  19. the other changes we made in this series, the IRQ chip is basically
  20. something different: it no logner generates ERR and PME interrupts (they
  21. are generated by emulated bridge's rp_irq_chip).
  22. [1] https://lore.kernel.org/linux-pci/[email protected]/
  23. [2] https://lore.kernel.org/linux-pci/[email protected]/
  24. Signed-off-by: Marek Behún <[email protected]>
  25. ---
  26. drivers/pci/controller/pci-aardvark.c | 25 +++++++------------------
  27. 1 file changed, 7 insertions(+), 18 deletions(-)
  28. --- a/drivers/pci/controller/pci-aardvark.c
  29. +++ b/drivers/pci/controller/pci-aardvark.c
  30. @@ -282,7 +282,6 @@ struct advk_pcie {
  31. int irq;
  32. struct irq_domain *rp_irq_domain;
  33. struct irq_domain *irq_domain;
  34. - struct irq_chip irq_chip;
  35. raw_spinlock_t irq_lock;
  36. struct irq_domain *msi_domain;
  37. struct irq_domain *msi_inner_domain;
  38. @@ -1336,14 +1335,19 @@ static void advk_pcie_irq_unmask(struct
  39. raw_spin_unlock_irqrestore(&pcie->irq_lock, flags);
  40. }
  41. +static struct irq_chip advk_irq_chip = {
  42. + .name = "advk-INT",
  43. + .irq_mask = advk_pcie_irq_mask,
  44. + .irq_unmask = advk_pcie_irq_unmask,
  45. +};
  46. +
  47. static int advk_pcie_irq_map(struct irq_domain *h,
  48. unsigned int virq, irq_hw_number_t hwirq)
  49. {
  50. struct advk_pcie *pcie = h->host_data;
  51. irq_set_status_flags(virq, IRQ_LEVEL);
  52. - irq_set_chip_and_handler(virq, &pcie->irq_chip,
  53. - handle_level_irq);
  54. + irq_set_chip_and_handler(virq, &advk_irq_chip, handle_level_irq);
  55. irq_set_chip_data(virq, pcie);
  56. return 0;
  57. @@ -1402,7 +1406,6 @@ static int advk_pcie_init_irq_domain(str
  58. struct device *dev = &pcie->pdev->dev;
  59. struct device_node *node = dev->of_node;
  60. struct device_node *pcie_intc_node;
  61. - struct irq_chip *irq_chip;
  62. int ret = 0;
  63. raw_spin_lock_init(&pcie->irq_lock);
  64. @@ -1413,28 +1416,14 @@ static int advk_pcie_init_irq_domain(str
  65. return -ENODEV;
  66. }
  67. - irq_chip = &pcie->irq_chip;
  68. -
  69. - irq_chip->name = devm_kasprintf(dev, GFP_KERNEL, "%s-irq",
  70. - dev_name(dev));
  71. - if (!irq_chip->name) {
  72. - ret = -ENOMEM;
  73. - goto out_put_node;
  74. - }
  75. -
  76. - irq_chip->irq_mask = advk_pcie_irq_mask;
  77. - irq_chip->irq_unmask = advk_pcie_irq_unmask;
  78. -
  79. pcie->irq_domain =
  80. irq_domain_add_linear(pcie_intc_node, PCI_NUM_INTX,
  81. &advk_pcie_irq_domain_ops, pcie);
  82. if (!pcie->irq_domain) {
  83. dev_err(dev, "Failed to get a INTx IRQ domain\n");
  84. ret = -ENOMEM;
  85. - goto out_put_node;
  86. }
  87. -out_put_node:
  88. of_node_put(pcie_intc_node);
  89. return ret;
  90. }