aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/net/arcnet
diff options
context:
space:
mode:
authorMichael Grzeschik <m.grzeschik@pengutronix.de>2017-06-28 18:32:19 +0200
committerDavid S. Miller <davem@davemloft.net>2017-06-29 15:26:13 -0400
commitede07a1fc7d70adfb290cfdace391295897023cb (patch)
tree83d1c56e9c4d4d8d0ddb0dc21028b2755e311e83 /drivers/net/arcnet
parentarcnet: add err_skb package for package status feedback (diff)
downloadwireguard-linux-ede07a1fc7d70adfb290cfdace391295897023cb.tar.xz
wireguard-linux-ede07a1fc7d70adfb290cfdace391295897023cb.zip
arcnet: com20020-pci: add attribute to readback backplane status
We add the sysfs interface the read back the backplane status of the interface. Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/arcnet')
-rw-r--r--drivers/net/arcnet/com20020-pci.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/net/arcnet/com20020-pci.c b/drivers/net/arcnet/com20020-pci.c
index 239de38fbd6a..dec300cac55f 100644
--- a/drivers/net/arcnet/com20020-pci.c
+++ b/drivers/net/arcnet/com20020-pci.c
@@ -93,6 +93,27 @@ static void led_recon_set(struct led_classdev *led_cdev,
outb(!!value, priv->misc + ci->leds[card->index].red);
}
+static ssize_t backplane_mode_show(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct net_device *net_dev = to_net_dev(dev);
+ struct arcnet_local *lp = netdev_priv(net_dev);
+
+ return sprintf(buf, "%s\n", lp->backplane ? "true" : "false");
+}
+static DEVICE_ATTR_RO(backplane_mode);
+
+static struct attribute *com20020_state_attrs[] = {
+ &dev_attr_backplane_mode.attr,
+ NULL,
+};
+
+static struct attribute_group com20020_state_group = {
+ .name = NULL,
+ .attrs = com20020_state_attrs,
+};
+
static void com20020pci_remove(struct pci_dev *pdev);
static int com20020pci_probe(struct pci_dev *pdev,
@@ -168,6 +189,7 @@ static int com20020pci_probe(struct pci_dev *pdev,
dev->base_addr = ioaddr;
dev->dev_addr[0] = node;
+ dev->sysfs_groups[0] = &com20020_state_group;
dev->irq = pdev->irq;
lp->card_name = "PCI COM20020";
lp->card_flags = ci->flags;