Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 254244
b: refs/heads/master
c: 55caa92
h: refs/heads/master
v: v3
  • Loading branch information
Yinglin Luan authored and David S. Miller committed Jun 29, 2011
1 parent f5b347d commit e7a1997
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7ab24bfdf9a9a9f87ac8e5ad9a25f80b5b947be7
refs/heads/master: 55caa9241ece1c07a930e3d05a624061adcf2653
28 changes: 15 additions & 13 deletions trunk/drivers/net/rionet.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ static int rionet_close(struct net_device *ndev)

static void rionet_remove(struct rio_dev *rdev)
{
struct net_device *ndev = NULL;
struct net_device *ndev = rio_get_drvdata(rdev);
struct rionet_peer *peer, *tmp;

free_pages((unsigned long)rionet_active, rdev->net->hport->sys_size ?
Expand Down Expand Up @@ -433,22 +433,12 @@ static const struct net_device_ops rionet_netdev_ops = {
.ndo_set_mac_address = eth_mac_addr,
};

static int rionet_setup_netdev(struct rio_mport *mport)
static int rionet_setup_netdev(struct rio_mport *mport, struct net_device *ndev)
{
int rc = 0;
struct net_device *ndev = NULL;
struct rionet_private *rnet;
u16 device_id;

/* Allocate our net_device structure */
ndev = alloc_etherdev(sizeof(struct rionet_private));
if (ndev == NULL) {
printk(KERN_INFO "%s: could not allocate ethernet device.\n",
DRV_NAME);
rc = -ENOMEM;
goto out;
}

rionet_active = (struct rio_dev **)__get_free_pages(GFP_KERNEL,
mport->sys_size ? __fls(sizeof(void *)) + 4 : 0);
if (!rionet_active) {
Expand Down Expand Up @@ -504,11 +494,21 @@ static int rionet_probe(struct rio_dev *rdev, const struct rio_device_id *id)
int rc = -ENODEV;
u32 lpef, lsrc_ops, ldst_ops;
struct rionet_peer *peer;
struct net_device *ndev = NULL;

/* If local device is not rionet capable, give up quickly */
if (!rionet_capable)
goto out;

/* Allocate our net_device structure */
ndev = alloc_etherdev(sizeof(struct rionet_private));
if (ndev == NULL) {
printk(KERN_INFO "%s: could not allocate ethernet device.\n",
DRV_NAME);
rc = -ENOMEM;
goto out;
}

/*
* First time through, make sure local device is rionet
* capable, setup netdev, and set flags so this is skipped
Expand All @@ -529,7 +529,7 @@ static int rionet_probe(struct rio_dev *rdev, const struct rio_device_id *id)
goto out;
}

rc = rionet_setup_netdev(rdev->net->hport);
rc = rionet_setup_netdev(rdev->net->hport, ndev);
rionet_check = 1;
}

Expand All @@ -546,6 +546,8 @@ static int rionet_probe(struct rio_dev *rdev, const struct rio_device_id *id)
list_add_tail(&peer->node, &rionet_peers);
}

rio_set_drvdata(rdev, ndev);

out:
return rc;
}
Expand Down

0 comments on commit e7a1997

Please sign in to comment.