]> git.baikalelectronics.ru Git - kernel.git/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)
committerJakub Kicinski <kuba@kernel.org>
Mon, 28 Dec 2020 21:32:34 +0000 (13:32 -0800)
commit4d2b0954f9ab8ef5f5eba97d9b0f849c08d2bd23
tree021179a47711a66b7afaec858b327b343c5fed28
parentcec8b771fd430f4ac36fbc568e71e1f1f24b468d
net: ethernet: ti: cpts: fix ethtool output when no ptp_clock registered

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: 28f5ff373868 ("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>
drivers/net/ethernet/ti/cpts.c