Commit 4cc17bcf authored by Geliang Tang's avatar Geliang Tang Committed by David S. Miller

net: atheros: atl1: use offset_in_page() macro

Use offset_in_page() macro instead of open-coding.
Signed-off-by: default avatarGeliang Tang <geliangtang@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4dd42b94
...@@ -1886,7 +1886,7 @@ static u16 atl1_alloc_rx_buffers(struct atl1_adapter *adapter) ...@@ -1886,7 +1886,7 @@ static u16 atl1_alloc_rx_buffers(struct atl1_adapter *adapter)
buffer_info->skb = skb; buffer_info->skb = skb;
buffer_info->length = (u16) adapter->rx_buffer_len; buffer_info->length = (u16) adapter->rx_buffer_len;
page = virt_to_page(skb->data); page = virt_to_page(skb->data);
offset = (unsigned long)skb->data & ~PAGE_MASK; offset = offset_in_page(skb->data);
buffer_info->dma = pci_map_page(pdev, page, offset, buffer_info->dma = pci_map_page(pdev, page, offset,
adapter->rx_buffer_len, adapter->rx_buffer_len,
PCI_DMA_FROMDEVICE); PCI_DMA_FROMDEVICE);
...@@ -2230,7 +2230,7 @@ static void atl1_tx_map(struct atl1_adapter *adapter, struct sk_buff *skb, ...@@ -2230,7 +2230,7 @@ static void atl1_tx_map(struct atl1_adapter *adapter, struct sk_buff *skb,
hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb);
buffer_info->length = hdr_len; buffer_info->length = hdr_len;
page = virt_to_page(skb->data); page = virt_to_page(skb->data);
offset = (unsigned long)skb->data & ~PAGE_MASK; offset = offset_in_page(skb->data);
buffer_info->dma = pci_map_page(adapter->pdev, page, buffer_info->dma = pci_map_page(adapter->pdev, page,
offset, hdr_len, offset, hdr_len,
PCI_DMA_TODEVICE); PCI_DMA_TODEVICE);
...@@ -2254,9 +2254,8 @@ static void atl1_tx_map(struct atl1_adapter *adapter, struct sk_buff *skb, ...@@ -2254,9 +2254,8 @@ static void atl1_tx_map(struct atl1_adapter *adapter, struct sk_buff *skb,
data_len -= buffer_info->length; data_len -= buffer_info->length;
page = virt_to_page(skb->data + page = virt_to_page(skb->data +
(hdr_len + i * ATL1_MAX_TX_BUF_LEN)); (hdr_len + i * ATL1_MAX_TX_BUF_LEN));
offset = (unsigned long)(skb->data + offset = offset_in_page(skb->data +
(hdr_len + i * ATL1_MAX_TX_BUF_LEN)) & (hdr_len + i * ATL1_MAX_TX_BUF_LEN));
~PAGE_MASK;
buffer_info->dma = pci_map_page(adapter->pdev, buffer_info->dma = pci_map_page(adapter->pdev,
page, offset, buffer_info->length, page, offset, buffer_info->length,
PCI_DMA_TODEVICE); PCI_DMA_TODEVICE);
...@@ -2268,7 +2267,7 @@ static void atl1_tx_map(struct atl1_adapter *adapter, struct sk_buff *skb, ...@@ -2268,7 +2267,7 @@ static void atl1_tx_map(struct atl1_adapter *adapter, struct sk_buff *skb,
/* not TSO */ /* not TSO */
buffer_info->length = buf_len; buffer_info->length = buf_len;
page = virt_to_page(skb->data); page = virt_to_page(skb->data);
offset = (unsigned long)skb->data & ~PAGE_MASK; offset = offset_in_page(skb->data);
buffer_info->dma = pci_map_page(adapter->pdev, page, buffer_info->dma = pci_map_page(adapter->pdev, page,
offset, buf_len, PCI_DMA_TODEVICE); offset, buf_len, PCI_DMA_TODEVICE);
if (++next_to_use == tpd_ring->count) if (++next_to_use == tpd_ring->count)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment