[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <b11adcc241126d68c2509e65cddab7f06c23b80e.1634044267.git.leonro@nvidia.com>
Date: Tue, 12 Oct 2021 16:15:22 +0300
From: Leon Romanovsky <leon@...nel.org>
To: "David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>
Cc: Leon Romanovsky <leonro@...dia.com>,
Ido Schimmel <idosch@...dia.com>,
Ingo Molnar <mingo@...hat.com>, Jiri Pirko <jiri@...dia.com>,
linux-kernel@...r.kernel.org, linux-rdma@...r.kernel.org,
mlxsw@...dia.com, Moshe Shemesh <moshe@...dia.com>,
netdev@...r.kernel.org, Saeed Mahameed <saeedm@...dia.com>,
Salil Mehta <salil.mehta@...wei.com>,
Shay Drory <shayd@...dia.com>,
Steven Rostedt <rostedt@...dmis.org>,
Tariq Toukan <tariqt@...dia.com>,
Yisen Zhuang <yisen.zhuang@...wei.com>
Subject: [PATCH net-next v4 2/6] devlink: Move netdev_to_devlink helpers to devlink.c
From: Leon Romanovsky <leonro@...dia.com>
Both netdev_to_devlink and netdev_to_devlink_port are used in devlink.c
only, so move them in order to reduce their scope.
Signed-off-by: Leon Romanovsky <leonro@...dia.com>
---
include/net/devlink.h | 17 -----------------
net/core/devlink.c | 18 ++++++++++++++++++
2 files changed, 18 insertions(+), 17 deletions(-)
diff --git a/include/net/devlink.h b/include/net/devlink.h
index ae03eb1c6cc9..7f44ad14e5ed 100644
--- a/include/net/devlink.h
+++ b/include/net/devlink.h
@@ -1486,23 +1486,6 @@ void *devlink_priv(struct devlink *devlink);
struct devlink *priv_to_devlink(void *priv);
struct device *devlink_to_dev(const struct devlink *devlink);
-static inline struct devlink_port *
-netdev_to_devlink_port(struct net_device *dev)
-{
- if (dev->netdev_ops->ndo_get_devlink_port)
- return dev->netdev_ops->ndo_get_devlink_port(dev);
- return NULL;
-}
-
-static inline struct devlink *netdev_to_devlink(struct net_device *dev)
-{
- struct devlink_port *devlink_port = netdev_to_devlink_port(dev);
-
- if (devlink_port)
- return devlink_port->devlink;
- return NULL;
-}
-
struct ib_device;
struct net *devlink_net(const struct devlink *devlink);
diff --git a/net/core/devlink.c b/net/core/devlink.c
index 87d1766ebdbf..e9e908c4cfb4 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -11381,6 +11381,24 @@ static void __devlink_compat_running_version(struct devlink *devlink,
nlmsg_free(msg);
}
+static struct devlink_port *netdev_to_devlink_port(struct net_device *dev)
+{
+ if (!dev->netdev_ops->ndo_get_devlink_port)
+ return NULL;
+
+ return dev->netdev_ops->ndo_get_devlink_port(dev);
+}
+
+static struct devlink *netdev_to_devlink(struct net_device *dev)
+{
+ struct devlink_port *devlink_port = netdev_to_devlink_port(dev);
+
+ if (!devlink_port)
+ return NULL;
+
+ return devlink_port->devlink;
+}
+
void devlink_compat_running_version(struct net_device *dev,
char *buf, size_t len)
{
--
2.31.1
Powered by blists - more mailing lists