Thread (17 messages) 17 messages, 5 authors, 2024-07-30

Re: [PATCH net-next V2 3/4] net: lan743x: Migrate phylib to phylink

From: "Russell King (Oracle)" <linux@armlinux.org.uk>
Date: 2024-07-30 11:29:35
Also in: lkml

On Tue, Jul 30, 2024 at 04:18:20PM +0530, Raju Lakkaraju wrote:
Ok. 
After change, i ran the checkpatch script. it's giving follwoing warning
i.e.
"CHECK: Comparison to NULL could be written "dn"" 

Is it OK ?
Assuming its referring to:

        return dn != NULL;

in a function that returns a bool, I find that utterly perverse, and I
suggest in this case ignoring checkpatch.
quoted
quoted
+static int lan743x_phylink_connect(struct lan743x_adapter *adapter)
+{
+     struct device_node *dn = adapter->pdev->dev.of_node;
+     struct net_device *dev = adapter->netdev;
+     struct fixed_phy_status fphy_status = {
+             .link = 1,
+             .speed = SPEED_1000,
+             .duplex = DUPLEX_FULL,
+     };
+     struct phy_device *phydev;
+     int ret;
+
+     if (dn)
+             ret = phylink_of_phy_connect(adapter->phylink, dn, 0);
+
+     if (!dn || (ret && !lan743x_phy_handle_exists(dn))) {
+             phydev = phy_find_first(adapter->mdiobus);
+             if (!phydev) {
+                     if (((adapter->csr.id_rev & ID_REV_ID_MASK_) ==
+                           ID_REV_ID_LAN7431_) || adapter->is_pci11x1x) {
+                             phydev = fixed_phy_register(PHY_POLL,
+                                                         &fphy_status,
+                                                         NULL);
+                             if (IS_ERR(phydev)) {
+                                     netdev_err(dev, "No PHY/fixed_PHY found\n");
+                                     return PTR_ERR(phydev);
+                             }
Eww. Given that phylink has its own internal fixed-PHY support, can we
not find some way to avoid the legacy fixed-PHY usage here?
Yes. I agree with you. This is very much valid suggestion.
Andrew also gave same suggestion.

Currently we don't have Device Tree support for LAN743X driver. 
For SFP support, I create the software-node an passing the paramters there.

I don't have fixed-PHY hardware setup currently.
I would like to take this as action item to fix it after SFP support commits.
Note that SFP shouldn't be using a fixed-phy at all.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help