diff mbox

[RFC,2/6] acpi/nfit, libnvdimm: clean up nd_cmd_dsmcall_pkg

Message ID 20160113053929.6293.85826.stgit@dwillia2-desk3.amr.corp.intel.com (mailing list archive)
State RFC
Headers show

Commit Message

Dan Williams Jan. 13, 2016, 5:39 a.m. UTC
Embedding the header items in an anonymous struct clutters the resulting
code for no benefit.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/acpi/nfit.c        |   16 +++++++---------
 drivers/nvdimm/bus.c       |   13 ++++++-------
 include/uapi/linux/ndctl.h |   18 ++++++++----------
 3 files changed, 21 insertions(+), 26 deletions(-)
diff mbox

Patch

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	 */
 };