Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 122616
b: refs/heads/master
c: 06d5e19
h: refs/heads/master
v: v3
  • Loading branch information
Ben Hutchings authored and David S. Miller committed Dec 13, 2008
1 parent efa2d7e commit 48b7553
Show file tree
Hide file tree
Showing 2 changed files with 20 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: 27dd2caca4eabe7c13a052b7456495ba75535e6a
refs/heads/master: 06d5e19318e59f6f139b5171f4dfc5f3eb4dd897
19 changes: 19 additions & 0 deletions trunk/drivers/net/sfc/efx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1496,6 +1496,14 @@ static struct notifier_block efx_netdev_notifier = {
.notifier_call = efx_netdev_event,
};

static ssize_t
show_phy_type(struct device *dev, struct device_attribute *attr, char *buf)
{
struct efx_nic *efx = pci_get_drvdata(to_pci_dev(dev));
return sprintf(buf, "%d\n", efx->phy_type);
}
static DEVICE_ATTR(phy_type, 0644, show_phy_type, NULL);

static int efx_register_netdev(struct efx_nic *efx)
{
struct net_device *net_dev = efx->net_dev;
Expand All @@ -1522,7 +1530,17 @@ static int efx_register_netdev(struct efx_nic *efx)
strcpy(efx->name, net_dev->name);
efx_set_channel_names(efx);

rc = device_create_file(&efx->pci_dev->dev, &dev_attr_phy_type);
if (rc) {
EFX_ERR(efx, "failed to init net dev attributes\n");
goto fail_registered;
}

return 0;

fail_registered:
unregister_netdev(net_dev);
return rc;
}

static void efx_unregister_netdev(struct efx_nic *efx)
Expand All @@ -1542,6 +1560,7 @@ static void efx_unregister_netdev(struct efx_nic *efx)

if (efx_dev_registered(efx)) {
strlcpy(efx->name, pci_name(efx->pci_dev), sizeof(efx->name));
device_remove_file(&efx->pci_dev->dev, &dev_attr_phy_type);
unregister_netdev(efx->net_dev);
}
}
Expand Down

0 comments on commit 48b7553

Please sign in to comment.