Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a9f38d023b65c9fe2602303c1101c868be4fcbcc
Commit:     a9f38d023b65c9fe2602303c1101c868be4fcbcc
Parent:     f455eb1a4ba2bf0ff1bde7844bf3a811269d2d79
Author:     Luis Carlos Cobo <[EMAIL PROTECTED]>
AuthorDate: Thu Aug 2 11:52:29 2007 -0400
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Wed Oct 10 16:49:52 2007 -0700

    [PATCH] Support for mesh autostart deactivation through sysfs
    
    echo 0 > /sys/class/net/mshX/autostart_enabled
    
    This is supported from Marvell firmware version 5.110.16.p0 (to be 
released).
    
    Signed-off-by: Luis Carlos Cobo <[EMAIL PROTECTED]>
    Signed-off-by: John W. Linville <[EMAIL PROTECTED]>
---
 drivers/net/wireless/libertas/host.h |    2 +
 drivers/net/wireless/libertas/main.c |   48 ++++++++++++++++++++++++++++++++-
 2 files changed, 48 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/libertas/host.h 
b/drivers/net/wireless/libertas/host.h
index 308ccdb..12d5dd9 100644
--- a/drivers/net/wireless/libertas/host.h
+++ b/drivers/net/wireless/libertas/host.h
@@ -320,6 +320,8 @@ enum cmd_mesh_access_opts {
        CMD_ACT_MESH_GET_RREQ_DELAY,
        CMD_ACT_MESH_SET_ROUTE_EXP,
        CMD_ACT_MESH_GET_ROUTE_EXP,
+       CMD_ACT_MESH_SET_AUTOSTART_ENABLED,
+       CMD_ACT_MESH_GET_AUTOSTART_ENABLED,
 };
 
 /** Card Event definition */
diff --git a/drivers/net/wireless/libertas/main.c 
b/drivers/net/wireless/libertas/main.c
index b4e2cd1..717b336 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -252,6 +252,50 @@ static ssize_t libertas_anycast_set(struct device * dev,
  */
 static DEVICE_ATTR(anycast_mask, 0644, libertas_anycast_get, 
libertas_anycast_set);
 
+static ssize_t libertas_autostart_enabled_get(struct device * dev,
+               struct device_attribute *attr, char * buf)
+{
+       struct cmd_ds_mesh_access mesh_access;
+
+       memset(&mesh_access, 0, sizeof(mesh_access));
+       libertas_prepare_and_send_command(to_net_dev(dev)->priv,
+                       CMD_MESH_ACCESS,
+                       CMD_ACT_MESH_GET_AUTOSTART_ENABLED,
+                       CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access);
+
+       return sprintf(buf, "%d\n", le32_to_cpu(mesh_access.data[0]));
+}
+
+static ssize_t libertas_autostart_enabled_set(struct device * dev,
+               struct device_attribute *attr, const char * buf, size_t count)
+{
+       struct cmd_ds_mesh_access mesh_access;
+       uint32_t datum;
+
+       memset(&mesh_access, 0, sizeof(mesh_access));
+       sscanf(buf, "%d", &datum);
+       mesh_access.data[0] = cpu_to_le32(datum);
+
+       libertas_prepare_and_send_command((to_net_dev(dev))->priv,
+                       CMD_MESH_ACCESS,
+                       CMD_ACT_MESH_SET_AUTOSTART_ENABLED,
+                       CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access);
+       return strlen(buf);
+}
+
+static DEVICE_ATTR(autostart_enabled, 0644,
+               libertas_autostart_enabled_get, libertas_autostart_enabled_set);
+
+static struct attribute *libertas_mesh_sysfs_entries[] = {
+       &dev_attr_anycast_mask.attr,
+       &dev_attr_autostart_enabled.attr,
+       NULL,
+};
+
+static struct attribute_group libertas_mesh_attr_group = {
+       .attrs = libertas_mesh_sysfs_entries,
+};
+
 /**
  *  @brief Check if the device can be open and wait if necessary.
  *
@@ -1250,7 +1294,7 @@ int libertas_add_mesh(wlan_private *priv, struct device 
*dev)
                goto err_free;
        }
 
-       ret = device_create_file(&(mesh_dev->dev), &dev_attr_anycast_mask);
+       ret = sysfs_create_group(&(mesh_dev->dev.kobj), 
&libertas_mesh_attr_group);
        if (ret)
                goto err_unregister;
 
@@ -1359,7 +1403,7 @@ void libertas_remove_mesh(wlan_private *priv)
        netif_stop_queue(mesh_dev);
        netif_carrier_off(priv->mesh_dev);
 
-       device_remove_file(&(mesh_dev->dev), &dev_attr_anycast_mask);
+       sysfs_remove_group(&(mesh_dev->dev.kobj), &libertas_mesh_attr_group);
        unregister_netdev(mesh_dev);
 
        priv->mesh_dev = NULL ;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to