]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
fm10k: prefer READ_ONCE instead of ACCESS_ONCE
authorJacob Keller <jacob.e.keller@intel.com>
Fri, 17 Jun 2016 23:21:11 +0000 (16:21 -0700)
committerChuck Anderson <chuck.anderson@oracle.com>
Sun, 26 Feb 2017 06:04:32 +0000 (22:04 -0800)
While technically not needed, as all our uses of ACCESS_ONCE are scalar
types, we already use READ_ONCE in a few places, and for code
readability we can swap all the uses of the older ACCESS_ONCE into
READ_ONCE.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Orabug: 25394529
(cherry picked from commit ce4dad2ce231aa5258ddfc98f8a80d958643c014)
Signed-off-by: Jack Vogel <jack.vogel@oracle.com>
drivers/net/ethernet/intel/fm10k/fm10k_common.h
drivers/net/ethernet/intel/fm10k/fm10k_iov.c
drivers/net/ethernet/intel/fm10k/fm10k_main.c
drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
drivers/net/ethernet/intel/fm10k/fm10k_pci.c

index 50f71e997448e7104780c51adea3f633edc039f6..d51f9c7a47ff4d4ec80b758650cfc59bf240794b 100644 (file)
@@ -34,7 +34,7 @@ u32 fm10k_read_reg(struct fm10k_hw *hw, int reg);
 /* write operations, indexed using DWORDS */
 #define fm10k_write_reg(hw, reg, val) \
 do { \
-       u32 __iomem *hw_addr = ACCESS_ONCE((hw)->hw_addr); \
+       u32 __iomem *hw_addr = READ_ONCE((hw)->hw_addr); \
        if (!FM10K_REMOVED(hw_addr)) \
                writel((val), &hw_addr[(reg)]); \
 } while (0)
@@ -42,7 +42,7 @@ do { \
 /* Switch register write operations, index using DWORDS */
 #define fm10k_write_sw_reg(hw, reg, val) \
 do { \
-       u32 __iomem *sw_addr = ACCESS_ONCE((hw)->sw_addr); \
+       u32 __iomem *sw_addr = READ_ONCE((hw)->sw_addr); \
        if (!FM10K_REMOVED(sw_addr)) \
                writel((val), &sw_addr[(reg)]); \
 } while (0)
index 47f0743ec03b8f38f9cd3012a0cbc14bb8e3eb2a..d9dec81f6b6d01dbd8f0fdbd1390692210597741 100644 (file)
@@ -51,7 +51,7 @@ s32 fm10k_iov_event(struct fm10k_intfc *interface)
        int i;
 
        /* if there is no iov_data then there is no mailbox to process */
-       if (!ACCESS_ONCE(interface->iov_data))
+       if (!READ_ONCE(interface->iov_data))
                return 0;
 
        rcu_read_lock();
@@ -99,7 +99,7 @@ s32 fm10k_iov_mbx(struct fm10k_intfc *interface)
        int i;
 
        /* if there is no iov_data then there is no mailbox to process */
-       if (!ACCESS_ONCE(interface->iov_data))
+       if (!READ_ONCE(interface->iov_data))
                return 0;
 
        rcu_read_lock();
index 895471a7ab100ff4a4eec4bc023b1e481f2ba0a4..f5a5bf910a889eec6897a8c1d6bb20c548328585 100644 (file)
@@ -1427,7 +1427,7 @@ static void fm10k_update_itr(struct fm10k_ring_container *ring_container)
         * that the calculation will never get below a 1. The bit shift
         * accounts for changes in the ITR due to PCIe link speed.
         */
-       itr_round = ACCESS_ONCE(ring_container->itr_scale) + 8;
+       itr_round = READ_ONCE(ring_container->itr_scale) + 8;
        avg_wire_size += BIT(itr_round) - 1;
        avg_wire_size >>= itr_round;
 
index 4062762c38b6713606f44c48ec97a0082f404b40..87c011eb293177e7ed26fe89bbe3b7105c030c0e 100644 (file)
@@ -1105,7 +1105,7 @@ static struct rtnl_link_stats64 *fm10k_get_stats64(struct net_device *netdev,
        rcu_read_lock();
 
        for (i = 0; i < interface->num_rx_queues; i++) {
-               ring = ACCESS_ONCE(interface->rx_ring[i]);
+               ring = READ_ONCE(interface->rx_ring[i]);
 
                if (!ring)
                        continue;
@@ -1121,7 +1121,7 @@ static struct rtnl_link_stats64 *fm10k_get_stats64(struct net_device *netdev,
        }
 
        for (i = 0; i < interface->num_tx_queues; i++) {
-               ring = ACCESS_ONCE(interface->tx_ring[i]);
+               ring = READ_ONCE(interface->tx_ring[i]);
 
                if (!ring)
                        continue;
@@ -1309,7 +1309,7 @@ static void *fm10k_dfwd_add_station(struct net_device *dev,
 static void fm10k_dfwd_del_station(struct net_device *dev, void *priv)
 {
        struct fm10k_intfc *interface = netdev_priv(dev);
-       struct fm10k_l2_accel *l2_accel = ACCESS_ONCE(interface->l2_accel);
+       struct fm10k_l2_accel *l2_accel = READ_ONCE(interface->l2_accel);
        struct fm10k_dglort_cfg dglort = { 0 };
        struct fm10k_hw *hw = &interface->hw;
        struct net_device *sdev = priv;
index 713a116314db53926282869e72f6a7afe377858b..08629e06ffd02e60c55bee501d0102cb9634068d 100644 (file)
@@ -62,7 +62,7 @@ u16 fm10k_read_pci_cfg_word(struct fm10k_hw *hw, u32 reg)
 
 u32 fm10k_read_reg(struct fm10k_hw *hw, int reg)
 {
-       u32 __iomem *hw_addr = ACCESS_ONCE(hw->hw_addr);
+       u32 __iomem *hw_addr = READ_ONCE(hw->hw_addr);
        u32 value = 0;
 
        if (FM10K_REMOVED(hw_addr))