]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
s390/pci: use proper endianness annotations
authorSebastian Ott <sebott@linux.vnet.ibm.com>
Sat, 17 Dec 2016 14:35:39 +0000 (15:35 +0100)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Mon, 16 Jan 2017 06:27:53 +0000 (07:27 +0100)
Add proper annotation to the bar definition and use casts within the
bus accessors. Also change the sequence in the accessors to do the
shifts in the native byte order. No functional change.

Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/include/asm/pci_clp.h
arch/s390/pci/pci.c

index d6f1b1d94352000035d61546cb6b2688b3081e0e..938b8cc19fc637598c089c2a87c74d4442e87b80 100644 (file)
@@ -85,7 +85,7 @@ struct clp_rsp_query_pci {
        u32 fid;                        /* pci function id */
        u8 bar_size[PCI_BAR_COUNT];
        u16 pchid;
-       u32 bar[PCI_BAR_COUNT];
+       __le32 bar[PCI_BAR_COUNT];
        u8 pfip[CLP_PFIP_NR_SEGMENTS];  /* pci function internal path */
        u32                     : 16;
        u8 fmb_len;
index 38e17d4d9884ddd240b8221a1155d991e00a253d..4c0fa9b3b2a003cf4acf191631432f54001c6901 100644 (file)
@@ -224,8 +224,8 @@ static int zpci_cfg_load(struct zpci_dev *zdev, int offset, u32 *val, u8 len)
 
        rc = zpci_load(&data, req, offset);
        if (!rc) {
-               data = data << ((8 - len) * 8);
-               data = le64_to_cpu(data);
+               data = le64_to_cpu((__force __le64) data);
+               data >>= (8 - len) * 8;
                *val = (u32) data;
        } else
                *val = 0xffffffff;
@@ -238,8 +238,8 @@ static int zpci_cfg_store(struct zpci_dev *zdev, int offset, u32 val, u8 len)
        u64 data = val;
        int rc;
 
-       data = cpu_to_le64(data);
-       data = data >> ((8 - len) * 8);
+       data <<= (8 - len) * 8;
+       data = (__force u64) cpu_to_le64(data);
        rc = zpci_store(data, req, offset);
        return rc;
 }