All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH v2 12/21] audio/sink: Remove dependency on struct audio_device
Date: Tue,  9 Jul 2013 17:39:09 +0300	[thread overview]
Message-ID: <1373380758-16489-16-git-send-email-luiz.dentz@gmail.com> (raw)
In-Reply-To: <1373380758-16489-1-git-send-email-luiz.dentz@gmail.com>

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

This is part of the work necessary to completely remove
struct audio_device
---
 profiles/audio/manager.c |  2 +-
 profiles/audio/sink.c    | 20 ++++++++------------
 profiles/audio/sink.h    |  2 +-
 3 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/profiles/audio/manager.c b/profiles/audio/manager.c
index ca4b9d4..cafb4dc 100644
--- a/profiles/audio/manager.c
+++ b/profiles/audio/manager.c
@@ -132,7 +132,7 @@ static int a2dp_sink_probe(struct btd_service *service)
 
 	audio_dev->sink = service;
 
-	return sink_init(audio_dev, service);
+	return sink_init(service);
 }
 
 static int avrcp_target_probe(struct btd_service *service)
diff --git a/profiles/audio/sink.c b/profiles/audio/sink.c
index 898ffea..9226002 100644
--- a/profiles/audio/sink.c
+++ b/profiles/audio/sink.c
@@ -39,11 +39,10 @@
 
 #include "log.h"
 
-#include "../src/adapter.h"
-#include "../src/device.h"
-#include "../src/service.h"
+#include "src/adapter.h"
+#include "src/device.h"
+#include "src/service.h"
 
-#include "device.h"
 #include "avdtp.h"
 #include "media.h"
 #include "a2dp.h"
@@ -55,7 +54,6 @@
 #define STREAM_SETUP_RETRY_TIMER 2
 
 struct sink {
-	struct audio_device *dev;
 	struct btd_service *service;
 	struct avdtp *session;
 	struct avdtp_stream *stream;
@@ -335,7 +333,6 @@ int sink_connect(struct btd_service *service)
 static void sink_free(struct btd_service *service)
 {
 	struct sink *sink = btd_service_get_user_data(service);
-	struct audio_device *dev = sink->dev;
 
 	if (sink->cb_id)
 		avdtp_stream_remove_cb(sink->session, sink->stream,
@@ -363,7 +360,6 @@ static void sink_free(struct btd_service *service)
 	btd_service_unref(sink->service);
 
 	g_free(sink);
-	dev->sink = NULL;
 }
 
 void sink_unregister(struct btd_service *service)
@@ -375,19 +371,19 @@ void sink_unregister(struct btd_service *service)
 	sink_free(service);
 }
 
-int sink_init(struct audio_device *dev, struct btd_service *service)
+int sink_init(struct btd_service *service)
 {
+	struct btd_device *dev = btd_service_get_device(service);
 	struct sink *sink;
 
-	DBG("%s", device_get_path(dev->btd_dev));
+	DBG("%s", device_get_path(dev));
 
 	sink = g_new0(struct sink, 1);
 
-	sink->dev = dev;
 	sink->service = btd_service_ref(service);
 
-	sink->avdtp_callback_id = avdtp_add_state_cb(dev->btd_dev,
-						avdtp_state_callback, sink);
+	sink->avdtp_callback_id = avdtp_add_state_cb(dev, avdtp_state_callback,
+									sink);
 
 	btd_service_set_user_data(service, sink);
 
diff --git a/profiles/audio/sink.h b/profiles/audio/sink.h
index cf0934b..904a33d 100644
--- a/profiles/audio/sink.h
+++ b/profiles/audio/sink.h
@@ -40,7 +40,7 @@ unsigned int sink_add_state_cb(struct btd_service *service, sink_state_cb cb,
 							void *user_data);
 gboolean sink_remove_state_cb(unsigned int id);
 
-int sink_init(struct audio_device *dev, struct btd_service *service);
+int sink_init(struct btd_service *service);
 void sink_unregister(struct btd_service *service);
 gboolean sink_is_active(struct btd_service *service);
 int sink_connect(struct btd_service *service);
-- 
1.8.1.4


  parent reply	other threads:[~2013-07-09 14:39 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-09 14:38 [PATCH v2 00/21] Remove audio_device and introduce policy plugin Luiz Augusto von Dentz
2013-07-09 14:38 ` [PATCH v2 01/21] audio/sink: Use service user_data for private data Luiz Augusto von Dentz
2013-07-09 14:38 ` [PATCH BlueZ 1/3 v2] core/service: Rename service_shutdown to service_remove Luiz Augusto von Dentz
2013-07-10 10:00   ` Luiz Augusto von Dentz
2013-07-09 14:38 ` [PATCH v2 02/21] audio/source: Use service user_data for private data Luiz Augusto von Dentz
2013-07-09 14:38 ` [PATCH BlueZ 2/3 v2] core/device: Fix crash while freeing services list Luiz Augusto von Dentz
2013-07-09 14:38 ` [PATCH v2 03/21] audio/control: Use service user_data for private data Luiz Augusto von Dentz
2013-07-09 14:39 ` [PATCH BlueZ 3/3 v2] core/device: Don't call btd_service_disconnect on device_remove Luiz Augusto von Dentz
2013-07-09 14:39 ` [PATCH v2 04/21] audio/sink: Reduce dependency on struct audio_device Luiz Augusto von Dentz
2013-07-09 14:39 ` [PATCH v2 05/21] audio/source: " Luiz Augusto von Dentz
2013-07-09 14:39 ` [PATCH v2 06/21] audio/control: " Luiz Augusto von Dentz
2013-07-09 14:39 ` [PATCH v2 07/21] audio/AVCTP: Remove " Luiz Augusto von Dentz
2013-07-09 14:39 ` [PATCH v2 08/21] audio/AVDTP: " Luiz Augusto von Dentz
2013-07-09 14:39 ` [PATCH v2 09/21] audio/AVRCP: " Luiz Augusto von Dentz
2013-07-09 14:39 ` [PATCH v2 10/21] audio/control: " Luiz Augusto von Dentz
2013-07-09 14:39 ` [PATCH v2 11/21] audio/A2DP: " Luiz Augusto von Dentz
2013-07-09 14:39 ` Luiz Augusto von Dentz [this message]
2013-07-09 14:39 ` [PATCH v2 13/21] audio/source: " Luiz Augusto von Dentz
2013-07-09 14:39 ` [PATCH v2 14/21] audio/media: " Luiz Augusto von Dentz
2013-07-09 14:39 ` [PATCH v2 15/21] audio/transport: " Luiz Augusto von Dentz
2013-07-09 14:39 ` [PATCH v2 16/21] audio/manager: " Luiz Augusto von Dentz
2013-07-09 14:39 ` [PATCH v2 17/21] audio/main: " Luiz Augusto von Dentz
2013-07-09 14:39 ` [PATCH v2 18/21] plugins/policy: Reword audio policy code in a simple plugin Luiz Augusto von Dentz
2013-07-09 14:39 ` [PATCH v2 19/21] audio/source: Move stream retry logic to policy plugin Luiz Augusto von Dentz
2013-07-09 14:39 ` [PATCH v2 20/21] audio/sink: " Luiz Augusto von Dentz
2013-07-09 14:39 ` [PATCH v2 21/21] audio/control: Enable initiate connection to CT role Luiz Augusto von Dentz
2013-07-12 12:07 ` [PATCH v2 00/21] Remove audio_device and introduce policy plugin 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=1373380758-16489-16-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.