]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: ethtool: avoid rebuilds on UTS_RELEASE change
authorJann Horn <jannh@google.com>
Tue, 20 Feb 2024 19:42:44 +0000 (20:42 +0100)
committerJakub Kicinski <kuba@kernel.org>
Sat, 24 Feb 2024 00:22:25 +0000 (16:22 -0800)
Currently, when you switch between branches or something like that and
rebuild, net/ethtool/ioctl.c has to be built again because it depends
on UTS_RELEASE.

By instead referencing a string variable stored in another object file,
this can be avoided.

Signed-off-by: Jann Horn <jannh@google.com>
Reviewed-by: John Garry <john.g.garry@oracle.com>
Link: https://lore.kernel.org/r/20240220194244.2056384-1-jannh@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ethtool/ioctl.c

index 1763e8b697e14b6aadef27d6ecc032a38eb84abf..b419969c0dcbbe5af9a7671a3579e205dda00f09 100644 (file)
 #include <linux/sched/signal.h>
 #include <linux/net.h>
 #include <linux/pm_runtime.h>
+#include <linux/utsname.h>
 #include <net/devlink.h>
 #include <net/ipv6.h>
 #include <net/xdp_sock_drv.h>
 #include <net/flow_offload.h>
 #include <linux/ethtool_netlink.h>
-#include <generated/utsrelease.h>
 #include "common.h"
 
 /* State held across locks and calls for commands which have devlink fallback */
@@ -713,7 +713,8 @@ ethtool_get_drvinfo(struct net_device *dev, struct ethtool_devlink_compat *rsp)
        struct device *parent = dev->dev.parent;
 
        rsp->info.cmd = ETHTOOL_GDRVINFO;
-       strscpy(rsp->info.version, UTS_RELEASE, sizeof(rsp->info.version));
+       strscpy(rsp->info.version, init_uts_ns.name.release,
+               sizeof(rsp->info.version));
        if (ops->get_drvinfo) {
                ops->get_drvinfo(dev, &rsp->info);
                if (!rsp->info.bus_info[0] && parent)