diff mbox

[v11,5/5] nfit: add sysfs dimm 'family' and 'dsm_mask' attributes

Message ID 146189776923.29835.5521802180709532725.stgit@dwillia2-desk3.amr.corp.intel.com (mailing list archive)
State Accepted
Commit a94e3fbe4d53
Headers show

Commit Message

Dan Williams April 29, 2016, 2:42 a.m. UTC
Communicate the command format and suppported functions to userspace
tooling.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/acpi/nfit.c |   26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

Comments

Jerry Hoemann May 5, 2016, 4:25 p.m. UTC | #1
On Thu, Apr 28, 2016 at 07:42:49PM -0700, Dan Williams wrote:
> Communicate the command format and suppported functions to userspace

				     ^^^^ typo


> tooling.
> 
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
>  drivers/acpi/nfit.c |   26 ++++++++++++++++++++++++++
>  1 file changed, 26 insertions(+)
> 
> diff --git a/drivers/acpi/nfit.c b/drivers/acpi/nfit.c
> index 30801fe3367b..24549ba217b5 100644
> --- a/drivers/acpi/nfit.c
> +++ b/drivers/acpi/nfit.c
> @@ -897,6 +897,30 @@ static ssize_t serial_show(struct device *dev,
>  }
>  static DEVICE_ATTR_RO(serial);
>  
> +static ssize_t family_show(struct device *dev,
> +		struct device_attribute *attr, char *buf)
> +{
> +	struct nvdimm *nvdimm = to_nvdimm(dev);
> +	struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm);
> +
> +	if (nfit_mem->family < 0)
> +		return -ENXIO;
> +	return sprintf(buf, "%d\n", nfit_mem->family);
> +}
> +static DEVICE_ATTR_RO(family);
> +
> +static ssize_t dsm_mask_show(struct device *dev,
> +		struct device_attribute *attr, char *buf)
> +{
> +	struct nvdimm *nvdimm = to_nvdimm(dev);
> +	struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm);
> +
> +	if (nfit_mem->family < 0)
> +		return -ENXIO;
> +	return sprintf(buf, "%#lx\n", nfit_mem->dsm_mask);
> +}
> +static DEVICE_ATTR_RO(dsm_mask);
> +
>  static ssize_t flags_show(struct device *dev,
>  		struct device_attribute *attr, char *buf)
>  {
> @@ -920,6 +944,8 @@ static struct attribute *acpi_nfit_dimm_attributes[] = {
>  	&dev_attr_serial.attr,
>  	&dev_attr_rev_id.attr,
>  	&dev_attr_flags.attr,
> +	&dev_attr_family.attr,
> +	&dev_attr_dsm_mask.attr,
>  	NULL,
>  };
>  
> 
> _______________________________________________
> Linux-nvdimm mailing list
> Linux-nvdimm@lists.01.org
> https://lists.01.org/mailman/listinfo/linux-nvdimm
diff mbox

Patch

diff --git a/drivers/acpi/nfit.c b/drivers/acpi/nfit.c
index 30801fe3367b..24549ba217b5 100644
--- a/drivers/acpi/nfit.c
+++ b/drivers/acpi/nfit.c
@@ -897,6 +897,30 @@  static ssize_t serial_show(struct device *dev,
 }
 static DEVICE_ATTR_RO(serial);
 
+static ssize_t family_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	struct nvdimm *nvdimm = to_nvdimm(dev);
+	struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm);
+
+	if (nfit_mem->family < 0)
+		return -ENXIO;
+	return sprintf(buf, "%d\n", nfit_mem->family);
+}
+static DEVICE_ATTR_RO(family);
+
+static ssize_t dsm_mask_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	struct nvdimm *nvdimm = to_nvdimm(dev);
+	struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm);
+
+	if (nfit_mem->family < 0)
+		return -ENXIO;
+	return sprintf(buf, "%#lx\n", nfit_mem->dsm_mask);
+}
+static DEVICE_ATTR_RO(dsm_mask);
+
 static ssize_t flags_show(struct device *dev,
 		struct device_attribute *attr, char *buf)
 {
@@ -920,6 +944,8 @@  static struct attribute *acpi_nfit_dimm_attributes[] = {
 	&dev_attr_serial.attr,
 	&dev_attr_rev_id.attr,
 	&dev_attr_flags.attr,
+	&dev_attr_family.attr,
+	&dev_attr_dsm_mask.attr,
 	NULL,
 };