From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ] Fix removing inotify watch whenever an adapter is removed
Date: Wed, 20 Jul 2011 12:12:22 +0300 [thread overview]
Message-ID: <1311153142-6165-1-git-send-email-luiz.dentz@gmail.com> (raw)
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This sometimes cause bluetoothd to burn cpu when an adapter is removed
from the system.
Since the watch is not really bond to any adapter, in fact it is added on
plugin .init, its removal is now moved to plugin .exit.
---
plugins/adaptername.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/plugins/adaptername.c b/plugins/adaptername.c
index 2a54cc0..9e99e6a 100644
--- a/plugins/adaptername.c
+++ b/plugins/adaptername.c
@@ -262,10 +262,6 @@ static gboolean handle_inotify_cb(GIOChannel *channel, GIOCondition cond,
static void adaptername_remove(struct btd_adapter *adapter)
{
- if (watch_fd >= 0)
- close(watch_fd);
- if (inotify != NULL)
- g_io_channel_shutdown(inotify, FALSE, NULL);
}
static struct btd_adapter_driver adaptername_driver = {
@@ -314,6 +310,13 @@ static int adaptername_init(void)
static void adaptername_exit(void)
{
+ if (watch_fd >= 0)
+ close(watch_fd);
+ if (inotify != NULL) {
+ g_io_channel_shutdown(inotify, FALSE, NULL);
+ g_io_channel_unref(inotify);
+ }
+
btd_unregister_adapter_driver(&adaptername_driver);
}
--
1.7.6
next reply other threads:[~2011-07-20 9:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-20 9:12 Luiz Augusto von Dentz [this message]
2011-07-26 10:01 ` [PATCH BlueZ] Fix removing inotify watch whenever an adapter is removed Johan Hedberg
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=1311153142-6165-1-git-send-email-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).