linux-mips
[Top] [All Lists]

[PATCH] fix for big-endian bug in arch/mips/pci/ops-au1000.c

To: Pete Popov <ppopov@embeddedalley.com>
Subject: [PATCH] fix for big-endian bug in arch/mips/pci/ops-au1000.c
From: Herbert Valerio Riedel <hvr@inso.tuwien.ac.at>
Date: Sun, 14 Nov 2004 21:03:13 +0100
Cc: linux-mips@linux-mips.org
Organization: Research Group for Industrial Software @ Vienna University of Technology
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
well, w/ the following modification, the code becomes
endian-independent... :-)

diff -u -r1.11 ops-au1000.c
--- arch/mips/pci/ops-au1000.c  6 Jun 2004 02:12:38 -0000       1.11
+++ arch/mips/pci/ops-au1000.c  14 Nov 2004 19:59:23 -0000
@@ -288,10 +288,18 @@
                       int where, int size, u32 * val)
 {
        switch (size) {
-       case 1:
-               return read_config_byte(bus, devfn, where, (u8 *) val);
-       case 2:
-               return read_config_word(bus, devfn, where, (u16 *) val);
+       case 1: {
+                       u8 _val;
+                       int rc = read_config_byte(bus, devfn, where, &_val);
+                       *val = _val;
+                       return rc;
+               }
+       case 2: {
+                       u16 _val;
+                       int rc = read_config_word(bus, devfn, where, &_val);
+                       *val = _val; 
+                       return rc;
+               }
        default:
                return read_config_dword(bus, devfn, where, val);
        }




-- 
Herbert Valerio Riedel <hvr@inso.tuwien.ac.at>
Research Group for Industrial Software @ Vienna University of Technology


<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH] fix for big-endian bug in arch/mips/pci/ops-au1000.c, Herbert Valerio Riedel <=