]> git.itanic.dy.fi Git - linux-stable/commit
net: ethernet: ti: cpts: fix ethtool output when no ptp_clock registered
authorGrygorii Strashko <grygorii.strashko@ti.com>
Thu, 24 Dec 2020 16:24:05 +0000 (18:24 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 12 Jan 2021 19:16:14 +0000 (20:16 +0100)
commitc076e11985546db5e70210592c8baaf56e42e471
tree561d51dc82ff2f353a1d66384e77956d78649ba5
parent8602c20a9160503ef8576490c0e4f879790aeb5d
net: ethernet: ti: cpts: fix ethtool output when no ptp_clock registered

[ Upstream commit 4614792eebcbf81c60ad3604c1aeeb2b0899cea4 ]

The CPTS driver registers PTP PHC clock when first netif is going up and
unregister it when all netif are down. Now ethtool will show:
 - PTP PHC clock index 0 after boot until first netif is up;
 - the last assigned PTP PHC clock index even if PTP PHC clock is not
registered any more after all netifs are down.

This patch ensures that -1 is returned by ethtool when PTP PHC clock is not
registered any more.

Fixes: 8a2c9a5ab4b9 ("net: ethernet: ti: cpts: rework initialization/deinitialization")
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Link: https://lore.kernel.org/r/20201224162405.28032-1-grygorii.strashko@ti.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/ti/cpts.c