Use netdev_alloc_skb. This sets skb->dev and allows arch specific allocation. Compile tested only. Signed-off-by: Stephen Hemminger --- a/drivers/net/sis190.c 2008-04-16 15:21:05.000000000 -0700 +++ b/drivers/net/sis190.c 2008-04-16 16:31:30.000000000 -0700 @@ -480,30 +480,28 @@ static inline void sis190_make_unusable_ desc->status = 0x0; } -static int sis190_alloc_rx_skb(struct pci_dev *pdev, struct sk_buff **sk_buff, - struct RxDesc *desc, u32 rx_buf_sz) +static struct sk_buff *sis190_alloc_rx_skb(struct pci_dev *pdev, + struct net_device *dev, + struct RxDesc *desc, u32 rx_buf_sz) { struct sk_buff *skb; dma_addr_t mapping; int ret = 0; - skb = dev_alloc_skb(rx_buf_sz); + skb = netdev_alloc_skb(dev, rx_buf_sz); if (!skb) goto err_out; - *sk_buff = skb; - mapping = pci_map_single(pdev, skb->data, rx_buf_sz, PCI_DMA_FROMDEVICE); sis190_map_to_asic(desc, mapping, rx_buf_sz); -out: - return ret; + return skb; err_out: ret = -ENOMEM; sis190_make_unusable_by_asic(desc); - goto out; + return NULL; } static u32 sis190_rx_fill(struct sis190_private *tp, struct net_device *dev, @@ -512,30 +510,32 @@ static u32 sis190_rx_fill(struct sis190_ u32 cur; for (cur = start; cur < end; cur++) { - int ret, i = cur % NUM_RX_DESC; + int i = cur % NUM_RX_DESC; if (tp->Rx_skbuff[i]) continue; - ret = sis190_alloc_rx_skb(tp->pci_dev, tp->Rx_skbuff + i, - tp->RxDescRing + i, tp->rx_buf_sz); - if (ret < 0) + tp->Rx_skbuff[i] = sis190_alloc_rx_skb(tp->pci_dev, dev, + tp->RxDescRing + i, + tp->rx_buf_sz); + if (!tp->Rx_skbuff[i]) break; } return cur - start; } -static inline int sis190_try_rx_copy(struct sk_buff **sk_buff, int pkt_size, - struct RxDesc *desc, int rx_buf_sz) +static int sis190_try_rx_copy(struct net_device *dev, + struct sk_buff **sk_buff, int pkt_size, + struct RxDesc *desc, int rx_buf_sz) { - int ret = -1; + int ret = 01; if (pkt_size < rx_copybreak) { struct sk_buff *skb; - skb = dev_alloc_skb(pkt_size + NET_IP_ALIGN); + skb = netdev_alloc_skb(dev, pkt_size + 2); if (skb) { - skb_reserve(skb, NET_IP_ALIGN); + skb_reserve(skb, 2); skb_copy_to_linear_data(skb, sk_buff[0]->data, pkt_size); *sk_buff = skb; sis190_give_to_asic(desc, rx_buf_sz); @@ -610,7 +610,7 @@ static int sis190_rx_interrupt(struct ne le32_to_cpu(desc->addr), tp->rx_buf_sz, PCI_DMA_FROMDEVICE); - if (sis190_try_rx_copy(&skb, pkt_size, desc, + if (sis190_try_rx_copy(dev, &skb, pkt_size, desc, tp->rx_buf_sz)) { pci_action = pci_unmap_single; tp->Rx_skbuff[entry] = NULL; -- -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html