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 <sameer.wadgaonkar@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Sameer Wadgaonkar 2017-08-22 13:27:03 -04:00 коммит произвёл Greg Kroah-Hartman
Родитель 55515a30d2
Коммит 76956aa7be
3 изменённых файлов: 10 добавлений и 46 удалений

Просмотреть файл

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

Просмотреть файл

@ -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);

Просмотреть файл

@ -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)
{