linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 2/2] adapter: Remove timer for removing temporary devices
Date: Wed, 15 Jul 2020 13:46:35 -0700	[thread overview]
Message-ID: <20200715204635.755599-2-luiz.dentz@gmail.com> (raw)
In-Reply-To: <20200715204635.755599-1-luiz.dentz@gmail.com>

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

Now that each temporary device object can cleanup after it has detected
that it has disappeared it is no longer necessary to keep this logic as
well in the adapter.
---
 src/adapter.c | 30 ------------------------------
 1 file changed, 30 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index 7a80554c5..c757447e2 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -258,7 +258,6 @@ struct btd_adapter {
 	GSList *discovery_found;	/* list of found devices */
 	guint discovery_idle_timeout;	/* timeout between discovery runs */
 	guint passive_scan_timeout;	/* timeout between passive scans */
-	guint temp_devices_timeout;	/* timeout for temporary devices */
 
 	guint pairable_timeout_id;	/* pairable timeout id */
 	guint auth_idle_id;		/* Pending authorization dequeue */
@@ -1484,27 +1483,6 @@ static void invalidate_rssi_and_tx_power(gpointer a)
 	device_set_tx_power(dev, 127);
 }
 
-static gboolean remove_temp_devices(gpointer user_data)
-{
-	struct btd_adapter *adapter = user_data;
-	GSList *l, *next;
-
-	DBG("%s", adapter->path);
-
-	adapter->temp_devices_timeout = 0;
-
-	for (l = adapter->devices; l != NULL; l = next) {
-		struct btd_device *dev = l->data;
-
-		next = g_slist_next(l);
-
-		if (device_is_temporary(dev) && !btd_device_is_connected(dev))
-			btd_adapter_remove_device(adapter, dev);
-	}
-
-	return FALSE;
-}
-
 static void discovery_cleanup(struct btd_adapter *adapter, int timeout)
 {
 	GSList *l, *next;
@@ -1516,11 +1494,6 @@ static void discovery_cleanup(struct btd_adapter *adapter, int timeout)
 		adapter->discovery_idle_timeout = 0;
 	}
 
-	if (adapter->temp_devices_timeout > 0) {
-		g_source_remove(adapter->temp_devices_timeout);
-		adapter->temp_devices_timeout = 0;
-	}
-
 	g_slist_free_full(adapter->discovery_found,
 						invalidate_rssi_and_tx_power);
 	adapter->discovery_found = NULL;
@@ -1536,9 +1509,6 @@ static void discovery_cleanup(struct btd_adapter *adapter, int timeout)
 		if (device_is_temporary(dev) && !device_is_connectable(dev))
 			btd_adapter_remove_device(adapter, dev);
 	}
-
-	adapter->temp_devices_timeout = g_timeout_add_seconds(timeout,
-						remove_temp_devices, adapter);
 }
 
 static void discovery_free(void *user_data)
-- 
2.25.3


  reply	other threads:[~2020-07-15 20:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-15 20:46 [PATCH BlueZ 1/2] device: Add timer for removing temporary devices Luiz Augusto von Dentz
2020-07-15 20:46 ` Luiz Augusto von Dentz [this message]
2020-07-15 21:03 ` Bastien Nocera
2020-07-16 16:40   ` Luiz Augusto von Dentz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200715204635.755599-2-luiz.dentz@gmail.com \
    --to=luiz.dentz@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).