From: Toshi Kani <toshi.kani@hpe.com> To: rjw@rjwysocki.net, dan.j.williams@intel.com Cc: robert.moore@intel.com, lv.zheng@intel.com, elliott@hpe.com, linux-nvdimm@lists.01.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, devel@acpica.org, Toshi Kani <toshi.kani@hpe.com> Subject: [PATCH v2 2/3] ACPI/NFIT: Add NVDIMM ID "id" under sysfs Date: Mon, 22 Feb 2016 14:55:29 -0700 [thread overview] Message-ID: <1456178130-26468-3-git-send-email-toshi.kani@hpe.com> (raw) In-Reply-To: <1456178130-26468-1-git-send-email-toshi.kani@hpe.com> ACPI 6.1, section 5.2.25.9, defines an identifier for an NVDIMM. Change the NFIT driver to create read-only "id" file under NVDIMM's nfit directory of sysfs, which shows the NVDIMM ID. Signed-off-by: Toshi Kani <toshi.kani@hpe.com> Cc: Rafael J. Wysocki <rjw@rjwysocki.net> Cc: Dan Williams <dan.j.williams@intel.com> Cc: Robert Elliott <elliott@hpe.com> --- drivers/acpi/nfit.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/acpi/nfit.c b/drivers/acpi/nfit.c index 4982a18..677cf89 100644 --- a/drivers/acpi/nfit.c +++ b/drivers/acpi/nfit.c @@ -781,6 +781,26 @@ static ssize_t flags_show(struct device *dev, } static DEVICE_ATTR_RO(flags); +static ssize_t id_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct acpi_nfit_control_region *dcr = to_nfit_dcr(dev); + + if (dcr->valid_fields & ACPI_NFIT_CONTROL_MFG_INFO_VALID) + return sprintf(buf, "%02x%02x-%02x-%02x%02x-%02x%02x%02x%02x\n", + dcr->vendor_id[0], dcr->vendor_id[1], + dcr->manufacturing_location, + dcr->manufacturing_date[0], dcr->manufacturing_date[1], + dcr->serial_number[0], dcr->serial_number[1], + dcr->serial_number[2], dcr->serial_number[3]); + else + return sprintf(buf, "%02x%02x-%02x%02x%02x%02x\n", + dcr->vendor_id[0], dcr->vendor_id[1], + dcr->serial_number[0], dcr->serial_number[1], + dcr->serial_number[2], dcr->serial_number[3]); +} +static DEVICE_ATTR_RO(id); + static struct attribute *acpi_nfit_dimm_attributes[] = { &dev_attr_handle.attr, &dev_attr_phys_id.attr, @@ -790,6 +810,7 @@ static struct attribute *acpi_nfit_dimm_attributes[] = { &dev_attr_serial.attr, &dev_attr_rev_id.attr, &dev_attr_flags.attr, + &dev_attr_id.attr, NULL, };
WARNING: multiple messages have this Message-ID (diff)
From: Toshi Kani <toshi.kani@hpe.com> To: rjw@rjwysocki.net, dan.j.williams@intel.com Cc: robert.moore@intel.com, lv.zheng@intel.com, elliott@hpe.com, linux-nvdimm@ml01.01.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, devel@acpica.org, Toshi Kani <toshi.kani@hpe.com> Subject: [PATCH v2 2/3] ACPI/NFIT: Add NVDIMM ID "id" under sysfs Date: Mon, 22 Feb 2016 14:55:29 -0700 [thread overview] Message-ID: <1456178130-26468-3-git-send-email-toshi.kani@hpe.com> (raw) In-Reply-To: <1456178130-26468-1-git-send-email-toshi.kani@hpe.com> ACPI 6.1, section 5.2.25.9, defines an identifier for an NVDIMM. Change the NFIT driver to create read-only "id" file under NVDIMM's nfit directory of sysfs, which shows the NVDIMM ID. Signed-off-by: Toshi Kani <toshi.kani@hpe.com> Cc: Rafael J. Wysocki <rjw@rjwysocki.net> Cc: Dan Williams <dan.j.williams@intel.com> Cc: Robert Elliott <elliott@hpe.com> --- drivers/acpi/nfit.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/acpi/nfit.c b/drivers/acpi/nfit.c index 4982a18..677cf89 100644 --- a/drivers/acpi/nfit.c +++ b/drivers/acpi/nfit.c @@ -781,6 +781,26 @@ static ssize_t flags_show(struct device *dev, } static DEVICE_ATTR_RO(flags); +static ssize_t id_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct acpi_nfit_control_region *dcr = to_nfit_dcr(dev); + + if (dcr->valid_fields & ACPI_NFIT_CONTROL_MFG_INFO_VALID) + return sprintf(buf, "%02x%02x-%02x-%02x%02x-%02x%02x%02x%02x\n", + dcr->vendor_id[0], dcr->vendor_id[1], + dcr->manufacturing_location, + dcr->manufacturing_date[0], dcr->manufacturing_date[1], + dcr->serial_number[0], dcr->serial_number[1], + dcr->serial_number[2], dcr->serial_number[3]); + else + return sprintf(buf, "%02x%02x-%02x%02x%02x%02x\n", + dcr->vendor_id[0], dcr->vendor_id[1], + dcr->serial_number[0], dcr->serial_number[1], + dcr->serial_number[2], dcr->serial_number[3]); +} +static DEVICE_ATTR_RO(id); + static struct attribute *acpi_nfit_dimm_attributes[] = { &dev_attr_handle.attr, &dev_attr_phys_id.attr, @@ -790,6 +810,7 @@ static struct attribute *acpi_nfit_dimm_attributes[] = { &dev_attr_serial.attr, &dev_attr_rev_id.attr, &dev_attr_flags.attr, + &dev_attr_id.attr, NULL, };
next prev parent reply other threads:[~2016-02-22 21:55 UTC|newest] Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top 2016-02-22 21:55 [PATCH v2 0/3] ACPI 6.1 update for NFIT Control Region Structure Toshi Kani 2016-02-22 21:55 ` Toshi Kani 2016-02-22 21:55 ` [PATCH v2 1/3] ACPI/NFIT: Update Control Region Structure to comply ACPI 6.1 Toshi Kani 2016-02-22 21:55 ` Toshi Kani 2016-03-01 15:13 ` Moore, Robert 2016-03-01 15:13 ` [Devel] " Moore, Robert 2016-03-01 15:13 ` Moore, Robert 2016-03-01 15:13 ` Moore, Robert 2016-03-01 16:38 ` Toshi Kani 2016-03-01 16:38 ` Toshi Kani 2016-03-01 16:38 ` Toshi Kani 2016-03-01 16:03 ` Moore, Robert 2016-03-01 16:03 ` [Devel] " Moore, Robert 2016-03-01 16:03 ` Moore, Robert 2016-03-01 16:03 ` Moore, Robert 2016-03-01 17:36 ` Toshi Kani 2016-03-01 17:36 ` Toshi Kani 2016-03-01 17:36 ` Toshi Kani 2016-03-01 17:37 ` Moore, Robert 2016-03-01 17:37 ` [Devel] " Moore, Robert 2016-03-01 17:37 ` Moore, Robert 2016-03-01 17:37 ` Moore, Robert 2016-03-01 17:41 ` Moore, Robert 2016-03-01 17:41 ` [Devel] " Moore, Robert 2016-03-01 17:41 ` Moore, Robert 2016-03-01 17:41 ` Moore, Robert 2016-03-01 19:10 ` Toshi Kani 2016-03-01 19:10 ` Toshi Kani 2016-03-01 19:10 ` Toshi Kani 2016-03-01 18:14 ` Dan Williams 2016-03-01 18:14 ` Dan Williams 2016-03-01 18:14 ` Dan Williams 2016-03-01 19:18 ` Toshi Kani 2016-03-01 19:18 ` Toshi Kani 2016-03-01 19:18 ` Toshi Kani 2016-03-01 19:53 ` Toshi Kani 2016-03-01 19:53 ` Toshi Kani 2016-03-01 19:53 ` Toshi Kani 2016-02-22 21:55 ` Toshi Kani [this message] 2016-02-22 21:55 ` [PATCH v2 2/3] ACPI/NFIT: Add NVDIMM ID "id" under sysfs Toshi Kani 2016-02-22 21:55 ` [PATCH v2 3/3] nfit_test: Update SPD ID init handlings Toshi Kani 2016-02-22 21:55 ` Toshi Kani
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=1456178130-26468-3-git-send-email-toshi.kani@hpe.com \ --to=toshi.kani@hpe.com \ --cc=dan.j.williams@intel.com \ --cc=devel@acpica.org \ --cc=elliott@hpe.com \ --cc=linux-acpi@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-nvdimm@lists.01.org \ --cc=lv.zheng@intel.com \ --cc=rjw@rjwysocki.net \ --cc=robert.moore@intel.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 an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.