libertas: convert extscan from wlanconfig to debugfs
Marcelo Tosatti
mtosatti at redhat.unroutablecom
Tue Nov 28 02:56:39 EST 2006
Commit: 51966c49644c242182c168ae2ba5ea92ad88a184
Parent: 2d0553c736901f154f25ff01b3567995fd980893
commit 51966c49644c242182c168ae2ba5ea92ad88a184
Author: Marcelo Tosatti <mtosatti at redhat.com>
AuthorDate: Thu Nov 16 22:51:32 2006 -0200
Commit: Marcelo Tosatti <mtosatti at redhat.com>
CommitDate: Thu Nov 16 22:51:32 2006 -0200
libertas: convert extscan from wlanconfig to debugfs
Subject says it all.
Signed-off-by: Marcelo Tosatti <mtosatti at redhat.com>
---
drivers/net/wireless/libertas/wlan_debugfs.c | 43 ++++++++++++++++++++++++++
drivers/net/wireless/libertas/wlan_dev.h | 1 +
drivers/net/wireless/libertas/wlan_ioctl.c | 3 --
drivers/net/wireless/libertas/wlan_scan.c | 30 ------------------
drivers/net/wireless/libertas/wlan_scan.h | 1 -
drivers/net/wireless/libertas/wlan_wext.c | 1 +
6 files changed, 45 insertions(+), 34 deletions(-)
diff --git a/drivers/net/wireless/libertas/wlan_debugfs.c b/drivers/net/wireless/libertas/wlan_debugfs.c
index c2ec0cd..3b54732 100644
--- a/drivers/net/wireless/libertas/wlan_debugfs.c
+++ b/drivers/net/wireless/libertas/wlan_debugfs.c
@@ -2,6 +2,7 @@
#include <linux/module.h>
#include <linux/dcache.h>
#include <linux/debugfs.h>
+#include <net/iw_handler.h>
#include "wlan_dev.h"
#include "wlan_decl.h"
#include "host.h"
@@ -184,6 +185,36 @@ out_unlock:
return res;
}
+static ssize_t libertas_extscan(struct file *file, const char __user *userbuf,
+ size_t count, loff_t *ppos)
+{
+ wlan_private *priv = file->private_data;
+ char *buf = big_buffer;
+ ssize_t res, buf_size;
+ struct WLAN_802_11_SSID extscan_ssid;
+ union iwreq_data wrqu;
+
+ down(&big_buffer_sem);
+ buf_size = min(count, sizeof(big_buffer) - 1);
+ if (copy_from_user(buf, userbuf, buf_size)) {
+ res = -EFAULT;
+ goto out_unlock;
+ }
+
+ memcpy(&extscan_ssid.Ssid, buf, strlen(buf)-1);
+ extscan_ssid.SsidLength = strlen(buf)-1;
+
+ libertas_send_specific_SSID_scan(priv, &extscan_ssid, 1);
+
+ memset(&wrqu, 0, sizeof(union iwreq_data));
+ wireless_send_event(priv->wlan_dev.netdev, SIOCGIWSCAN, &wrqu, NULL);
+
+out_unlock:
+ up(&big_buffer_sem);
+
+ return count;
+}
+
static struct file_operations libertas_devinfo_fops = {
.owner = THIS_MODULE,
@@ -206,6 +237,12 @@ static struct file_operations libertas_s
.read = libertas_sleepparams_read,
};
+static struct file_operations libertas_extscan_fops = {
+ .owner = THIS_MODULE,
+ .open = open_file_generic,
+ .write = libertas_extscan,
+};
+
void libertas_debugfs_init(void)
{
if (!libertas_dir)
@@ -248,6 +285,12 @@ void libertas_debugfs_init_one(wlan_priv
priv,
&libertas_sleepparams_fops);
+ priv->debugfs_extscan = debugfs_create_file("extscan", 0600,
+ priv->debugfs_dir,
+ priv,
+ &libertas_extscan_fops);
+
+
#ifdef PROC_DEBUG
libertas_debug_init(priv, dev);
#endif
diff --git a/drivers/net/wireless/libertas/wlan_dev.h b/drivers/net/wireless/libertas/wlan_dev.h
index 8a33b61..1d75139 100644
--- a/drivers/net/wireless/libertas/wlan_dev.h
+++ b/drivers/net/wireless/libertas/wlan_dev.h
@@ -174,6 +174,7 @@ struct _wlan_private {
struct dentry *debugfs_debug;
struct dentry *debugfs_getscantable;
struct dentry *debugfs_sleepparams;
+ struct dentry *debugfs_extscan;
const struct firmware *firmware;
struct device *hotplug_device;
diff --git a/drivers/net/wireless/libertas/wlan_ioctl.c b/drivers/net/wireless/libertas/wlan_ioctl.c
index ffb6ad1..17ff747 100644
--- a/drivers/net/wireless/libertas/wlan_ioctl.c
+++ b/drivers/net/wireless/libertas/wlan_ioctl.c
@@ -2038,9 +2038,6 @@ int libertas_do_ioctl(struct net_device
dprintk(1, "libertas_do_ioctl: ioctl cmd = 0x%x\n", cmd);
switch (cmd) {
- case WLANEXTSCAN:
- ret = libertas_extscan_ioctl(priv, req);
- break;
case WLANHOSTCMD:
ret = wlan_hostcmd_ioctl(dev, req, cmd);
break;
diff --git a/drivers/net/wireless/libertas/wlan_scan.c b/drivers/net/wireless/libertas/wlan_scan.c
index 91de20f..59d6dfd 100644
--- a/drivers/net/wireless/libertas/wlan_scan.c
+++ b/drivers/net/wireless/libertas/wlan_scan.c
@@ -2102,33 +2102,3 @@ int libertas_ret_80211_scan(wlan_private
LEAVE();
return WLAN_STATUS_SUCCESS;
}
-
-/**
- * @brief scan network with specific ssid
- *
- * @param priv A pointer to wlan_private structure
- * @param req A pointer to ifreq structure
- *
- * @return WLAN_STATUS_SUCCESS --success, otherwise fail
- */
-int libertas_extscan_ioctl(wlan_private * priv, struct ifreq *req)
-{
- struct WLAN_802_11_SSID Ext_Scan_SSID;
- union iwreq_data wrqu;
-
- ENTER();
-
- if (copy_from_user(&Ext_Scan_SSID, req->ifr_data,
- sizeof(Ext_Scan_SSID))) {
- dprintk(1, "copy of SSID for ext scan from user failed \n");
- LEAVE();
- return -EFAULT;
- }
- libertas_send_specific_SSID_scan(priv, &Ext_Scan_SSID, 1);
-
- memset(&wrqu, 0, sizeof(union iwreq_data));
- wireless_send_event(priv->wlan_dev.netdev, SIOCGIWSCAN, &wrqu, NULL);
-
- LEAVE();
- return WLAN_STATUS_SUCCESS;
-}
diff --git a/drivers/net/wireless/libertas/wlan_scan.h b/drivers/net/wireless/libertas/wlan_scan.h
index f77ae91..da5fd91 100644
--- a/drivers/net/wireless/libertas/wlan_scan.h
+++ b/drivers/net/wireless/libertas/wlan_scan.h
@@ -230,7 +230,6 @@ extern int libertas_ret_80211_scan(wlan_
struct HostCmd_DS_COMMAND *resp);
struct ifreq;
-extern int libertas_extscan_ioctl(wlan_private * priv, struct ifreq *req);
#ifdef __KERNEL__
struct iw_point;
diff --git a/drivers/net/wireless/libertas/wlan_wext.c b/drivers/net/wireless/libertas/wlan_wext.c
index c45eaec..6688731 100644
--- a/drivers/net/wireless/libertas/wlan_wext.c
+++ b/drivers/net/wireless/libertas/wlan_wext.c
@@ -1249,6 +1249,7 @@ static const struct iw_priv_args wlan_pr
/*
* { cmd, set_args, get_args, name }
*/
+ /* XXX: converted to debugfs, remove */
{
WLANEXTSCAN,
IW_PRIV_TYPE_INT,
More information about the Commits-kernel
mailing list