]> www.infradead.org Git - users/jedix/linux-maple.git/commit
net: stmmac: stm32: simplify clock handling
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Mon, 7 Apr 2025 19:15:35 +0000 (20:15 +0100)
committerDavid S. Miller <davem@davemloft.net>
Fri, 11 Apr 2025 08:38:49 +0000 (09:38 +0100)
commit61499764e5cc5918c9f63026d3b7a34c8668d4b8
tree3748cadc544aeb611fd246d690c9a95cd1169956
parent0c49baf099ba2147a6ff3bbdc3197c6ddbee5469
net: stmmac: stm32: simplify clock handling

Some stm32 implementations need the receive clock running in suspend,
as indicated by dwmac->ops->clk_rx_enable_in_suspend. The existing
code achieved this in a rather complex way, by passing a flag around.

However, the clk API prepare/enables are counted - which means that a
clock won't be stopped as long as there are more prepare and enables
than disables and unprepares, just like a reference count.

Therefore, we can simplify this logic by calling clk_prepare_enable()
an additional time in the probe function if this flag is set, and then
balancing that at remove time.

With this, we can avoid passing a "are we suspending" and "are we
resuming" flag to various functions in the driver.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c