From 76956aa7be7e85b7653adae2dad0a81b959c6247 Mon Sep 17 00:00:00 2001 From: Sameer Wadgaonkar Date: Tue, 22 Aug 2017 13:27:03 -0400 Subject: [PATCH] staging: unisys: visorbus: merging the visorbus_*_response functions into one. 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 Signed-off-by: David Kershner Reviewed-by: Tim Sell Signed-off-by: Greg Kroah-Hartman --- .../staging/unisys/visorbus/visorbus_main.c | 10 +++-- .../unisys/visorbus/visorbus_private.h | 5 +-- .../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 e89cee0a0a7c..93db8d32f7ef 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 74248c5dd24a..fed7e6233189 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 28ea21f84d7f..a203c19048ea 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) { -- 2.20.1