[PATCH 39/45] staging: unisys: visorbus: simplify visorchannel_create_guts

David Kershner david.kershner at unisys.com
Wed Sep 27 17:14:44 UTC 2017


From: Sameer Wadgaonkar <sameer.wadgaonkar at unisys.com>

Removing the two wrapper functions dealing with visorchannel_create() and
instead just always use a new version of visorchannel_create() with an
additional parameter.

Signed-off-by: Sameer Wadgaonkar <sameer.wadgaonkar at unisys.com>
Signed-off-by: David Kershner <david.kershner at unisys.com>
Reviewed-by: Tim Sell <timothy.sell at unisys.com>
---
 drivers/staging/unisys/visorbus/visorbus_private.h |  4 +---
 drivers/staging/unisys/visorbus/visorchannel.c     | 23 +++++-----------------
 drivers/staging/unisys/visorbus/visorchipset.c     | 15 +++++++-------
 3 files changed, 14 insertions(+), 28 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorbus_private.h b/drivers/staging/unisys/visorbus/visorbus_private.h
index 841437f..4a8b12d 100644
--- a/drivers/staging/unisys/visorbus/visorbus_private.h
+++ b/drivers/staging/unisys/visorbus/visorbus_private.h
@@ -39,9 +39,7 @@ void visorbus_device_changestate_response(struct visor_device *p, int response,
 
 /* visorchannel access functions */
 struct visorchannel *visorchannel_create(u64 physaddr, gfp_t gfp,
-					 const guid_t *guid);
-struct visorchannel *visorchannel_create_with_lock(u64 physaddr, gfp_t gfp,
-						   const guid_t *guid);
+					 const guid_t *guid, bool needs_lock);
 void visorchannel_destroy(struct visorchannel *channel);
 int visorchannel_read(struct visorchannel *channel, ulong offset,
 		      void *dest, ulong nbytes);
diff --git a/drivers/staging/unisys/visorbus/visorchannel.c b/drivers/staging/unisys/visorbus/visorchannel.c
index 68cfd95..aae1607 100644
--- a/drivers/staging/unisys/visorbus/visorchannel.c
+++ b/drivers/staging/unisys/visorbus/visorchannel.c
@@ -342,9 +342,9 @@ static int signalinsert_inner(struct visorchannel *channel, u32 queue,
 }
 
 /*
- * visorchannel_create_guts() - creates the struct visorchannel abstraction for
- *				a data area in memory, but does NOT modify this
- *				data area
+ * visorchannel_create() - creates the struct visorchannel abstraction for a
+ *                         data area in memory, but does NOT modify this data
+ *                         area
  * @physaddr:      physical address of start of channel
  * @gfp:           gfp_t to use when allocating memory for the data struct
  * @guid:          GUID that identifies channel type;
@@ -355,9 +355,8 @@ static int signalinsert_inner(struct visorchannel *channel, u32 queue,
  * Return: pointer to visorchannel that was created if successful,
  *         otherwise NULL
  */
-static struct visorchannel *visorchannel_create_guts(u64 physaddr, gfp_t gfp,
-						     const guid_t *guid,
-						     bool needs_lock)
+struct visorchannel *visorchannel_create(u64 physaddr, gfp_t gfp,
+					 const guid_t *guid, bool needs_lock)
 {
 	struct visorchannel *channel;
 	int err;
@@ -416,18 +415,6 @@ static struct visorchannel *visorchannel_create_guts(u64 physaddr, gfp_t gfp,
 	return NULL;
 }
 
-struct visorchannel *visorchannel_create(u64 physaddr, gfp_t gfp,
-					 const guid_t *guid)
-{
-	return visorchannel_create_guts(physaddr, gfp, guid, false);
-}
-
-struct visorchannel *visorchannel_create_with_lock(u64 physaddr, gfp_t gfp,
-						   const guid_t *guid)
-{
-	return visorchannel_create_guts(physaddr, gfp, guid, true);
-}
-
 /**
  * visorchannel_signalinsert() - inserts a message into the designated
  *                               channel/queue
diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c
index c876e54..027e10f 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -494,7 +494,8 @@ static int visorbus_create(struct controlvm_message *inmsg)
 	}
 	visorchannel = visorchannel_create(cmd->create_bus.channel_addr,
 					   GFP_KERNEL,
-					   &cmd->create_bus.bus_data_type_guid);
+					   &cmd->create_bus.bus_data_type_guid,
+					   false);
 	if (!visorchannel) {
 		err = -ENOMEM;
 		goto err_free_pending_msg;
@@ -681,10 +682,10 @@ static int visorbus_device_create(struct controlvm_message *inmsg)
 	dev_info->chipset_dev_no = dev_no;
 	guid_copy(&dev_info->inst, &cmd->create_device.dev_inst_guid);
 	dev_info->device.parent = &bus_info->device;
-	visorchannel =
-	       visorchannel_create_with_lock(cmd->create_device.channel_addr,
-					     GFP_KERNEL,
-					     &cmd->create_device.data_type_guid);
+	visorchannel = visorchannel_create(cmd->create_device.channel_addr,
+					   GFP_KERNEL,
+					   &cmd->create_device.data_type_guid,
+					   true);
 	if (!visorchannel) {
 		dev_err(&chipset_dev->acpi_device->dev,
 			"failed to create visorchannel: %d/%d\n",
@@ -1203,8 +1204,8 @@ static int controlvm_channel_create(struct visorchipset_device *dev)
 	if (err)
 		return err;
 	addr = dev->controlvm_params.address;
-	chan = visorchannel_create_with_lock(addr, GFP_KERNEL,
-					     &visor_controlvm_channel_guid);
+	chan = visorchannel_create(addr, GFP_KERNEL,
+				   &visor_controlvm_channel_guid, true);
 	if (!chan)
 		return -ENOMEM;
 	dev->controlvm_channel = chan;
-- 
1.9.1



More information about the devel mailing list