Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 96600
b: refs/heads/master
c: 8f5bf5f
h: refs/heads/master
v: v3
  • Loading branch information
Ben Dooks authored and Jeff Garzik committed May 13, 2008
1 parent 6e3f10e commit 061f8c9
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 37d5dca6af6b62bbb2c63f46a06cb07d0cf4522b
refs/heads/master: 8f5bf5f25cdf9270f33ed347c582a3a451d3c38a
26 changes: 26 additions & 0 deletions trunk/drivers/net/dm9000.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ typedef struct board_info {

struct mutex addr_lock; /* phy and eeprom access lock */

struct delayed_work phy_poll;
struct net_device *ndev;

spinlock_t lock;

struct mii_if_info mii;
Expand Down Expand Up @@ -297,6 +300,10 @@ static void dm9000_set_io(struct board_info *db, int byte_width)
}
}

static void dm9000_schedule_poll(board_info_t *db)
{
schedule_delayed_work(&db->phy_poll, HZ * 2);
}

/* Our watchdog timed out. Called by the networking layer */
static void dm9000_timeout(struct net_device *dev)
Expand Down Expand Up @@ -465,6 +472,17 @@ static const struct ethtool_ops dm9000_ethtool_ops = {
.set_eeprom = dm9000_set_eeprom,
};

static void
dm9000_poll_work(struct work_struct *w)
{
struct delayed_work *dw = container_of(w, struct delayed_work, work);
board_info_t *db = container_of(dw, board_info_t, phy_poll);

mii_check_media(&db->mii, netif_msg_link(db), 0);

if (netif_running(db->ndev))
dm9000_schedule_poll(db);
}

/* dm9000_release_board
*
Expand Down Expand Up @@ -532,10 +550,14 @@ dm9000_probe(struct platform_device *pdev)
memset(db, 0, sizeof (*db));

db->dev = &pdev->dev;
db->ndev = ndev;

spin_lock_init(&db->lock);
mutex_init(&db->addr_lock);

INIT_DELAYED_WORK(&db->phy_poll, dm9000_poll_work);


if (pdev->num_resources < 2) {
ret = -ENODEV;
goto out;
Expand Down Expand Up @@ -761,6 +783,8 @@ dm9000_open(struct net_device *dev)

mii_check_media(&db->mii, netif_msg_link(db), 1);
netif_start_queue(dev);

dm9000_schedule_poll(db);

return 0;
}
Expand Down Expand Up @@ -879,6 +903,8 @@ dm9000_stop(struct net_device *ndev)
if (netif_msg_ifdown(db))
dev_dbg(db->dev, "shutting down %s\n", ndev->name);

cancel_delayed_work(&db->phy_poll);

netif_stop_queue(ndev);
netif_carrier_off(ndev);

Expand Down

0 comments on commit 061f8c9

Please sign in to comment.