From patchwork Mon Feb 22 21:55:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kani, Toshi" X-Patchwork-Id: 8383281 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 219CC9F1D4 for ; Mon, 22 Feb 2016 21:03:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 51FAA205CA for ; Mon, 22 Feb 2016 21:03:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5284E205CD for ; Mon, 22 Feb 2016 21:03:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755672AbcBVVDJ (ORCPT ); Mon, 22 Feb 2016 16:03:09 -0500 Received: from g4t3427.houston.hp.com ([15.201.208.55]:53264 "EHLO g4t3427.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753218AbcBVVCn (ORCPT ); Mon, 22 Feb 2016 16:02:43 -0500 Received: from g4t3433.houston.hp.com (g4t3433.houston.hp.com [16.210.25.219]) by g4t3427.houston.hp.com (Postfix) with ESMTP id 53ADE4C; Mon, 22 Feb 2016 21:02:42 +0000 (UTC) Received: from misato.fc.hp.com (misato.fc.hp.com [16.78.168.61]) by g4t3433.houston.hp.com (Postfix) with ESMTP id 708AC64; Mon, 22 Feb 2016 21:02:41 +0000 (UTC) From: Toshi Kani 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 Subject: [PATCH v2 2/3] ACPI/NFIT: Add NVDIMM ID "id" under sysfs Date: Mon, 22 Feb 2016 14:55:29 -0700 Message-Id: <1456178130-26468-3-git-send-email-toshi.kani@hpe.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1456178130-26468-1-git-send-email-toshi.kani@hpe.com> References: <1456178130-26468-1-git-send-email-toshi.kani@hpe.com> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Cc: Rafael J. Wysocki Cc: Dan Williams Cc: Robert Elliott --- drivers/acpi/nfit.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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, };