From patchwork Fri Mar 11 21:16:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerry Hoemann X-Patchwork-Id: 8569301 Return-Path: X-Original-To: patchwork-linux-nvdimm@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 D844F9F38C for ; Fri, 11 Mar 2016 21:16:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 04E962034A for ; Fri, 11 Mar 2016 21:16:52 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 17CC42034C for ; Fri, 11 Mar 2016 21:16:51 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 5FD131A1F99; Fri, 11 Mar 2016 13:17:05 -0800 (PST) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from g2t4619.austin.hp.com (g2t4619.austin.hp.com [15.73.212.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 959B51A1F86 for ; Fri, 11 Mar 2016 13:17:03 -0800 (PST) Received: from g1t6217.austin.hpicorp.net (g1t6217.austin.hpicorp.net [15.67.1.144]) by g2t4619.austin.hp.com (Postfix) with ESMTP id 12DB1E7; Fri, 11 Mar 2016 21:16:47 +0000 (UTC) Received: from lxbuild.ftc.rdlabs.hpecorp.net (lxbuild.ftc.rdlabs.hpecorp.net [16.78.34.175]) by g1t6217.austin.hpicorp.net (Postfix) with ESMTP id B2E166F; Fri, 11 Mar 2016 21:16:46 +0000 (UTC) From: Jerry Hoemann To: dan.j.williams@intel.com Subject: [RFC v6 6/8] libnvdimm: advertise 'call_dsm' support Date: Fri, 11 Mar 2016 14:16:30 -0700 Message-Id: X-Mailer: git-send-email 1.7.11.3 In-Reply-To: References: In-Reply-To: References: Cc: linux-nvdimm@lists.01.org X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, 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 Indicate to userspace that the generic 'dsm_call' capability is available for the given control device. Over time we want to deprecate the per-dsm function ioctl commands and direct everything through the generic envelope. Signed-off-by: Dan Williams --- drivers/nvdimm/core.c | 3 +++ drivers/nvdimm/dimm_devs.c | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/nvdimm/core.c b/drivers/nvdimm/core.c index 79646d0..cc449e0 100644 --- a/drivers/nvdimm/core.c +++ b/drivers/nvdimm/core.c @@ -253,6 +253,9 @@ static ssize_t commands_show(struct device *dev, for_each_set_bit(cmd, &nd_desc->dsm_mask, BITS_PER_LONG) len += sprintf(buf + len, "%s ", nvdimm_bus_cmd_name(cmd)); + if (nd_desc->call_dsm) + len += sprintf(buf + len, "%s ", + nvdimm_bus_cmd_name(ND_CMD_CALL_DSM)); len += sprintf(buf + len, "\n"); return len; } diff --git a/drivers/nvdimm/dimm_devs.c b/drivers/nvdimm/dimm_devs.c index c56f882..c2a9f58 100644 --- a/drivers/nvdimm/dimm_devs.c +++ b/drivers/nvdimm/dimm_devs.c @@ -274,14 +274,20 @@ EXPORT_SYMBOL_GPL(nvdimm_provider_data); static ssize_t commands_show(struct device *dev, struct device_attribute *attr, char *buf) { + struct nvdimm_bus *nvdimm_bus = walk_to_nvdimm_bus(dev); struct nvdimm *nvdimm = to_nvdimm(dev); + struct nvdimm_bus_descriptor *nd_desc; int cmd, len = 0; - if (!nvdimm->dsm_mask) + if (!nvdimm->dsm_mask || !nvdimm_bus) return sprintf(buf, "\n"); for_each_set_bit(cmd, nvdimm->dsm_mask, BITS_PER_LONG) len += sprintf(buf + len, "%s ", nvdimm_cmd_name(cmd)); + nd_desc = nvdimm_bus->nd_desc; + if (nd_desc->call_dsm) + len += sprintf(buf + len, "%s ", + nvdimm_cmd_name(ND_CMD_CALL_DSM)); len += sprintf(buf + len, "\n"); return len; }