linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phil Reid <preid@electromag.com.au>
To: Alexander Stein <alexander.stein@systec-electronic.com>,
	linux-kernel@vger.kernel.org
Cc: Yong Li <sdliyong@gmail.com>, linux-gpio@vger.kernel.org
Subject: Re: [PATCH] gpio: pca953x: Use correct u16 value for register word write
Date: Wed, 30 Mar 2016 00:33:28 +0800	[thread overview]
Message-ID: <56FAAE58.20004@electromag.com.au> (raw)
In-Reply-To: <1680089.6CCf2RWg8O@ws-stein>

On 29/03/2016 10:39 PM, Alexander Stein wrote:
> You missed CC'ing Phil (Added for this post)
>
> On Tuesday 29 March 2016 20:53:58, Yong Li wrote:
>> Thanks for your comment, I think I can change it to val[0] | (val[1]
>> << 8), is it okay ?
>
> Mh, currently there is only one caller (device_pca953x_init) which passes only
> 0, 0 or 0xff, 0xff, so endianess is irrelevant. But to be future proof this
> should be done in an endian-safe manner. Though cpu_to_le16p does not work,
> due to same alignment problem as casting to u16*.
>

I think get_unaligned((u16 *) val) should do the job.
There's also get_unaligned_le* get_unaligned_be*

-- 
Regards
Phil Reid


  reply	other threads:[~2016-03-29 16:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-29  6:27 [PATCH] gpio: pca953x: Use correct u16 value for register word write Yong Li
2016-03-29 12:06 ` Phil Reid
2016-03-29 12:53   ` Yong Li
2016-03-29 14:39     ` Alexander Stein
2016-03-29 16:33       ` Phil Reid [this message]
2016-03-30  2:46         ` Yong Li
     [not found]         ` <CADO9-pdxpQRQQ8RFtjT6rz28GteL3u+at0EGVdNwG8VV48SGEw@mail.gmail.com>
2016-03-30  5:01           ` Yong Li
2016-03-30  5:14             ` Phil Reid

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=56FAAE58.20004@electromag.com.au \
    --to=preid@electromag.com.au \
    --cc=alexander.stein@systec-electronic.com \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sdliyong@gmail.com \
    /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).