Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 91aa6931 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

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: (21 commits)
  natsemi: Support Aculab E1/T1 PMXc cPCI carrier cards
  natsemi: Add support for using MII port with no PHY
  skge: race with workq and RTNL
  Replace local random function with random32()
  s2io: RTNL and flush_scheduled_work deadlock
  8139too: RTNL and flush_scheduled_work deadlock
  sis190: RTNL and flush_scheduled_work deadlock
  r8169: RTNL and flush_scheduled_work deadlock
  [PATCH] ieee80211softmac: Fix setting of initial transmit rates
  [PATCH] bcm43xx: OFDM fix for rev 1 cards
  [PATCH] bcm43xx: Fix for 4311 and 02/07/07 specification changes
  [PATCH] prism54: correct assignment of DOT1XENABLE in WE-19 codepaths
  [PATCH] zd1211rw: Readd zd_addr_t cast
  [PATCH] bcm43xx: Fix for oops on resume
  [PATCH] bcm43xx: Ignore ampdu status reports
  [PATCH] wavelan: Use ARRAY_SIZE macro when appropriate
  [PATCH] hostap: Use ARRAY_SIZE macro when appropriate
  [PATCH] misc-wireless: Use ARRAY_SIZE macro when appropriate
  [PATCH] ipw2100: Use ARRAY_SIZE macro when appropriate
  [PATCH] bcm43xx: Janitorial change - remove two unused variables
  ...
parents a5527c6a 6606e17a
Loading
Loading
Loading
Loading
+17 −23
Original line number Diff line number Diff line
@@ -1109,6 +1109,8 @@ static void __devexit rtl8139_remove_one (struct pci_dev *pdev)

	assert (dev != NULL);

	flush_scheduled_work();

	unregister_netdev (dev);

	__rtl8139_cleanup_dev (dev);
@@ -1603,18 +1605,21 @@ static void rtl8139_thread (struct work_struct *work)
	struct net_device *dev = tp->mii.dev;
	unsigned long thr_delay = next_tick;

	rtnl_lock();

	if (!netif_running(dev))
		goto out_unlock;

	if (tp->watchdog_fired) {
		tp->watchdog_fired = 0;
		rtl8139_tx_timeout_task(work);
	} else if (rtnl_trylock()) {
	} else
		rtl8139_thread_iter(dev, tp, tp->mmio_addr);
		rtnl_unlock ();
	} else {
		/* unlikely race.  mitigate with fast poll. */
		thr_delay = HZ / 2;
	}

	if (tp->have_thread)
		schedule_delayed_work(&tp->thread, thr_delay);
out_unlock:
	rtnl_unlock ();
}

static void rtl8139_start_thread(struct rtl8139_private *tp)
@@ -1626,19 +1631,11 @@ static void rtl8139_start_thread(struct rtl8139_private *tp)
		return;

	tp->have_thread = 1;
	tp->watchdog_fired = 0;

	schedule_delayed_work(&tp->thread, next_tick);
}

static void rtl8139_stop_thread(struct rtl8139_private *tp)
{
	if (tp->have_thread) {
		cancel_rearming_delayed_work(&tp->thread);
		tp->have_thread = 0;
	} else
		flush_scheduled_work();
}

static inline void rtl8139_tx_clear (struct rtl8139_private *tp)
{
	tp->cur_tx = 0;
@@ -1696,12 +1693,11 @@ static void rtl8139_tx_timeout (struct net_device *dev)
{
	struct rtl8139_private *tp = netdev_priv(dev);

	tp->watchdog_fired = 1;
	if (!tp->have_thread) {
		INIT_DELAYED_WORK(&tp->thread, rtl8139_tx_timeout_task);
		INIT_DELAYED_WORK(&tp->thread, rtl8139_thread);
		schedule_delayed_work(&tp->thread, next_tick);
	} else
		tp->watchdog_fired = 1;

	}
}

static int rtl8139_start_xmit (struct sk_buff *skb, struct net_device *dev)
@@ -2233,8 +2229,6 @@ static int rtl8139_close (struct net_device *dev)

	netif_stop_queue (dev);

	rtl8139_stop_thread(tp);

	if (netif_msg_ifdown(tp))
		printk(KERN_DEBUG "%s: Shutting down ethercard, status was 0x%4.4x.\n",
			dev->name, RTL_R16 (IntrStatus));
+2 −11
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@
#include <linux/hdlcdrv.h>
#include <linux/baycom.h>
#include <linux/jiffies.h>
#include <linux/random.h>
#include <net/ax25.h> 
#include <asm/uaccess.h>

@@ -433,16 +434,6 @@ static void encode_hdlc(struct baycom_state *bc)

/* ---------------------------------------------------------------------- */

static unsigned short random_seed;

static inline unsigned short random_num(void)
{
	random_seed = 28629 * random_seed + 157;
	return random_seed;
}

/* ---------------------------------------------------------------------- */

static int transmit(struct baycom_state *bc, int cnt, unsigned char stat)
{
	struct parport *pp = bc->pdev->port;
@@ -464,7 +455,7 @@ static int transmit(struct baycom_state *bc, int cnt, unsigned char stat)
			if ((--bc->hdlctx.slotcnt) > 0)
				return 0;
			bc->hdlctx.slotcnt = bc->ch_params.slottime;
			if ((random_num() % 256) > bc->ch_params.ppersist)
			if ((random32() % 256) > bc->ch_params.ppersist)
				return 0;
		}
	}
+2 −11
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@
#include <linux/if_arp.h>
#include <linux/skbuff.h>
#include <linux/hdlcdrv.h>
#include <linux/random.h>
#include <net/ax25.h> 
#include <asm/uaccess.h>

@@ -371,16 +372,6 @@ static void start_tx(struct net_device *dev, struct hdlcdrv_state *s)

/* ---------------------------------------------------------------------- */

static unsigned short random_seed;

static inline unsigned short random_num(void)
{
	random_seed = 28629 * random_seed + 157;
	return random_seed;
}

/* ---------------------------------------------------------------------- */

void hdlcdrv_arbitrate(struct net_device *dev, struct hdlcdrv_state *s)
{
	if (!s || s->magic != HDLCDRV_MAGIC || s->hdlctx.ptt || !s->skb) 
@@ -396,7 +387,7 @@ void hdlcdrv_arbitrate(struct net_device *dev, struct hdlcdrv_state *s)
	if ((--s->hdlctx.slotcnt) > 0)
		return;
	s->hdlctx.slotcnt = s->ch_params.slottime;
	if ((random_num() % 256) > s->ch_params.ppersist)
	if ((random32() % 256) > s->ch_params.ppersist)
		return;
	start_tx(dev, s);
}
+2 −9
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@
#include <linux/slab.h>
#include <linux/errno.h>
#include <linux/bitops.h>
#include <linux/random.h>
#include <asm/io.h>
#include <asm/system.h>
#include <linux/interrupt.h>
@@ -566,14 +567,6 @@ static void yam_start_tx(struct net_device *dev, struct yam_port *yp)
	ptt_on(dev);
}

static unsigned short random_seed;

static inline unsigned short random_num(void)
{
	random_seed = 28629 * random_seed + 157;
	return random_seed;
}

static void yam_arbitrate(struct net_device *dev)
{
	struct yam_port *yp = netdev_priv(dev);
@@ -600,7 +593,7 @@ static void yam_arbitrate(struct net_device *dev)
	yp->slotcnt = yp->slot / 10;

	/* is random > persist ? */
	if ((random_num() % 256) > yp->pers)
	if ((random32() % 256) > yp->pers)
		return;

	yam_start_tx(dev, yp);
+38 −5
Original line number Diff line number Diff line
@@ -244,6 +244,9 @@ enum {
	MII_EN_SCRM	= 0x0004,	/* enable scrambler (tp) */
};

enum {
	NATSEMI_FLAG_IGNORE_PHY		= 0x1,
};

/* array of board data directly indexed by pci_tbl[x].driver_data */
static const struct {
@@ -251,10 +254,12 @@ static const struct {
	unsigned long flags;
	unsigned int eeprom_size;
} natsemi_pci_info[] __devinitdata = {
	{ "Aculab E1/T1 PMXc cPCI carrier card", NATSEMI_FLAG_IGNORE_PHY, 128 },
	{ "NatSemi DP8381[56]", 0, 24 },
};

static const struct pci_device_id natsemi_pci_tbl[] __devinitdata = {
	{ PCI_VENDOR_ID_NS, 0x0020, 0x12d9,     0x000c,     0, 0, 0 },
	{ PCI_VENDOR_ID_NS, 0x0020, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
	{ }	/* terminate list */
};
@@ -568,6 +573,8 @@ struct netdev_private {
	u32 intr_status;
	/* Do not touch the nic registers */
	int hands_off;
	/* Don't pay attention to the reported link state. */
	int ignore_phy;
	/* external phy that is used: only valid if dev->if_port != PORT_TP */
	int mii;
	int phy_addr_external;
@@ -696,6 +703,9 @@ static void __devinit natsemi_init_media (struct net_device *dev)
	struct netdev_private *np = netdev_priv(dev);
	u32 tmp;

	if (np->ignore_phy)
		netif_carrier_on(dev);
	else
		netif_carrier_off(dev);

	/* get the initial settings from hardware */
@@ -806,8 +816,13 @@ static int __devinit natsemi_probe1 (struct pci_dev *pdev,
	np->hands_off = 0;
	np->intr_status = 0;
	np->eeprom_size = natsemi_pci_info[chip_idx].eeprom_size;
	if (natsemi_pci_info[chip_idx].flags & NATSEMI_FLAG_IGNORE_PHY)
		np->ignore_phy = 1;
	else
		np->ignore_phy = 0;

	/* Initial port:
	 * - If configured to ignore the PHY set up for external.
	 * - If the nic was configured to use an external phy and if find_mii
	 *   finds a phy: use external port, first phy that replies.
	 * - Otherwise: internal port.
@@ -815,7 +830,7 @@ static int __devinit natsemi_probe1 (struct pci_dev *pdev,
	 * The address would be used to access a phy over the mii bus, but
	 * the internal phy is accessed through mapped registers.
	 */
	if (readl(ioaddr + ChipConfig) & CfgExtPhy)
	if (np->ignore_phy || readl(ioaddr + ChipConfig) & CfgExtPhy)
		dev->if_port = PORT_MII;
	else
		dev->if_port = PORT_TP;
@@ -825,7 +840,9 @@ static int __devinit natsemi_probe1 (struct pci_dev *pdev,

	if (dev->if_port != PORT_TP) {
		np->phy_addr_external = find_mii(dev);
		if (np->phy_addr_external == PHY_ADDR_NONE) {
		/* If we're ignoring the PHY it doesn't matter if we can't
		 * find one. */
		if (!np->ignore_phy && np->phy_addr_external == PHY_ADDR_NONE) {
			dev->if_port = PORT_TP;
			np->phy_addr_external = PHY_ADDR_INTERNAL;
		}
@@ -891,6 +908,8 @@ static int __devinit natsemi_probe1 (struct pci_dev *pdev,
		printk("%02x, IRQ %d", dev->dev_addr[i], irq);
		if (dev->if_port == PORT_TP)
			printk(", port TP.\n");
		else if (np->ignore_phy)
			printk(", port MII, ignoring PHY\n");
		else
			printk(", port MII, phy ad %d.\n", np->phy_addr_external);
	}
@@ -1571,9 +1590,13 @@ static void check_link(struct net_device *dev)
{
	struct netdev_private *np = netdev_priv(dev);
	void __iomem * ioaddr = ns_ioaddr(dev);
	int duplex;
	int duplex = np->duplex;
	u16 bmsr;

	/* If we are ignoring the PHY then don't try reading it. */
	if (np->ignore_phy)
		goto propagate_state;

	/* The link status field is latched: it remains low after a temporary
	 * link failure until it's read. We need the current link status,
	 * thus read twice.
@@ -1609,6 +1632,7 @@ static void check_link(struct net_device *dev)
			duplex = 1;
	}

propagate_state:
	/* if duplex is set then bit 28 must be set, too */
	if (duplex ^ !!(np->rx_config & RxAcceptTx)) {
		if (netif_msg_link(np))
@@ -2818,6 +2842,15 @@ static int netdev_set_ecmd(struct net_device *dev, struct ethtool_cmd *ecmd)
		return -EINVAL;
	}

	/*
	 * If we're ignoring the PHY then autoneg and the internal
	 * transciever are really not going to work so don't let the
	 * user select them.
	 */
	if (np->ignore_phy && (ecmd->autoneg == AUTONEG_ENABLE ||
			       ecmd->port == PORT_TP))
		return -EINVAL;

	/*
	 * maxtxpkt, maxrxpkt: ignored for now.
	 *
Loading