diff mbox series

[v2,6/6] device: command: remove default device concept

Message ID 20220811175900.443310-6-prestwoj@gmail.com (mailing list archive)
State Accepted, archived
Headers show
Series [v2,1/6] doc: add documentation for StationDebug | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
prestwoj/iwd-ci-gitlint success GitLint

Commit Message

James Prestwood Aug. 11, 2022, 5:59 p.m. UTC
There was quite a bit of framework behind setting/resetting a default
device, which is now no longer needed.
---
 client/command.c    | 18 ----------------
 client/command.h    |  3 ---
 client/dbus-proxy.c |  2 --
 client/device.c     | 50 ---------------------------------------------
 4 files changed, 73 deletions(-)
diff mbox series

Patch

diff --git a/client/command.c b/client/command.c
index 46752c72..dbd97703 100644
--- a/client/command.c
+++ b/client/command.c
@@ -329,9 +329,6 @@  static char **cmd_completion_match_family_cmd(const char *cmd_family,
 			break;
 		}
 
-		if (family->set_default_entity)
-			family->set_default_entity(arg1);
-
 		matches = cmd_completion_match_entity_cmd(arg2, text,
 							family->command_list);
 
@@ -663,21 +660,6 @@  int command_get_exit_status(void)
 	return exit_status;
 }
 
-void command_reset_default_entities(void)
-{
-	const struct l_queue_entry *entry;
-
-	for (entry = l_queue_get_entries(command_families); entry;
-							entry = entry->next) {
-		struct command_family *family = entry->data;
-
-		if (!family->reset_default_entity)
-			continue;
-
-		family->reset_default_entity();
-	}
-}
-
 void command_family_register(const struct command_family *family)
 {
 	l_queue_push_tail(command_families, (void *) family);
diff --git a/client/command.h b/client/command.h
index 1f841689..96eefdec 100644
--- a/client/command.h
+++ b/client/command.h
@@ -56,8 +56,6 @@  struct command_family {
 	const struct command *command_list;
 	command_rl_completion_func_t family_arg_completion;
 	command_rl_completion_func_t entity_arg_completion;
-	void (*set_default_entity)(const char *entity);
-	void (*reset_default_entity)(void);
 };
 
 bool command_option_get(const char *name, const char **value_out);
@@ -74,7 +72,6 @@  void command_noninteractive_trigger(void);
 bool command_is_interactive_mode(void);
 int command_get_exit_status(void);
 void command_set_exit_status(int status);
-void command_reset_default_entities(void);
 
 void command_family_register(const struct command_family *family);
 void command_family_unregister(const struct command_family *family);
diff --git a/client/dbus-proxy.c b/client/dbus-proxy.c
index 1534488e..42b8427f 100644
--- a/client/dbus-proxy.c
+++ b/client/dbus-proxy.c
@@ -806,8 +806,6 @@  static void service_disappeared_callback(struct l_dbus *dbus,
 
 	l_queue_clear(proxy_interfaces, proxy_interface_destroy);
 
-	command_reset_default_entities();
-
 	display_disable_cmd_prompt();
 }
 
diff --git a/client/device.c b/client/device.c
index 8b27ddd2..ce2afc81 100644
--- a/client/device.c
+++ b/client/device.c
@@ -42,8 +42,6 @@  struct device {
 	const struct proxy_interface *adapter;
 };
 
-static struct proxy_interface *default_device;
-
 static void display_device(const struct proxy_interface *proxy)
 {
 	const struct device *device = proxy_interface_get_data(proxy);
@@ -260,52 +258,6 @@  static bool match_by_partial_name(const void *a, const void *b)
 	return !strncmp(device->name, text, strlen(text));
 }
 
-static bool match_all(const void *a, const void *b)
-{
-	return true;
-}
-
-static void device_set_default(const char *device_name)
-{
-	struct l_queue *match;
-
-	if (!device_name)
-		return;
-
-	match = proxy_interface_find_all(device_interface_type.interface,
-						match_by_name, device_name);
-
-	if (!match)
-		return;
-
-	default_device = l_queue_pop_head(match);
-	l_queue_destroy(match, NULL);
-}
-
-static void device_reset_default(void)
-{
-	default_device = NULL;
-}
-
-const struct proxy_interface *device_get_default(void)
-{
-	struct l_queue *match;
-
-	if (default_device)
-		return default_device;
-
-	match = proxy_interface_find_all(device_interface_type.interface,
-							match_all, NULL);
-
-	if (!match)
-		return NULL;
-
-	default_device = l_queue_pop_head(match);
-	l_queue_destroy(match, NULL);
-
-	return default_device;
-}
-
 const struct proxy_interface *device_proxy_find_by_name(const char *name)
 {
 	struct l_queue *match;
@@ -464,8 +416,6 @@  static struct command_family device_command_family = {
 	.command_list = device_commands,
 	.family_arg_completion = family_arg_completion,
 	.entity_arg_completion = entity_arg_completion,
-	.set_default_entity = device_set_default,
-	.reset_default_entity = device_reset_default,
 };
 
 static int device_command_family_init(void)