device: Convert to using IWD_MODULE

This commit is contained in:
Denis Kenzior 2019-05-22 10:12:22 -05:00
parent 978e538f81
commit 03ff5ef7d0
3 changed files with 5 additions and 12 deletions

View File

@ -457,7 +457,7 @@ void device_remove(struct device *device)
l_free(device);
}
bool device_init(void)
static int device_init(void)
{
if (!l_dbus_register_interface(dbus_get_bus(),
IWD_DEVICE_INTERFACE,
@ -467,12 +467,14 @@ bool device_init(void)
netdev_watch = netdev_watch_add(device_netdev_notify, NULL, NULL);
return true;
return 0;
}
void device_exit(void)
static void device_exit(void)
{
netdev_watch_remove(netdev_watch);
l_dbus_unregister_interface(dbus_get_bus(), IWD_DEVICE_INTERFACE);
}
IWD_MODULE(device, device_init, device_exit)

View File

@ -33,9 +33,6 @@ void netdev_exit(void);
void netdev_set_nl80211(struct l_genl_family *nl80211);
void netdev_shutdown(void);
bool device_init(void);
void device_exit(void);
bool manager_init(struct l_genl_family *in,
const char *if_whitelist, const char *if_blacklist);
void manager_exit(void);

View File

@ -521,21 +521,15 @@ int main(int argc, char *argv[])
if (!netdev_init())
goto fail_netdev;
if (!device_init())
goto fail_device;
if (iwd_modules_init() < 0)
goto fail_modules;
plugin_init(plugins, noplugins);
exit_status = l_main_run_with_signal(signal_handler, NULL);
plugin_exit();
fail_modules:
iwd_modules_exit();
device_exit();
fail_device:
netdev_exit();
fail_netdev:
rfkill_exit();