From patchwork Wed Jan 13 05:39:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 8022201 Return-Path: X-Original-To: patchwork-linux-nvdimm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9188BBEEE5 for ; Wed, 13 Jan 2016 05:40:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9889C20414 for ; Wed, 13 Jan 2016 05:40:19 +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 A66862040F for ; Wed, 13 Jan 2016 05:40:18 +0000 (UTC) Received: from ml01.vlan14.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 9391B1A1F98; Tue, 12 Jan 2016 21:40:18 -0800 (PST) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by ml01.01.org (Postfix) with ESMTP id 717891A1F6C for ; Tue, 12 Jan 2016 21:40:17 -0800 (PST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP; 12 Jan 2016 21:39:55 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,287,1449561600"; d="scan'208";a="859436332" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.136]) by orsmga001.jf.intel.com with ESMTP; 12 Jan 2016 21:39:55 -0800 Subject: [RFC PATCH 2/6] acpi/nfit, libnvdimm: clean up nd_cmd_dsmcall_pkg From: Dan Williams To: linux-nvdimm@lists.01.org Date: Tue, 12 Jan 2016 21:39:29 -0800 Message-ID: <20160113053929.6293.85826.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 Embedding the header items in an anonymous struct clutters the resulting code for no benefit. Signed-off-by: Dan Williams --- drivers/acpi/nfit.c | 16 +++++++--------- drivers/nvdimm/bus.c | 13 ++++++------- include/uapi/linux/ndctl.h | 18 ++++++++---------- 3 files changed, 21 insertions(+), 26 deletions(-) diff --git a/drivers/acpi/nfit.c b/drivers/acpi/nfit.c index 015fc8e4d719..9ba5a9a4b943 100644 --- a/drivers/acpi/nfit.c +++ b/drivers/acpi/nfit.c @@ -136,11 +136,11 @@ static int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, if (dsm_call) { /* must skip over package wrapper */ in_buf.buffer.pointer = (void *) &pkg->dsm_buf; - in_buf.buffer.length = pkg->h.dsm_in; + in_buf.buffer.length = pkg->dsm_in; /* for pass thru must use value sent in from user space. */ - uuid = pkg->h.dsm_uuid; - rev = pkg->h.dsm_rev; - func = pkg->h.dsm_fun_idx; + uuid = pkg->dsm_uuid; + rev = pkg->dsm_rev; + func = pkg->dsm_fun_idx; } if (IS_ENABLED(CONFIG_ACPI_NFIT_DEBUG)) { @@ -174,11 +174,9 @@ static int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, } if (dsm_call) { - pkg->h.dsm_size = out_obj->buffer.length; - memcpy(pkg->dsm_buf + pkg->h.dsm_in, - out_obj->buffer.pointer, - min(pkg->h.dsm_size, pkg->h.dsm_out)); - + pkg->dsm_size = out_obj->buffer.length; + memcpy(pkg->dsm_buf + pkg->dsm_in, out_obj->buffer.pointer, + min(pkg->dsm_size, pkg->dsm_out)); ACPI_FREE(out_obj); return 0; } diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c index 8d3a64b86057..6e9787ad1fe1 100644 --- a/drivers/nvdimm/bus.c +++ b/drivers/nvdimm/bus.c @@ -437,7 +437,7 @@ u32 nd_cmd_in_size(struct nvdimm *nvdimm, int cmd, } else if (cmd == ND_CMD_CALL_DSM) { struct nd_cmd_dsmcall_pkg *pkg = buf; - return pkg->h.dsm_in; + return pkg->dsm_in; } return UINT_MAX; @@ -463,7 +463,7 @@ u32 nd_cmd_out_size(struct nvdimm *nvdimm, int cmd, else if (cmd == ND_CMD_CALL_DSM) { struct nd_cmd_dsmcall_pkg *pkg = (struct nd_cmd_dsmcall_pkg *) in_field; - return pkg->h.dsm_out; + return pkg->dsm_out; } @@ -576,12 +576,11 @@ static int __nd_ioctl(struct nvdimm_bus *nvdimm_bus, struct nvdimm *nvdimm, pkg = (struct nd_cmd_dsmcall_pkg *) in_env; dev_dbg(dev, "%s:%s rev: %llu, idx: %llu, in: %zu, out: %zu, len %zu\n", - __func__, dimm_name, - pkg->h.dsm_rev, pkg->h.dsm_fun_idx, - in_len, out_len, buf_len); + __func__, dimm_name, pkg->dsm_rev, + pkg->dsm_fun_idx, in_len, out_len, buf_len); - for (i = 0; i < ARRAY_SIZE(pkg->h.reserved2); i++) - if (pkg->h.reserved2[i]) + for (i = 0; i < ARRAY_SIZE(pkg->reserved2); i++) + if (pkg->reserved2[i]) return -EINVAL; } diff --git a/include/uapi/linux/ndctl.h b/include/uapi/linux/ndctl.h index d40bc7ebe890..a7ddadc54957 100644 --- a/include/uapi/linux/ndctl.h +++ b/include/uapi/linux/ndctl.h @@ -213,16 +213,14 @@ enum ars_masks { struct nd_cmd_dsmcall_pkg { - struct { - __u8 dsm_uuid[16]; - __u64 reserved1; /* reserved should be zero */ - __u64 dsm_rev; /* revision of dsm call */ - __u64 dsm_fun_idx; /* DSM function id */ - __u32 dsm_in; /* size of _DSM input */ - __u32 dsm_out; /* size of user buffer */ - __u32 reserved2[23]; /* reserved must be zero */ - __u32 dsm_size; /* size _DSM would write */ - } h; + __u8 dsm_uuid[16]; + __u64 reserved1; /* reserved should be zero */ + __u64 dsm_rev; /* revision of dsm call */ + __u64 dsm_fun_idx; /* DSM function id */ + __u32 dsm_in; /* size of _DSM input */ + __u32 dsm_out; /* size of user buffer */ + __u32 reserved2[23]; /* reserved must be zero */ + __u32 dsm_size; /* size _DSM would write */ unsigned char dsm_buf[]; /* Contents of DSM call */ };