Linux bluetooth development
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 09/16] android/avrcp-lib: Make hton24 and ntoh24 public
Date: Sun,  2 Mar 2014 20:48:24 +0200	[thread overview]
Message-ID: <1393786109-6554-9-git-send-email-luiz.dentz@gmail.com> (raw)
In-Reply-To: <1393786109-6554-1-git-send-email-luiz.dentz@gmail.com>

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

This avoids duplicating those function everytime.
---
 android/avrcp-lib.c | 12 ------------
 android/avrcp-lib.h | 12 ++++++++++++
 unit/test-avrcp.c   |  7 -------
 3 files changed, 12 insertions(+), 19 deletions(-)

diff --git a/android/avrcp-lib.c b/android/avrcp-lib.c
index 40ff7b3..60c8ba3 100644
--- a/android/avrcp-lib.c
+++ b/android/avrcp-lib.c
@@ -73,18 +73,6 @@ struct avrcp_header {
 #error "Unknown byte order"
 #endif
 
-static inline uint32_t ntoh24(const uint8_t src[3])
-{
-	return src[0] << 16 | src[1] << 8 | src[2];
-}
-
-static inline void hton24(uint8_t dst[3], uint32_t src)
-{
-	dst[0] = (src & 0xff0000) >> 16;
-	dst[1] = (src & 0x00ff00) >> 8;
-	dst[2] = (src & 0x0000ff);
-}
-
 struct avrcp {
 	struct avctp *conn;
 
diff --git a/android/avrcp-lib.h b/android/avrcp-lib.h
index 3df5897..8625425 100644
--- a/android/avrcp-lib.h
+++ b/android/avrcp-lib.h
@@ -91,6 +91,18 @@ struct avrcp_passthrough_handler {
 
 typedef void (*avrcp_destroy_cb_t) (void *user_data);
 
+static inline uint32_t ntoh24(const uint8_t src[3])
+{
+	return src[0] << 16 | src[1] << 8 | src[2];
+}
+
+static inline void hton24(uint8_t dst[3], uint32_t src)
+{
+	dst[0] = (src & 0xff0000) >> 16;
+	dst[1] = (src & 0x00ff00) >> 8;
+	dst[2] = (src & 0x0000ff);
+}
+
 struct avrcp *avrcp_new(int fd, size_t imtu, size_t omtu, uint16_t version);
 void avrcp_shutdown(struct avrcp *session);
 void avrcp_set_destroy_cb(struct avrcp *session, avrcp_destroy_cb_t cb,
diff --git a/unit/test-avrcp.c b/unit/test-avrcp.c
index 0294973..695f62c 100644
--- a/unit/test-avrcp.c
+++ b/unit/test-avrcp.c
@@ -94,13 +94,6 @@ struct context {
 		g_test_add_data_func(name, &data, function);		\
 	} while (0)
 
-static inline void hton24(uint8_t dst[3], uint32_t src)
-{
-	dst[0] = (src & 0xff0000) >> 16;
-	dst[1] = (src & 0x00ff00) >> 8;
-	dst[2] = (src & 0x0000ff);
-}
-
 static void test_debug(const char *str, void *user_data)
 {
 	const char *prefix = user_data;
-- 
1.8.5.3


  parent reply	other threads:[~2014-03-02 18:48 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-02 18:48 [PATCH BlueZ 01/16] android/avrcp-lib: Add avrcp_send function Luiz Augusto von Dentz
2014-03-02 18:48 ` [PATCH BlueZ 02/16] android/avctp: Make handler return ssize_t Luiz Augusto von Dentz
2014-03-02 18:48 ` [PATCH BlueZ 03/16] android/avrcp-lib: Rework handler callback parameters Luiz Augusto von Dentz
2014-03-03  9:52   ` Andrei Emeltchenko
2014-03-03 12:41     ` Luiz Augusto von Dentz
2014-03-04  8:05       ` Andrei Emeltchenko
2014-03-02 18:48 ` [PATCH BlueZ 04/16] android/avrcp-lib: Embed response code into handler table Luiz Augusto von Dentz
2014-03-02 18:48 ` [PATCH BlueZ 05/16] android/avrcp-lib: Fix not passing user data of passthrough callback Luiz Augusto von Dentz
2014-03-02 18:48 ` [PATCH BlueZ 06/16] android/avrcp-lib: Add pressed status to passthrough handler callback Luiz Augusto von Dentz
2014-03-02 18:48 ` [PATCH BlueZ 07/16] android/avrcp: Add passthrough handler for fast forward Luiz Augusto von Dentz
2014-03-02 18:48 ` [PATCH BlueZ 08/16] android/avrcp: Add passthrough handler for rewind Luiz Augusto von Dentz
2014-03-02 18:48 ` Luiz Augusto von Dentz [this message]
2014-03-02 18:48 ` [PATCH BlueZ 10/16] android/avrcp: Add handler for GetCapabilities command Luiz Augusto von Dentz
2014-03-03 10:10   ` Andrei Emeltchenko
2014-03-02 18:48 ` [PATCH BlueZ 11/16] android/avrcp: Add handler for GetPlayStatus command Luiz Augusto von Dentz
2014-03-02 18:48 ` [PATCH BlueZ 12/16] android/avrcp: Add handler for GetElementAttributes command Luiz Augusto von Dentz
2014-03-02 18:48 ` [PATCH BlueZ 13/16] android/avrcp: Add handler for RegisterNotification command Luiz Augusto von Dentz
2014-03-02 18:48 ` [PATCH BlueZ 14/16] android/avrcp: Bump version to 1.3 Luiz Augusto von Dentz
2014-03-04 11:47 ` [PATCH BlueZ 01/16] android/avrcp-lib: Add avrcp_send function 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=1393786109-6554-9-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