git://ftp.safe.ca
/
safe
/
jmp
/
linux-2.6
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
KVM: MMU: reduce 'struct kvm_mmu_page' size
[safe/jmp/linux-2.6]
/
drivers
/
net
/
sungem.c
diff --git
a/drivers/net/sungem.c
b/drivers/net/sungem.c
index
5322bb7
..
e6880f1
100644
(file)
--- a/
drivers/net/sungem.c
+++ b/
drivers/net/sungem.c
@@
-38,7
+38,7
@@
#include <linux/interrupt.h>
#include <linux/ioport.h>
#include <linux/in.h>
#include <linux/interrupt.h>
#include <linux/ioport.h>
#include <linux/in.h>
-#include <linux/s
lab
.h>
+#include <linux/s
ched
.h>
#include <linux/string.h>
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/string.h>
#include <linux/delay.h>
#include <linux/init.h>
@@
-57,6
+57,7
@@
#include <linux/bitops.h>
#include <linux/mutex.h>
#include <linux/mm.h>
#include <linux/bitops.h>
#include <linux/mutex.h>
#include <linux/mm.h>
+#include <linux/gfp.h>
#include <asm/system.h>
#include <asm/io.h>
#include <asm/system.h>
#include <asm/io.h>
@@
-106,7
+107,7
@@
MODULE_LICENSE("GPL");
#define GEM_MODULE_NAME "gem"
#define PFX GEM_MODULE_NAME ": "
#define GEM_MODULE_NAME "gem"
#define PFX GEM_MODULE_NAME ": "
-static
struct pci_device_id gem_pci_tbl[]
= {
+static
DEFINE_PCI_DEVICE_TABLE(gem_pci_tbl)
= {
{ PCI_VENDOR_ID_SUN, PCI_DEVICE_ID_SUN_GEM,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
{ PCI_VENDOR_ID_SUN, PCI_DEVICE_ID_SUN_GEM,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
@@
-781,7
+782,7
@@
static int gem_rx(struct gem *gp, int work_to_do)
break;
/* When writing back RX descriptor, GEM writes status
break;
/* When writing back RX descriptor, GEM writes status
- * then buffer address, possibly in sep
e
rate transactions.
+ * then buffer address, possibly in sep
a
rate transactions.
* If we don't wait for the chip to write both, we could
* post a new buffer to this descriptor then have GEM spam
* on the buffer address. We sync on the RX completion
* If we don't wait for the chip to write both, we could
* post a new buffer to this descriptor then have GEM spam
* on the buffer address. We sync on the RX completion
@@
-1015,7
+1016,8
@@
static __inline__ int gem_intme(int entry)
return 0;
}
return 0;
}
-static int gem_start_xmit(struct sk_buff *skb, struct net_device *dev)
+static netdev_tx_t gem_start_xmit(struct sk_buff *skb,
+ struct net_device *dev)
{
struct gem *gp = netdev_priv(dev);
int entry;
{
struct gem *gp = netdev_priv(dev);
int entry;
@@
-1032,10
+1034,8
@@
static int gem_start_xmit(struct sk_buff *skb, struct net_device *dev)
(csum_stuff_off << 21));
}
(csum_stuff_off << 21));
}
- local_irq_save(flags);
- if (!spin_trylock(&gp->tx_lock)) {
+ if (!spin_trylock_irqsave(&gp->tx_lock, flags)) {
/* Tell upper layer to requeue */
/* Tell upper layer to requeue */
- local_irq_restore(flags);
return NETDEV_TX_LOCKED;
}
/* We raced with gem_do_stop() */
return NETDEV_TX_LOCKED;
}
/* We raced with gem_do_stop() */
@@
-1157,7
+1157,7
@@
static void gem_pcs_reset(struct gem *gp)
if (limit-- <= 0)
break;
}
if (limit-- <= 0)
break;
}
- if (limit <
=
0)
+ if (limit < 0)
printk(KERN_WARNING "%s: PCS reset bit would not clear.\n",
gp->dev->name);
}
printk(KERN_WARNING "%s: PCS reset bit would not clear.\n",
gp->dev->name);
}
@@
-1229,7
+1229,7
@@
static void gem_reset(struct gem *gp)
break;
} while (val & (GREG_SWRST_TXRST | GREG_SWRST_RXRST));
break;
} while (val & (GREG_SWRST_TXRST | GREG_SWRST_RXRST));
- if (limit <
=
0)
+ if (limit < 0)
printk(KERN_ERR "%s: SW reset is ghetto.\n", gp->dev->name);
if (gp->phy_type == phy_serialink || gp->phy_type == phy_serdes)
printk(KERN_ERR "%s: SW reset is ghetto.\n", gp->dev->name);
if (gp->phy_type == phy_serialink || gp->phy_type == phy_serdes)
@@
-1837,7
+1837,7
@@
static u32 gem_setup_multicast(struct gem *gp)
int i;
if ((gp->dev->flags & IFF_ALLMULTI) ||
int i;
if ((gp->dev->flags & IFF_ALLMULTI) ||
- (
gp->dev->mc_count
> 256)) {
+ (
netdev_mc_count(gp->dev)
> 256)) {
for (i=0; i<16; i++)
writel(0xffff, gp->regs + MAC_HASH0 + (i << 2));
rxcfg |= MAC_RXCFG_HFE;
for (i=0; i<16; i++)
writel(0xffff, gp->regs + MAC_HASH0 + (i << 2));
rxcfg |= MAC_RXCFG_HFE;
@@
-1846,17
+1846,13
@@
static u32 gem_setup_multicast(struct gem *gp)
} else {
u16 hash_table[16];
u32 crc;
} else {
u16 hash_table[16];
u32 crc;
- struct dev_mc_list *dmi
= gp->dev->mc_list
;
+ struct dev_mc_list *dmi;
int i;
int i;
- for (i = 0; i < 16; i++)
- hash_table[i] = 0;
-
- for (i = 0; i < gp->dev->mc_count; i++) {
+ memset(hash_table, 0, sizeof(hash_table));
+ netdev_for_each_mc_addr(dmi, gp->dev) {
char *addrs = dmi->dmi_addr;
char *addrs = dmi->dmi_addr;
- dmi = dmi->next;
-
if (!(*addrs & 1))
continue;
if (!(*addrs & 1))
continue;
@@
-2061,7
+2057,15
@@
static int gem_check_invariants(struct gem *gp)
mif_cfg &= ~MIF_CFG_PSELECT;
writel(mif_cfg, gp->regs + MIF_CFG);
} else {
mif_cfg &= ~MIF_CFG_PSELECT;
writel(mif_cfg, gp->regs + MIF_CFG);
} else {
- gp->phy_type = phy_serialink;
+#ifdef CONFIG_SPARC
+ const char *p;
+
+ p = of_get_property(gp->of_node, "shared-pins", NULL);
+ if (p && !strcmp(p, "serdes"))
+ gp->phy_type = phy_serdes;
+ else
+#endif
+ gp->phy_type = phy_serialink;
}
if (gp->phy_type == phy_mii_mdio1 ||
gp->phy_type == phy_mii_mdio0) {
}
if (gp->phy_type == phy_mii_mdio1 ||
gp->phy_type == phy_mii_mdio0) {
@@
-2851,9
+2855,7
@@
static int gem_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
break;
case SIOCSMIIREG: /* Write MII PHY register. */
break;
case SIOCSMIIREG: /* Write MII PHY register. */
- if (!capable(CAP_NET_ADMIN))
- rc = -EPERM;
- else if (!gp->running)
+ if (!gp->running)
rc = -EAGAIN;
else {
__phy_write(gp, data->phy_id & 0x1f, data->reg_num & 0x1f,
rc = -EAGAIN;
else {
__phy_write(gp, data->phy_id & 0x1f, data->reg_num & 0x1f,
@@
-2998,8
+3000,11
@@
static const struct net_device_ops gem_netdev_ops = {
.ndo_do_ioctl = gem_ioctl,
.ndo_tx_timeout = gem_tx_timeout,
.ndo_change_mtu = gem_change_mtu,
.ndo_do_ioctl = gem_ioctl,
.ndo_tx_timeout = gem_tx_timeout,
.ndo_change_mtu = gem_change_mtu,
- .ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
.ndo_validate_addr = eth_validate_addr,
+ .ndo_set_mac_address = gem_set_mac_address,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+ .ndo_poll_controller = gem_poll_controller,
+#endif
};
static int __devinit gem_init_one(struct pci_dev *pdev,
};
static int __devinit gem_init_one(struct pci_dev *pdev,
@@
-3039,10
+3044,10
@@
static int __devinit gem_init_one(struct pci_dev *pdev,
*/
if (pdev->vendor == PCI_VENDOR_ID_SUN &&
pdev->device == PCI_DEVICE_ID_SUN_GEM &&
*/
if (pdev->vendor == PCI_VENDOR_ID_SUN &&
pdev->device == PCI_DEVICE_ID_SUN_GEM &&
- !pci_set_dma_mask(pdev, DMA_
64BIT_MASK
)) {
+ !pci_set_dma_mask(pdev, DMA_
BIT_MASK(64)
)) {
pci_using_dac = 1;
} else {
pci_using_dac = 1;
} else {
- err = pci_set_dma_mask(pdev, DMA_
32BIT_MASK
);
+ err = pci_set_dma_mask(pdev, DMA_
BIT_MASK(32)
);
if (err) {
printk(KERN_ERR PFX "No usable DMA configuration, "
"aborting.\n");
if (err) {
printk(KERN_ERR PFX "No usable DMA configuration, "
"aborting.\n");
@@
-3161,10
+3166,6
@@
static int __devinit gem_init_one(struct pci_dev *pdev,
dev->watchdog_timeo = 5 * HZ;
dev->irq = pdev->irq;
dev->dma = 0;
dev->watchdog_timeo = 5 * HZ;
dev->irq = pdev->irq;
dev->dma = 0;
- dev->set_mac_address = gem_set_mac_address;
-#ifdef CONFIG_NET_POLL_CONTROLLER
- dev->poll_controller = gem_poll_controller;
-#endif
/* Set that now, in case PM kicks in now */
pci_set_drvdata(pdev, dev);
/* Set that now, in case PM kicks in now */
pci_set_drvdata(pdev, dev);