Commit 0defd9f5 authored by David S. Miller's avatar David S. Miller

Merge nuts.davemloft.net:/disk1/davem/BK/network-2.6

into nuts.davemloft.net:/disk1/davem/BK/net-2.6
parents 0dc316de 2f1b9f80
...@@ -897,8 +897,8 @@ E: bj0rn@blox.se ...@@ -897,8 +897,8 @@ E: bj0rn@blox.se
W: http://www.pi.se/blox/ W: http://www.pi.se/blox/
D: Extended support for loadable modules D: Extended support for loadable modules
D: D-Link pocket adapter drivers D: D-Link pocket adapter drivers
S: Grevgatan 11 S: Brevia 1043
S: S-114 53 Stockholm S: S-114 79 Stockholm
S: Sweden S: Sweden
N: Michael Engel N: Michael Engel
......
...@@ -103,6 +103,8 @@ static struct pci_device_id gem_pci_tbl[] = { ...@@ -103,6 +103,8 @@ static struct pci_device_id gem_pci_tbl[] = {
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
{ PCI_VENDOR_ID_APPLE, PCI_DEVICE_ID_APPLE_UNI_N_GMAC2, { PCI_VENDOR_ID_APPLE, PCI_DEVICE_ID_APPLE_UNI_N_GMAC2,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
{ PCI_VENDOR_ID_APPLE, PCI_DEVICE_ID_APPLE_K2_GMAC,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
{0, } {0, }
}; };
...@@ -778,6 +780,10 @@ static irqreturn_t gem_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -778,6 +780,10 @@ static irqreturn_t gem_interrupt(int irq, void *dev_id, struct pt_regs *regs)
struct gem *gp = dev->priv; struct gem *gp = dev->priv;
u32 gem_status = readl(gp->regs + GREG_STAT); u32 gem_status = readl(gp->regs + GREG_STAT);
/* Swallow interrupts when shutting the chip down */
if (gp->hw_running == 0)
goto out;
spin_lock(&gp->lock); spin_lock(&gp->lock);
if (gem_status & GREG_STAT_ABNORMAL) { if (gem_status & GREG_STAT_ABNORMAL) {
...@@ -1240,6 +1246,12 @@ static int gem_mdio_link_not_up(struct gem *gp) ...@@ -1240,6 +1246,12 @@ static int gem_mdio_link_not_up(struct gem *gp)
gp->lstate = link_force_ok; gp->lstate = link_force_ok;
return 0; return 0;
case link_aneg: case link_aneg:
/* We try forced modes after a failed aneg only on PHYs that don't
* have "magic_aneg" bit set, which means they internally do the
* while forced-mode thingy. On these, we just restart aneg
*/
if (gp->phy_mii.def->magic_aneg)
return 1;
if (netif_msg_link(gp)) if (netif_msg_link(gp))
printk(KERN_INFO "%s: switching to forced 100bt\n", printk(KERN_INFO "%s: switching to forced 100bt\n",
gp->dev->name); gp->dev->name);
...@@ -1497,18 +1509,26 @@ static void gem_init_phy(struct gem *gp) ...@@ -1497,18 +1509,26 @@ static void gem_init_phy(struct gem *gp)
* to schedule instead * to schedule instead
*/ */
pmac_call_feature(PMAC_FTR_GMAC_PHY_RESET, gp->of_node, 0, 0); pmac_call_feature(PMAC_FTR_GMAC_PHY_RESET, gp->of_node, 0, 0);
mdelay(10);
for (j = 0; j < 3; j++) { for (j = 0; j < 3; j++) {
/* Some PHYs used by apple have problem getting back to us, /* Some PHYs used by apple have problem getting back to us,
* we _know_ it's actually at addr 0, that's a hack, but * we _know_ it's actually at addr 0 or 1, that's a hack, but
* it helps to do that reset now. I suspect some motherboards * it helps to do that reset now. I suspect some motherboards
* don't wire the PHY reset line properly, thus the PHY doesn't * don't wire the PHY reset line properly, thus the PHY doesn't
* come back with the above pmac_call_feature. * come back with the above pmac_call_feature.
*/ */
gp->mii_phy_addr = 0; gp->mii_phy_addr = 0;
phy_write(gp, MII_BMCR, BMCR_RESET); phy_write(gp, MII_BMCR, BMCR_RESET);
gp->mii_phy_addr = 1;
phy_write(gp, MII_BMCR, BMCR_RESET);
/* We should probably break some locks here and schedule... */ /* We should probably break some locks here and schedule... */
mdelay(10); mdelay(10);
/* On K2, we only probe the internal PHY at address 1, other
* addresses tend to return garbage.
*/
if (gp->pdev->device == PCI_DEVICE_ID_APPLE_K2_GMAC)
break;
for (i = 0; i < 32; i++) { for (i = 0; i < 32; i++) {
gp->mii_phy_addr = i; gp->mii_phy_addr = i;
if (phy_read(gp, MII_BMCR) != 0xffff) if (phy_read(gp, MII_BMCR) != 0xffff)
...@@ -1770,6 +1790,8 @@ static void gem_init_mac(struct gem *gp) ...@@ -1770,6 +1790,8 @@ static void gem_init_mac(struct gem *gp)
/* Must be invoked under gp->lock. */ /* Must be invoked under gp->lock. */
static void gem_init_pause_thresholds(struct gem *gp) static void gem_init_pause_thresholds(struct gem *gp)
{ {
u32 cfg;
/* Calculate pause thresholds. Setting the OFF threshold to the /* Calculate pause thresholds. Setting the OFF threshold to the
* full RX fifo size effectively disables PAUSE generation which * full RX fifo size effectively disables PAUSE generation which
* is what we do for 10/100 only GEMs which have FIFOs too small * is what we do for 10/100 only GEMs which have FIFOs too small
...@@ -1786,17 +1808,28 @@ static void gem_init_pause_thresholds(struct gem *gp) ...@@ -1786,17 +1808,28 @@ static void gem_init_pause_thresholds(struct gem *gp)
gp->rx_pause_on = on; gp->rx_pause_on = on;
} }
{
u32 cfg;
cfg = 0; /* Configure the chip "burst" DMA mode & enable some
* HW bug fixes on Apple version
*/
cfg = 0;
if (gp->pdev->vendor == PCI_VENDOR_ID_APPLE)
cfg |= GREG_CFG_RONPAULBIT | GREG_CFG_ENBUG2FIX;
#if !defined(CONFIG_SPARC64) && !defined(CONFIG_ALPHA) #if !defined(CONFIG_SPARC64) && !defined(CONFIG_ALPHA)
cfg |= GREG_CFG_IBURST; cfg |= GREG_CFG_IBURST;
#endif #endif
cfg |= ((31 << 1) & GREG_CFG_TXDMALIM); cfg |= ((31 << 1) & GREG_CFG_TXDMALIM);
cfg |= ((31 << 6) & GREG_CFG_RXDMALIM); cfg |= ((31 << 6) & GREG_CFG_RXDMALIM);
writel(cfg, gp->regs + GREG_CFG);
/* If Infinite Burst didn't stick, then use different
* thresholds (and Apple bug fixes don't exist)
*/
if (readl(gp->regs + GREG_CFG) & GREG_CFG_IBURST) {
cfg = ((2 << 1) & GREG_CFG_TXDMALIM);
cfg = ((8 << 6) & GREG_CFG_RXDMALIM);
writel(cfg, gp->regs + GREG_CFG); writel(cfg, gp->regs + GREG_CFG);
} }
} }
static int gem_check_invariants(struct gem *gp) static int gem_check_invariants(struct gem *gp)
...@@ -1931,18 +1964,10 @@ static void gem_apple_powerup(struct gem *gp) ...@@ -1931,18 +1964,10 @@ static void gem_apple_powerup(struct gem *gp)
u16 cmd; u16 cmd;
u32 mif_cfg; u32 mif_cfg;
mb();
pmac_call_feature(PMAC_FTR_GMAC_ENABLE, gp->of_node, 0, 1); pmac_call_feature(PMAC_FTR_GMAC_ENABLE, gp->of_node, 0, 1);
current->state = TASK_UNINTERRUPTIBLE; udelay(3);
schedule_timeout((21 * HZ) / 1000);
pci_read_config_word(gp->pdev, PCI_COMMAND, &cmd);
cmd |= PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER | PCI_COMMAND_INVALIDATE;
pci_write_config_word(gp->pdev, PCI_COMMAND, cmd);
pci_write_config_byte(gp->pdev, PCI_LATENCY_TIMER, 6);
pci_write_config_byte(gp->pdev, PCI_CACHE_LINE_SIZE, 8);
mdelay(1);
mif_cfg = readl(gp->regs + MIF_CFG); mif_cfg = readl(gp->regs + MIF_CFG);
mif_cfg &= ~(MIF_CFG_PSELECT|MIF_CFG_POLL|MIF_CFG_BBMODE|MIF_CFG_MDI1); mif_cfg &= ~(MIF_CFG_PSELECT|MIF_CFG_POLL|MIF_CFG_BBMODE|MIF_CFG_MDI1);
...@@ -1950,8 +1975,6 @@ static void gem_apple_powerup(struct gem *gp) ...@@ -1950,8 +1975,6 @@ static void gem_apple_powerup(struct gem *gp)
writel(mif_cfg, gp->regs + MIF_CFG); writel(mif_cfg, gp->regs + MIF_CFG);
writel(PCS_DMODE_MGM, gp->regs + PCS_DMODE); writel(PCS_DMODE_MGM, gp->regs + PCS_DMODE);
writel(MAC_XIFCFG_OE, gp->regs + MAC_XIFCFG); writel(MAC_XIFCFG_OE, gp->regs + MAC_XIFCFG);
mdelay(1);
} }
/* Turn off the chip's clock */ /* Turn off the chip's clock */
...@@ -1962,10 +1985,17 @@ static void gem_apple_powerdown(struct gem *gp) ...@@ -1962,10 +1985,17 @@ static void gem_apple_powerdown(struct gem *gp)
#endif /* CONFIG_PPC_PMAC */ #endif /* CONFIG_PPC_PMAC */
/* Must be invoked under gp->lock. */ /* Must be invoked with no lock held. */
static void gem_stop_phy(struct gem *gp) static void gem_stop_phy(struct gem *gp)
{ {
u32 mifcfg; u32 mifcfg;
unsigned long flags;
/* Let the chip settle down a bit, it seems that helps
* for sleep mode on some models
*/
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(HZ/100);
/* Make sure we aren't polling PHY status change. We /* Make sure we aren't polling PHY status change. We
* don't currently use that feature though * don't currently use that feature though
...@@ -1976,17 +2006,28 @@ static void gem_stop_phy(struct gem *gp) ...@@ -1976,17 +2006,28 @@ static void gem_stop_phy(struct gem *gp)
if (gp->wake_on_lan) { if (gp->wake_on_lan) {
/* Setup wake-on-lan */ /* Setup wake-on-lan */
} else } else {
writel(0, gp->regs + MAC_RXCFG); writel(0, gp->regs + MAC_RXCFG);
(void)readl(gp->regs + MAC_RXCFG);
/* Machine sleep will die in strange ways if we
* dont wait a bit here, looks like the chip takes
* some time to really shut down
*/
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(HZ/100);
}
writel(0, gp->regs + MAC_TXCFG); writel(0, gp->regs + MAC_TXCFG);
writel(0, gp->regs + MAC_XIFCFG); writel(0, gp->regs + MAC_XIFCFG);
writel(0, gp->regs + TXDMA_CFG); writel(0, gp->regs + TXDMA_CFG);
writel(0, gp->regs + RXDMA_CFG); writel(0, gp->regs + RXDMA_CFG);
if (!gp->wake_on_lan) { if (!gp->wake_on_lan) {
spin_lock_irqsave(&gp->lock, flags);
gem_stop(gp); gem_stop(gp);
writel(MAC_TXRST_CMD, gp->regs + MAC_TXRST); writel(MAC_TXRST_CMD, gp->regs + MAC_TXRST);
writel(MAC_RXRST_CMD, gp->regs + MAC_RXRST); writel(MAC_RXRST_CMD, gp->regs + MAC_RXRST);
spin_unlock_irqrestore(&gp->lock, flags);
} }
if (found_mii_phy(gp) && gp->phy_mii.def->ops->suspend) if (found_mii_phy(gp) && gp->phy_mii.def->ops->suspend)
...@@ -2008,31 +2049,33 @@ static void gem_stop_phy(struct gem *gp) ...@@ -2008,31 +2049,33 @@ static void gem_stop_phy(struct gem *gp)
/* Shut down the chip, must be called with pm_sem held. */ /* Shut down the chip, must be called with pm_sem held. */
static void gem_shutdown(struct gem *gp) static void gem_shutdown(struct gem *gp)
{ {
/* Make us not-running to avoid timers respawning */ /* Make us not-running to avoid timers respawning
* and swallow irqs
*/
gp->hw_running = 0; gp->hw_running = 0;
wmb();
/* Stop the link timer */ /* Stop the link timer */
del_timer_sync(&gp->link_timer); del_timer_sync(&gp->link_timer);
/* Stop the reset task */ /* Stop the reset task */
while (gp->reset_task_pending) while (gp->reset_task_pending)
schedule(); yield();
/* Actually stop the chip */ /* Actually stop the chip */
spin_lock_irq(&gp->lock);
if (gp->pdev->vendor == PCI_VENDOR_ID_APPLE) { if (gp->pdev->vendor == PCI_VENDOR_ID_APPLE) {
gem_stop_phy(gp); gem_stop_phy(gp);
spin_unlock_irq(&gp->lock);
#ifdef CONFIG_PPC_PMAC #ifdef CONFIG_PPC_PMAC
/* Power down the chip */ /* Power down the chip */
gem_apple_powerdown(gp); gem_apple_powerdown(gp);
#endif /* CONFIG_PPC_PMAC */ #endif /* CONFIG_PPC_PMAC */
} else { } else{
gem_stop(gp); unsigned long flags;
spin_unlock_irq(&gp->lock); spin_lock_irqsave(&gp->lock, flags);
gem_stop(gp);
spin_unlock_irqrestore(&gp->lock, flags);
} }
} }
...@@ -2692,6 +2735,7 @@ static int __devinit gem_init_one(struct pci_dev *pdev, ...@@ -2692,6 +2735,7 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
* not have properly shut down the PHY. * not have properly shut down the PHY.
*/ */
#ifdef CONFIG_PPC_PMAC #ifdef CONFIG_PPC_PMAC
gp->of_node = pci_device_to_OF_node(pdev);
if (pdev->vendor == PCI_VENDOR_ID_APPLE) if (pdev->vendor == PCI_VENDOR_ID_APPLE)
gem_apple_powerup(gp); gem_apple_powerup(gp);
#endif #endif
...@@ -2725,9 +2769,6 @@ static int __devinit gem_init_one(struct pci_dev *pdev, ...@@ -2725,9 +2769,6 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
goto err_out_iounmap; goto err_out_iounmap;
} }
#ifdef CONFIG_PPC_PMAC
gp->of_node = pci_device_to_OF_node(pdev);
#endif
if (gem_get_device_address(gp)) if (gem_get_device_address(gp))
goto err_out_free_consistent; goto err_out_free_consistent;
......
...@@ -28,6 +28,9 @@ ...@@ -28,6 +28,9 @@
#define GREG_CFG_IBURST 0x00000001 /* Infinite Burst */ #define GREG_CFG_IBURST 0x00000001 /* Infinite Burst */
#define GREG_CFG_TXDMALIM 0x0000003e /* TX DMA grant limit */ #define GREG_CFG_TXDMALIM 0x0000003e /* TX DMA grant limit */
#define GREG_CFG_RXDMALIM 0x000007c0 /* RX DMA grant limit */ #define GREG_CFG_RXDMALIM 0x000007c0 /* RX DMA grant limit */
#define GREG_CFG_RONPAULBIT 0x00000800 /* Use mem read multiple for PCI read
* after infinite burst (Apple) */
#define GREG_CFG_ENBUG2FIX 0x00001000 /* Fix Rx hang after overflow */
/* Global Interrupt Status Register. /* Global Interrupt Status Register.
* *
......
...@@ -72,7 +72,7 @@ static int reset_one_mii_phy(struct mii_phy* phy, int phy_id) ...@@ -72,7 +72,7 @@ static int reset_one_mii_phy(struct mii_phy* phy, int phy_id)
int limit = 10000; int limit = 10000;
val = __phy_read(phy, phy_id, MII_BMCR); val = __phy_read(phy, phy_id, MII_BMCR);
val &= ~BMCR_ISOLATE; val &= ~(BMCR_ISOLATE | BMCR_PDOWN);
val |= BMCR_RESET; val |= BMCR_RESET;
__phy_write(phy, phy_id, MII_BMCR, val); __phy_write(phy, phy_id, MII_BMCR, val);
...@@ -157,7 +157,7 @@ static int bcm5400_init(struct mii_phy* phy) ...@@ -157,7 +157,7 @@ static int bcm5400_init(struct mii_phy* phy)
data |= MII_BCM5400_GB_CONTROL_FULLDUPLEXCAP; data |= MII_BCM5400_GB_CONTROL_FULLDUPLEXCAP;
phy_write(phy, MII_BCM5400_GB_CONTROL, data); phy_write(phy, MII_BCM5400_GB_CONTROL, data);
mdelay(10); udelay(100);
/* Reset and configure cascaded 10/100 PHY */ /* Reset and configure cascaded 10/100 PHY */
(void)reset_one_mii_phy(phy, 0x1f); (void)reset_one_mii_phy(phy, 0x1f);
...@@ -217,7 +217,7 @@ static int bcm5401_init(struct mii_phy* phy) ...@@ -217,7 +217,7 @@ static int bcm5401_init(struct mii_phy* phy)
data |= MII_BCM5400_GB_CONTROL_FULLDUPLEXCAP; data |= MII_BCM5400_GB_CONTROL_FULLDUPLEXCAP;
phy_write(phy, MII_BCM5400_GB_CONTROL, data); phy_write(phy, MII_BCM5400_GB_CONTROL, data);
mdelay(10); udelay(10);
/* Reset and configure cascaded 10/100 PHY */ /* Reset and configure cascaded 10/100 PHY */
(void)reset_one_mii_phy(phy, 0x1f); (void)reset_one_mii_phy(phy, 0x1f);
...@@ -258,7 +258,7 @@ static int bcm5411_init(struct mii_phy* phy) ...@@ -258,7 +258,7 @@ static int bcm5411_init(struct mii_phy* phy)
data |= MII_BCM5400_GB_CONTROL_FULLDUPLEXCAP; data |= MII_BCM5400_GB_CONTROL_FULLDUPLEXCAP;
phy_write(phy, MII_BCM5400_GB_CONTROL, data); phy_write(phy, MII_BCM5400_GB_CONTROL, data);
mdelay(10); udelay(10);
/* Reset and configure cascaded 10/100 PHY */ /* Reset and configure cascaded 10/100 PHY */
(void)reset_one_mii_phy(phy, 0x1f); (void)reset_one_mii_phy(phy, 0x1f);
...@@ -302,6 +302,15 @@ static int bcm5421_init(struct mii_phy* phy) ...@@ -302,6 +302,15 @@ static int bcm5421_init(struct mii_phy* phy)
return 0; return 0;
} }
static int bcm5421k2_init(struct mii_phy* phy)
{
/* Init code borrowed from OF */
phy_write(phy, 4, 0x01e1);
phy_write(phy, 9, 0x0300);
return 0;
}
static int bcm54xx_setup_aneg(struct mii_phy *phy, u32 advertise) static int bcm54xx_setup_aneg(struct mii_phy *phy, u32 advertise)
{ {
u16 ctl, adv; u16 ctl, adv;
...@@ -647,7 +656,7 @@ static struct mii_phy_def bcm5201_phy_def = { ...@@ -647,7 +656,7 @@ static struct mii_phy_def bcm5201_phy_def = {
.phy_id_mask = 0xfffffff0, .phy_id_mask = 0xfffffff0,
.name = "BCM5201", .name = "BCM5201",
.features = MII_BASIC_FEATURES, .features = MII_BASIC_FEATURES,
.magic_aneg = 0, .magic_aneg = 1,
.ops = &bcm5201_phy_ops .ops = &bcm5201_phy_ops
}; };
...@@ -666,7 +675,7 @@ static struct mii_phy_def bcm5221_phy_def = { ...@@ -666,7 +675,7 @@ static struct mii_phy_def bcm5221_phy_def = {
.phy_id_mask = 0xfffffff0, .phy_id_mask = 0xfffffff0,
.name = "BCM5221", .name = "BCM5221",
.features = MII_BASIC_FEATURES, .features = MII_BASIC_FEATURES,
.magic_aneg = 0, .magic_aneg = 1,
.ops = &bcm5221_phy_ops .ops = &bcm5221_phy_ops
}; };
...@@ -746,6 +755,25 @@ static struct mii_phy_def bcm5421_phy_def = { ...@@ -746,6 +755,25 @@ static struct mii_phy_def bcm5421_phy_def = {
.ops = &bcm5421_phy_ops .ops = &bcm5421_phy_ops
}; };
/* Broadcom BCM 5421 built-in K2 */
static struct mii_phy_ops bcm5421k2_phy_ops = {
.init = bcm5421k2_init,
.suspend = bcm5411_suspend,
.setup_aneg = bcm54xx_setup_aneg,
.setup_forced = bcm54xx_setup_forced,
.poll_link = genmii_poll_link,
.read_link = bcm54xx_read_link,
};
static struct mii_phy_def bcm5421k2_phy_def = {
.phy_id = 0x002062e0,
.phy_id_mask = 0xfffffff0,
.name = "BCM5421-K2",
.features = MII_GBIT_FEATURES,
.magic_aneg = 1,
.ops = &bcm5421k2_phy_ops
};
/* Marvell 88E1101 (Apple seem to deal with 2 different revs, /* Marvell 88E1101 (Apple seem to deal with 2 different revs,
* I masked out the 8 last bits to get both, but some specs * I masked out the 8 last bits to get both, but some specs
* would be useful here) --BenH. * would be useful here) --BenH.
...@@ -790,6 +818,7 @@ static struct mii_phy_def* mii_phy_table[] = { ...@@ -790,6 +818,7 @@ static struct mii_phy_def* mii_phy_table[] = {
&bcm5401_phy_def, &bcm5401_phy_def,
&bcm5411_phy_def, &bcm5411_phy_def,
&bcm5421_phy_def, &bcm5421_phy_def,
&bcm5421k2_phy_def,
&marvell_phy_def, &marvell_phy_def,
&genmii_phy_def, &genmii_phy_def,
NULL NULL
...@@ -813,8 +842,8 @@ int mii_phy_probe(struct mii_phy *phy, int mii_id) ...@@ -813,8 +842,8 @@ int mii_phy_probe(struct mii_phy *phy, int mii_id)
goto fail; goto fail;
/* Read ID and find matching entry */ /* Read ID and find matching entry */
id = (phy_read(phy, MII_PHYSID1) << 16 | phy_read(phy, MII_PHYSID2)) id = (phy_read(phy, MII_PHYSID1) << 16 | phy_read(phy, MII_PHYSID2));
& 0xfffffff0; printk(KERN_DEBUG "PHY ID: %x, addr: %x\n", id, mii_id);
for (i=0; (def = mii_phy_table[i]) != NULL; i++) for (i=0; (def = mii_phy_table[i]) != NULL; i++)
if ((id & def->phy_id_mask) == def->phy_id) if ((id & def->phy_id_mask) == def->phy_id)
break; break;
......
...@@ -5850,10 +5850,12 @@ static int tg3_get_regs_len(struct net_device *dev) ...@@ -5850,10 +5850,12 @@ static int tg3_get_regs_len(struct net_device *dev)
return TG3_REGDUMP_LEN; return TG3_REGDUMP_LEN;
} }
static void tg3_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p) static void tg3_get_regs(struct net_device *dev,
struct ethtool_regs *regs, void *_p)
{ {
u32 *p = _p;
struct tg3 *tp = dev->priv; struct tg3 *tp = dev->priv;
u8 *orig_p = p; u8 *orig_p = _p;
int i; int i;
regs->version = 0; regs->version = 0;
...@@ -5863,15 +5865,15 @@ static void tg3_get_regs(struct net_device *dev, struct ethtool_regs *regs, void ...@@ -5863,15 +5865,15 @@ static void tg3_get_regs(struct net_device *dev, struct ethtool_regs *regs, void
spin_lock_irq(&tp->lock); spin_lock_irq(&tp->lock);
spin_lock(&tp->tx_lock); spin_lock(&tp->tx_lock);
#define __GET_REG32(reg) (*((u32 *)(p))++ = tr32(reg)) #define __GET_REG32(reg) (*(p)++ = tr32(reg))
#define GET_REG32_LOOP(base,len) \ #define GET_REG32_LOOP(base,len) \
do { p = orig_p + (base); \ do { p = (u32 *)(orig_p + (base)); \
for (i = 0; i < len; i += 4) \ for (i = 0; i < len; i += 4) \
__GET_REG32((base) + i); \ __GET_REG32((base) + i); \
} while (0) } while (0)
#define GET_REG32_1(reg) \ #define GET_REG32_1(reg) \
do { p = orig_p + (reg); \ do { p = (u32 *)(orig_p + (reg)); \
__GET_REG32((reg)); \ __GET_REG32((reg)); \
} while (0) } while (0)
GET_REG32_LOOP(TG3PCI_VENDOR, 0xb0); GET_REG32_LOOP(TG3PCI_VENDOR, 0xb0);
......
...@@ -807,6 +807,7 @@ ...@@ -807,6 +807,7 @@
#define PCI_DEVICE_ID_APPLE_UNI_N_AGP2 0x0034 #define PCI_DEVICE_ID_APPLE_UNI_N_AGP2 0x0034
#define PCI_DEVICE_ID_APPLE_KAUAI_ATA 0x003b #define PCI_DEVICE_ID_APPLE_KAUAI_ATA 0x003b
#define PCI_DEVICE_ID_APPLE_KEYLARGO_I 0x003e #define PCI_DEVICE_ID_APPLE_KEYLARGO_I 0x003e
#define PCI_DEVICE_ID_APPLE_K2_GMAC 0x004c
#define PCI_DEVICE_ID_APPLE_TIGON3 0x1645 #define PCI_DEVICE_ID_APPLE_TIGON3 0x1645
#define PCI_VENDOR_ID_YAMAHA 0x1073 #define PCI_VENDOR_ID_YAMAHA 0x1073
......
...@@ -61,14 +61,14 @@ typedef struct sctphdr { ...@@ -61,14 +61,14 @@ typedef struct sctphdr {
__u16 dest; __u16 dest;
__u32 vtag; __u32 vtag;
__u32 checksum; __u32 checksum;
} sctp_sctphdr_t __attribute__((packed)); } __attribute__((packed)) sctp_sctphdr_t;
/* Section 3.2. Chunk Field Descriptions. */ /* Section 3.2. Chunk Field Descriptions. */
typedef struct sctp_chunkhdr { typedef struct sctp_chunkhdr {
__u8 type; __u8 type;
__u8 flags; __u8 flags;
__u16 length; __u16 length;
} sctp_chunkhdr_t __attribute__((packed)); } __attribute__((packed)) sctp_chunkhdr_t;
/* Section 3.2. Chunk Type Values. /* Section 3.2. Chunk Type Values.
...@@ -152,7 +152,7 @@ enum { SCTP_CHUNK_FLAG_T = 0x01 }; ...@@ -152,7 +152,7 @@ enum { SCTP_CHUNK_FLAG_T = 0x01 };
typedef struct sctp_paramhdr { typedef struct sctp_paramhdr {
__u16 type; __u16 type;
__u16 length; __u16 length;
} sctp_paramhdr_t __attribute((packed)); } __attribute__((packed)) sctp_paramhdr_t;
typedef enum { typedef enum {
...@@ -202,12 +202,12 @@ typedef struct sctp_datahdr { ...@@ -202,12 +202,12 @@ typedef struct sctp_datahdr {
__u16 ssn; __u16 ssn;
__u32 ppid; __u32 ppid;
__u8 payload[0]; __u8 payload[0];
} sctp_datahdr_t __attribute__((packed)); } __attribute__((packed)) sctp_datahdr_t;
typedef struct sctp_data_chunk { typedef struct sctp_data_chunk {
sctp_chunkhdr_t chunk_hdr; sctp_chunkhdr_t chunk_hdr;
sctp_datahdr_t data_hdr; sctp_datahdr_t data_hdr;
} sctp_data_chunk_t __attribute__((packed)); } __attribute__((packed)) sctp_data_chunk_t;
/* DATA Chuck Specific Flags */ /* DATA Chuck Specific Flags */
enum { enum {
...@@ -232,48 +232,48 @@ typedef struct sctp_inithdr { ...@@ -232,48 +232,48 @@ typedef struct sctp_inithdr {
__u16 num_inbound_streams; __u16 num_inbound_streams;
__u32 initial_tsn; __u32 initial_tsn;
__u8 params[0]; __u8 params[0];
} sctp_inithdr_t __attribute__((packed)); } __attribute__((packed)) sctp_inithdr_t;
typedef struct sctp_init_chunk { typedef struct sctp_init_chunk {
sctp_chunkhdr_t chunk_hdr; sctp_chunkhdr_t chunk_hdr;
sctp_inithdr_t init_hdr; sctp_inithdr_t init_hdr;
} sctp_init_chunk_t __attribute__((packed)); } __attribute__((packed)) sctp_init_chunk_t;
/* Section 3.3.2.1. IPv4 Address Parameter (5) */ /* Section 3.3.2.1. IPv4 Address Parameter (5) */
typedef struct sctp_ipv4addr_param { typedef struct sctp_ipv4addr_param {
sctp_paramhdr_t param_hdr; sctp_paramhdr_t param_hdr;
struct in_addr addr; struct in_addr addr;
} sctp_ipv4addr_param_t __attribute__((packed)); } __attribute__((packed)) sctp_ipv4addr_param_t;
/* Section 3.3.2.1. IPv6 Address Parameter (6) */ /* Section 3.3.2.1. IPv6 Address Parameter (6) */
typedef struct sctp_ipv6addr_param { typedef struct sctp_ipv6addr_param {
sctp_paramhdr_t param_hdr; sctp_paramhdr_t param_hdr;
struct in6_addr addr; struct in6_addr addr;
} sctp_ipv6addr_param_t __attribute__((packed)); } __attribute__((packed)) sctp_ipv6addr_param_t;
/* Section 3.3.2.1 Cookie Preservative (9) */ /* Section 3.3.2.1 Cookie Preservative (9) */
typedef struct sctp_cookie_preserve_param { typedef struct sctp_cookie_preserve_param {
sctp_paramhdr_t param_hdr; sctp_paramhdr_t param_hdr;
uint32_t lifespan_increment; uint32_t lifespan_increment;
} sctp_cookie_preserve_param_t __attribute__((packed)); } __attribute__((packed)) sctp_cookie_preserve_param_t;
/* Section 3.3.2.1 Host Name Address (11) */ /* Section 3.3.2.1 Host Name Address (11) */
typedef struct sctp_hostname_param { typedef struct sctp_hostname_param {
sctp_paramhdr_t param_hdr; sctp_paramhdr_t param_hdr;
uint8_t hostname[0]; uint8_t hostname[0];
} sctp_hostname_param_t __attribute__((packed)); } __attribute__((packed)) sctp_hostname_param_t;
/* Section 3.3.2.1 Supported Address Types (12) */ /* Section 3.3.2.1 Supported Address Types (12) */
typedef struct sctp_supported_addrs_param { typedef struct sctp_supported_addrs_param {
sctp_paramhdr_t param_hdr; sctp_paramhdr_t param_hdr;
uint16_t types[0]; uint16_t types[0];
} sctp_supported_addrs_param_t __attribute__((packed)); } __attribute__((packed)) sctp_supported_addrs_param_t;
/* Appendix A. ECN Capable (32768) */ /* Appendix A. ECN Capable (32768) */
typedef struct sctp_ecn_capable_param { typedef struct sctp_ecn_capable_param {
sctp_paramhdr_t param_hdr; sctp_paramhdr_t param_hdr;
} sctp_ecn_capable_param_t __attribute__((packed)); } __attribute__((packed)) sctp_ecn_capable_param_t;
...@@ -287,13 +287,13 @@ typedef sctp_init_chunk_t sctp_initack_chunk_t; ...@@ -287,13 +287,13 @@ typedef sctp_init_chunk_t sctp_initack_chunk_t;
typedef struct sctp_cookie_param { typedef struct sctp_cookie_param {
sctp_paramhdr_t p; sctp_paramhdr_t p;
__u8 body[0]; __u8 body[0];
} sctp_cookie_param_t __attribute__((packed)); } __attribute__((packed)) sctp_cookie_param_t;
/* Section 3.3.3.1 Unrecognized Parameters (8) */ /* Section 3.3.3.1 Unrecognized Parameters (8) */
typedef struct sctp_unrecognized_param { typedef struct sctp_unrecognized_param {
sctp_paramhdr_t param_hdr; sctp_paramhdr_t param_hdr;
sctp_paramhdr_t unrecognized; sctp_paramhdr_t unrecognized;
} sctp_unrecognized_param_t __attribute__((packed)); } __attribute__((packed)) sctp_unrecognized_param_t;
...@@ -308,7 +308,7 @@ typedef struct sctp_unrecognized_param { ...@@ -308,7 +308,7 @@ typedef struct sctp_unrecognized_param {
typedef struct sctp_gap_ack_block { typedef struct sctp_gap_ack_block {
__u16 start; __u16 start;
__u16 end; __u16 end;
} sctp_gap_ack_block_t __attribute__((packed)); } __attribute__((packed)) sctp_gap_ack_block_t;
typedef uint32_t sctp_dup_tsn_t; typedef uint32_t sctp_dup_tsn_t;
...@@ -323,12 +323,12 @@ typedef struct sctp_sackhdr { ...@@ -323,12 +323,12 @@ typedef struct sctp_sackhdr {
__u16 num_gap_ack_blocks; __u16 num_gap_ack_blocks;
__u16 num_dup_tsns; __u16 num_dup_tsns;
sctp_sack_variable_t variable[0]; sctp_sack_variable_t variable[0];
} sctp_sackhdr_t __attribute__((packed)); } __attribute__((packed)) sctp_sackhdr_t;
typedef struct sctp_sack_chunk { typedef struct sctp_sack_chunk {
sctp_chunkhdr_t chunk_hdr; sctp_chunkhdr_t chunk_hdr;
sctp_sackhdr_t sack_hdr; sctp_sackhdr_t sack_hdr;
} sctp_sack_chunk_t __attribute__((packed)); } __attribute__((packed)) sctp_sack_chunk_t;
/* RFC 2960. Section 3.3.5 Heartbeat Request (HEARTBEAT) (4): /* RFC 2960. Section 3.3.5 Heartbeat Request (HEARTBEAT) (4):
...@@ -340,12 +340,12 @@ typedef struct sctp_sack_chunk { ...@@ -340,12 +340,12 @@ typedef struct sctp_sack_chunk {
typedef struct sctp_heartbeathdr { typedef struct sctp_heartbeathdr {
sctp_paramhdr_t info; sctp_paramhdr_t info;
} sctp_heartbeathdr_t __attribute__((packed)); } __attribute__((packed)) sctp_heartbeathdr_t;
typedef struct sctp_heartbeat_chunk { typedef struct sctp_heartbeat_chunk {
sctp_chunkhdr_t chunk_hdr; sctp_chunkhdr_t chunk_hdr;
sctp_heartbeathdr_t hb_hdr; sctp_heartbeathdr_t hb_hdr;
} sctp_heartbeat_chunk_t __attribute__((packed)); } __attribute__((packed)) sctp_heartbeat_chunk_t;
/* For the abort and shutdown ACK we must carry the init tag in the /* For the abort and shutdown ACK we must carry the init tag in the
...@@ -354,7 +354,7 @@ typedef struct sctp_heartbeat_chunk { ...@@ -354,7 +354,7 @@ typedef struct sctp_heartbeat_chunk {
*/ */
typedef struct sctp_abort_chunk { typedef struct sctp_abort_chunk {
sctp_chunkhdr_t uh; sctp_chunkhdr_t uh;
} sctp_abort_chunkt_t __attribute__((packed)); } __attribute__((packed)) sctp_abort_chunkt_t;
/* For the graceful shutdown we must carry the tag (in common header) /* For the graceful shutdown we must carry the tag (in common header)
...@@ -362,14 +362,12 @@ typedef struct sctp_abort_chunk { ...@@ -362,14 +362,12 @@ typedef struct sctp_abort_chunk {
*/ */
typedef struct sctp_shutdownhdr { typedef struct sctp_shutdownhdr {
__u32 cum_tsn_ack; __u32 cum_tsn_ack;
} sctp_shutdownhdr_t __attribute__((packed)); } __attribute__((packed)) sctp_shutdownhdr_t;
struct sctp_shutdown_chunk_t { struct sctp_shutdown_chunk_t {
sctp_chunkhdr_t chunk_hdr; sctp_chunkhdr_t chunk_hdr;
sctp_shutdownhdr_t shutdown_hdr; sctp_shutdownhdr_t shutdown_hdr;
} __attribute__((packed)); } __attribute__ ((packed));
/* RFC 2960. Section 3.3.10 Operation Error (ERROR) (9) */ /* RFC 2960. Section 3.3.10 Operation Error (ERROR) (9) */
...@@ -377,12 +375,12 @@ typedef struct sctp_errhdr { ...@@ -377,12 +375,12 @@ typedef struct sctp_errhdr {
__u16 cause; __u16 cause;
__u16 length; __u16 length;
__u8 variable[0]; __u8 variable[0];
} sctp_errhdr_t __attribute__((packed)); } __attribute__((packed)) sctp_errhdr_t;
typedef struct sctp_operr_chunk { typedef struct sctp_operr_chunk {
sctp_chunkhdr_t chunk_hdr; sctp_chunkhdr_t chunk_hdr;
sctp_errhdr_t err_hdr; sctp_errhdr_t err_hdr;
} sctp_operr_chunk_t __attribute__((packed)); } __attribute__((packed)) sctp_operr_chunk_t;
/* RFC 2960 3.3.10 - Operation Error /* RFC 2960 3.3.10 - Operation Error
* *
...@@ -460,7 +458,7 @@ typedef struct sctp_ecnehdr { ...@@ -460,7 +458,7 @@ typedef struct sctp_ecnehdr {
typedef struct sctp_ecne_chunk { typedef struct sctp_ecne_chunk {
sctp_chunkhdr_t chunk_hdr; sctp_chunkhdr_t chunk_hdr;
sctp_ecnehdr_t ence_hdr; sctp_ecnehdr_t ence_hdr;
} sctp_ecne_chunk_t __attribute__((packed)); } __attribute__((packed)) sctp_ecne_chunk_t;
/* RFC 2960. Appendix A. Explicit Congestion Notification. /* RFC 2960. Appendix A. Explicit Congestion Notification.
* Congestion Window Reduced (CWR) (13) * Congestion Window Reduced (CWR) (13)
...@@ -472,7 +470,7 @@ typedef struct sctp_cwrhdr { ...@@ -472,7 +470,7 @@ typedef struct sctp_cwrhdr {
typedef struct sctp_cwr_chunk { typedef struct sctp_cwr_chunk {
sctp_chunkhdr_t chunk_hdr; sctp_chunkhdr_t chunk_hdr;
sctp_cwrhdr_t cwr_hdr; sctp_cwrhdr_t cwr_hdr;
} sctp_cwr_chunk_t __attribute__((packed)); } __attribute__((packed)) sctp_cwr_chunk_t;
/* /*
* ADDIP Section 3.1 New Chunk Types * ADDIP Section 3.1 New Chunk Types
...@@ -513,16 +511,16 @@ typedef struct sctp_cwr_chunk { ...@@ -513,16 +511,16 @@ typedef struct sctp_cwr_chunk {
typedef struct sctp_addip_param { typedef struct sctp_addip_param {
sctp_paramhdr_t param_hdr; sctp_paramhdr_t param_hdr;
__u32 crr_id; __u32 crr_id;
}sctp_addip_param_t __attribute__((packed)); } __attribute__((packed)) sctp_addip_param_t;
typedef struct sctp_addiphdr { typedef struct sctp_addiphdr {
__u32 serial; __u32 serial;
__u8 params[0]; __u8 params[0];
} sctp_addiphdr_t __attribute__((packed)); } __attribute__((packed)) sctp_addiphdr_t;
typedef struct sctp_addip_chunk { typedef struct sctp_addip_chunk {
sctp_chunkhdr_t chunk_hdr; sctp_chunkhdr_t chunk_hdr;
sctp_addiphdr_t addip_hdr; sctp_addiphdr_t addip_hdr;
} sctp_addip_chunk_t __attribute__((packed)); } __attribute__((packed)) sctp_addip_chunk_t;
#endif /* __LINUX_SCTP_H__ */ #endif /* __LINUX_SCTP_H__ */
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
#define CONTROL_BIT 0x80 #define CONTROL_BIT 0x80
inline void irlmp_send_data_pdu(struct lap_cb *self, __u8 dlsap, __u8 slsap, void irlmp_send_data_pdu(struct lap_cb *self, __u8 dlsap, __u8 slsap,
int expedited, struct sk_buff *skb); int expedited, struct sk_buff *skb);
void irlmp_send_lcf_pdu(struct lap_cb *self, __u8 dlsap, __u8 slsap, void irlmp_send_lcf_pdu(struct lap_cb *self, __u8 dlsap, __u8 slsap,
__u8 opcode, struct sk_buff *skb); __u8 opcode, struct sk_buff *skb);
......
...@@ -74,19 +74,19 @@ typedef void (*TIMER_CALLBACK)(void *); ...@@ -74,19 +74,19 @@ typedef void (*TIMER_CALLBACK)(void *);
void irda_start_timer(struct timer_list *ptimer, int timeout, void* data, void irda_start_timer(struct timer_list *ptimer, int timeout, void* data,
TIMER_CALLBACK callback); TIMER_CALLBACK callback);
inline void irlap_start_slot_timer(struct irlap_cb *self, int timeout); void irlap_start_slot_timer(struct irlap_cb *self, int timeout);
inline void irlap_start_query_timer(struct irlap_cb *self, int timeout); void irlap_start_query_timer(struct irlap_cb *self, int timeout);
inline void irlap_start_final_timer(struct irlap_cb *self, int timeout); void irlap_start_final_timer(struct irlap_cb *self, int timeout);
inline void irlap_start_wd_timer(struct irlap_cb *self, int timeout); void irlap_start_wd_timer(struct irlap_cb *self, int timeout);
inline void irlap_start_backoff_timer(struct irlap_cb *self, int timeout); void irlap_start_backoff_timer(struct irlap_cb *self, int timeout);
void irlap_start_mbusy_timer(struct irlap_cb *self, int timeout); void irlap_start_mbusy_timer(struct irlap_cb *self, int timeout);
void irlap_stop_mbusy_timer(struct irlap_cb *); void irlap_stop_mbusy_timer(struct irlap_cb *);
inline void irlmp_start_watchdog_timer(struct lsap_cb *, int timeout); void irlmp_start_watchdog_timer(struct lsap_cb *, int timeout);
inline void irlmp_start_discovery_timer(struct irlmp_cb *, int timeout); void irlmp_start_discovery_timer(struct irlmp_cb *, int timeout);
inline void irlmp_start_idle_timer(struct lap_cb *, int timeout); void irlmp_start_idle_timer(struct lap_cb *, int timeout);
inline void irlmp_stop_idle_timer(struct lap_cb *self); void irlmp_stop_idle_timer(struct lap_cb *self);
#endif #endif
...@@ -369,7 +369,7 @@ typedef struct sctp_sender_hb_info { ...@@ -369,7 +369,7 @@ typedef struct sctp_sender_hb_info {
struct sctp_paramhdr param_hdr; struct sctp_paramhdr param_hdr;
union sctp_addr daddr; union sctp_addr daddr;
unsigned long sent_at; unsigned long sent_at;
} sctp_sender_hb_info_t __attribute__((packed)); } __attribute__((packed)) sctp_sender_hb_info_t;
/* /*
* RFC 2960 1.3.2 Sequenced Delivery within Streams * RFC 2960 1.3.2 Sequenced Delivery within Streams
......
...@@ -738,7 +738,7 @@ DECLARE_SNMP_STAT(struct tcp_mib, tcp_statistics); ...@@ -738,7 +738,7 @@ DECLARE_SNMP_STAT(struct tcp_mib, tcp_statistics);
#define TCP_ADD_STATS_BH(field, val) SNMP_ADD_STATS_BH(tcp_statistics, field, val) #define TCP_ADD_STATS_BH(field, val) SNMP_ADD_STATS_BH(tcp_statistics, field, val)
#define TCP_ADD_STATS_USER(field, val) SNMP_ADD_STATS_USER(tcp_statistics, field, val) #define TCP_ADD_STATS_USER(field, val) SNMP_ADD_STATS_USER(tcp_statistics, field, val)
extern inline void tcp_put_port(struct sock *sk); extern void tcp_put_port(struct sock *sk);
extern void tcp_inherit_port(struct sock *sk, struct sock *child); extern void tcp_inherit_port(struct sock *sk, struct sock *child);
extern void tcp_v4_err(struct sk_buff *skb, u32); extern void tcp_v4_err(struct sk_buff *skb, u32);
......
...@@ -1051,7 +1051,7 @@ static int atalk_create(struct socket *sock, int protocol) ...@@ -1051,7 +1051,7 @@ static int atalk_create(struct socket *sock, int protocol)
sk = sk_alloc(PF_APPLETALK, GFP_KERNEL, 1, NULL); sk = sk_alloc(PF_APPLETALK, GFP_KERNEL, 1, NULL);
if (!sk) if (!sk)
goto out; goto out;
at = at_sk(sk) = kmalloc(sizeof(*at), GFP_KERNEL); at = sk->sk_protinfo = kmalloc(sizeof(*at), GFP_KERNEL);
if (!at) if (!at)
goto outsk; goto outsk;
memset(at, 0, sizeof(*at)); memset(at, 0, sizeof(*at));
......
...@@ -148,7 +148,7 @@ int vcc_create(struct socket *sock, int protocol, int family) ...@@ -148,7 +148,7 @@ int vcc_create(struct socket *sock, int protocol, int family)
sk->sk_state_change = vcc_def_wakeup; sk->sk_state_change = vcc_def_wakeup;
sk->sk_write_space = vcc_write_space; sk->sk_write_space = vcc_write_space;
vcc = atm_sk(sk) = kmalloc(sizeof(*vcc), GFP_KERNEL); vcc = sk->sk_protinfo = kmalloc(sizeof(*vcc), GFP_KERNEL);
if (!vcc) { if (!vcc) {
sk_free(sk); sk_free(sk);
return -ENOMEM; return -ENOMEM;
......
...@@ -816,7 +816,7 @@ int ax25_create(struct socket *sock, int protocol) ...@@ -816,7 +816,7 @@ int ax25_create(struct socket *sock, int protocol)
if ((sk = sk_alloc(PF_AX25, GFP_ATOMIC, 1, NULL)) == NULL) if ((sk = sk_alloc(PF_AX25, GFP_ATOMIC, 1, NULL)) == NULL)
return -ENOMEM; return -ENOMEM;
ax25 = ax25_sk(sk) = ax25_create_cb(); ax25 = sk->sk_protinfo = ax25_create_cb();
if (!ax25) { if (!ax25) {
sk_free(sk); sk_free(sk);
return -ENOMEM; return -ENOMEM;
...@@ -901,7 +901,7 @@ struct sock *ax25_make_new(struct sock *osk, struct ax25_dev *ax25_dev) ...@@ -901,7 +901,7 @@ struct sock *ax25_make_new(struct sock *osk, struct ax25_dev *ax25_dev)
memcpy(ax25->digipeat, oax25->digipeat, sizeof(ax25_digi)); memcpy(ax25->digipeat, oax25->digipeat, sizeof(ax25_digi));
} }
ax25_sk(sk) = ax25; sk->sk_protinfo = ax25;
ax25->sk = sk; ax25->sk = sk;
return sk; return sk;
......
...@@ -1940,9 +1940,9 @@ void dev_seq_stop(struct seq_file *seq, void *v) ...@@ -1940,9 +1940,9 @@ void dev_seq_stop(struct seq_file *seq, void *v)
static void dev_seq_printf_stats(struct seq_file *seq, struct net_device *dev) static void dev_seq_printf_stats(struct seq_file *seq, struct net_device *dev)
{ {
struct net_device_stats *stats = dev->get_stats ? dev->get_stats(dev) : if (dev->get_stats) {
NULL; struct net_device_stats *stats = dev->get_stats(dev);
if (stats)
seq_printf(seq, "%6s:%8lu %7lu %4lu %4lu %4lu %5lu %10lu %9lu " seq_printf(seq, "%6s:%8lu %7lu %4lu %4lu %4lu %5lu %10lu %9lu "
"%8lu %7lu %4lu %4lu %4lu %5lu %7lu %10lu\n", "%8lu %7lu %4lu %4lu %4lu %5lu %7lu %10lu\n",
dev->name, stats->rx_bytes, stats->rx_packets, dev->name, stats->rx_bytes, stats->rx_packets,
...@@ -1960,7 +1960,7 @@ static void dev_seq_printf_stats(struct seq_file *seq, struct net_device *dev) ...@@ -1960,7 +1960,7 @@ static void dev_seq_printf_stats(struct seq_file *seq, struct net_device *dev)
stats->tx_window_errors + stats->tx_window_errors +
stats->tx_heartbeat_errors, stats->tx_heartbeat_errors,
stats->tx_compressed); stats->tx_compressed);
else } else
seq_printf(seq, "%6s: No statistics available.\n", dev->name); seq_printf(seq, "%6s: No statistics available.\n", dev->name);
} }
......
...@@ -456,7 +456,7 @@ struct sock *dn_alloc_sock(struct socket *sock, int gfp) ...@@ -456,7 +456,7 @@ struct sock *dn_alloc_sock(struct socket *sock, int gfp)
if (!sk) if (!sk)
goto out; goto out;
DN_SK(sk) = scp = (struct dn_scp *)(sk + 1); sk->sk_protinfo = scp = (struct dn_scp *)(sk + 1);
if (sock) if (sock)
sock->ops = &dn_proto_ops; sock->ops = &dn_proto_ops;
......
...@@ -327,7 +327,7 @@ static int dn_phase3_output(struct sk_buff *skb) ...@@ -327,7 +327,7 @@ static int dn_phase3_output(struct sk_buff *skb)
} }
data = skb_push(skb, sizeof(struct dn_short_packet) + 2); data = skb_push(skb, sizeof(struct dn_short_packet) + 2);
((unsigned short *)data) = dn_htons(skb->len - 2); *((unsigned short *)data) = dn_htons(skb->len - 2);
sp = (struct dn_short_packet *)(data + 2); sp = (struct dn_short_packet *)(data + 2);
sp->msgflg = DN_RT_PKT_SHORT|(cb->rt_flags&(DN_RT_F_RQR|DN_RT_F_RTS)); sp->msgflg = DN_RT_PKT_SHORT|(cb->rt_flags&(DN_RT_F_RQR|DN_RT_F_RTS));
......
...@@ -568,7 +568,7 @@ static int econet_create(struct socket *sock, int protocol) ...@@ -568,7 +568,7 @@ static int econet_create(struct socket *sock, int protocol)
sock_init_data(sock,sk); sock_init_data(sock,sk);
sk_set_owner(sk, THIS_MODULE); sk_set_owner(sk, THIS_MODULE);
eo = ec_sk(sk) = kmalloc(sizeof(*eo), GFP_KERNEL); eo = sk->sk_protinfo = kmalloc(sizeof(*eo), GFP_KERNEL);
if (!eo) if (!eo)
goto out_free; goto out_free;
memset(eo, 0, sizeof(*eo)); memset(eo, 0, sizeof(*eo));
......
...@@ -71,10 +71,7 @@ static struct ipt_target ipt_classify_reg = { ...@@ -71,10 +71,7 @@ static struct ipt_target ipt_classify_reg = {
static int __init init(void) static int __init init(void)
{ {
if (ipt_register_target(&ipt_classify_reg)) return ipt_register_target(&ipt_classify_reg);
return -EINVAL;
return 0;
} }
static void __exit fini(void) static void __exit fini(void)
......
...@@ -91,10 +91,7 @@ static struct ipt_target ipt_dscp_reg = { ...@@ -91,10 +91,7 @@ static struct ipt_target ipt_dscp_reg = {
static int __init init(void) static int __init init(void)
{ {
if (ipt_register_target(&ipt_dscp_reg)) return ipt_register_target(&ipt_dscp_reg);
return -EINVAL;
return 0;
} }
static void __exit fini(void) static void __exit fini(void)
......
...@@ -155,10 +155,7 @@ static struct ipt_target ipt_ecn_reg = { ...@@ -155,10 +155,7 @@ static struct ipt_target ipt_ecn_reg = {
static int __init init(void) static int __init init(void)
{ {
if (ipt_register_target(&ipt_ecn_reg)) return ipt_register_target(&ipt_ecn_reg);
return -EINVAL;
return 0;
} }
static void __exit fini(void) static void __exit fini(void)
......
...@@ -404,10 +404,7 @@ static struct ipt_target ipt_log_reg = { ...@@ -404,10 +404,7 @@ static struct ipt_target ipt_log_reg = {
static int __init init(void) static int __init init(void)
{ {
if (ipt_register_target(&ipt_log_reg)) return ipt_register_target(&ipt_log_reg);
return -EINVAL;
return 0;
} }
static void __exit fini(void) static void __exit fini(void)
......
...@@ -59,10 +59,7 @@ static struct ipt_target ipt_mark_reg = { ...@@ -59,10 +59,7 @@ static struct ipt_target ipt_mark_reg = {
static int __init init(void) static int __init init(void)
{ {
if (ipt_register_target(&ipt_mark_reg)) return ipt_register_target(&ipt_mark_reg);
return -EINVAL;
return 0;
} }
static void __exit fini(void) static void __exit fini(void)
......
...@@ -449,9 +449,7 @@ static struct ipt_target ipt_reject_reg = { ...@@ -449,9 +449,7 @@ static struct ipt_target ipt_reject_reg = {
static int __init init(void) static int __init init(void)
{ {
if (ipt_register_target(&ipt_reject_reg)) return ipt_register_target(&ipt_reject_reg);
return -EINVAL;
return 0;
} }
static void __exit fini(void) static void __exit fini(void)
......
...@@ -84,10 +84,7 @@ static struct ipt_target ipt_tos_reg = { ...@@ -84,10 +84,7 @@ static struct ipt_target ipt_tos_reg = {
static int __init init(void) static int __init init(void)
{ {
if (ipt_register_target(&ipt_tos_reg)) return ipt_register_target(&ipt_tos_reg);
return -EINVAL;
return 0;
} }
static void __exit fini(void) static void __exit fini(void)
......
...@@ -313,7 +313,7 @@ static void __tcp_put_port(struct sock *sk) ...@@ -313,7 +313,7 @@ static void __tcp_put_port(struct sock *sk)
spin_unlock(&head->lock); spin_unlock(&head->lock);
} }
inline void tcp_put_port(struct sock *sk) void tcp_put_port(struct sock *sk)
{ {
local_bh_disable(); local_bh_disable();
__tcp_put_port(sk); __tcp_put_port(sk);
......
...@@ -475,7 +475,8 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh, ...@@ -475,7 +475,8 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh,
skb_reserve(skb, (dev->hard_header_len + 15) & ~15); skb_reserve(skb, (dev->hard_header_len + 15) & ~15);
ip6_nd_hdr(sk, skb, dev, src_addr, daddr, IPPROTO_ICMPV6, len); ip6_nd_hdr(sk, skb, dev, src_addr, daddr, IPPROTO_ICMPV6, len);
skb->h.raw = (unsigned char*) msg = (struct nd_msg *) skb_put(skb, len); msg = (struct nd_msg *)skb_put(skb, len);
skb->h.raw = (unsigned char*)msg;
msg->icmph.icmp6_type = NDISC_NEIGHBOUR_ADVERTISEMENT; msg->icmph.icmp6_type = NDISC_NEIGHBOUR_ADVERTISEMENT;
msg->icmph.icmp6_code = 0; msg->icmph.icmp6_code = 0;
...@@ -559,7 +560,8 @@ void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh, ...@@ -559,7 +560,8 @@ void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh,
skb_reserve(skb, (dev->hard_header_len + 15) & ~15); skb_reserve(skb, (dev->hard_header_len + 15) & ~15);
ip6_nd_hdr(sk, skb, dev, saddr, daddr, IPPROTO_ICMPV6, len); ip6_nd_hdr(sk, skb, dev, saddr, daddr, IPPROTO_ICMPV6, len);
skb->h.raw = (unsigned char*) msg = (struct nd_msg *)skb_put(skb, len); msg = (struct nd_msg *)skb_put(skb, len);
skb->h.raw = (unsigned char*)msg;
msg->icmph.icmp6_type = NDISC_NEIGHBOUR_SOLICITATION; msg->icmph.icmp6_type = NDISC_NEIGHBOUR_SOLICITATION;
msg->icmph.icmp6_code = 0; msg->icmph.icmp6_code = 0;
msg->icmph.icmp6_cksum = 0; msg->icmph.icmp6_cksum = 0;
...@@ -630,7 +632,8 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr, ...@@ -630,7 +632,8 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr,
skb_reserve(skb, (dev->hard_header_len + 15) & ~15); skb_reserve(skb, (dev->hard_header_len + 15) & ~15);
ip6_nd_hdr(sk, skb, dev, saddr, daddr, IPPROTO_ICMPV6, len); ip6_nd_hdr(sk, skb, dev, saddr, daddr, IPPROTO_ICMPV6, len);
skb->h.raw = (unsigned char*) hdr = (struct icmp6hdr *) skb_put(skb, len); hdr = (struct icmp6hdr *)skb_put(skb, len);
skb->h.raw = (unsigned char*)hdr;
hdr->icmp6_type = NDISC_ROUTER_SOLICITATION; hdr->icmp6_type = NDISC_ROUTER_SOLICITATION;
hdr->icmp6_code = 0; hdr->icmp6_code = 0;
hdr->icmp6_cksum = 0; hdr->icmp6_cksum = 0;
...@@ -1374,7 +1377,8 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh, ...@@ -1374,7 +1377,8 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
ip6_nd_hdr(sk, buff, dev, &saddr_buf, &skb->nh.ipv6h->saddr, ip6_nd_hdr(sk, buff, dev, &saddr_buf, &skb->nh.ipv6h->saddr,
IPPROTO_ICMPV6, len); IPPROTO_ICMPV6, len);
buff->h.raw = (unsigned char*) icmph = (struct icmp6hdr *) skb_put(buff, len); icmph = (struct icmp6hdr *)skb_put(buff, len);
buff->h.raw = (unsigned char*)icmph;
memset(icmph, 0, sizeof(struct icmp6hdr)); memset(icmph, 0, sizeof(struct icmp6hdr));
icmph->icmp6_type = NDISC_REDIRECT; icmph->icmp6_type = NDISC_REDIRECT;
......
...@@ -1351,7 +1351,7 @@ static int ipx_create(struct socket *sock, int protocol) ...@@ -1351,7 +1351,7 @@ static int ipx_create(struct socket *sock, int protocol)
rc = -ENOMEM; rc = -ENOMEM;
if (!sk) if (!sk)
goto out; goto out;
ipx = ipx_sk(sk) = kmalloc(sizeof(*ipx), GFP_KERNEL); ipx = sk->sk_protinfo = kmalloc(sizeof(*ipx), GFP_KERNEL);
if (!ipx) if (!ipx)
goto outsk; goto outsk;
memset(ipx, 0, sizeof(*ipx)); memset(ipx, 0, sizeof(*ipx));
......
...@@ -1089,7 +1089,7 @@ static int irda_create(struct socket *sock, int protocol) ...@@ -1089,7 +1089,7 @@ static int irda_create(struct socket *sock, int protocol)
return -ENOMEM; return -ENOMEM;
/* Allocate IrDA socket */ /* Allocate IrDA socket */
self = irda_sk(sk) = kmalloc(sizeof(struct irda_sock), GFP_ATOMIC); self = sk->sk_protinfo = kmalloc(sizeof(struct irda_sock), GFP_ATOMIC);
if (self == NULL) { if (self == NULL) {
sk_free(sk); sk_free(sk);
return -ENOMEM; return -ENOMEM;
...@@ -1208,7 +1208,7 @@ static int irda_release(struct socket *sock) ...@@ -1208,7 +1208,7 @@ static int irda_release(struct socket *sock)
/* Destroy IrDA socket */ /* Destroy IrDA socket */
irda_destroy_socket(irda_sk(sk)); irda_destroy_socket(irda_sk(sk));
/* Prevent sock_def_destruct() to create havoc */ /* Prevent sock_def_destruct() to create havoc */
irda_sk(sk) = NULL; sk->sk_protinfo = NULL;
sock_orphan(sk); sock_orphan(sk);
sock->sk = NULL; sock->sk = NULL;
......
...@@ -148,7 +148,7 @@ static int pfkey_create(struct socket *sock, int protocol) ...@@ -148,7 +148,7 @@ static int pfkey_create(struct socket *sock, int protocol)
sk_set_owner(sk, THIS_MODULE); sk_set_owner(sk, THIS_MODULE);
err = -ENOMEM; err = -ENOMEM;
pfk = pfkey_sk(sk) = kmalloc(sizeof(*pfk), GFP_KERNEL); pfk = sk->sk_protinfo = kmalloc(sizeof(*pfk), GFP_KERNEL);
if (!pfk) { if (!pfk) {
sk_free(sk); sk_free(sk);
goto out; goto out;
......
...@@ -826,7 +826,7 @@ int llc_sk_init(struct sock* sk) ...@@ -826,7 +826,7 @@ int llc_sk_init(struct sock* sk)
* tx_win of remote LLC) */ * tx_win of remote LLC) */
skb_queue_head_init(&llc->pdu_unack_q); skb_queue_head_init(&llc->pdu_unack_q);
sk->sk_backlog_rcv = llc_backlog_rcv; sk->sk_backlog_rcv = llc_backlog_rcv;
llc_sk(sk) = llc; sk->sk_protinfo = llc;
out: out:
return rc; return rc;
} }
......
...@@ -72,7 +72,7 @@ static struct sock *nr_alloc_sock(void) ...@@ -72,7 +72,7 @@ static struct sock *nr_alloc_sock(void)
if (!sk) if (!sk)
goto out; goto out;
nr = nr_sk(sk) = kmalloc(sizeof(*nr), GFP_ATOMIC); nr = sk->sk_protinfo = kmalloc(sizeof(*nr), GFP_ATOMIC);
if (!nr) if (!nr)
goto frees; goto frees;
......
...@@ -133,7 +133,7 @@ static struct sock *rose_alloc_sock(void) ...@@ -133,7 +133,7 @@ static struct sock *rose_alloc_sock(void)
if (!sk) if (!sk)
goto out; goto out;
rose = rose_sk(sk) = kmalloc(sizeof(*rose), GFP_ATOMIC); rose = sk->sk_protinfo = kmalloc(sizeof(*rose), GFP_ATOMIC);
if (!rose) if (!rose)
goto frees; goto frees;
......
...@@ -438,7 +438,7 @@ static struct sock *x25_alloc_socket(void) ...@@ -438,7 +438,7 @@ static struct sock *x25_alloc_socket(void)
if (!sk) if (!sk)
goto out; goto out;
x25 = x25_sk(sk) = kmalloc(sizeof(*x25), GFP_ATOMIC); x25 = sk->sk_protinfo = kmalloc(sizeof(*x25), GFP_ATOMIC);
if (!x25) if (!x25)
goto frees; goto frees;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment