Thread (84 messages) 84 messages, 9 authors, 2022-06-25

Re: [net-next: PATCH 03/12] net: dsa: switch to device_/fwnode_ APIs

From: Marcin Wojtas <hidden>
Date: 2022-06-21 09:28:14
Also in: linux-acpi, lkml

pon., 20 cze 2022 o 19:41 Andy Shevchenko
[off-list ref] napisał(a):
On Mon, Jun 20, 2022 at 05:02:16PM +0200, Marcin Wojtas wrote:
quoted
In order to support both ACPI and DT, modify the generic
DSA code to use device_/fwnode_ equivalent routines.
No functional change is introduced by this patch.
...
quoted
      struct device_node      *dn;
What prevents us from removing this?
I left it to satisfy possible issues with backward compatibility - I
migrated mv88e6xxx, other DSA drivers still rely on of_* and may use
this field.
quoted
+     struct fwnode_handle    *fwnode;
...
quoted
-             dn = of_get_child_by_name(ds->dev->of_node, "mdio");
+             fwnode = fwnode_get_named_child_node(ds->dev->fwnode, "mdio");
The rule of thumb is avoid dereferencing fwnode from struct device. So
dev_fwnode(), but here it would be achieved by device_get_named_child_node().
Ok, thanks - will do for all occurences.
...
quoted
-static int dsa_switch_parse_of(struct dsa_switch *ds, struct device_node *dn)
+static int dsa_switch_parse_of(struct dsa_switch *ds, struct fwnode_handle *fwnode)
Shouldn't _of suffix be replaced by, let's say, _fw?
I thought about it and can perform such naming update in next iteration.
...
quoted
-     return dsa_switch_parse_ports_of(ds, dn);
+     return dsa_switch_parse_ports_of(ds, fwnode);
Ditto.

...
quoted
+     fwnode = ds->dev->fwnode;
dev_fwnode() or corresponding device_property_ API.
OK.
...
quoted
      slave_dev->dev.of_node = port->dn;
+     slave_dev->dev.fwnode = port->fwnode;
device_set_node()
OK.

Thanks,
Marcin
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help