[PATCH v2 13/46] staging: unisys: visorbus: merging the visorbus_*_response functions into one.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Sameer Wadgaonkar <sameer.wadgaonkar@xxxxxxxxxx>

The functions visorbus_create_response(), visorbus_destroy_response(),
viosrbus_device_create_response(), viosrbus_device_destroy_response()
are all functionally similar. Merging these four functions into a
single function called visorbus_response().

Signed-off-by: Sameer Wadgaonkar <sameer.wadgaonkar@xxxxxxxxxx>
Signed-off-by: David Kershner <david.kershner@xxxxxxxxxx>
Reviewed-by: Tim Sell <timothy.sell@xxxxxxxxxx>
---
 drivers/staging/unisys/visorbus/visorbus_main.c    | 10 ++--
 drivers/staging/unisys/visorbus/visorbus_private.h |  5 +--
 drivers/staging/unisys/visorbus/visorchipset.c     | 41 +--------------
 3 files changed, 10 insertions(+), 46 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c
index e89cee0..93db8d3 100644
--- a/drivers/staging/unisys/visorbus/visorbus_main.c
+++ b/drivers/staging/unisys/visorbus/visorbus_main.c
@@ -1123,7 +1123,8 @@ int visorchipset_bus_create(struct visor_device *dev)
 	if (err < 0)
 		return err;
 
-	visorbus_create_response(dev, err);
+	visorbus_response(dev, err, CONTROLVM_BUS_CREATE);
+	dev->state.created = 1;
 
 	return 0;
 }
@@ -1131,7 +1132,7 @@ int visorchipset_bus_create(struct visor_device *dev)
 void visorchipset_bus_destroy(struct visor_device *dev)
 {
 	visorbus_remove_instance(dev);
-	visorbus_destroy_response(dev, 0);
+	visorbus_response(dev, 0, CONTROLVM_BUS_DESTROY);
 }
 
 int visorchipset_device_create(struct visor_device *dev_info)
@@ -1142,7 +1143,8 @@ int visorchipset_device_create(struct visor_device *dev_info)
 	if (err < 0)
 		return err;
 
-	visorbus_device_create_response(dev_info, err);
+	visorbus_response(dev_info, err, CONTROLVM_DEVICE_CREATE);
+	dev_info->state.created = 1;
 
 	return 0;
 }
@@ -1150,7 +1152,7 @@ int visorchipset_device_create(struct visor_device *dev_info)
 void visorchipset_device_destroy(struct visor_device *dev_info)
 {
 	remove_visor_device(dev_info);
-	visorbus_device_destroy_response(dev_info, 0);
+	visorbus_response(dev_info, 0, CONTROLVM_DEVICE_DESTROY);
 }
 
 /*
diff --git a/drivers/staging/unisys/visorbus/visorbus_private.h b/drivers/staging/unisys/visorbus/visorbus_private.h
index 74248c5..fed7e62 100644
--- a/drivers/staging/unisys/visorbus/visorbus_private.h
+++ b/drivers/staging/unisys/visorbus/visorbus_private.h
@@ -29,10 +29,7 @@ void visorchipset_device_destroy(struct visor_device *dev_info);
 int visorchipset_device_pause(struct visor_device *dev_info);
 int visorchipset_device_resume(struct visor_device *dev_info);
 
-void visorbus_create_response(struct visor_device *p, int response);
-void visorbus_destroy_response(struct visor_device *p, int response);
-void visorbus_device_create_response(struct visor_device *p, int response);
-void visorbus_device_destroy_response(struct visor_device *p, int response);
+void visorbus_response(struct visor_device *p, int response, int controlvm_id);
 void visorbus_device_resume_response(struct visor_device *p, int response);
 void visorbus_device_pause_response(struct visor_device *p, int response);
 
diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c
index 28ea21f..a203c19 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -1446,50 +1446,15 @@ static void setup_crash_devices_work_queue(struct work_struct *work)
 	visorbus_device_create(&local_crash_dev_msg);
 }
 
-void visorbus_create_response(struct visor_device *bus_info, int response)
+void visorbus_response(struct visor_device *bus_info, int response,
+		       int controlvm_id)
 {
-	if (response >= 0)
-		bus_info->state.created = 1;
-
-	controlvm_responder(CONTROLVM_BUS_CREATE, bus_info->pending_msg_hdr,
-			    response);
+	controlvm_responder(controlvm_id, bus_info->pending_msg_hdr, response);
 
 	kfree(bus_info->pending_msg_hdr);
 	bus_info->pending_msg_hdr = NULL;
 }
 
-void visorbus_destroy_response(struct visor_device *bus_info, int response)
-{
-	controlvm_responder(CONTROLVM_BUS_DESTROY, bus_info->pending_msg_hdr,
-			    response);
-
-	kfree(bus_info->pending_msg_hdr);
-	bus_info->pending_msg_hdr = NULL;
-}
-
-void visorbus_device_create_response(struct visor_device *dev_info,
-				     int response)
-{
-	if (response >= 0)
-		dev_info->state.created = 1;
-
-	controlvm_responder(CONTROLVM_DEVICE_CREATE, dev_info->pending_msg_hdr,
-			    response);
-
-	kfree(dev_info->pending_msg_hdr);
-	dev_info->pending_msg_hdr = NULL;
-}
-
-void visorbus_device_destroy_response(struct visor_device *dev_info,
-				      int response)
-{
-	controlvm_responder(CONTROLVM_DEVICE_DESTROY, dev_info->pending_msg_hdr,
-			    response);
-
-	kfree(dev_info->pending_msg_hdr);
-	dev_info->pending_msg_hdr = NULL;
-}
-
 void visorbus_device_pause_response(struct visor_device *dev_info,
 				    int response)
 {
-- 
git-series 0.9.1
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux