From: Vadim Fedorenko <vadim.fedorenko@linux.dev>
To: "Marc Kleine-Budde" <mkl@pengutronix.de>,
"Vincent Mailhol" <mailhol@kernel.org>,
"Stefan Mätje" <stefan.maetje@esd.eu>,
socketcan@esd.eu, "Manivannan Sadhasivam" <mani@kernel.org>,
"Thomas Kopp" <thomas.kopp@microchip.com>,
"Oliver Hartkopp" <socketcan@hartkopp.net>,
"Jimmy Assarsson" <extja@kvaser.com>,
"Axel Forsman" <axfo@kvaser.com>,
"Vadim Fedorenko" <vadim.fedorenko@linux.dev>
Cc: linux-can@vger.kernel.org, netdev@vger.kernel.org,
Jakub Kicinski <kuba@kernel.org>,
Vladimir Oltean <vladimir.oltean@nxp.com>,
Kory Maincent <kory.maincent@bootlin.com>,
Jacob Keller <jacob.e.keller@intel.com>
Subject: [PATCH net-next 3/3] can: peak_usb: convert to use ndo_hwtstamp callbacks
Date: Wed, 29 Oct 2025 23:16:20 +0000 [thread overview]
Message-ID: <20251029231620.1135640-4-vadim.fedorenko@linux.dev> (raw)
In-Reply-To: <20251029231620.1135640-1-vadim.fedorenko@linux.dev>
Convert driver to use ndo_hwtstamp_set()/ndo_hwtstamp_get() callbacks.
ndo_eth_ioctl handler does nothing after conversion - remove it.
Signed-off-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
---
drivers/net/can/usb/peak_usb/pcan_usb_core.c | 39 +++++++++-----------
1 file changed, 18 insertions(+), 21 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 94b1d7f15d27..cf48bb26d46d 100644
--- a/drivers/net/can/usb/peak_usb/pcan_usb_core.c
+++ b/drivers/net/can/usb/peak_usb/pcan_usb_core.c
@@ -784,36 +784,33 @@ static int peak_usb_set_data_bittiming(struct net_device *netdev)
return 0;
}
-static int peak_eth_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
+static int peak_hwtstamp_get(struct net_device *netdev,
+ struct kernel_hwtstamp_config *config)
{
- struct hwtstamp_config hwts_cfg = { 0 };
-
- switch (cmd) {
- case SIOCSHWTSTAMP: /* set */
- if (copy_from_user(&hwts_cfg, ifr->ifr_data, sizeof(hwts_cfg)))
- return -EFAULT;
- if (hwts_cfg.tx_type == HWTSTAMP_TX_OFF &&
- hwts_cfg.rx_filter == HWTSTAMP_FILTER_ALL)
- return 0;
- return -ERANGE;
-
- case SIOCGHWTSTAMP: /* get */
- hwts_cfg.tx_type = HWTSTAMP_TX_OFF;
- hwts_cfg.rx_filter = HWTSTAMP_FILTER_ALL;
- if (copy_to_user(ifr->ifr_data, &hwts_cfg, sizeof(hwts_cfg)))
- return -EFAULT;
+ config->tx_type = HWTSTAMP_TX_OFF;
+ config->rx_filter = HWTSTAMP_FILTER_ALL;
+
+ return 0;
+}
+
+static int peak_hwtstamp_set(struct net_device *netdev,
+ struct kernel_hwtstamp_config *config,
+ struct netlink_ext_ack *extack)
+{
+ if (config->tx_type == HWTSTAMP_TX_OFF &&
+ config->rx_filter == HWTSTAMP_FILTER_ALL)
return 0;
- default:
- return -EOPNOTSUPP;
- }
+ NL_SET_ERR_MSG_MOD(extack, "Only RX HWTSTAMP_FILTER_ALL is supported");
+ return -ERANGE;
}
static const struct net_device_ops peak_usb_netdev_ops = {
.ndo_open = peak_usb_ndo_open,
.ndo_stop = peak_usb_ndo_stop,
- .ndo_eth_ioctl = peak_eth_ioctl,
.ndo_start_xmit = peak_usb_ndo_start_xmit,
+ .ndo_hwtstamp_get = peak_hwtstamp_get,
+ .ndo_hwtstamp_set = peak_hwtstamp_set,
};
/* CAN-USB devices generally handle 32-bit CAN channel IDs.
--
2.47.3
next prev parent reply other threads:[~2025-10-29 23:16 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-29 23:16 [PATCH net-next 0/3] convert can drivers to use ndo_hwtstamp callbacks Vadim Fedorenko
2025-10-29 23:16 ` [PATCH net-next 1/3] can: convert generic HW timestamp ioctl to " Vadim Fedorenko
2025-10-30 17:01 ` Kory Maincent
2025-10-29 23:16 ` [PATCH net-next 2/3] can: peak_canfd: convert to use " Vadim Fedorenko
2025-10-30 17:04 ` Kory Maincent
2025-10-29 23:16 ` Vadim Fedorenko [this message]
2025-10-30 17:05 ` [PATCH net-next 3/3] can: peak_usb: " Kory Maincent
2025-10-30 6:36 ` [PATCH net-next 0/3] convert can drivers " Vincent Mailhol
2025-10-31 12:19 ` Marc Kleine-Budde
2025-11-12 8:45 ` Marc Kleine-Budde
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251029231620.1135640-4-vadim.fedorenko@linux.dev \
--to=vadim.fedorenko@linux.dev \
--cc=axfo@kvaser.com \
--cc=extja@kvaser.com \
--cc=jacob.e.keller@intel.com \
--cc=kory.maincent@bootlin.com \
--cc=kuba@kernel.org \
--cc=linux-can@vger.kernel.org \
--cc=mailhol@kernel.org \
--cc=mani@kernel.org \
--cc=mkl@pengutronix.de \
--cc=netdev@vger.kernel.org \
--cc=socketcan@esd.eu \
--cc=socketcan@hartkopp.net \
--cc=stefan.maetje@esd.eu \
--cc=thomas.kopp@microchip.com \
--cc=vladimir.oltean@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.