On 4/18/2024 9:28 PM, Rahul Rameshbabu wrote:

On Thu, 18 Apr, 2024 01:24:54 -0400 Mateusz Polchlopek 
<mateusz.polchlo...@intel.com> wrote:
From: Jacob Keller <jacob.e.kel...@intel.com>

Add the iavf_ptp.c file and fill it in with a skeleton framework to
allow registering the PTP clock device.
Add implementation of helper functions to check if a PTP capability
is supported and handle change in PTP capabilities.
Enabling virtual clock would be possible, though it would probably
perform poorly due to the lack of direct time access.

Reviewed-by: Sai Krishna <saikrish...@marvell.com>
Reviewed-by: Wojciech Drewek <wojciech.dre...@intel.com>
Signed-off-by: Jacob Keller <jacob.e.kel...@intel.com>
Co-developed-by: Ahmed Zaki <ahmed.z...@intel.com>
Signed-off-by: Ahmed Zaki <ahmed.z...@intel.com>
Co-developed-by: Mateusz Polchlopek <mateusz.polchlo...@intel.com>
Signed-off-by: Mateusz Polchlopek <mateusz.polchlo...@intel.com>
---
diff --git a/drivers/net/ethernet/intel/iavf/iavf_ptp.c 
b/drivers/net/ethernet/intel/iavf/iavf_ptp.c
<snip>
+/**
+ * iavf_ptp_release - Disable PTP support
+ * @adapter: private adapter structure
+ *
+ * Release all PTP resources that were previously initialized.
+ */
+void iavf_ptp_release(struct iavf_adapter *adapter)
+{
+       if (!IS_ERR_OR_NULL(adapter->ptp.clock)) {
+               dev_info(&adapter->pdev->dev, "removing PTP clock %s\n",
+                        adapter->ptp.info.name);
+               ptp_clock_unregister(adapter->ptp.clock);
+               adapter->ptp.clock = NULL;
+       }
+
+       adapter->ptp.initialized = false;

I think teardown should be LIFO order to initialization. I would move
this line to the beginning of the function before any resources are
actually released.


Not really sure if this is applicable here. I understand Your point with
LIFO but in my opinion at the beginning we should unregister PTP clock
and when done - set the flag to false;

+}

<snip>

--
Thanks,

Rahul Rameshbabu

Reply via email to