diff --git a/src/main.c b/src/main.c index c19956cd..b34da3d0 100644 --- a/src/main.c +++ b/src/main.c @@ -478,7 +478,6 @@ int main(int argc, char *argv[]) eap_init(eap_mtu); eapol_init(); - rfkill_init(); if (!netdev_init()) goto fail_netdev; @@ -494,7 +493,6 @@ fail_modules: iwd_modules_exit(); netdev_exit(); fail_netdev: - rfkill_exit(); eapol_exit(); eap_exit(); diff --git a/src/rfkill.c b/src/rfkill.c index 34bdbde5..3a88ebcf 100644 --- a/src/rfkill.c +++ b/src/rfkill.c @@ -274,7 +274,7 @@ bool rfkill_get_hard_state(unsigned int wiphy_id) return entry ? entry->hard_state : false; } -int rfkill_init(void) +static int rfkill_init(void) { int fd; @@ -289,7 +289,6 @@ int rfkill_init(void) } l_io_set_close_on_destroy(rfkill_io, true); - l_io_set_read_handler(rfkill_io, rfkill_read, NULL, NULL); rfkill_map = l_queue_new(); @@ -297,11 +296,11 @@ int rfkill_init(void) return 0; } -void rfkill_exit(void) +static void rfkill_exit(void) { l_io_destroy(rfkill_io); - l_queue_destroy(rfkill_map, l_free); - l_queue_destroy(rfkill_watches, l_free); } + +IWD_MODULE(rfkill, rfkill_init, rfkill_exit) diff --git a/src/rfkill.h b/src/rfkill.h index d54ef4e1..d0f1e187 100644 --- a/src/rfkill.h +++ b/src/rfkill.h @@ -29,6 +29,3 @@ bool rfkill_watch_remove(uint32_t watch_id); bool rfkill_get_soft_state(unsigned int wiphy_id); bool rfkill_set_soft_state(unsigned int wiphy_id, bool state); bool rfkill_get_hard_state(unsigned int wiphy_id); - -int rfkill_init(void); -void rfkill_exit(void);