public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: roger blofeld <blofeldus@yahoo.com>
To: gregkh@suse.de
Cc: linux-kernel@vger.kernel.org
Subject: [W1] Fix slave addition on big-endian platform
Date: Wed, 22 Jun 2005 18:27:32 -0700 (PDT)	[thread overview]
Message-ID: <20050623012732.64286.qmail@web53508.mail.yahoo.com> (raw)

Hi
 In the 2.6.12 code the "rn" structure is in the wrong-endianness when
passed to w1_attach_slave_device(). This causes problems like the
family and crc being swapped around. The following patch fixes the
problem for me.

Signed-off-by: Roger Blofeld <blofeldus@yahoo.com>

diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -493,6 +493,7 @@ void w1_slave_found(unsigned long data, 
        struct w1_reg_num *tmp;
        int family_found = 0;
        struct w1_master *dev;
+       u64 rn_le = cpu_to_le64(rn);
 
        dev = w1_search_master(data);
        if (!dev) {
@@ -522,10 +523,8 @@ void w1_slave_found(unsigned long data, 
                slave_count++;
        }
 
-       rn = cpu_to_le64(rn);
-
        if (slave_count == dev->slave_count &&
-               rn && ((le64_to_cpu(rn) >> 56) & 0xff) ==
w1_calc_crc8((u8 *)&rn, 7)) {
+               rn && ((rn >> 56) & 0xff) == w1_calc_crc8((u8 *)&rn_le,
7)) {
                w1_attach_slave_device(dev, tmp);
        }
                        



		
__________________________________ 
Yahoo! Mail 
Stay connected, organized, and protected. Take the tour: 
http://tour.mail.yahoo.com/mailtour.html 


             reply	other threads:[~2005-06-23  1:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-23  1:27 roger blofeld [this message]
2005-06-23  7:04 ` [W1] Fix slave addition on big-endian platform Greg KH

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=20050623012732.64286.qmail@web53508.mail.yahoo.com \
    --to=blofeldus@yahoo.com \
    --cc=gregkh@suse.de \
    --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