Netdev Archive on lore.kernel.org help / color / mirror / Atom feed
From: Thomas Falcon <tlfalcon@linux.ibm.com> To: netdev@vger.kernel.org Cc: drt@linux.vnet.ibm.com, sukadev@linux.vnet.ibm.com, ljp@linux.vnet.ibm.com, cforno12@linux.ibm.com, Thomas Falcon <tlfalcon@linux.ibm.com> Subject: [PATCH net-next 1/5] ibmvnic: Create failover sysfs as part of an attribute group Date: Mon, 31 Aug 2020 11:58:09 -0500 [thread overview] Message-ID: <1598893093-14280-2-git-send-email-tlfalcon@linux.ibm.com> (raw) In-Reply-To: <1598893093-14280-1-git-send-email-tlfalcon@linux.ibm.com> Create a sysfs attribute group and make failover sysfs file a member. Signed-off-by: Thomas Falcon <tlfalcon@linux.ibm.com> --- drivers/net/ethernet/ibm/ibmvnic.c | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c index 86a83e5..91b9cc3 100644 --- a/drivers/net/ethernet/ibm/ibmvnic.c +++ b/drivers/net/ethernet/ibm/ibmvnic.c @@ -5047,7 +5047,7 @@ static int ibmvnic_reset_init(struct ibmvnic_adapter *adapter, bool reset) return rc; } -static struct device_attribute dev_attr_failover; +static const struct attribute_group *dev_attr_groups[]; static int ibmvnic_probe(struct vio_dev *dev, const struct vio_device_id *id) { @@ -5126,9 +5126,9 @@ static int ibmvnic_probe(struct vio_dev *dev, const struct vio_device_id *id) netdev->min_mtu = adapter->min_mtu - ETH_HLEN; netdev->max_mtu = adapter->max_mtu - ETH_HLEN; - rc = device_create_file(&dev->dev, &dev_attr_failover); + rc = sysfs_create_groups(&dev->dev.kobj, dev_attr_groups); if (rc) - goto ibmvnic_dev_file_err; + goto ibmvnic_dev_groups_err; netif_carrier_off(netdev); rc = register_netdev(netdev); @@ -5145,14 +5145,11 @@ static int ibmvnic_probe(struct vio_dev *dev, const struct vio_device_id *id) return 0; ibmvnic_register_fail: - device_remove_file(&dev->dev, &dev_attr_failover); - -ibmvnic_dev_file_err: + sysfs_remove_groups(&dev->dev.kobj, dev_attr_groups); +ibmvnic_dev_groups_err: release_stats_token(adapter); - ibmvnic_stats_fail: release_stats_buffers(adapter); - ibmvnic_init_fail: release_sub_crqs(adapter, 1); release_crq_queue(adapter); @@ -5194,13 +5191,15 @@ static int ibmvnic_remove(struct vio_dev *dev) rtnl_unlock(); mutex_destroy(&adapter->fw_lock); - device_remove_file(&dev->dev, &dev_attr_failover); + sysfs_remove_groups(&dev->dev.kobj, dev_attr_groups); free_netdev(netdev); dev_set_drvdata(&dev->dev, NULL); return 0; } +static struct device_attribute dev_attr_failover; + static ssize_t failover_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { @@ -5237,6 +5236,20 @@ static ssize_t failover_store(struct device *dev, struct device_attribute *attr, static DEVICE_ATTR_WO(failover); +static struct attribute *dev_attrs[] = { + &dev_attr_failover.attr, + NULL, +}; + +static struct attribute_group dev_attr_group = { + .attrs = dev_attrs, +}; + +static const struct attribute_group *dev_attr_groups[] = { + &dev_attr_group, + NULL, +}; + static unsigned long ibmvnic_get_desired_dma(struct vio_dev *vdev) { struct net_device *netdev = dev_get_drvdata(&vdev->dev); -- 1.8.3.1
next prev parent reply other threads:[~2020-08-31 16:58 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-08-31 16:58 [PATCH net-next 0/5] ibmvnic: Report ACL settings in sysfs Thomas Falcon 2020-08-31 16:58 ` Thomas Falcon [this message] 2020-08-31 16:58 ` [PATCH net-next 2/5] ibmvnic: Include documentation for ibmvnic sysfs files Thomas Falcon 2020-08-31 19:07 ` Jakub Kicinski 2020-08-31 19:51 ` Thomas Falcon 2020-08-31 16:58 ` [PATCH net-next 3/5] ibmvnic: Remove ACL change indication definitions Thomas Falcon 2020-08-31 16:58 ` [PATCH net-next 4/5] ibmvnic: Reporting device ACL settings through sysfs Thomas Falcon 2020-09-02 21:51 ` Sukadev Bhattiprolu 2020-08-31 16:58 ` [PATCH net-next 5/5] ibmvnic: Provide documentation for ACL sysfs files Thomas Falcon 2020-08-31 19:26 ` Jakub Kicinski 2020-08-31 19:54 ` Thomas Falcon 2020-08-31 20:11 ` Jakub Kicinski 2020-08-31 21:44 ` Thomas Falcon 2020-08-31 22:00 ` Jakub Kicinski 2020-08-31 22:17 ` David Miller 2020-08-31 22:30 ` Thomas Falcon
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1598893093-14280-2-git-send-email-tlfalcon@linux.ibm.com \ --to=tlfalcon@linux.ibm.com \ --cc=cforno12@linux.ibm.com \ --cc=drt@linux.vnet.ibm.com \ --cc=ljp@linux.vnet.ibm.com \ --cc=netdev@vger.kernel.org \ --cc=sukadev@linux.vnet.ibm.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).