]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: stmmac: intel: only populate plat->crosststamp when supported
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Wed, 3 Sep 2025 14:00:56 +0000 (15:00 +0100)
committerJakub Kicinski <kuba@kernel.org>
Sat, 6 Sep 2025 01:45:19 +0000 (18:45 -0700)
To allow the ptp_chardev code to correctly detect whether crosststamps
are supported, we need to conditionally populate the .getcrosststamp()
method. As the previous patch implements that functionality by
detecting whether the platform glue provides a crosststamp() method,
arrange for the dwmac-intel code to only populate this if the X86
ART feature is present, rather than testing for it at runtime in
intel_crosststamp().

This reflects what other x86 PTP clock drivers do, e.g.
ice_ptp_set_funcs_e830(), e1000e_ptp_init(), idpf_ptp_set_caps() etc.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://patch.msgid.link/E1uto2i-00000001seA-0lxv@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c

index 3fac3945cbfa78091e12c53cf6db81bdc4fb1b4f..3ff271b097ea50bf9a0a52426c591b8a66f32402 100644 (file)
@@ -371,9 +371,6 @@ static int intel_crosststamp(ktime_t *device,
        u32 acr_value;
        int i;
 
-       if (!boot_cpu_has(X86_FEATURE_ART))
-               return -EOPNOTSUPP;
-
        intel_priv = priv->plat->bsp_priv;
 
        /* Both internal crosstimestamping and external triggered event
@@ -755,7 +752,9 @@ static int intel_mgbe_common_data(struct pci_dev *pdev,
 
        plat->int_snapshot_num = AUX_SNAPSHOT1;
 
-       plat->crosststamp = intel_crosststamp;
+       if (boot_cpu_has(X86_FEATURE_ART))
+               plat->crosststamp = intel_crosststamp;
+
        plat->flags &= ~STMMAC_FLAG_INT_SNAPSHOT_EN;
 
        /* Setup MSI vector offset specific to Intel mGbE controller */