Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1400252

[PATCH v2 1/5] IB/hfi1: Export drivers user sw version via sysfs

From Dennis Dalessandro <dennis.dalessandro@intel.com>
Newsgroups linux.kernel
Subject [PATCH v2 1/5] IB/hfi1: Export drivers user sw version via sysfs
Date 2016-05-12 19:20 +0200
Message-ID <ry2rg-1NT-7@gated-at.bofh.it> (permalink)
References <ry2rf-1NT-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


User space consumers of hfi1 will need to know what version of the
driver they are dealing with. This becomes particularly important when
the write() interface is removed. User's will need to be able to query
the driver information but without asking the driver directly.

Add the driver's software version to sysfs for this exact purpose.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Mitko Haralanov <mitko.haralanov@intel.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
---
 drivers/staging/rdma/hfi1/sysfs.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/rdma/hfi1/sysfs.c b/drivers/staging/rdma/hfi1/sysfs.c
index 8cd6df8..2ff5a14 100644
--- a/drivers/staging/rdma/hfi1/sysfs.c
+++ b/drivers/staging/rdma/hfi1/sysfs.c
@@ -622,6 +622,12 @@ static ssize_t show_tempsense(struct device *device,
 	return ret;
 }
 
+static ssize_t show_user_sw_version(struct device *device,
+				    struct device_attribute *attr, char *buf)
+{
+	return scnprintf(buf, PAGE_SIZE, "0x%x\n", HFI1_USER_SWVERSION);
+}
+
 /*
  * end of per-unit (or driver, in some cases, but replicated
  * per unit) functions
@@ -636,6 +642,7 @@ static DEVICE_ATTR(serial, S_IRUGO, show_serial, NULL);
 static DEVICE_ATTR(boardversion, S_IRUGO, show_boardversion, NULL);
 static DEVICE_ATTR(tempsense, S_IRUGO, show_tempsense, NULL);
 static DEVICE_ATTR(chip_reset, S_IWUSR, NULL, store_chip_reset);
+static DEVICE_ATTR(user_sw_version, S_IRUGO, show_user_sw_version, NULL);
 
 static struct device_attribute *hfi1_attributes[] = {
 	&dev_attr_hw_rev,
@@ -646,6 +653,7 @@ static struct device_attribute *hfi1_attributes[] = {
 	&dev_attr_boardversion,
 	&dev_attr_tempsense,
 	&dev_attr_chip_reset,
+	&dev_attr_user_sw_version,
 };
 
 int hfi1_create_port_files(struct ib_device *ibdev, u8 port_num,

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/5] IB/hfi1: Remove write() and use ioctl() for user  access Dennis Dalessandro <dennis.dalessandro@intel.com> - 2016-05-12 19:20 +0200
  [PATCH v2 3/5] IB/hfi1: Add ioctl() interface for user commands Dennis Dalessandro <dennis.dalessandro@intel.com> - 2016-05-12 19:20 +0200
    Re: [PATCH v2 3/5] IB/hfi1: Add ioctl() interface for user commands Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2016-05-12 19:50 +0200
      RE: [PATCH v2 3/5] IB/hfi1: Add ioctl() interface for user commands "Hefty, Sean" <sean.hefty@intel.com> - 2016-05-12 20:20 +0200
      Re: [PATCH v2 3/5] IB/hfi1: Add ioctl() interface for user commands Dennis Dalessandro <dennis.dalessandro@intel.com> - 2016-05-12 21:30 +0200
        Re: [PATCH v2 3/5] IB/hfi1: Add ioctl() interface for user commands Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2016-05-12 21:50 +0200
          Re: [PATCH v2 3/5] IB/hfi1: Add ioctl() interface for user commands Doug Ledford <dledford@redhat.com> - 2016-05-12 21:50 +0200
            Re: [PATCH v2 3/5] IB/hfi1: Add ioctl() interface for user commands Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2016-05-12 23:30 +0200
              Re: [PATCH v2 3/5] IB/hfi1: Add ioctl() interface for user commands Dennis Dalessandro <dennis.dalessandro@intel.com> - 2016-05-13 16:40 +0200
          Re: [PATCH v2 3/5] IB/hfi1: Add ioctl() interface for user commands "ira.weiny" <ira.weiny@intel.com> - 2016-05-13 23:00 +0200
  [PATCH v2 1/5] IB/hfi1: Export drivers user sw version via sysfs Dennis Dalessandro <dennis.dalessandro@intel.com> - 2016-05-12 19:20 +0200
  [PATCH v2 2/5] IB/hfi1: Remove unused user command Dennis Dalessandro <dennis.dalessandro@intel.com> - 2016-05-12 19:20 +0200
  [PATCH v2 4/5] IB/hfi1: Remove write(), use ioctl() for user cmds Dennis Dalessandro <dennis.dalessandro@intel.com> - 2016-05-12 19:20 +0200
  [PATCH v2 5/5] IB/hfi1: Add trace message in user IOCTL handling Dennis Dalessandro <dennis.dalessandro@intel.com> - 2016-05-12 19:20 +0200
  Re: [PATCH v2 0/5] IB/hfi1: Remove write() and use ioctl() for user  access Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2016-05-12 19:40 +0200
    Re: [PATCH v2 0/5] IB/hfi1: Remove write() and use ioctl() for user access Dennis Dalessandro <dennis.dalessandro@intel.com> - 2016-05-12 21:10 +0200
      Re: [PATCH v2 0/5] IB/hfi1: Remove write() and use ioctl() for user  access Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2016-05-12 21:30 +0200
        Re: [PATCH v2 0/5] IB/hfi1: Remove write() and use ioctl() for user access Dennis Dalessandro <dennis.dalessandro@intel.com> - 2016-05-12 22:00 +0200
          Re: [PATCH v2 0/5] IB/hfi1: Remove write() and use ioctl() for user  access Doug Ledford <dledford@redhat.com> - 2016-05-12 22:40 +0200
          Re: [PATCH v2 0/5] IB/hfi1: Remove write() and use ioctl() for user  access Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2016-05-12 23:30 +0200

csiph-web