Skip to contentSkip to conversation

net: dsa: felix: allow the device to be disabled

PATCH RESEND Applied Michael Walle 4 participants 4 messages May 4, 2020

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

PATCH RESEND 1/1 net: dsa: felix: allow the device to be disabled

If there is no specific configuration of the felix switch in the device tree, but only the default configuration (ie. given by the SoCs dtsi file), the probe fails because no CPU port has been set. On the other hand you cannot set a default CPU port because that depends on the actual board using the switch.

[    2.701300] DSA: tree 0 has no CPU port
[    2.705167] mscc_felix 0000:00:00.5: Failed to register DSA switch: -22
[    2.711844] mscc_felix: probe of 0000:00:00.5 failed with error -22

Thus let the device tree disable this device entirely, like it is also done with the enetc driver of the same SoC.

---
This was part of a two patch series. The second patch is already merged. This patch was never picked up, although it was Acked-by: David Miller, see:
https://lore.kernel.org/netdev/[email protected]/

Since there is no more dependency, this patch could go through the net-next queue.

 drivers/net/dsa/ocelot/felix.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/net/dsa/ocelot/felix.c +5 -0
index 69546383a382..531c7710063f 100644
@@ -699,6 +699,11 @@ static int felix_pci_probe(struct pci_dev *pdev,
 	struct felix *felix;
 	int err;
 
+	if (pdev->dev.of_node && !of_device_is_available(pdev->dev.of_node)) {
+		dev_info(&pdev->dev, "device is disabled, skipping\n");
+		return -ENODEV;
+	}
+
 	err = pci_enable_device(pdev);
 	if (err) {
 		dev_err(&pdev->dev, "device enable failed\n");
Signature · 1 line
2.20.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Michael Walle

If there is no specific configuration of the felix switch in the device tree, but only the default configuration (ie. given by the SoCs dtsi file), the probe fails because no CPU port has been set. On the other hand you cannot set a default CPU port because that depends on the actual board using the switch.

[    2.701300] DSA: tree 0 has no CPU port
[    2.705167] mscc_felix 0000:00:00.5: Failed to register DSA switch: -22
[    2.711844] mscc_felix: probe of 0000:00:00.5 failed with error -22
Quoted 5 lines

Thus let the device tree disable this device entirely, like it is also done with the enetc driver of the same SoC.

---

Quoted 28 lines

This was part of a two patch series. The second patch is already merged. This patch was never picked up, although it was Acked-by: David Miller, see:
https://lore.kernel.org/netdev/[email protected]/

Since there is no more dependency, this patch could go through the net-next queue.

 drivers/net/dsa/ocelot/felix.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/net/dsa/ocelot/felix.c +5 -1
index 69546383a382..531c7710063f 100644
@@ -699,6 +699,11 @@ static int felix_pci_probe(struct pci_dev *pdev,
        struct felix *felix;
        int err;
 
+       if (pdev->dev.of_node && !of_device_is_available(pdev->dev.of_node)) {
+               dev_info(&pdev->dev, "device is disabled, skipping\n");
+               return -ENODEV;
+       }
+
        err = pci_enable_device(pdev);
        if (err) {
                dev_err(&pdev->dev, "device enable failed\n");
--
Quoted 2 lines

2.20.1

Thanks, Michael!
-Vladimir

Reviewed-by on v1 1/1
#2 lore raw
In reply to Michael Walle
Quoted 6 lines · Michael Walle

If there is no specific configuration of the felix switch in the device tree, but only the default configuration (ie. given by the SoCs dtsi file), the probe fails because no CPU port has been set. On the other hand you cannot set a default CPU port because that depends on the actual board using the switch.

Quoted 8 lines
[    2.701300] DSA: tree 0 has no CPU port
[    2.705167] mscc_felix 0000:00:00.5: Failed to register DSA switch: -22
[    2.711844] mscc_felix: probe of 0000:00:00.5 failed with error -22

Thus let the device tree disable this device entirely, like it is also done with the enetc driver of the same SoC.

Signature · 1 line
Florian
maintainer Applied
#3 lore raw
In reply to Michael Walle

From: Michael Walle <[email protected]>
Date: Mon, 4 May 2020 18:52:28 +0200

Quoted 6 lines

If there is no specific configuration of the felix switch in the device tree, but only the default configuration (ie. given by the SoCs dtsi file), the probe fails because no CPU port has been set. On the other hand you cannot set a default CPU port because that depends on the actual board using the switch.

Quoted 8 lines
[    2.701300] DSA: tree 0 has no CPU port
[    2.705167] mscc_felix 0000:00:00.5: Failed to register DSA switch: -22
[    2.711844] mscc_felix: probe of 0000:00:00.5 failed with error -22

Thus let the device tree disable this device entirely, like it is also done with the enetc driver of the same SoC.

Applied, thank you.