netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jouni Malinen <jkmaline@cc.hut.fi>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: netdev@oss.sgi.com
Subject: [PATCH] hostap: Use ethtool_ops
Date: Thu, 24 Mar 2005 19:23:14 -0800	[thread overview]
Message-ID: <20050325032314.GA8357@jm.kir.nu> (raw)

Convert ethtool ioctl handler to use ethtool_ops.

Signed-off-by: Jouni Malinen <jkmaline@cc.hut.fi>


Index: wireless-2.6/drivers/net/wireless/hostap/hostap.c
===================================================================
--- wireless-2.6.orig/drivers/net/wireless/hostap/hostap.c	2005-03-22 20:07:48.000000000 -0800
+++ wireless-2.6/drivers/net/wireless/hostap/hostap.c	2005-03-22 21:27:00.000000000 -0800
@@ -934,6 +934,8 @@
 		dev->tx_queue_len = 0;
 	}
 
+	SET_ETHTOOL_OPS(dev, &prism2_ethtool_ops);
+
 	netif_stop_queue(dev);
 }
 
Index: wireless-2.6/drivers/net/wireless/hostap/hostap_ioctl.c
===================================================================
--- wireless-2.6.orig/drivers/net/wireless/hostap/hostap_ioctl.c	2005-03-22 21:15:44.000000000 -0800
+++ wireless-2.6/drivers/net/wireless/hostap/hostap_ioctl.c	2005-03-22 21:27:23.000000000 -0800
@@ -3925,31 +3925,28 @@
 }
 
 
-static int prism2_ioctl_ethtool(local_info_t *local, void __user *useraddr)
+static void prism2_get_drvinfo(struct net_device *dev,
+			       struct ethtool_drvinfo *info)
 {
-	u32 ethcmd;
-	struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
-
-	if (copy_from_user(&ethcmd, useraddr, sizeof(ethcmd)))
-		return -EFAULT;
+	struct hostap_interface *iface;
+	local_info_t *local;
 
-	switch (ethcmd) {
-	case ETHTOOL_GDRVINFO:
-		strncpy(info.driver, "hostap", sizeof(info.driver) - 1);
-		strncpy(info.version, PRISM2_VERSION,
-			sizeof(info.version) - 1);
-		snprintf(info.fw_version, sizeof(info.fw_version) - 1,
-			 "%d.%d.%d", (local->sta_fw_ver >> 16) & 0xff,
-			 (local->sta_fw_ver >> 8) & 0xff,
-			 local->sta_fw_ver & 0xff);
-		if (copy_to_user(useraddr, &info, sizeof(info)))
-			return -EFAULT;
-		return 0;
-	}
+	iface = netdev_priv(dev);
+	local = iface->local;
 
-	return -EOPNOTSUPP;
+	strncpy(info->driver, "hostap", sizeof(info->driver) - 1);
+	strncpy(info->version, PRISM2_VERSION,
+		sizeof(info->version) - 1);
+	snprintf(info->fw_version, sizeof(info->fw_version) - 1,
+		 "%d.%d.%d", (local->sta_fw_ver >> 16) & 0xff,
+		 (local->sta_fw_ver >> 8) & 0xff,
+		 local->sta_fw_ver & 0xff);
 }
 
+static struct ethtool_ops prism2_ethtool_ops = {
+	.get_drvinfo = prism2_get_drvinfo
+};
+
 
 /* Structures to export the Wireless Handlers */
 
@@ -4117,10 +4114,6 @@
 		else ret = prism2_ioctl_priv_hostapd(local, &wrq->u.data);
 		break;
 
-	case SIOCETHTOOL:
-		ret = prism2_ioctl_ethtool(local, ifr->ifr_data);
-		break;
-
 	default:
 		ret = -EOPNOTSUPP;
 		break;


-- 
Jouni Malinen                                            PGP id EFC895FA

             reply	other threads:[~2005-03-25  3:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-25  3:23 Jouni Malinen [this message]
2005-03-25  3:34 ` [PATCH] hostap: Use ethtool_ops Jeff Garzik
2005-03-25  3:41   ` Jouni Malinen
2005-03-25  3:47     ` Jeff Garzik

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=20050325032314.GA8357@jm.kir.nu \
    --to=jkmaline@cc.hut.fi \
    --cc=jgarzik@pobox.com \
    --cc=netdev@oss.sgi.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).