From 03ff5ef7d060438c49bdea989ffad6da4b826ad1 Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Wed, 22 May 2019 10:12:22 -0500 Subject: [PATCH] device: Convert to using IWD_MODULE --- src/device.c | 8 +++++--- src/iwd.h | 3 --- src/main.c | 6 ------ 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/device.c b/src/device.c index 7bdd86c0..70316b98 100644 --- a/src/device.c +++ b/src/device.c @@ -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) diff --git a/src/iwd.h b/src/iwd.h index d988b482..dba62fd7 100644 --- a/src/iwd.h +++ b/src/iwd.h @@ -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); diff --git a/src/main.c b/src/main.c index e91b8db5..39cceedd 100644 --- a/src/main.c +++ b/src/main.c @@ -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();