lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <55374edd-2698-6841-569c-cccf1151cfb1@gmail.com>
Date:   Thu, 12 Mar 2020 14:45:37 -0700
From:   Florian Fainelli <f.fainelli@...il.com>
To:     Vladimir Oltean <olteanv@...il.com>,
        Michael Walle <michael@...le.cc>
Cc:     "moderated list:ARM/Mediatek SoC support" 
        <linux-arm-kernel@...ts.infradead.org>, devicetree@...r.kernel.org,
        lkml <linux-kernel@...r.kernel.org>,
        netdev <netdev@...r.kernel.org>,
        "David S . Miller" <davem@...emloft.net>,
        Vivien Didelot <vivien.didelot@...il.com>,
        Andrew Lunn <andrew@...n.ch>,
        Claudiu Manoil <claudiu.manoil@....com>,
        Vladimir Oltean <vladimir.oltean@....com>,
        Rob Herring <robh+dt@...nel.org>, Li Yang <leoyang.li@....com>,
        Shawn Guo <shawnguo@...nel.org>
Subject: Re: [PATCH 1/2] net: dsa: felix: allow the device to be disabled

On 3/12/20 2:35 PM, Vladimir Oltean wrote:
> On Thu, 12 Mar 2020 at 18:44, Michael Walle <michael@...le.cc> wrote:
>>
>> 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.
>>
>> Signed-off-by: Michael Walle <michael@...le.cc>
>> ---
>>  drivers/net/dsa/ocelot/felix.c | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c
>> index 69546383a382..531c7710063f 100644
>> --- a/drivers/net/dsa/ocelot/felix.c
>> +++ b/drivers/net/dsa/ocelot/felix.c
>> @@ -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;
>> +       }
>> +
> 
> IMHO since DSA is already dependent on device tree for PHY bindings,
> it would make more sense to move this there:

Michael's solution makes more sense, as this is a driver specific
problem whereby you have a pci_dev instance that is created and does not
honor the status property provided in Device Tree. If you were to look
for a proper solution it would likely be within the PCI core actually.

No other DSA switch has that problem because they use the
I2C/SPI/platform_device/GPIO/whatever entry points into the driver model.
-- 
Florian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ