linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [RFC BlueZ 01/22] lib: Add functions to deal with unaligned access without conversion
Date: Sat, 11 Feb 2012 12:25:09 +0100	[thread overview]
Message-ID: <1328959509.28848.42.camel@aeonflux> (raw)
In-Reply-To: <1328910007-25604-2-git-send-email-vinicius.gomes@openbossa.org>

Hi Vinicius,

> In various places we need to do access unaligned memory, but we don't
> want to do any type of conversions, i.e. the values are already in the
> host order.
> ---
>  lib/bluetooth.h |   40 ++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 40 insertions(+), 0 deletions(-)
> 
> diff --git a/lib/bluetooth.h b/lib/bluetooth.h
> index 1dee6df..e9ced19 100644
> --- a/lib/bluetooth.h
> +++ b/lib/bluetooth.h
> @@ -126,6 +126,46 @@ do {						\
>  	__p->__v = (val);			\
>  } while(0)
>  
> +static inline uint64_t bt_get_h64(void *ptr)
> +{
> +	return bt_get_unaligned((uint64_t *) ptr);
> +}

this is a bad idea. Rather change the code to always clearly use the le
vs be versions. There is no need for a host copy. You only do this on
wire protocols and you know the endian.

Regards

Marcel



  reply	other threads:[~2012-02-11 11:25 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-10 21:39 [RFC BlueZ 00/22] Using clang for compiling BlueZ Vinicius Costa Gomes
2012-02-10 21:39 ` [RFC BlueZ 01/22] lib: Add functions to deal with unaligned access without conversion Vinicius Costa Gomes
2012-02-11 11:25   ` Marcel Holtmann [this message]
2012-02-10 21:39 ` [RFC BlueZ 02/22] lib: Add functions to storing values in unaligned places Vinicius Costa Gomes
2012-02-11 11:27   ` Marcel Holtmann
2012-02-10 21:39 ` [RFC BlueZ 03/22] lib: Fix the unaligned memory "getters" not receiving a const pointer Vinicius Costa Gomes
2012-02-10 21:39 ` [RFC BlueZ 04/22] tools: Fix using old-style initializers Vinicius Costa Gomes
2012-02-10 21:39 ` [RFC BlueZ 05/22] sap: Fix clang compiler warnings related to unaligned memory access Vinicius Costa Gomes
2012-02-10 21:39 ` [RFC BlueZ 06/22] lib: Fix using old-style initializers Vinicius Costa Gomes
2012-02-10 21:39 ` [RFC BlueZ 07/22] sdp: Fix clang compiler warnings related to unaligned memory access Vinicius Costa Gomes
2012-02-10 21:39 ` [RFC BlueZ 08/22] l2test: Fix clang compiler warning " Vinicius Costa Gomes
2012-02-10 21:39 ` [RFC BlueZ 09/22] rctest: Fix clang compiler warnings " Vinicius Costa Gomes
2012-02-10 21:39 ` [RFC BlueZ 10/22] dun: Fix using old-style initializers Vinicius Costa Gomes
2012-02-10 21:39 ` [RFC BlueZ 11/22] scotest: Fix clang compiler warnings related to unaligned memory access Vinicius Costa Gomes
2012-02-10 21:39 ` [RFC BlueZ 12/22] ipctest: Fix using the format specifier "as" Vinicius Costa Gomes
2012-02-11 11:31   ` Marcel Holtmann
2012-02-10 21:39 ` [RFC BlueZ 13/22] audio: Fix clang compiler warnings related to unaligned memory access Vinicius Costa Gomes
2012-02-10 21:39 ` [RFC BlueZ 14/22] audio: Fix clang compiler warnings regarding implicit enum conversion Vinicius Costa Gomes
2012-02-10 21:40 ` [RFC BlueZ 15/22] sap: Fix compiler warnings related to unaligned memory access Vinicius Costa Gomes
2012-02-10 21:40 ` [RFC BlueZ 16/22] network: Fix clang " Vinicius Costa Gomes
2012-02-10 21:40 ` [RFC BlueZ 17/22] mgmtops: Fix doing a useless memset() Vinicius Costa Gomes
2012-02-10 21:40 ` [RFC BlueZ 18/22] adaptername: Fix clang warning related to unaligned memory access Vinicius Costa Gomes
2012-02-14 12:39   ` Johan Hedberg
2012-02-10 21:40 ` [RFC BlueZ 19/22] sdp: Fix clang compiler warnings " Vinicius Costa Gomes
2012-02-10 21:40 ` [RFC BlueZ 20/22] hciconfig: Fix using old-style initializers Vinicius Costa Gomes
2012-02-10 21:40 ` [RFC BlueZ 21/22] hciconfig: Fix compiler warnings related to unaligned memory access Vinicius Costa Gomes
2012-02-10 21:40 ` [RFC BlueZ 22/22] hciemu: Fix clang " Vinicius Costa Gomes
2012-02-14 12:43 ` [RFC BlueZ 00/22] Using clang for compiling BlueZ 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=1328959509.28848.42.camel@aeonflux \
    --to=marcel@holtmann.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=vinicius.gomes@openbossa.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).