linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v0] network: Remove unnecessary field from connect_req
@ 2012-10-26  5:55 Mikel Astiz
  2012-10-26  8:00 ` Johan Hedberg
  0 siblings, 1 reply; 2+ messages in thread
From: Mikel Astiz @ 2012-10-26  5:55 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Mikel Astiz

From: Mikel Astiz <mikel.astiz@bmw-carit.de>

The device pointer in struct connect_req can be completely removed since
the callback already receives such pointer, and the network_peer takes
care of the device refcounting.
---
 profiles/network/manager.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/profiles/network/manager.c b/profiles/network/manager.c
index ad52885..8d0dc4d 100644
--- a/profiles/network/manager.c
+++ b/profiles/network/manager.c
@@ -48,7 +48,6 @@
 static gboolean conf_security = TRUE;
 
 struct connect_req {
-	struct btd_device	*device;
 	struct btd_profile	*profile;
 	btd_profile_cb		cb;
 };
@@ -84,9 +83,7 @@ static void connect_profile_cb(struct btd_device *device, int err,
 {
 	struct connect_req *req = data;
 
-	req->cb(req->profile, req->device, err);
-
-	btd_device_unref(req->device);
+	req->cb(req->profile, device, err);
 
 	g_free(req);
 }
@@ -100,14 +97,12 @@ static int connect_profile(struct btd_device *dev, struct btd_profile *profile,
 	DBG("path %s id %u", device_get_path(dev), id);
 
 	req  = g_new0(struct connect_req, 1);
-	req->device = btd_device_ref(dev);
 	req->profile = profile;
 	req->cb = cb;
 
 	err = connection_connect(dev, BNEP_SVC_PANU, NULL, connect_profile_cb,
 									req);
 	if (err < 0) {
-		btd_device_unref(req->device);
 		g_free(req);
 		return err;
 	}
-- 
1.7.11.7


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

* Re: [PATCH v0] network: Remove unnecessary field from connect_req
  2012-10-26  5:55 [PATCH v0] network: Remove unnecessary field from connect_req Mikel Astiz
@ 2012-10-26  8:00 ` Johan Hedberg
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2012-10-26  8:00 UTC (permalink / raw)
  To: Mikel Astiz; +Cc: linux-bluetooth, Mikel Astiz

Hi Mikel,

On Fri, Oct 26, 2012, Mikel Astiz wrote:
> The device pointer in struct connect_req can be completely removed since
> the callback already receives such pointer, and the network_peer takes
> care of the device refcounting.
> ---
>  profiles/network/manager.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)

Applied. Thanks.

Johan

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

end of thread, other threads:[~2012-10-26  8:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-26  5:55 [PATCH v0] network: Remove unnecessary field from connect_req Mikel Astiz
2012-10-26  8:00 ` Johan Hedberg

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