net: aquantia: fix warnings on endianness
authorIgor Russkikh <Igor.Russkikh@aquantia.com>
Sat, 26 Oct 2019 11:05:33 +0000 (11:05 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sat, 26 Oct 2019 18:28:40 +0000 (11:28 -0700)
fixes to remove sparse warnings:
sparse: sparse: cast to restricted __be64

Fixes: 04a1839950d9 ("net: aquantia: implement data PTP datapath")
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.h

index 51ecf87e019873a7be4bfe87237f6b345dbc67a7..abee561ea54e9a97665708ac23ada6992b0fa01c 100644 (file)
@@ -1236,9 +1236,9 @@ static u16 hw_atl_b0_rx_extract_ts(struct aq_hw_s *self, u8 *p,
 {
        unsigned int offset = 14;
        struct ethhdr *eth;
-       u64 sec;
+       __be64 sec;
+       __be32 ns;
        u8 *ptr;
-       u32 ns;
 
        if (len <= offset || !timestamp)
                return 0;
@@ -1256,9 +1256,8 @@ static u16 hw_atl_b0_rx_extract_ts(struct aq_hw_s *self, u8 *p,
        ptr += sizeof(sec);
        memcpy(&ns, ptr, sizeof(ns));
 
-       sec = be64_to_cpu(sec) & 0xffffffffffffllu;
-       ns = be32_to_cpu(ns);
-       *timestamp = sec * NSEC_PER_SEC + ns + self->ptp_clk_offset;
+       *timestamp = (be64_to_cpu(sec) & 0xffffffffffffllu) * NSEC_PER_SEC +
+                    be32_to_cpu(ns) + self->ptp_clk_offset;
 
        eth = (struct ethhdr *)p;
 
index 37e6b696009d52ff7210f706b674dafed2944eb1..ee11b107f0a593df75e0251738a4574209454139 100644 (file)
@@ -41,7 +41,7 @@ struct __packed hw_atl_rxd_wb_s {
        u16 status;
        u16 pkt_len;
        u16 next_desc_ptr;
-       u16 vlan;
+       __le16 vlan;
 };
 
 /* Hardware rx HW TIMESTAMP writeback */