summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2020-07-16 11:32:24 -0700
committerJakub Kicinski <kuba@kernel.org>2020-07-16 11:34:06 -0700
commit999cf8aeb6c9d4019659efe85ce0594808d071a6 (patch)
tree22e323bdd9a13987d359133b4c2ff5546068b43b
parent59632b220f2d61df274ed3a14a204e941051fdad (diff)
parent31bb1a560b2996f9953cfc232f6349d043aaab49 (diff)
Merge branch 'net-fec-a-few-improvements'
Sergey Organov says: ==================== net: fec: a few improvements This is a collection of simple improvements that reduce and/or simplify code. They got developed out of attempt to use DP83640 PTP PHY connected to built-in FEC (that has its own PTP support) of the iMX 6SX micro-controller. The primary bug-fix was now submitted separately, and this is the rest of the changes. NOTE: the patches are developed and tested on 4.9.146, and rebased on top of recent 'net-next/master', where, besides visual inspection, I only tested that they do compile. ==================== Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-rw-r--r--drivers/net/ethernet/freescale/fec_ptp.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c
index 945643c02615..93a86553147c 100644
--- a/drivers/net/ethernet/freescale/fec_ptp.c
+++ b/drivers/net/ethernet/freescale/fec_ptp.c
@@ -103,11 +103,6 @@ static int fec_ptp_enable_pps(struct fec_enet_private *fep, uint enable)
u64 ns;
val = 0;
- if (!(fep->hwts_tx_en || fep->hwts_rx_en)) {
- dev_err(&fep->pdev->dev, "No ptp stack is running\n");
- return -EINVAL;
- }
-
if (fep->pps_enable == enable)
return 0;
@@ -269,7 +264,7 @@ void fec_ptp_start_cyclecounter(struct net_device *ndev)
fep->cc.mult = FEC_CC_MULT;
/* reset the ns time counter */
- timecounter_init(&fep->tc, &fep->cc, ktime_to_ns(ktime_get_real()));
+ timecounter_init(&fep->tc, &fep->cc, 0);
spin_unlock_irqrestore(&fep->tmreg_lock, flags);
}
@@ -478,9 +473,7 @@ int fec_ptp_set(struct net_device *ndev, struct ifreq *ifr)
switch (config.rx_filter) {
case HWTSTAMP_FILTER_NONE:
- if (fep->hwts_rx_en)
- fep->hwts_rx_en = 0;
- config.rx_filter = HWTSTAMP_FILTER_NONE;
+ fep->hwts_rx_en = 0;
break;
default:
@@ -577,7 +570,7 @@ void fec_ptp_init(struct platform_device *pdev, int irq_idx)
int ret;
fep->ptp_caps.owner = THIS_MODULE;
- snprintf(fep->ptp_caps.name, 16, "fec ptp");
+ strlcpy(fep->ptp_caps.name, "fec ptp", sizeof(fep->ptp_caps.name));
fep->ptp_caps.max_adj = 250000000;
fep->ptp_caps.n_alarm = 0;