git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git]
/
drivers
/
net
/
ns83820.c
diff --git
a/drivers/net/ns83820.c
b/drivers/net/ns83820.c
index
23397f9
..
b0c3b6a
100644
(file)
--- a/
drivers/net/ns83820.c
+++ b/
drivers/net/ns83820.c
@@
-96,6
+96,7
@@
//#define dprintk printk
#define dprintk(x...) do { } while (0)
//#define dprintk printk
#define dprintk(x...) do { } while (0)
+#include <linux/config.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/types.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/types.h>
@@
-115,7
+116,6
@@
#include <linux/timer.h>
#include <linux/if_vlan.h>
#include <linux/rtnetlink.h>
#include <linux/timer.h>
#include <linux/if_vlan.h>
#include <linux/rtnetlink.h>
-#include <linux/jiffies.h>
#include <asm/io.h>
#include <asm/uaccess.h>
#include <asm/io.h>
#include <asm/uaccess.h>
@@
-567,7
+567,8
@@
static inline int ns83820_add_rx_skb(struct ns83820 *dev, struct sk_buff *skb)
#endif
sg = dev->rx_info.descs + (next_empty * DESC_SIZE);
#endif
sg = dev->rx_info.descs + (next_empty * DESC_SIZE);
- BUG_ON(NULL != dev->rx_info.skbs[next_empty]);
+ if (unlikely(NULL != dev->rx_info.skbs[next_empty]))
+ BUG();
dev->rx_info.skbs[next_empty] = skb;
dev->rx_info.next_empty = (next_empty + 1) % NR_RX_DESC;
dev->rx_info.skbs[next_empty] = skb;
dev->rx_info.next_empty = (next_empty + 1) % NR_RX_DESC;
@@
-650,7
+651,7
@@
static void FASTCALL(phy_intr(struct net_device *ndev));
static void fastcall phy_intr(struct net_device *ndev)
{
struct ns83820 *dev = PRIV(ndev);
static void fastcall phy_intr(struct net_device *ndev)
{
struct ns83820 *dev = PRIV(ndev);
- static c
onst c
har *speeds[] = { "10", "100", "1000", "1000(?)", "1000F" };
+ static char *speeds[] = { "10", "100", "1000", "1000(?)", "1000F" };
u32 cfg, new_cfg;
u32 tbisr, tanar, tanlpar;
int speed, fullduplex, newlinkstate;
u32 cfg, new_cfg;
u32 tbisr, tanar, tanlpar;
int speed, fullduplex, newlinkstate;
@@
-803,7
+804,7
@@
static int ns83820_setup_rx(struct net_device *ndev)
writel(dev->IMR_cache, dev->base + IMR);
writel(1, dev->base + IER);
writel(dev->IMR_cache, dev->base + IMR);
writel(1, dev->base + IER);
- spin_unlock(&dev->misc_lock);
+ spin_unlock
_irq
(&dev->misc_lock);
kick_rx(ndev);
kick_rx(ndev);
@@
-1012,6
+1013,8
@@
static void do_tx_done(struct net_device *ndev)
struct ns83820 *dev = PRIV(ndev);
u32 cmdsts, tx_done_idx, *desc;
struct ns83820 *dev = PRIV(ndev);
u32 cmdsts, tx_done_idx, *desc;
+ spin_lock_irq(&dev->tx_lock);
+
dprintk("do_tx_done(%p)\n", ndev);
tx_done_idx = dev->tx_done_idx;
desc = dev->tx_descs + (tx_done_idx * DESC_SIZE);
dprintk("do_tx_done(%p)\n", ndev);
tx_done_idx = dev->tx_done_idx;
desc = dev->tx_descs + (tx_done_idx * DESC_SIZE);
@@
-1067,6
+1070,7
@@
static void do_tx_done(struct net_device *ndev)
netif_start_queue(ndev);
netif_wake_queue(ndev);
}
netif_start_queue(ndev);
netif_wake_queue(ndev);
}
+ spin_unlock_irq(&dev->tx_lock);
}
static void ns83820_cleanup_tx(struct ns83820 *dev)
}
static void ns83820_cleanup_tx(struct ns83820 *dev)
@@
-1278,13
+1282,11
@@
static struct ethtool_ops ops = {
.get_link = ns83820_get_link
};
.get_link = ns83820_get_link
};
-/* this function is called in irq context from the ISR */
static void ns83820_mib_isr(struct ns83820 *dev)
{
static void ns83820_mib_isr(struct ns83820 *dev)
{
- unsigned long flags;
- spin_lock_irqsave(&dev->misc_lock, flags);
+ spin_lock(&dev->misc_lock);
ns83820_update_stats(dev);
ns83820_update_stats(dev);
- spin_unlock
_irqrestore(&dev->misc_lock, flags
);
+ spin_unlock
(&dev->misc_lock
);
}
static void ns83820_do_isr(struct net_device *ndev, u32 isr);
}
static void ns83820_do_isr(struct net_device *ndev, u32 isr);
@@
-1306,8
+1308,6
@@
static irqreturn_t ns83820_irq(int foo, void *data, struct pt_regs *regs)
static void ns83820_do_isr(struct net_device *ndev, u32 isr)
{
struct ns83820 *dev = PRIV(ndev);
static void ns83820_do_isr(struct net_device *ndev, u32 isr)
{
struct ns83820 *dev = PRIV(ndev);
- unsigned long flags;
-
#ifdef DEBUG
if (isr & ~(ISR_PHY | ISR_RXDESC | ISR_RXEARLY | ISR_RXOK | ISR_RXERR | ISR_TXIDLE | ISR_TXOK | ISR_TXDESC))
Dprintk("odd isr? 0x%08x\n", isr);
#ifdef DEBUG
if (isr & ~(ISR_PHY | ISR_RXDESC | ISR_RXEARLY | ISR_RXOK | ISR_RXERR | ISR_TXIDLE | ISR_TXOK | ISR_TXDESC))
Dprintk("odd isr? 0x%08x\n", isr);
@@
-1322,10
+1322,10
@@
static void ns83820_do_isr(struct net_device *ndev, u32 isr)
if ((ISR_RXDESC | ISR_RXOK) & isr) {
prefetch(dev->rx_info.next_rx_desc);
if ((ISR_RXDESC | ISR_RXOK) & isr) {
prefetch(dev->rx_info.next_rx_desc);
- spin_lock_irq
save(&dev->misc_lock, flags
);
+ spin_lock_irq
(&dev->misc_lock
);
dev->IMR_cache &= ~(ISR_RXDESC | ISR_RXOK);
writel(dev->IMR_cache, dev->base + IMR);
dev->IMR_cache &= ~(ISR_RXDESC | ISR_RXOK);
writel(dev->IMR_cache, dev->base + IMR);
- spin_unlock_irq
restore(&dev->misc_lock, flags
);
+ spin_unlock_irq
(&dev->misc_lock
);
tasklet_schedule(&dev->rx_tasklet);
//rx_irq(ndev);
tasklet_schedule(&dev->rx_tasklet);
//rx_irq(ndev);
@@
-1371,18
+1371,16
@@
static void ns83820_do_isr(struct net_device *ndev, u32 isr)
* work has accumulated
*/
if ((ISR_TXDESC | ISR_TXIDLE | ISR_TXOK | ISR_TXERR) & isr) {
* work has accumulated
*/
if ((ISR_TXDESC | ISR_TXIDLE | ISR_TXOK | ISR_TXERR) & isr) {
- spin_lock_irqsave(&dev->tx_lock, flags);
do_tx_done(ndev);
do_tx_done(ndev);
- spin_unlock_irqrestore(&dev->tx_lock, flags);
/* Disable TxOk if there are no outstanding tx packets.
*/
if ((dev->tx_done_idx == dev->tx_free_idx) &&
(dev->IMR_cache & ISR_TXOK)) {
/* Disable TxOk if there are no outstanding tx packets.
*/
if ((dev->tx_done_idx == dev->tx_free_idx) &&
(dev->IMR_cache & ISR_TXOK)) {
- spin_lock_irq
save(&dev->misc_lock, flags
);
+ spin_lock_irq
(&dev->misc_lock
);
dev->IMR_cache &= ~ISR_TXOK;
writel(dev->IMR_cache, dev->base + IMR);
dev->IMR_cache &= ~ISR_TXOK;
writel(dev->IMR_cache, dev->base + IMR);
- spin_unlock_irq
restore(&dev->misc_lock, flags
);
+ spin_unlock_irq
(&dev->misc_lock
);
}
}
}
}
@@
-1393,10
+1391,10
@@
static void ns83820_do_isr(struct net_device *ndev, u32 isr)
* nature are expected, we must enable TxOk.
*/
if ((ISR_TXIDLE & isr) && (dev->tx_done_idx != dev->tx_free_idx)) {
* nature are expected, we must enable TxOk.
*/
if ((ISR_TXIDLE & isr) && (dev->tx_done_idx != dev->tx_free_idx)) {
- spin_lock_irq
save(&dev->misc_lock, flags
);
+ spin_lock_irq
(&dev->misc_lock
);
dev->IMR_cache |= ISR_TXOK;
writel(dev->IMR_cache, dev->base + IMR);
dev->IMR_cache |= ISR_TXOK;
writel(dev->IMR_cache, dev->base + IMR);
- spin_unlock_irq
restore(&dev->misc_lock, flags
);
+ spin_unlock_irq
(&dev->misc_lock
);
}
/* MIB interrupt: one of the statistics counters is about to overflow */
}
/* MIB interrupt: one of the statistics counters is about to overflow */
@@
-1458,7
+1456,7
@@
static void ns83820_tx_timeout(struct net_device *ndev)
u32 tx_done_idx, *desc;
unsigned long flags;
u32 tx_done_idx, *desc;
unsigned long flags;
-
spin_lock_irqsave(&dev->tx_lock,
flags);
+
local_irq_save(
flags);
tx_done_idx = dev->tx_done_idx;
desc = dev->tx_descs + (tx_done_idx * DESC_SIZE);
tx_done_idx = dev->tx_done_idx;
desc = dev->tx_descs + (tx_done_idx * DESC_SIZE);
@@
-1485,7
+1483,7
@@
static void ns83820_tx_timeout(struct net_device *ndev)
ndev->name,
tx_done_idx, dev->tx_free_idx, le32_to_cpu(desc[DESC_CMDSTS]));
ndev->name,
tx_done_idx, dev->tx_free_idx, le32_to_cpu(desc[DESC_CMDSTS]));
-
spin_unlock_irqrestore(&dev->tx_lock,
flags);
+
local_irq_restore(
flags);
}
static void ns83820_tx_watch(unsigned long data)
}
static void ns83820_tx_watch(unsigned long data)
@@
-1609,7
+1607,7
@@
static void ns83820_run_bist(struct net_device *ndev, const char *name, u32 enab
{
struct ns83820 *dev = PRIV(ndev);
int timed_out = 0;
{
struct ns83820 *dev = PRIV(ndev);
int timed_out = 0;
-
unsigned
long start;
+ long start;
u32 status;
int loops = 0;
u32 status;
int loops = 0;
@@
-1627,7
+1625,7
@@
static void ns83820_run_bist(struct net_device *ndev, const char *name, u32 enab
break;
if (status & fail)
break;
break;
if (status & fail)
break;
- if (
time_after_eq(jiffies, start + HZ)
) {
+ if (
(jiffies - start) >= HZ
) {
timed_out = 1;
break;
}
timed_out = 1;
break;
}
@@
-1829,13
+1827,13
@@
static int __devinit ns83820_init_one(struct pci_dev *pci_dev, const struct pci_
int using_dac = 0;
/* See if we can set the dma mask early on; failure is fatal. */
int using_dac = 0;
/* See if we can set the dma mask early on; failure is fatal. */
- if (sizeof(dma_addr_t) == 8 &&
- !pci_set_dma_mask(pci_dev,
DMA_64BIT_MASK
)) {
+ if (sizeof(dma_addr_t) == 8 &&
+ !pci_set_dma_mask(pci_dev,
0xffffffffffffffffULL
)) {
using_dac = 1;
using_dac = 1;
- } else if (!pci_set_dma_mask(pci_dev,
DMA_32BIT_MASK
)) {
+ } else if (!pci_set_dma_mask(pci_dev,
0xffffffff
)) {
using_dac = 0;
} else {
using_dac = 0;
} else {
-
dev_warn(&pci_dev->dev, "
pci_set_dma_mask failed!\n");
+
printk(KERN_WARNING "ns83820.c:
pci_set_dma_mask failed!\n");
return -ENODEV;
}
return -ENODEV;
}
@@
-1858,7
+1856,7
@@
static int __devinit ns83820_init_one(struct pci_dev *pci_dev, const struct pci_
err = pci_enable_device(pci_dev);
if (err) {
err = pci_enable_device(pci_dev);
if (err) {
-
dev_info(&pci_dev->dev, "
pci_enable_dev failed: %d\n", err);
+
printk(KERN_INFO "ns83820:
pci_enable_dev failed: %d\n", err);
goto out_free;
}
goto out_free;
}
@@
-1884,11
+1882,11
@@
static int __devinit ns83820_init_one(struct pci_dev *pci_dev, const struct pci_
dev->IMR_cache = 0;
dev->IMR_cache = 0;
- err = request_irq(pci_dev->irq, ns83820_irq,
IRQF_SHARED
,
+ err = request_irq(pci_dev->irq, ns83820_irq,
SA_SHIRQ
,
DRV_NAME, ndev);
if (err) {
DRV_NAME, ndev);
if (err) {
-
dev_info(&pci_dev->dev, "unable to register irq %d, err
%d\n",
- pci_dev->irq
, err
);
+
printk(KERN_INFO "ns83820: unable to register irq
%d\n",
+ pci_dev->irq);
goto out_disable;
}
goto out_disable;
}
@@
-1902,7
+1900,7
@@
static int __devinit ns83820_init_one(struct pci_dev *pci_dev, const struct pci_
rtnl_lock();
err = dev_alloc_name(ndev, ndev->name);
if (err < 0) {
rtnl_lock();
err = dev_alloc_name(ndev, ndev->name);
if (err < 0) {
-
dev_info(&pci_dev->dev, "
unable to get netdev name: %d\n", err);
+
printk(KERN_INFO "ns83820:
unable to get netdev name: %d\n", err);
goto out_free_irq;
}
goto out_free_irq;
}
@@
-2189,7
+2187,6
@@
static void __exit ns83820_exit(void)
MODULE_AUTHOR("Benjamin LaHaise <bcrl@kvack.org>");
MODULE_DESCRIPTION("National Semiconductor DP83820 10/100/1000 driver");
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Benjamin LaHaise <bcrl@kvack.org>");
MODULE_DESCRIPTION("National Semiconductor DP83820 10/100/1000 driver");
MODULE_LICENSE("GPL");
-MODULE_VERSION(VERSION);
MODULE_DEVICE_TABLE(pci, ns83820_pci_tbl);
MODULE_DEVICE_TABLE(pci, ns83820_pci_tbl);