Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 01414802 authored by Ben Hutchings's avatar Ben Hutchings Committed by David S. Miller
Browse files

ethtool: Provide a default implementation of ethtool_ops::get_drvinfo



The driver name and bus address for a net_device can normally be found
through the driver model now.  Instead of requiring drivers to provide
this information redundantly through the ethtool_ops::get_drvinfo
operation, use the driver model to do so if the driver does not define
the operation.  Since ETHTOOL_GDRVINFO no longer requires the driver
to implement any operations, do not require net_device::ethtool_ops to
be set either.

Remove implementations of get_drvinfo and ethtool_ops that provide
only this information.

Signed-off-by: default avatarBen Hutchings <bhutchings@solarflare.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent bb8a10bb
Loading
Loading
Loading
Loading
+0 −13
Original line number Diff line number Diff line
@@ -8,7 +8,6 @@

#include <linux/bug.h>
#include <linux/device.h>
#include <linux/ethtool.h>
#include <linux/firewire.h>
#include <linux/firewire-constants.h>
#include <linux/highmem.h>
@@ -1359,17 +1358,6 @@ static int fwnet_change_mtu(struct net_device *net, int new_mtu)
	return 0;
}

static void fwnet_get_drvinfo(struct net_device *net,
			      struct ethtool_drvinfo *info)
{
	strcpy(info->driver, KBUILD_MODNAME);
	strcpy(info->bus_info, "ieee1394");
}

static const struct ethtool_ops fwnet_ethtool_ops = {
	.get_drvinfo = fwnet_get_drvinfo,
};

static const struct net_device_ops fwnet_netdev_ops = {
	.ndo_open       = fwnet_open,
	.ndo_stop	= fwnet_stop,
@@ -1388,7 +1376,6 @@ static void fwnet_init_dev(struct net_device *net)
	net->hard_header_len	= FWNET_HLEN;
	net->type		= ARPHRD_IEEE1394;
	net->tx_queue_len	= 10;
	SET_ETHTOOL_OPS(net, &fwnet_ethtool_ops);
}

/* caller must hold fwnet_device_mutex */
+0 −16
Original line number Diff line number Diff line
@@ -58,7 +58,6 @@
#include <linux/tcp.h>
#include <linux/skbuff.h>
#include <linux/bitops.h>
#include <linux/ethtool.h>
#include <asm/uaccess.h>
#include <asm/delay.h>
#include <asm/unaligned.h>
@@ -173,8 +172,6 @@ static netdev_tx_t ether1394_tx(struct sk_buff *skb,
				struct net_device *dev);
static void ether1394_iso(struct hpsb_iso *iso);

static const struct ethtool_ops ethtool_ops;

static int ether1394_write(struct hpsb_host *host, int srcid, int destid,
			   quadlet_t *data, u64 addr, size_t len, u16 flags);
static void ether1394_add_host(struct hpsb_host *host);
@@ -525,8 +522,6 @@ static void ether1394_init_dev(struct net_device *dev)
	dev->header_ops		= &ether1394_header_ops;
	dev->netdev_ops		= &ether1394_netdev_ops;

	SET_ETHTOOL_OPS(dev, &ethtool_ops);

	dev->watchdog_timeo	= ETHER1394_TIMEOUT;
	dev->flags		= IFF_BROADCAST | IFF_MULTICAST;
	dev->features		= NETIF_F_HIGHDMA;
@@ -1695,17 +1690,6 @@ fail:
	return NETDEV_TX_OK;
}

static void ether1394_get_drvinfo(struct net_device *dev,
				  struct ethtool_drvinfo *info)
{
	strcpy(info->driver, driver_name);
	strcpy(info->bus_info, "ieee1394"); /* FIXME provide more detail? */
}

static const struct ethtool_ops ethtool_ops = {
	.get_drvinfo = ether1394_get_drvinfo
};

static int __init ether1394_init_module(void)
{
	int err;
+0 −7
Original line number Diff line number Diff line
@@ -1233,15 +1233,8 @@ static void bmac_reset_and_enable(struct net_device *dev)
	}
	spin_unlock_irqrestore(&bp->lock, flags);
}
static void bmac_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
{
	struct bmac_data *bp = netdev_priv(dev);
	strcpy(info->driver, "bmac");
	strcpy(info->bus_info, dev_name(&bp->mdev->ofdev.dev));
}

static const struct ethtool_ops bmac_ethtool_ops = {
	.get_drvinfo		= bmac_get_drvinfo,
	.get_link		= ethtool_op_get_link,
};

+0 −6
Original line number Diff line number Diff line
@@ -771,11 +771,6 @@ static void mpc52xx_fec_reset(struct net_device *dev)


/* ethtool interface */
static void mpc52xx_fec_get_drvinfo(struct net_device *dev,
		struct ethtool_drvinfo *info)
{
	strcpy(info->driver, DRIVER_NAME);
}

static int mpc52xx_fec_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
{
@@ -810,7 +805,6 @@ static void mpc52xx_fec_set_msglevel(struct net_device *dev, u32 level)
}

static const struct ethtool_ops mpc52xx_fec_ethtool_ops = {
	.get_drvinfo = mpc52xx_fec_get_drvinfo,
	.get_settings = mpc52xx_fec_get_settings,
	.set_settings = mpc52xx_fec_set_settings,
	.get_link = ethtool_op_get_link,
+0 −16
Original line number Diff line number Diff line
@@ -90,21 +90,6 @@ pasemi_mac_ethtool_set_settings(struct net_device *netdev,
	return phy_ethtool_sset(phydev, cmd);
}

static void
pasemi_mac_ethtool_get_drvinfo(struct net_device *netdev,
			       struct ethtool_drvinfo *drvinfo)
{
	struct pasemi_mac *mac;
	mac = netdev_priv(netdev);

	/* clear and fill out info */
	memset(drvinfo, 0, sizeof(struct ethtool_drvinfo));
	strncpy(drvinfo->driver, "pasemi_mac", 12);
	strcpy(drvinfo->version, "N/A");
	strcpy(drvinfo->fw_version, "N/A");
	strncpy(drvinfo->bus_info, pci_name(mac->pdev), 32);
}

static u32
pasemi_mac_ethtool_get_msglevel(struct net_device *netdev)
{
@@ -164,7 +149,6 @@ static void pasemi_mac_get_strings(struct net_device *netdev, u32 stringset,
const struct ethtool_ops pasemi_mac_ethtool_ops = {
	.get_settings		= pasemi_mac_ethtool_get_settings,
	.set_settings		= pasemi_mac_ethtool_set_settings,
	.get_drvinfo		= pasemi_mac_ethtool_get_drvinfo,
	.get_msglevel		= pasemi_mac_ethtool_get_msglevel,
	.set_msglevel		= pasemi_mac_ethtool_set_msglevel,
	.get_link		= ethtool_op_get_link,
Loading