From patchwork Wed Jan 13 05:39:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 8022181 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 16C8D9F3F6 for ; Wed, 13 Jan 2016 05:40:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6543F2040F for ; Wed, 13 Jan 2016 05:40:14 +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 74EF5203DF for ; Wed, 13 Jan 2016 05:40:13 +0000 (UTC) Received: from ml01.vlan14.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 6ADCE1A1F4D; Tue, 12 Jan 2016 21:40:13 -0800 (PST) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by ml01.01.org (Postfix) with ESMTP id 2CF221A1EEB for ; Tue, 12 Jan 2016 21:40:13 -0800 (PST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP; 12 Jan 2016 21:40:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,287,1449561600"; d="scan'208";a="725934757" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.136]) by orsmga003.jf.intel.com with ESMTP; 12 Jan 2016 21:40:11 -0800 Subject: [RFC PATCH 5/6] libnvdimm: fail call_dsm on unsupported devices From: Dan Williams To: linux-nvdimm@lists.01.org Date: Tue, 12 Jan 2016 21:39:46 -0800 Message-ID: <20160113053946.6293.52129.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <20160113052327.6293.32858.stgit@dwillia2-desk3.amr.corp.intel.com> References: <20160113052327.6293.32858.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.17.1-9-g687f MIME-Version: 1.0 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: , 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 Now that buses and nvdimms are advertising their support for the call_dsm command, fail the command early if the bus has not opted-in for support. Signed-off-by: Dan Williams --- drivers/nvdimm/bus.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c index b86d5eda78ed..0dc6210d568c 100644 --- a/drivers/nvdimm/bus.c +++ b/drivers/nvdimm/bus.c @@ -532,6 +532,8 @@ static int __nd_ioctl(struct nvdimm_bus *nvdimm_bus, struct nvdimm *nvdimm, } if (cmd == ND_CMD_CALL_DSM) { + if (!nd_desc->call_dsm) + return -ENOTTY; if (copy_from_user(&call_dsm, p, sizeof(cmd))) return -EFAULT; func = call_dsm.dsm_fun_idx;