Skip to contentSkip to conversation

PCI: aspeed: Switch to irq_domain_create_linear()

PATCH Applied Jiri Slaby (SUSE) 3 participants 4 messages Jul 8 – Jul 20

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI: aspeed: Switch to irq_domain_create_linear()

irq_domain_add_linear() is going away as being obsolete now. Switch to the preferred irq_domain_create_linear(). That differs in the first
parameter: It takes more generic struct fwnode_handle instead of struct device_node. Therefore, of_fwnode_handle() is added around the parameter.

Note some of the users can likely use dev->fwnode directly instead of indirect of_fwnode_handle(dev->of_node). But dev->fwnode is not guaranteed to be set for all, so this has to be investigated on case to case basis (by people who can actually test with the HW).

Cc Thomas Gleixner <[email protected]>
Cc Jacky Chou <[email protected]>

---
Cc: Lorenzo Pieralisi <[email protected]>
Cc: "Krzysztof Wilczyński" <[email protected]>
Cc: Manivannan Sadhasivam <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Bjorn Helgaas <[email protected]>
Cc: Joel Stanley <[email protected]>
Cc: Andrew Jeffery <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
 drivers/pci/controller/pcie-aspeed.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/pci/controller/pcie-aspeed.c +4 -4
index 9aa9e14c6148..74b03a55643f 100644
@@ -725,10 +725,10 @@ static int aspeed_pcie_init_irq_domain(struct aspeed_pcie *pcie)
 {
 	int ret;
 
-	pcie->intx_domain = irq_domain_add_linear(pcie->dev->of_node,
-						  PCI_NUM_INTX,
-						  &aspeed_intx_domain_ops,
-						  pcie);
+	pcie->intx_domain = irq_domain_create_linear(dev_fwnode(pcie->dev),
+						     PCI_NUM_INTX,
+						     &aspeed_intx_domain_ops,
+						     pcie);
 	if (!pcie->intx_domain) {
 		ret = dev_err_probe(pcie->dev, -ENOMEM,
 				    "failed to get INTx IRQ domain\n");
Signature · 1 line
2.55.0
#1 lore raw
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] The commit message claims to use `of_fwnode_handle()`, but the code actually uses…

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The commit message claims to use of_fwnode_handle(), but the code actually uses dev_fwnode(). --

--- Patch [1]: [PATCH] PCI: aspeed: Switch to irq_domain_create_linear() --- commit aee46b37ad2da511a238368770cbd10115b36171
Author: Jiri Slaby (SUSE) <[email protected]>

PCI: aspeed: Switch to irq_domain_create_linear()

This commit updates the driver to use the modern irq_domain_create_linear() function instead of the obsolete irq_domain_add_linear(). It adjusts the first parameter to pass a fwnode_handle rather than a device_node.

Quoted 17 lines

irq_domain_add_linear() is going away as being obsolete now. Switch to the preferred irq_domain_create_linear(). That differs in the first
parameter: It takes more generic struct fwnode_handle instead of struct device_node. Therefore, of_fwnode_handle() is added around the parameter.

Note some of the users can likely use dev->fwnode directly instead of indirect of_fwnode_handle(dev->of_node). But dev->fwnode is not guaranteed to be set for all, so this has to be investigated on case to case basis (by people who can actually test with the HW).

drivers/pci/controller/pcie-aspeed.c +0 -0
index 9aa9e14c61484..74b03a55643fa 100644
@@ -725,10 +725,10 @@ static int aspeed_pcie_init_irq_domain(struct aspeed_pcie *pcie)
 {

drivers/pci/controller/pcie-aspeed.c static int aspeed_pcie_init_irq_domain(struct aspeed_pcie *pcie) · line 731

Quoted 10 lines
drivers/pci/controller/pcie-aspeed.c +4 -4
 	int ret;
 
-	pcie->intx_domain = irq_domain_add_linear(pcie->dev->of_node,
-						  PCI_NUM_INTX,
-						  &aspeed_intx_domain_ops,
-						  pcie);
+	pcie->intx_domain = irq_domain_create_linear(dev_fwnode(pcie->dev),
+						     PCI_NUM_INTX,
+						     &aspeed_intx_domain_ops,
+						     pcie);

[Severity: Medium]
Does this code change contradict the commit message?

The commit message explicitly mentions adding of_fwnode_handle() around the parameter and warns against using dev->fwnode directly since it is not guaranteed to be set.

The patch uses dev_fwnode(pcie->dev) here, which fetches dev->fwnode, rather than using of_fwnode_handle(pcie->dev->of_node) as described. Should the implementation be updated to use of_fwnode_handle(), or does the commit message need to be revised to match this dev_fwnode() approach?

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
author
#2 lore raw
Quoted 45 lines · On 08. 07. 26, 12:04, [email protected] wrote:

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The commit message claims to use of_fwnode_handle(), but the code actually uses dev_fwnode(). --

--- Patch [1]: [PATCH] PCI: aspeed: Switch to irq_domain_create_linear() --- commit aee46b37ad2da511a238368770cbd10115b36171
Author: Jiri Slaby (SUSE) <[email protected]>

PCI: aspeed: Switch to irq_domain_create_linear()

This commit updates the driver to use the modern irq_domain_create_linear() function instead of the obsolete irq_domain_add_linear(). It adjusts the first parameter to pass a fwnode_handle rather than a device_node.

Quoted 17 lines

irq_domain_add_linear() is going away as being obsolete now. Switch to the preferred irq_domain_create_linear(). That differs in the first
parameter: It takes more generic struct fwnode_handle instead of struct device_node. Therefore, of_fwnode_handle() is added around the parameter.

Note some of the users can likely use dev->fwnode directly instead of indirect of_fwnode_handle(dev->of_node). But dev->fwnode is not guaranteed to be set for all, so this has to be investigated on case to case basis (by people who can actually test with the HW).

drivers/pci/controller/pcie-aspeed.c +0 -0
index 9aa9e14c61484..74b03a55643fa 100644
@@ -725,10 +725,10 @@ static int aspeed_pcie_init_irq_domain(struct aspeed_pcie *pcie)
  {

drivers/pci/controller/pcie-aspeed.c static int aspeed_pcie_init_irq_domain(struct aspeed_pcie *pcie) · line 731

Quoted 10 lines
drivers/pci/controller/pcie-aspeed.c +4 -4
  	int ret;
 
-	pcie->intx_domain = irq_domain_add_linear(pcie->dev->of_node,
-						  PCI_NUM_INTX,
-						  &aspeed_intx_domain_ops,
-						  pcie);
+	pcie->intx_domain = irq_domain_create_linear(dev_fwnode(pcie->dev),
+						     PCI_NUM_INTX,
+						     &aspeed_intx_domain_ops,
+						     pcie);

[Severity: Medium]
Does this code change contradict the commit message?

Quoted 3 lines

The commit message explicitly mentions adding of_fwnode_handle() around the parameter and warns against using dev->fwnode directly since it is not guaranteed to be set.

Sashiko is right, I used a template for more patches...

Quoted 4 lines

The patch uses dev_fwnode(pcie->dev) here, which fetches dev->fwnode, rather than using of_fwnode_handle(pcie->dev->of_node) as described. Should the implementation be updated to use of_fwnode_handle(), or does the commit message need to be revised to match this dev_fwnode() approach?

In this very case, dev_fwnode(pcie->dev) is used in aspeed_pcie_msi_init(), called few lines below, so this is all right. The commit log is obsolete in this case though. Do you want me to resubmit?

thanks,

Signature · 2 lines
js
suse labs
maintainer Applied
#3 lore raw
In reply to Jiri Slaby (SUSE)
Quoted 6 lines · Jiri Slaby (SUSE)

irq_domain_add_linear() is going away as being obsolete now. Switch to the preferred irq_domain_create_linear(). That differs in the first
parameter: It takes more generic struct fwnode_handle instead of struct device_node. Therefore, of_fwnode_handle() is added around the parameter.

Quoted 6 lines

Note some of the users can likely use dev->fwnode directly instead of indirect of_fwnode_handle(dev->of_node). But dev->fwnode is not guaranteed to be set for all, so this has to be investigated on case to case basis (by people who can actually test with the HW).

[...]

Applied, thanks!

[1/1] PCI: aspeed: Switch to irq_domain_create_linear()

      commit: f944349dcbaeaa9d6e1c8f2f8182f5560ba79581

Best regards,

Signature · 1 line
மணிவண்ணன் சதாசிவம்