mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Evgeniy Polyakov <zbr@ioremap.net>
To: Chen Lin <chen.lin5@zte.com.cn>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: "jiang.biao2@zte.com.cn" <jiang.biao2@zte.com.cn>
Subject: Re: [PATCH v2] w1:fix byteorder of W1_READ_ROM id under big-endian cpu
Date: Sun, 27 Aug 2017 10:36:50 +0300	[thread overview]
Message-ID: <1206341503819410@web4g.yandex.ru> (raw)
In-Reply-To: <1500451680-17885-1-git-send-email-chen.lin5@zte.com.cn>

Hi Chen

19.07.2017, 10:58, "Chen Lin" <chen.lin5@zte.com.cn>:
> The byteorder of para rn(W1_READ_ROM id) pass to w1_slave_found must
> be the same with the byterorder defined in struct w1_reg_num.
>
> The rn read from 'rv = w1_read_block(dev, (u8 *)&rn, 8)' is a byte
> serial and not cpu endian relative, it need to change to cpu endian
> before passed to w1_slave_found.

But w1_reg_num has a different layout for be/le systems, isn't it enough?

> Signed-off-by: Chen Lin <chen.lin5@zte.com.cn>
> Reviewed-by: Jiang Biao <jiang.biao2@zte.com.cn>
> ---
> Forgot the description in v1.
>
> ---
>  drivers/w1/w1.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
> index 95ea7e6..c531545 100644
> --- a/drivers/w1/w1.c
> +++ b/drivers/w1/w1.c
> @@ -979,7 +979,7 @@ void w1_search(struct w1_master *dev, u8 search_type, w1_slave_found_callback cb
>                          mutex_unlock(&dev->bus_mutex);
>
>                          if (rv == 8 && rn)
> - cb(dev, rn);
> + cb(dev, le64_to_cpu(rn));
>
>                          break;
>                  }
> --
> 1.8.3.1

  reply	other threads:[~2017-08-27  7:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-19  8:08 Chen Lin
2017-08-27  7:36 ` Evgeniy Polyakov [this message]
     [not found] <201708281725129358346@zte.com.cn>
2017-09-05 13:39 ` Evgeniy Polyakov

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=1206341503819410@web4g.yandex.ru \
    --to=zbr@ioremap.net \
    --cc=chen.lin5@zte.com.cn \
    --cc=jiang.biao2@zte.com.cn \
    --cc=linux-kernel@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

all inboxes | Powered by JetHome®