Message ID | 20190623223508.2713-6-marex@denx.de |
---|---|
State | Changes Requested |
Delegated to: | David Miller |
Headers | show |
Series | net: dsa: microchip: Convert to regmap | expand |
On 6/24/19 5:20 AM, Andrew Lunn wrote: > On Mon, Jun 24, 2019 at 12:35:03AM +0200, Marek Vasut wrote: >> The indirect function call to dev->dev_ops->get_port_addr() is expensive >> especially if called for every single register access, and only returns >> the value of PORT_CTRL_ADDR() macro. Use PORT_CTRL_ADDR() macro directly >> instead. > > Hi Marek > > Rather than change just one instance, it would be better to change > them all. And then remove dev_ops->get_port_addr(). So that actually doesn't work. The rest of the calls are in common code (ksz_common.h) and I plan to add the KSZ8795, which has different spacing between the ports, so those have to stay. Although, depending on how things look, I will do more regmap cleanups, the driver needs it. Since I have the KSZ9477 devkit, that also makes it much easier to test the changes. I think inlining those custom accessors would be high on the list, because they are just a mess. But that's for another series.
diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c index e8b96566abd9..7d209fd9f26f 100644 --- a/drivers/net/dsa/microchip/ksz9477.c +++ b/drivers/net/dsa/microchip/ksz9477.c @@ -83,7 +83,7 @@ static void ksz_port_cfg(struct ksz_device *dev, int port, int offset, u8 bits, u32 addr; u8 data; - addr = dev->dev_ops->get_port_addr(port, offset); + addr = PORT_CTRL_ADDR(port, offset); ksz_read8(dev, addr, &data); if (set)
The indirect function call to dev->dev_ops->get_port_addr() is expensive especially if called for every single register access, and only returns the value of PORT_CTRL_ADDR() macro. Use PORT_CTRL_ADDR() macro directly instead. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Andrew Lunn <andrew@lunn.ch> Cc: Florian Fainelli <f.fainelli@gmail.com> Cc: Tristram Ha <Tristram.Ha@microchip.com> Cc: Woojung Huh <Woojung.Huh@microchip.com> --- V2: New patch V3: - Rebase on next/master - Test on KSZ9477EVB --- drivers/net/dsa/microchip/ksz9477.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)