diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-04-24 14:05:20 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-04-24 14:05:20 -0400 |
commit | 89d8ab6993e1d9f3c482ee8c862c03c528f696aa (patch) | |
tree | d9adfe3c3d3e640bd5d7cacabef6c18f739fce22 /drivers | |
parent | d80a7920731a964b8c3492667a8069e5385ec794 (diff) | |
parent | 5efb764c8653c187912669629c14bb47242a5d05 (diff) |
Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6
* 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6:
drivers/net/hamradio/baycom_ser_fdx build fix
usb-net/pegasus: fix pegasus carrier detection
sis900: Allocate rx replacement buffer before rx operation
[netdrvr] depca: handle platform_device_add() failure
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/depca.c | 3 | ||||
-rw-r--r-- | drivers/net/hamradio/baycom_ser_fdx.c | 6 | ||||
-rw-r--r-- | drivers/net/sis900.c | 44 | ||||
-rw-r--r-- | drivers/usb/net/pegasus.c | 17 | ||||
-rw-r--r-- | drivers/usb/net/pegasus.h | 3 |
5 files changed, 40 insertions, 33 deletions
diff --git a/drivers/net/depca.c b/drivers/net/depca.c index 5113eef755b9..f3807aaf10aa 100644 --- a/drivers/net/depca.c +++ b/drivers/net/depca.c | |||
@@ -1491,8 +1491,9 @@ static void __init depca_platform_probe (void) | |||
1491 | depca_io_ports[i].device = pldev; | 1491 | depca_io_ports[i].device = pldev; |
1492 | 1492 | ||
1493 | if (platform_device_add(pldev)) { | 1493 | if (platform_device_add(pldev)) { |
1494 | platform_device_put(pldev); | ||
1495 | depca_io_ports[i].device = NULL; | 1494 | depca_io_ports[i].device = NULL; |
1495 | pldev->dev.platform_data = NULL; | ||
1496 | platform_device_put(pldev); | ||
1496 | continue; | 1497 | continue; |
1497 | } | 1498 | } |
1498 | 1499 | ||
diff --git a/drivers/net/hamradio/baycom_ser_fdx.c b/drivers/net/hamradio/baycom_ser_fdx.c index 59214e74b9cf..30baf6ecfc63 100644 --- a/drivers/net/hamradio/baycom_ser_fdx.c +++ b/drivers/net/hamradio/baycom_ser_fdx.c | |||
@@ -75,12 +75,14 @@ | |||
75 | #include <linux/ioport.h> | 75 | #include <linux/ioport.h> |
76 | #include <linux/string.h> | 76 | #include <linux/string.h> |
77 | #include <linux/init.h> | 77 | #include <linux/init.h> |
78 | #include <asm/uaccess.h> | ||
79 | #include <asm/io.h> | ||
80 | #include <linux/hdlcdrv.h> | 78 | #include <linux/hdlcdrv.h> |
81 | #include <linux/baycom.h> | 79 | #include <linux/baycom.h> |
82 | #include <linux/jiffies.h> | 80 | #include <linux/jiffies.h> |
83 | 81 | ||
82 | #include <asm/uaccess.h> | ||
83 | #include <asm/io.h> | ||
84 | #include <asm/irq.h> | ||
85 | |||
84 | /* --------------------------------------------------------------------- */ | 86 | /* --------------------------------------------------------------------- */ |
85 | 87 | ||
86 | #define BAYCOM_DEBUG | 88 | #define BAYCOM_DEBUG |
diff --git a/drivers/net/sis900.c b/drivers/net/sis900.c index b3750f284279..b2a3b19d773a 100644 --- a/drivers/net/sis900.c +++ b/drivers/net/sis900.c | |||
@@ -1755,6 +1755,24 @@ static int sis900_rx(struct net_device *net_dev) | |||
1755 | } else { | 1755 | } else { |
1756 | struct sk_buff * skb; | 1756 | struct sk_buff * skb; |
1757 | 1757 | ||
1758 | pci_unmap_single(sis_priv->pci_dev, | ||
1759 | sis_priv->rx_ring[entry].bufptr, RX_BUF_SIZE, | ||
1760 | PCI_DMA_FROMDEVICE); | ||
1761 | |||
1762 | /* refill the Rx buffer, what if there is not enought | ||
1763 | * memory for new socket buffer ?? */ | ||
1764 | if ((skb = dev_alloc_skb(RX_BUF_SIZE)) == NULL) { | ||
1765 | /* | ||
1766 | * Not enough memory to refill the buffer | ||
1767 | * so we need to recycle the old one so | ||
1768 | * as to avoid creating a memory hole | ||
1769 | * in the rx ring | ||
1770 | */ | ||
1771 | skb = sis_priv->rx_skbuff[entry]; | ||
1772 | sis_priv->stats.rx_dropped++; | ||
1773 | goto refill_rx_ring; | ||
1774 | } | ||
1775 | |||
1758 | /* This situation should never happen, but due to | 1776 | /* This situation should never happen, but due to |
1759 | some unknow bugs, it is possible that | 1777 | some unknow bugs, it is possible that |
1760 | we are working on NULL sk_buff :-( */ | 1778 | we are working on NULL sk_buff :-( */ |
@@ -1768,9 +1786,6 @@ static int sis900_rx(struct net_device *net_dev) | |||
1768 | break; | 1786 | break; |
1769 | } | 1787 | } |
1770 | 1788 | ||
1771 | pci_unmap_single(sis_priv->pci_dev, | ||
1772 | sis_priv->rx_ring[entry].bufptr, RX_BUF_SIZE, | ||
1773 | PCI_DMA_FROMDEVICE); | ||
1774 | /* give the socket buffer to upper layers */ | 1789 | /* give the socket buffer to upper layers */ |
1775 | skb = sis_priv->rx_skbuff[entry]; | 1790 | skb = sis_priv->rx_skbuff[entry]; |
1776 | skb_put(skb, rx_size); | 1791 | skb_put(skb, rx_size); |
@@ -1783,33 +1798,14 @@ static int sis900_rx(struct net_device *net_dev) | |||
1783 | net_dev->last_rx = jiffies; | 1798 | net_dev->last_rx = jiffies; |
1784 | sis_priv->stats.rx_bytes += rx_size; | 1799 | sis_priv->stats.rx_bytes += rx_size; |
1785 | sis_priv->stats.rx_packets++; | 1800 | sis_priv->stats.rx_packets++; |
1786 | 1801 | sis_priv->dirty_rx++; | |
1787 | /* refill the Rx buffer, what if there is not enought | 1802 | refill_rx_ring: |
1788 | * memory for new socket buffer ?? */ | ||
1789 | if ((skb = dev_alloc_skb(RX_BUF_SIZE)) == NULL) { | ||
1790 | /* not enough memory for skbuff, this makes a | ||
1791 | * "hole" on the buffer ring, it is not clear | ||
1792 | * how the hardware will react to this kind | ||
1793 | * of degenerated buffer */ | ||
1794 | if (netif_msg_rx_status(sis_priv)) | ||
1795 | printk(KERN_INFO "%s: Memory squeeze," | ||
1796 | "deferring packet.\n", | ||
1797 | net_dev->name); | ||
1798 | sis_priv->rx_skbuff[entry] = NULL; | ||
1799 | /* reset buffer descriptor state */ | ||
1800 | sis_priv->rx_ring[entry].cmdsts = 0; | ||
1801 | sis_priv->rx_ring[entry].bufptr = 0; | ||
1802 | sis_priv->stats.rx_dropped++; | ||
1803 | sis_priv->cur_rx++; | ||
1804 | break; | ||
1805 | } | ||
1806 | skb->dev = net_dev; | 1803 | skb->dev = net_dev; |
1807 | sis_priv->rx_skbuff[entry] = skb; | 1804 | sis_priv->rx_skbuff[entry] = skb; |
1808 | sis_priv->rx_ring[entry].cmdsts = RX_BUF_SIZE; | 1805 | sis_priv->rx_ring[entry].cmdsts = RX_BUF_SIZE; |
1809 | sis_priv->rx_ring[entry].bufptr = | 1806 | sis_priv->rx_ring[entry].bufptr = |
1810 | pci_map_single(sis_priv->pci_dev, skb->data, | 1807 | pci_map_single(sis_priv->pci_dev, skb->data, |
1811 | RX_BUF_SIZE, PCI_DMA_FROMDEVICE); | 1808 | RX_BUF_SIZE, PCI_DMA_FROMDEVICE); |
1812 | sis_priv->dirty_rx++; | ||
1813 | } | 1809 | } |
1814 | sis_priv->cur_rx++; | 1810 | sis_priv->cur_rx++; |
1815 | entry = sis_priv->cur_rx % NUM_RX_DESC; | 1811 | entry = sis_priv->cur_rx % NUM_RX_DESC; |
diff --git a/drivers/usb/net/pegasus.c b/drivers/usb/net/pegasus.c index d48c024cff59..6d12961cf9f9 100644 --- a/drivers/usb/net/pegasus.c +++ b/drivers/usb/net/pegasus.c | |||
@@ -316,6 +316,7 @@ static int update_eth_regs_async(pegasus_t * pegasus) | |||
316 | return ret; | 316 | return ret; |
317 | } | 317 | } |
318 | 318 | ||
319 | /* Returns 0 on success, error on failure */ | ||
319 | static int read_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 * regd) | 320 | static int read_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 * regd) |
320 | { | 321 | { |
321 | int i; | 322 | int i; |
@@ -847,10 +848,16 @@ static void intr_callback(struct urb *urb) | |||
847 | * d[0].NO_CARRIER kicks in only with failed TX. | 848 | * d[0].NO_CARRIER kicks in only with failed TX. |
848 | * ... so monitoring with MII may be safest. | 849 | * ... so monitoring with MII may be safest. |
849 | */ | 850 | */ |
850 | if (d[0] & NO_CARRIER) | 851 | if (pegasus->features & TRUST_LINK_STATUS) { |
851 | netif_carrier_off(net); | 852 | if (d[5] & LINK_STATUS) |
852 | else | 853 | netif_carrier_on(net); |
853 | netif_carrier_on(net); | 854 | else |
855 | netif_carrier_off(net); | ||
856 | } else { | ||
857 | /* Never set carrier _on_ based on ! NO_CARRIER */ | ||
858 | if (d[0] & NO_CARRIER) | ||
859 | netif_carrier_off(net); | ||
860 | } | ||
854 | 861 | ||
855 | /* bytes 3-4 == rx_lostpkt, reg 2E/2F */ | 862 | /* bytes 3-4 == rx_lostpkt, reg 2E/2F */ |
856 | pegasus->stats.rx_missed_errors += ((d[3] & 0x7f) << 8) | d[4]; | 863 | pegasus->stats.rx_missed_errors += ((d[3] & 0x7f) << 8) | d[4]; |
@@ -950,7 +957,7 @@ static void set_carrier(struct net_device *net) | |||
950 | pegasus_t *pegasus = netdev_priv(net); | 957 | pegasus_t *pegasus = netdev_priv(net); |
951 | u16 tmp; | 958 | u16 tmp; |
952 | 959 | ||
953 | if (!read_mii_word(pegasus, pegasus->phy, MII_BMSR, &tmp)) | 960 | if (read_mii_word(pegasus, pegasus->phy, MII_BMSR, &tmp)) |
954 | return; | 961 | return; |
955 | 962 | ||
956 | if (tmp & BMSR_LSTATUS) | 963 | if (tmp & BMSR_LSTATUS) |
diff --git a/drivers/usb/net/pegasus.h b/drivers/usb/net/pegasus.h index c7467823cd1c..c7aadb413e8c 100644 --- a/drivers/usb/net/pegasus.h +++ b/drivers/usb/net/pegasus.h | |||
@@ -11,6 +11,7 @@ | |||
11 | 11 | ||
12 | #define PEGASUS_II 0x80000000 | 12 | #define PEGASUS_II 0x80000000 |
13 | #define HAS_HOME_PNA 0x40000000 | 13 | #define HAS_HOME_PNA 0x40000000 |
14 | #define TRUST_LINK_STATUS 0x20000000 | ||
14 | 15 | ||
15 | #define PEGASUS_MTU 1536 | 16 | #define PEGASUS_MTU 1536 |
16 | #define RX_SKBS 4 | 17 | #define RX_SKBS 4 |
@@ -203,7 +204,7 @@ PEGASUS_DEV( "AEI USB Fast Ethernet Adapter", VENDOR_AEILAB, 0x1701, | |||
203 | PEGASUS_DEV( "Allied Telesyn Int. AT-USB100", VENDOR_ALLIEDTEL, 0xb100, | 204 | PEGASUS_DEV( "Allied Telesyn Int. AT-USB100", VENDOR_ALLIEDTEL, 0xb100, |
204 | DEFAULT_GPIO_RESET | PEGASUS_II ) | 205 | DEFAULT_GPIO_RESET | PEGASUS_II ) |
205 | PEGASUS_DEV( "Belkin F5D5050 USB Ethernet", VENDOR_BELKIN, 0x0121, | 206 | PEGASUS_DEV( "Belkin F5D5050 USB Ethernet", VENDOR_BELKIN, 0x0121, |
206 | DEFAULT_GPIO_RESET | PEGASUS_II ) | 207 | DEFAULT_GPIO_RESET | PEGASUS_II | TRUST_LINK_STATUS ) |
207 | PEGASUS_DEV( "Billionton USB-100", VENDOR_BILLIONTON, 0x0986, | 208 | PEGASUS_DEV( "Billionton USB-100", VENDOR_BILLIONTON, 0x0986, |
208 | DEFAULT_GPIO_RESET ) | 209 | DEFAULT_GPIO_RESET ) |
209 | PEGASUS_DEV( "Billionton USBLP-100", VENDOR_BILLIONTON, 0x0987, | 210 | PEGASUS_DEV( "Billionton USBLP-100", VENDOR_BILLIONTON, 0x0987, |