3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-21 11:52:34 +01:00

device: Add device_is_busy()

This commit is contained in:
Denis Kenzior 2016-05-16 12:24:41 -05:00
parent a9e9be469c
commit 68a79b23fb
2 changed files with 11 additions and 2 deletions

View File

@ -38,6 +38,7 @@ void __device_watch_call_removed(struct netdev *device);
struct network *device_get_connected_network(struct netdev *device);
const char *device_get_path(struct netdev *device);
bool device_is_busy(struct netdev *device);
void device_connect_network(struct netdev *device, struct network *network,
struct scan_bss *bss,

View File

@ -184,6 +184,15 @@ struct network *device_get_connected_network(struct netdev *device)
return device->connected_network;
}
bool device_is_busy(struct netdev *device)
{
if (device->state != DEVICE_STATE_DISCONNECTED &&
device->state != DEVICE_STATE_AUTOCONNECT)
return true;
return false;
}
static void netdev_enter_state(struct netdev *netdev, enum device_state state)
{
l_debug("Old State: %s, new state: %s",
@ -444,8 +453,7 @@ static struct l_dbus_message *network_connect(struct l_dbus *dbus,
l_debug("");
if (netdev->state != DEVICE_STATE_DISCONNECTED &&
netdev->state != DEVICE_STATE_AUTOCONNECT)
if (device_is_busy(netdev))
return dbus_error_busy(message);
/*