From patchwork Wed Jun 28 16:32:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Grzeschik X-Patchwork-Id: 781772 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3wySyR5vvkz9s7f for ; Thu, 29 Jun 2017 02:33:03 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752514AbdF1Qcx (ORCPT ); Wed, 28 Jun 2017 12:32:53 -0400 Received: from metis.ext.4.pengutronix.de ([92.198.50.35]:47083 "EHLO metis.ext.4.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752486AbdF1Qce (ORCPT ); Wed, 28 Jun 2017 12:32:34 -0400 Received: from dude.hi.pengutronix.de ([2001:67c:670:100:1d::7]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dQFtD-0007n8-HV; Wed, 28 Jun 2017 18:32:27 +0200 Received: from mgr by dude.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1dQFtC-00083s-HF; Wed, 28 Jun 2017 18:32:26 +0200 From: Michael Grzeschik To: davem@davemloft.net Cc: netdev@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 2/4] arcnet: com20020-pci: add attribute to readback backplane status Date: Wed, 28 Jun 2017 18:32:19 +0200 Message-Id: <20170628163221.32301-3-m.grzeschik@pengutronix.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170628163221.32301-1-m.grzeschik@pengutronix.de> References: <20170628163221.32301-1-m.grzeschik@pengutronix.de> X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::7 X-SA-Exim-Mail-From: mgr@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: netdev@vger.kernel.org Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org We add the sysfs interface the read back the backplane status of the interface. Signed-off-by: Michael Grzeschik --- drivers/net/arcnet/com20020-pci.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/net/arcnet/com20020-pci.c b/drivers/net/arcnet/com20020-pci.c index 239de38fbd6a5..dec300cac55f9 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;