static void alias_device_cb(struct device_user *dep, enum device_event ev)
{
struct alias_device *alias;
- bool new_state = false;
alias = container_of(dep, struct alias_device, dep);
switch (ev) {
case DEV_EVENT_ADD:
- new_state = true;
+ device_set_present(&alias->dev, true);
+ break;
case DEV_EVENT_REMOVE:
- device_set_present(&alias->dev, new_state);
+ device_set_present(&alias->dev, false);
break;
case DEV_EVENT_LINK_UP:
- new_state = true;
+ device_set_link(&alias->dev, true);
+ break;
case DEV_EVENT_LINK_DOWN:
- device_set_link(&alias->dev, new_state);
+ device_set_link(&alias->dev, false);
break;
case DEV_EVENT_UPDATE_IFINDEX:
device_set_ifindex(&alias->dev, dep->dev->ifindex);
interface_main_dev_cb(struct device_user *dep, enum device_event ev)
{
struct interface *iface;
- bool new_state = false;
iface = container_of(dep, struct interface, main_dev);
switch (ev) {
case DEV_EVENT_ADD:
- new_state = true;
+ interface_set_available(iface, true);
+ break;
case DEV_EVENT_REMOVE:
- interface_set_available(iface, new_state);
- if (!new_state && dep->dev && dep->dev->external)
+ interface_set_available(iface, false);
+ if (dep->dev && dep->dev->external)
interface_set_main_dev(iface, NULL);
break;
case DEV_EVENT_UP:
- new_state = true;
+ interface_set_enabled(iface, true);
+ break;
case DEV_EVENT_DOWN:
- interface_set_enabled(iface, new_state);
+ interface_set_enabled(iface, false);
break;
case DEV_EVENT_LINK_UP:
- new_state = true;
+ interface_set_link_state(iface, true);
+ break;
case DEV_EVENT_LINK_DOWN:
- interface_set_link_state(iface, new_state);
+ interface_set_link_state(iface, false);
break;
case DEV_EVENT_TOPO_CHANGE:
interface_proto_event(iface->proto, PROTO_CMD_RENEW, false);
static void vlan_dev_cb(struct device_user *dep, enum device_event ev)
{
struct vlan_device *vldev;
- bool new_state = false;
vldev = container_of(dep, struct vlan_device, dep);
switch(ev) {
case DEV_EVENT_ADD:
- new_state = true;
+ device_set_present(&vldev->dev, true);
+ break;
case DEV_EVENT_REMOVE:
- device_set_present(&vldev->dev, new_state);
+ device_set_present(&vldev->dev, false);
break;
case DEV_EVENT_UPDATE_IFNAME:
vlan_dev_set_name(vldev, dep->dev);