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 2/3] can: peak_canfd: convert to use ndo_hwtstamp callbacks
Date: Wed, 29 Oct 2025 23:16:19 +0000 [thread overview]
Message-ID: <20251029231620.1135640-3-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/peak_canfd/peak_canfd.c | 35 +++++++++++--------------
1 file changed, 16 insertions(+), 19 deletions(-)
diff --git a/drivers/net/can/peak_canfd/peak_canfd.c b/drivers/net/can/peak_canfd/peak_canfd.c
index a53c9d347b7b..06cb2629f66a 100644
--- a/drivers/net/can/peak_canfd/peak_canfd.c
+++ b/drivers/net/can/peak_canfd/peak_canfd.c
@@ -743,36 +743,33 @@ static netdev_tx_t peak_canfd_start_xmit(struct sk_buff *skb,
return NETDEV_TX_OK;
}
-static int peak_eth_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
+static int peak_eth_hwtstamp_get(struct net_device *netdev,
+ struct kernel_hwtstamp_config *config)
{
- struct hwtstamp_config hwts_cfg = { 0 };
+ config->tx_type = HWTSTAMP_TX_OFF;
+ config->rx_filter = HWTSTAMP_FILTER_ALL;
- 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;
+ return 0;
+}
- 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;
+static int peak_eth_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_canfd_netdev_ops = {
.ndo_open = peak_canfd_open,
.ndo_stop = peak_canfd_close,
- .ndo_eth_ioctl = peak_eth_ioctl,
.ndo_start_xmit = peak_canfd_start_xmit,
+ .ndo_hwtstamp_get = peak_eth_hwtstamp_get,
+ .ndo_hwtstamp_set = peak_eth_hwtstamp_set,
};
static int peak_get_ts_info(struct net_device *dev,
--
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 ` Vadim Fedorenko [this message]
2025-10-30 17:04 ` [PATCH net-next 2/3] can: peak_canfd: convert to use " Kory Maincent
2025-10-29 23:16 ` [PATCH net-next 3/3] can: peak_usb: " Vadim Fedorenko
2025-10-30 17:05 ` 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-3-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).