Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 66492
b: refs/heads/master
c: d21b31f
h: refs/heads/master
v: v3
  • Loading branch information
Luis Carlos Cobo authored and David S. Miller committed Oct 10, 2007
1 parent 8915c18 commit d0785c6
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b37e5842f5ab66f8d0533ee62ffe35c26ae800a3
refs/heads/master: d21b31fd53626f9c1d14fc676793dbe86b44d1c6
1 change: 1 addition & 0 deletions trunk/drivers/net/wireless/libertas/dev.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ struct _wlan_private {
int open;
int mesh_open;
int infra_open;
int mesh_autostart_enabled;

char name[DEV_NAME_LEN];

Expand Down
26 changes: 26 additions & 0 deletions trunk/drivers/net/wireless/libertas/if_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -990,6 +990,19 @@ static int if_usb_suspend(struct usb_interface *intf, pm_message_t message)
if (priv->adapter->psstate != PS_STATE_FULL_POWER)
return -1;

if (priv->mesh_dev && !priv->mesh_autostart_enabled) {
/* Mesh autostart must be activated while sleeping
* On resume it will go back to the current state
*/
struct cmd_ds_mesh_access mesh_access;
memset(&mesh_access, 0, sizeof(mesh_access));
mesh_access.data[0] = cpu_to_le32(1);
libertas_prepare_and_send_command(priv,
CMD_MESH_ACCESS,
CMD_ACT_MESH_SET_AUTOSTART_ENABLED,
CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access);
}

netif_device_detach(cardp->eth_dev);
netif_device_detach(priv->mesh_dev);

Expand Down Expand Up @@ -1017,6 +1030,19 @@ static int if_usb_resume(struct usb_interface *intf)
netif_device_attach(cardp->eth_dev);
netif_device_attach(priv->mesh_dev);

if (priv->mesh_dev && !priv->mesh_autostart_enabled) {
/* Mesh autostart was activated while sleeping
* Disable it if appropriate
*/
struct cmd_ds_mesh_access mesh_access;
memset(&mesh_access, 0, sizeof(mesh_access));
mesh_access.data[0] = cpu_to_le32(0);
libertas_prepare_and_send_command(priv,
CMD_MESH_ACCESS,
CMD_ACT_MESH_SET_AUTOSTART_ENABLED,
CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access);
}

lbs_deb_leave(LBS_DEB_USB);
return 0;
}
Expand Down
23 changes: 22 additions & 1 deletion trunk/drivers/net/wireless/libertas/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,15 +271,20 @@ static ssize_t libertas_autostart_enabled_set(struct device * dev,
{
struct cmd_ds_mesh_access mesh_access;
uint32_t datum;
wlan_private * priv = (to_net_dev(dev))->priv;
int ret;

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,
ret = libertas_prepare_and_send_command(priv,
CMD_MESH_ACCESS,
CMD_ACT_MESH_SET_AUTOSTART_ENABLED,
CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access);
if (ret == 0)
priv->mesh_autostart_enabled = datum ? 1 : 0;

return strlen(buf);
}

Expand Down Expand Up @@ -853,6 +858,7 @@ static int wlan_setup_station_hw(wlan_private * priv)
{
int ret = -1;
wlan_adapter *adapter = priv->adapter;
struct cmd_ds_mesh_access mesh_access;

lbs_deb_enter(LBS_DEB_FW);

Expand Down Expand Up @@ -889,6 +895,21 @@ static int wlan_setup_station_hw(wlan_private * priv)
goto done;
}

/* Disable mesh autostart */
if (priv->mesh_dev) {
memset(&mesh_access, 0, sizeof(mesh_access));
mesh_access.data[0] = cpu_to_le32(0);
ret = libertas_prepare_and_send_command(priv,
CMD_MESH_ACCESS,
CMD_ACT_MESH_SET_AUTOSTART_ENABLED,
CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access);
if (ret) {
ret = -1;
goto done;
}
priv->mesh_autostart_enabled = 0;
}

ret = 0;
done:
lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret);
Expand Down

0 comments on commit d0785c6

Please sign in to comment.