Commit 76956aa7 authored by Sameer Wadgaonkar's avatar Sameer Wadgaonkar Committed by Greg Kroah-Hartman
Browse files

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: default avatarSameer Wadgaonkar <sameer.wadgaonkar@unisys.com>
Signed-off-by: default avatarDavid Kershner <david.kershner@unisys.com>
Reviewed-by: default avatarTim Sell <timothy.sell@unisys.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 55515a30
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -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);
}

/*
+1 −4
Original line number Diff line number Diff line
@@ -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);

+3 −38
Original line number Diff line number Diff line
@@ -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)
{