diff options
Diffstat (limited to 'drivers/net/ethoc.c')
-rw-r--r-- | drivers/net/ethoc.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/net/ethoc.c b/drivers/net/ethoc.c index f7d9ac8324cb..a8d92503226e 100644 --- a/drivers/net/ethoc.c +++ b/drivers/net/ethoc.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/phy.h> | 18 | #include <linux/phy.h> |
19 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
20 | #include <linux/sched.h> | 20 | #include <linux/sched.h> |
21 | #include <linux/slab.h> | ||
21 | #include <net/ethoc.h> | 22 | #include <net/ethoc.h> |
22 | 23 | ||
23 | static int buffer_size = 0x8000; /* 32 KBytes */ | 24 | static int buffer_size = 0x8000; /* 32 KBytes */ |
@@ -406,10 +407,10 @@ static int ethoc_rx(struct net_device *dev, int limit) | |||
406 | 407 | ||
407 | if (ethoc_update_rx_stats(priv, &bd) == 0) { | 408 | if (ethoc_update_rx_stats(priv, &bd) == 0) { |
408 | int size = bd.stat >> 16; | 409 | int size = bd.stat >> 16; |
409 | struct sk_buff *skb = netdev_alloc_skb(dev, size); | 410 | struct sk_buff *skb; |
410 | 411 | ||
411 | size -= 4; /* strip the CRC */ | 412 | size -= 4; /* strip the CRC */ |
412 | skb_reserve(skb, 2); /* align TCP/IP header */ | 413 | skb = netdev_alloc_skb_ip_align(dev, size); |
413 | 414 | ||
414 | if (likely(skb)) { | 415 | if (likely(skb)) { |
415 | void *src = phys_to_virt(bd.addr); | 416 | void *src = phys_to_virt(bd.addr); |
@@ -641,7 +642,7 @@ static int ethoc_mdio_probe(struct net_device *dev) | |||
641 | return -ENXIO; | 642 | return -ENXIO; |
642 | } | 643 | } |
643 | 644 | ||
644 | phy = phy_connect(dev, dev_name(&phy->dev), ðoc_mdio_poll, 0, | 645 | phy = phy_connect(dev, dev_name(&phy->dev), ethoc_mdio_poll, 0, |
645 | PHY_INTERFACE_MODE_GMII); | 646 | PHY_INTERFACE_MODE_GMII); |
646 | if (IS_ERR(phy)) { | 647 | if (IS_ERR(phy)) { |
647 | dev_err(&dev->dev, "could not attach to PHY\n"); | 648 | dev_err(&dev->dev, "could not attach to PHY\n"); |
@@ -755,7 +756,7 @@ static void ethoc_set_multicast_list(struct net_device *dev) | |||
755 | { | 756 | { |
756 | struct ethoc *priv = netdev_priv(dev); | 757 | struct ethoc *priv = netdev_priv(dev); |
757 | u32 mode = ethoc_read(priv, MODER); | 758 | u32 mode = ethoc_read(priv, MODER); |
758 | struct dev_mc_list *mc = NULL; | 759 | struct dev_mc_list *mc; |
759 | u32 hash[2] = { 0, 0 }; | 760 | u32 hash[2] = { 0, 0 }; |
760 | 761 | ||
761 | /* set loopback mode if requested */ | 762 | /* set loopback mode if requested */ |
@@ -783,8 +784,8 @@ static void ethoc_set_multicast_list(struct net_device *dev) | |||
783 | hash[0] = 0xffffffff; | 784 | hash[0] = 0xffffffff; |
784 | hash[1] = 0xffffffff; | 785 | hash[1] = 0xffffffff; |
785 | } else { | 786 | } else { |
786 | for (mc = dev->mc_list; mc; mc = mc->next) { | 787 | netdev_for_each_mc_addr(mc, dev) { |
787 | u32 crc = ether_crc(mc->dmi_addrlen, mc->dmi_addr); | 788 | u32 crc = ether_crc(ETH_ALEN, mc->dmi_addr); |
788 | int bit = (crc >> 26) & 0x3f; | 789 | int bit = (crc >> 26) & 0x3f; |
789 | hash[bit >> 5] |= 1 << (bit & 0x1f); | 790 | hash[bit >> 5] |= 1 << (bit & 0x1f); |
790 | } | 791 | } |
@@ -904,7 +905,7 @@ static int ethoc_probe(struct platform_device *pdev) | |||
904 | } | 905 | } |
905 | 906 | ||
906 | mmio = devm_request_mem_region(&pdev->dev, res->start, | 907 | mmio = devm_request_mem_region(&pdev->dev, res->start, |
907 | res->end - res->start + 1, res->name); | 908 | resource_size(res), res->name); |
908 | if (!mmio) { | 909 | if (!mmio) { |
909 | dev_err(&pdev->dev, "cannot request I/O memory space\n"); | 910 | dev_err(&pdev->dev, "cannot request I/O memory space\n"); |
910 | ret = -ENXIO; | 911 | ret = -ENXIO; |
@@ -917,7 +918,7 @@ static int ethoc_probe(struct platform_device *pdev) | |||
917 | res = platform_get_resource(pdev, IORESOURCE_MEM, 1); | 918 | res = platform_get_resource(pdev, IORESOURCE_MEM, 1); |
918 | if (res) { | 919 | if (res) { |
919 | mem = devm_request_mem_region(&pdev->dev, res->start, | 920 | mem = devm_request_mem_region(&pdev->dev, res->start, |
920 | res->end - res->start + 1, res->name); | 921 | resource_size(res), res->name); |
921 | if (!mem) { | 922 | if (!mem) { |
922 | dev_err(&pdev->dev, "cannot request memory space\n"); | 923 | dev_err(&pdev->dev, "cannot request memory space\n"); |
923 | ret = -ENXIO; | 924 | ret = -ENXIO; |
@@ -945,7 +946,7 @@ static int ethoc_probe(struct platform_device *pdev) | |||
945 | priv->dma_alloc = 0; | 946 | priv->dma_alloc = 0; |
946 | 947 | ||
947 | priv->iobase = devm_ioremap_nocache(&pdev->dev, netdev->base_addr, | 948 | priv->iobase = devm_ioremap_nocache(&pdev->dev, netdev->base_addr, |
948 | mmio->end - mmio->start + 1); | 949 | resource_size(mmio)); |
949 | if (!priv->iobase) { | 950 | if (!priv->iobase) { |
950 | dev_err(&pdev->dev, "cannot remap I/O memory space\n"); | 951 | dev_err(&pdev->dev, "cannot remap I/O memory space\n"); |
951 | ret = -ENXIO; | 952 | ret = -ENXIO; |
@@ -954,7 +955,7 @@ static int ethoc_probe(struct platform_device *pdev) | |||
954 | 955 | ||
955 | if (netdev->mem_end) { | 956 | if (netdev->mem_end) { |
956 | priv->membase = devm_ioremap_nocache(&pdev->dev, | 957 | priv->membase = devm_ioremap_nocache(&pdev->dev, |
957 | netdev->mem_start, mem->end - mem->start + 1); | 958 | netdev->mem_start, resource_size(mem)); |
958 | if (!priv->membase) { | 959 | if (!priv->membase) { |
959 | dev_err(&pdev->dev, "cannot remap memory space\n"); | 960 | dev_err(&pdev->dev, "cannot remap memory space\n"); |
960 | ret = -ENXIO; | 961 | ret = -ENXIO; |