linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] g_dbus_remove_watch function
@ 2010-02-11 21:06 Claudio Takahasi
  2010-02-12 17:57 ` Marcel Holtmann
  0 siblings, 1 reply; 2+ messages in thread
From: Claudio Takahasi @ 2010-02-11 21:06 UTC (permalink / raw)
  To: BlueZ development

[-- Attachment #1: Type: text/plain, Size: 102 bytes --]

this patch removes an unnecessary argument(D-Bus connection) of
g_dbus_remove_watch.

Cheers,
Claudio

[-- Attachment #2: 0001-Remove-D-Bus-connection-argument-of-g_dbus_remove_wa.patch --]
[-- Type: application/octet-stream, Size: 7574 bytes --]

From 19a1a18c3ee8627f20d7a28dd266778c07546b8f Mon Sep 17 00:00:00 2001
From: Claudio Takahasi <claudio.takahasi@openbossa.org>
Date: Thu, 11 Feb 2010 16:47:37 -0200
Subject: [PATCH 1/1] Remove D-Bus connection argument of g_dbus_remove_watch function

---
 audio/gateway.c         |    2 +-
 audio/telephony-ofono.c |    8 ++++----
 gdbus/gdbus.h           |    2 +-
 gdbus/watch.c           |    2 +-
 network/connection.c    |    4 ++--
 plugins/service.c       |    4 ++--
 serial/port.c           |   10 +++++-----
 serial/proxy.c          |    2 +-
 src/adapter.c           |    2 +-
 src/agent.c             |    2 +-
 src/device.c            |    4 ++--
 11 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/audio/gateway.c b/audio/gateway.c
index 46fbb63..f9e0429 100644
--- a/audio/gateway.c
+++ b/audio/gateway.c
@@ -534,7 +534,7 @@ static DBusMessage *unregister_agent(DBusConnection *conn,
 				ERROR_INTERFACE ".Failed",
 				"Unknown object path");
 
-	g_dbus_remove_watch(device->conn, gw->agent->watch);
+	g_dbus_remove_watch(gw->agent->watch);
 
 	agent_free(gw->agent);
 	gw->agent = NULL;
diff --git a/audio/telephony-ofono.c b/audio/telephony-ofono.c
index 3df76c3..ccf3c80 100644
--- a/audio/telephony-ofono.c
+++ b/audio/telephony-ofono.c
@@ -739,7 +739,7 @@ static void vc_free(struct voice_call *vc)
 	if (!vc)
 		return;
 
-	g_dbus_remove_watch(connection, vc->watch);
+	g_dbus_remove_watch(vc->watch);
 	g_free(vc->obj_path);
 	g_free(vc->number);
 	g_free(vc);
@@ -1090,9 +1090,9 @@ void telephony_exit(void)
 	g_slist_free(calls);
 	calls = NULL;
 
-	g_dbus_remove_watch(connection, registration_watch);
-	g_dbus_remove_watch(connection, voice_watch);
-	g_dbus_remove_watch(connection, device_watch);
+	g_dbus_remove_watch(registration_watch);
+	g_dbus_remove_watch(voice_watch);
+	g_dbus_remove_watch(device_watch);
 
 	dbus_connection_unref(connection);
 	connection = NULL;
diff --git a/gdbus/gdbus.h b/gdbus/gdbus.h
index 77b8aee..cb82c7c 100644
--- a/gdbus/gdbus.h
+++ b/gdbus/gdbus.h
@@ -132,7 +132,7 @@ guint g_dbus_add_signal_watch(DBusConnection *connection,
 				const char *interface, const char *member,
 				GDBusSignalFunction function, void *user_data,
 				GDBusDestroyFunction destroy);
-gboolean g_dbus_remove_watch(DBusConnection *connection, guint tag);
+gboolean g_dbus_remove_watch(guint tag);
 void g_dbus_remove_all_watches(DBusConnection *connection);
 
 #ifdef __cplusplus
diff --git a/gdbus/watch.c b/gdbus/watch.c
index 75e4210..438295d 100644
--- a/gdbus/watch.c
+++ b/gdbus/watch.c
@@ -597,7 +597,7 @@ guint g_dbus_add_signal_watch(DBusConnection *connection,
 	return cb->id;
 }
 
-gboolean g_dbus_remove_watch(DBusConnection *connection, guint id)
+gboolean g_dbus_remove_watch(guint id)
 {
 	struct filter_data *data;
 	struct filter_callback *cb;
diff --git a/network/connection.c b/network/connection.c
index 3e52d2a..1b3c27c 100644
--- a/network/connection.c
+++ b/network/connection.c
@@ -165,7 +165,7 @@ static gboolean bnep_watchdog_cb(GIOChannel *chan, GIOCondition cond,
 		device_remove_disconnect_watch(nc->peer->device, nc->dc_id);
 		nc->dc_id = 0;
 		if (nc->watch) {
-			g_dbus_remove_watch(connection, nc->watch);
+			g_dbus_remove_watch(nc->watch);
 			nc->watch = 0;
 		}
 	}
@@ -185,7 +185,7 @@ static void cancel_connection(struct network_conn *nc, const char *err_msg)
 	DBusMessage *reply;
 
 	if (nc->watch) {
-		g_dbus_remove_watch(connection, nc->watch);
+		g_dbus_remove_watch(nc->watch);
 		nc->watch = 0;
 	}
 
diff --git a/plugins/service.c b/plugins/service.c
index 77f8c1a..edb4ab7 100644
--- a/plugins/service.c
+++ b/plugins/service.c
@@ -501,7 +501,7 @@ static int remove_record(DBusConnection *conn, const char *sender,
 
 	debug("listner_id %d", user_record->listener_id);
 
-	g_dbus_remove_watch(conn, user_record->listener_id);
+	g_dbus_remove_watch(user_record->listener_id);
 
 	exit_callback(conn, user_record);
 
@@ -758,7 +758,7 @@ static void path_unregister(void *data)
 
 		next = l->next;
 
-		g_dbus_remove_watch(connection, user_record->listener_id);
+		g_dbus_remove_watch(user_record->listener_id);
 		exit_callback(connection, user_record);
 	}
 
diff --git a/serial/port.c b/serial/port.c
index b29aab3..2732cf5 100644
--- a/serial/port.c
+++ b/serial/port.c
@@ -194,7 +194,7 @@ static void serial_port_free(struct serial_port *port)
 	struct serial_device *device = port->device;
 
 	if (device && port->listener_id > 0)
-		g_dbus_remove_watch(device->conn, port->listener_id);
+		g_dbus_remove_watch(port->listener_id);
 
 	port_release(port);
 
@@ -373,7 +373,7 @@ static void rfcomm_connect_cb(GIOChannel *chan, GError *conn_err,
 
 fail:
 	g_dbus_send_message(device->conn, reply);
-	g_dbus_remove_watch(device->conn, port->listener_id);
+	g_dbus_remove_watch(port->listener_id);
 	port->listener_id = 0;
 }
 
@@ -433,7 +433,7 @@ static void get_record_cb(sdp_list_t *recs, int err, gpointer user_data)
 	return;
 
 failed:
-	g_dbus_remove_watch(device->conn, port->listener_id);
+	g_dbus_remove_watch(port->listener_id);
 	port->listener_id = 0;
 	g_dbus_send_message(device->conn, reply);
 }
@@ -524,7 +524,7 @@ static DBusMessage *port_connect(DBusConnection *conn,
 		DBusMessage *reply;
 
 		error("%s", strerror(-err));
-		g_dbus_remove_watch(conn, port->listener_id);
+		g_dbus_remove_watch(port->listener_id);
 		port->listener_id = 0;
 		reply = failed(msg, strerror(-err));
 		return reply;
@@ -558,7 +558,7 @@ static DBusMessage *port_disconnect(DBusConnection *conn,
 
 	port_release(port);
 
-	g_dbus_remove_watch(conn, port->listener_id);
+	g_dbus_remove_watch(port->listener_id);
 	port->listener_id = 0;
 
 	return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
diff --git a/serial/proxy.c b/serial/proxy.c
index 41bd331..6629c20 100644
--- a/serial/proxy.c
+++ b/serial/proxy.c
@@ -1022,7 +1022,7 @@ static void unregister_proxy(struct serial_proxy *proxy)
 	char *path = g_strdup(proxy->path);
 
 	if (proxy->watch > 0)
-		g_dbus_remove_watch(adapter->conn, proxy->watch);
+		g_dbus_remove_watch(proxy->watch);
 
 	g_dbus_emit_signal(adapter->conn,
 			adapter_get_path(adapter->btd_adapter),
diff --git a/src/adapter.c b/src/adapter.c
index 5fd0736..818a4b0 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -648,7 +648,7 @@ static void session_free(struct session_req *req)
 		req->mode ? "Mode" : "Discovery", req, req->owner);
 
 	if (req->id)
-		g_dbus_remove_watch(req->conn, req->id);
+		g_dbus_remove_watch(req->id);
 
 	session_remove(req);
 
diff --git a/src/agent.c b/src/agent.c
index 49e015c..3b472d5 100644
--- a/src/agent.c
+++ b/src/agent.c
@@ -176,7 +176,7 @@ void agent_free(struct agent *agent)
 	}
 
 	if (!agent->exited) {
-		g_dbus_remove_watch(connection, agent->listener_id);
+		g_dbus_remove_watch(agent->listener_id);
 		agent_release(agent);
 	}
 
diff --git a/src/device.c b/src/device.c
index dfdacd8..31f4c7e 100644
--- a/src/device.c
+++ b/src/device.c
@@ -186,7 +186,7 @@ static inline DBusMessage *in_progress(DBusMessage *msg, const char *str)
 static void browse_request_free(struct browse_req *req)
 {
 	if (req->listener_id)
-		g_dbus_remove_watch(req->conn, req->listener_id);
+		g_dbus_remove_watch(req->listener_id);
 	if (req->msg)
 		dbus_message_unref(req->msg);
 	if (req->conn)
@@ -1639,7 +1639,7 @@ static void bonding_request_free(struct bonding_req *bonding)
 		return;
 
 	if (bonding->listener_id)
-		g_dbus_remove_watch(bonding->conn, bonding->listener_id);
+		g_dbus_remove_watch(bonding->listener_id);
 
 	if (bonding->msg)
 		dbus_message_unref(bonding->msg);
-- 
1.6.6.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] g_dbus_remove_watch function
  2010-02-11 21:06 [PATCH] g_dbus_remove_watch function Claudio Takahasi
@ 2010-02-12 17:57 ` Marcel Holtmann
  0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2010-02-12 17:57 UTC (permalink / raw)
  To: Claudio Takahasi; +Cc: BlueZ development

Hi Claudio,

> this patch removes an unnecessary argument(D-Bus connection) of
> g_dbus_remove_watch.

I would prefer if we keep it. In theory we can open watches on per
connection basis. And keep the watch id based on this connection.

Regards

Marcel



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-02-12 17:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-11 21:06 [PATCH] g_dbus_remove_watch function Claudio Takahasi
2010-02-12 17:57 ` Marcel Holtmann

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).