sfc: Use ACCESS_ONCE when copying efx_tx_queue::read_count
authorBen Hutchings <bhutchings@solarflare.com>
Wed, 10 Nov 2010 18:46:40 +0000 (18:46 +0000)
committerBen Hutchings <bhutchings@solarflare.com>
Mon, 6 Dec 2010 22:54:18 +0000 (22:54 +0000)
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
drivers/net/sfc/tx.c

index 03194f7c09547ad88356c254eb35add62365b58f..fef22351ddbde2d7a9afd129a77934e33fcf9b0a 100644 (file)
@@ -240,8 +240,7 @@ netdev_tx_t efx_enqueue_skb(struct efx_tx_queue *tx_queue, struct sk_buff *skb)
                                 * of read_count. */
                                smp_mb();
                                tx_queue->old_read_count =
-                                       *(volatile unsigned *)
-                                       &tx_queue->read_count;
+                                       ACCESS_ONCE(tx_queue->read_count);
                                fill_level = (tx_queue->insert_count
                                              - tx_queue->old_read_count);
                                q_space = efx->txq_entries - 1 - fill_level;
@@ -764,7 +763,7 @@ static int efx_tx_queue_insert(struct efx_tx_queue *tx_queue,
                         * stopped from the access of read_count. */
                        smp_mb();
                        tx_queue->old_read_count =
-                               *(volatile unsigned *)&tx_queue->read_count;
+                               ACCESS_ONCE(tx_queue->read_count);
                        fill_level = (tx_queue->insert_count
                                      - tx_queue->old_read_count);
                        q_space = efx->txq_entries - 1 - fill_level;