All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] can: peak_usb: CANFD: remove unused timestamp infrastructure
@ 2021-10-18 12:32 Marc Kleine-Budde
  2021-10-20  7:14 ` Stéphane Grosjean
  0 siblings, 1 reply; 3+ messages in thread
From: Marc Kleine-Budde @ 2021-10-18 12:32 UTC (permalink / raw)
  To: linux-can; +Cc: Marc Kleine-Budde, Stephane Grosjean

With the support for full 64 bit timestamps the old timestamping
infrastructure is obsolete. This patch removes the left over bits.

Cc: Stephane Grosjean <s.grosjean@peak-system.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/usb/peak_usb/pcan_usb_core.c | 13 -----------
 drivers/net/can/usb/peak_usb/pcan_usb_core.h |  2 --
 drivers/net/can/usb/peak_usb/pcan_usb_fd.c   | 23 --------------------
 3 files changed, 38 deletions(-)

diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_core.c b/drivers/net/can/usb/peak_usb/pcan_usb_core.c
index 6107fef9f4a0..9411a76f315c 100644
--- a/drivers/net/can/usb/peak_usb/pcan_usb_core.c
+++ b/drivers/net/can/usb/peak_usb/pcan_usb_core.c
@@ -192,19 +192,6 @@ void peak_usb_get_ts_time(struct peak_time_ref *time_ref, u32 ts, ktime_t *time)
 	}
 }
 
-/*
- * post received skb after having set any hw timestamp
- */
-int peak_usb_netif_rx(struct sk_buff *skb,
-		      struct peak_time_ref *time_ref, u32 ts_low)
-{
-	struct skb_shared_hwtstamps *hwts = skb_hwtstamps(skb);
-
-	peak_usb_get_ts_time(time_ref, ts_low, &hwts->hwtstamp);
-
-	return netif_rx(skb);
-}
-
 /* post received skb with native 64-bit hw timestamp */
 int peak_usb_netif_rx_64(struct sk_buff *skb, u32 ts_low, u32 ts_high)
 {
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_core.h b/drivers/net/can/usb/peak_usb/pcan_usb_core.h
index daa19f57e742..ffc2be6ef881 100644
--- a/drivers/net/can/usb/peak_usb/pcan_usb_core.h
+++ b/drivers/net/can/usb/peak_usb/pcan_usb_core.h
@@ -141,8 +141,6 @@ void peak_usb_init_time_ref(struct peak_time_ref *time_ref,
 void peak_usb_update_ts_now(struct peak_time_ref *time_ref, u32 ts_now);
 void peak_usb_set_ts_now(struct peak_time_ref *time_ref, u32 ts_now);
 void peak_usb_get_ts_time(struct peak_time_ref *time_ref, u32 ts, ktime_t *tv);
-int peak_usb_netif_rx(struct sk_buff *skb,
-		      struct peak_time_ref *time_ref, u32 ts_low);
 int peak_usb_netif_rx_64(struct sk_buff *skb, u32 ts_low, u32 ts_high);
 void peak_usb_async_complete(struct urb *urb);
 void peak_usb_restart_complete(struct peak_usb_device *dev);
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_fd.c b/drivers/net/can/usb/peak_usb/pcan_usb_fd.c
index 2770087d4d5d..394f4959a515 100644
--- a/drivers/net/can/usb/peak_usb/pcan_usb_fd.c
+++ b/drivers/net/can/usb/peak_usb/pcan_usb_fd.c
@@ -50,8 +50,6 @@ struct __packed pcan_ufd_fw_info {
 struct pcan_usb_fd_if {
 	struct peak_usb_device	*dev[PCAN_USB_MAX_CHANNEL];
 	struct pcan_ufd_fw_info	fw_info;
-	struct peak_time_ref	time_ref;
-	int			cm_ignore_count;
 	int			dev_opened_count;
 };
 
@@ -642,19 +640,6 @@ static int pcan_usb_fd_decode_overrun(struct pcan_usb_fd_if *usb_if,
 	return 0;
 }
 
-/* handle USB calibration message */
-static void pcan_usb_fd_decode_ts(struct pcan_usb_fd_if *usb_if,
-				  struct pucan_msg *rx_msg)
-{
-	struct pcan_ufd_ts_msg *ts = (struct pcan_ufd_ts_msg *)rx_msg;
-
-	/* should wait until clock is stabilized */
-	if (usb_if->cm_ignore_count > 0)
-		usb_if->cm_ignore_count--;
-	else
-		peak_usb_set_ts_now(&usb_if->time_ref, le32_to_cpu(ts->ts_low));
-}
-
 /* callback for bulk IN urb */
 static int pcan_usb_fd_decode_buf(struct peak_usb_device *dev, struct urb *urb)
 {
@@ -695,7 +680,6 @@ static int pcan_usb_fd_decode_buf(struct peak_usb_device *dev, struct urb *urb)
 			break;
 
 		case PCAN_UFD_MSG_CALIBRATION:
-			pcan_usb_fd_decode_ts(usb_if, rx_msg);
 			break;
 
 		case PUCAN_MSG_ERROR:
@@ -811,10 +795,6 @@ static int pcan_usb_fd_start(struct peak_usb_device *dev)
 
 	/* opening first device: */
 	if (pdev->usb_if->dev_opened_count == 0) {
-		/* reset time_ref */
-		peak_usb_init_time_ref(&pdev->usb_if->time_ref,
-				       &pcan_usb_pro_fd);
-
 		/* enable USB calibration messages */
 		err = pcan_usb_fd_set_options(dev, 1,
 					      PUCAN_OPTION_ERROR,
@@ -880,9 +860,6 @@ static int pcan_usb_fd_init(struct peak_usb_device *dev)
 		if (!pdev->cmd_buffer_addr)
 			goto err_out_1;
 
-		/* number of ts msgs to ignore before taking one into account */
-		pdev->usb_if->cm_ignore_count = 5;
-
 		err = pcan_usb_pro_send_req(dev, PCAN_USBPRO_REQ_INFO,
 					    PCAN_USBPRO_INFO_FW,
 					    &pdev->usb_if->fw_info,
-- 
2.33.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-10-29 12:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-18 12:32 [RFC PATCH] can: peak_usb: CANFD: remove unused timestamp infrastructure Marc Kleine-Budde
2021-10-20  7:14 ` Stéphane Grosjean
2021-10-29 12:54   ` Marc Kleine-Budde

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.