diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2008-12-13 00:47:23 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-12-13 00:57:59 -0500 |
commit | 06d5e19318e59f6f139b5171f4dfc5f3eb4dd897 (patch) | |
tree | 6ec5b0f285c06b2ada45c003106cdf548762eaa2 /drivers/net | |
parent | 27dd2caca4eabe7c13a052b7456495ba75535e6a (diff) |
sfc: Add phy_type device attribute
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/sfc/efx.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c index 957a6320bbcb..90820d4046f8 100644 --- a/drivers/net/sfc/efx.c +++ b/drivers/net/sfc/efx.c | |||
@@ -1496,6 +1496,14 @@ static struct notifier_block efx_netdev_notifier = { | |||
1496 | .notifier_call = efx_netdev_event, | 1496 | .notifier_call = efx_netdev_event, |
1497 | }; | 1497 | }; |
1498 | 1498 | ||
1499 | static ssize_t | ||
1500 | show_phy_type(struct device *dev, struct device_attribute *attr, char *buf) | ||
1501 | { | ||
1502 | struct efx_nic *efx = pci_get_drvdata(to_pci_dev(dev)); | ||
1503 | return sprintf(buf, "%d\n", efx->phy_type); | ||
1504 | } | ||
1505 | static DEVICE_ATTR(phy_type, 0644, show_phy_type, NULL); | ||
1506 | |||
1499 | static int efx_register_netdev(struct efx_nic *efx) | 1507 | static int efx_register_netdev(struct efx_nic *efx) |
1500 | { | 1508 | { |
1501 | struct net_device *net_dev = efx->net_dev; | 1509 | struct net_device *net_dev = efx->net_dev; |
@@ -1522,7 +1530,17 @@ static int efx_register_netdev(struct efx_nic *efx) | |||
1522 | strcpy(efx->name, net_dev->name); | 1530 | strcpy(efx->name, net_dev->name); |
1523 | efx_set_channel_names(efx); | 1531 | efx_set_channel_names(efx); |
1524 | 1532 | ||
1533 | rc = device_create_file(&efx->pci_dev->dev, &dev_attr_phy_type); | ||
1534 | if (rc) { | ||
1535 | EFX_ERR(efx, "failed to init net dev attributes\n"); | ||
1536 | goto fail_registered; | ||
1537 | } | ||
1538 | |||
1525 | return 0; | 1539 | return 0; |
1540 | |||
1541 | fail_registered: | ||
1542 | unregister_netdev(net_dev); | ||
1543 | return rc; | ||
1526 | } | 1544 | } |
1527 | 1545 | ||
1528 | static void efx_unregister_netdev(struct efx_nic *efx) | 1546 | static void efx_unregister_netdev(struct efx_nic *efx) |
@@ -1542,6 +1560,7 @@ static void efx_unregister_netdev(struct efx_nic *efx) | |||
1542 | 1560 | ||
1543 | if (efx_dev_registered(efx)) { | 1561 | if (efx_dev_registered(efx)) { |
1544 | strlcpy(efx->name, pci_name(efx->pci_dev), sizeof(efx->name)); | 1562 | strlcpy(efx->name, pci_name(efx->pci_dev), sizeof(efx->name)); |
1563 | device_remove_file(&efx->pci_dev->dev, &dev_attr_phy_type); | ||
1545 | unregister_netdev(efx->net_dev); | 1564 | unregister_netdev(efx->net_dev); |
1546 | } | 1565 | } |
1547 | } | 1566 | } |