Commit 4fb2539c authored by David Kershner's avatar David Kershner Committed by Greg Kroah-Hartman

staging: unisys: visorbus: consolidate bus_responder and device_responder

With all the code churn, bus_responder and device_responder have become
identical, consolidate them to the same function.
Signed-off-by: default avatarDavid Kershner <david.kershner@unisys.com>
Reviewed-by: default avatarReviewed-by: Tim Sell <timothy.sell@unisys.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3f49a21d
...@@ -537,9 +537,9 @@ save_crash_message(struct controlvm_message *msg, enum crash_obj_type typ) ...@@ -537,9 +537,9 @@ save_crash_message(struct controlvm_message *msg, enum crash_obj_type typ)
} }
static int static int
bus_responder(enum controlvm_id cmd_id, controlvm_responder(enum controlvm_id cmd_id,
struct controlvm_message_header *pending_msg_hdr, struct controlvm_message_header *pending_msg_hdr,
int response) int response)
{ {
if (!pending_msg_hdr) if (!pending_msg_hdr)
return -EIO; return -EIO;
...@@ -574,20 +574,6 @@ device_changestate_responder(enum controlvm_id cmd_id, ...@@ -574,20 +574,6 @@ device_changestate_responder(enum controlvm_id cmd_id,
CONTROLVM_QUEUE_REQUEST, &outmsg); CONTROLVM_QUEUE_REQUEST, &outmsg);
} }
static int
device_responder(enum controlvm_id cmd_id,
struct controlvm_message_header *pending_msg_hdr,
int response)
{
if (!pending_msg_hdr)
return -EIO;
if (pending_msg_hdr->id != (u32)cmd_id)
return -EINVAL;
return controlvm_respond(pending_msg_hdr, response);
}
static int static int
bus_create(struct controlvm_message *inmsg) bus_create(struct controlvm_message *inmsg)
{ {
...@@ -675,7 +661,7 @@ bus_create(struct controlvm_message *inmsg) ...@@ -675,7 +661,7 @@ bus_create(struct controlvm_message *inmsg)
err_respond: err_respond:
if (inmsg->hdr.flags.response_expected == 1) if (inmsg->hdr.flags.response_expected == 1)
bus_responder(inmsg->hdr.id, &inmsg->hdr, err); controlvm_responder(inmsg->hdr.id, &inmsg->hdr, err);
return err; return err;
} }
...@@ -723,7 +709,7 @@ bus_destroy(struct controlvm_message *inmsg) ...@@ -723,7 +709,7 @@ bus_destroy(struct controlvm_message *inmsg)
err_respond: err_respond:
if (inmsg->hdr.flags.response_expected == 1) if (inmsg->hdr.flags.response_expected == 1)
bus_responder(inmsg->hdr.id, &inmsg->hdr, err); controlvm_responder(inmsg->hdr.id, &inmsg->hdr, err);
return err; return err;
} }
...@@ -773,12 +759,12 @@ bus_configure(struct controlvm_message *inmsg, ...@@ -773,12 +759,12 @@ bus_configure(struct controlvm_message *inmsg,
DIAG_SEVERITY_PRINT); DIAG_SEVERITY_PRINT);
if (inmsg->hdr.flags.response_expected == 1) if (inmsg->hdr.flags.response_expected == 1)
bus_responder(inmsg->hdr.id, &inmsg->hdr, err); controlvm_responder(inmsg->hdr.id, &inmsg->hdr, err);
return 0; return 0;
err_respond: err_respond:
if (inmsg->hdr.flags.response_expected == 1) if (inmsg->hdr.flags.response_expected == 1)
bus_responder(inmsg->hdr.id, &inmsg->hdr, err); controlvm_responder(inmsg->hdr.id, &inmsg->hdr, err);
return err; return err;
} }
...@@ -884,7 +870,7 @@ my_device_create(struct controlvm_message *inmsg) ...@@ -884,7 +870,7 @@ my_device_create(struct controlvm_message *inmsg)
err_respond: err_respond:
if (inmsg->hdr.flags.response_expected == 1) if (inmsg->hdr.flags.response_expected == 1)
device_responder(inmsg->hdr.id, &inmsg->hdr, err); controlvm_responder(inmsg->hdr.id, &inmsg->hdr, err);
return err; return err;
} }
...@@ -945,7 +931,7 @@ my_device_changestate(struct controlvm_message *inmsg) ...@@ -945,7 +931,7 @@ my_device_changestate(struct controlvm_message *inmsg)
err_respond: err_respond:
if (inmsg->hdr.flags.response_expected == 1) if (inmsg->hdr.flags.response_expected == 1)
device_responder(inmsg->hdr.id, &inmsg->hdr, err); controlvm_responder(inmsg->hdr.id, &inmsg->hdr, err);
return err; return err;
} }
...@@ -991,7 +977,7 @@ my_device_destroy(struct controlvm_message *inmsg) ...@@ -991,7 +977,7 @@ my_device_destroy(struct controlvm_message *inmsg)
err_respond: err_respond:
if (inmsg->hdr.flags.response_expected == 1) if (inmsg->hdr.flags.response_expected == 1)
device_responder(inmsg->hdr.id, &inmsg->hdr, err); controlvm_responder(inmsg->hdr.id, &inmsg->hdr, err);
return err; return err;
} }
...@@ -1484,8 +1470,8 @@ bus_create_response(struct visor_device *bus_info, int response) ...@@ -1484,8 +1470,8 @@ bus_create_response(struct visor_device *bus_info, int response)
if (response >= 0) if (response >= 0)
bus_info->state.created = 1; bus_info->state.created = 1;
bus_responder(CONTROLVM_BUS_CREATE, bus_info->pending_msg_hdr, controlvm_responder(CONTROLVM_BUS_CREATE, bus_info->pending_msg_hdr,
response); response);
kfree(bus_info->pending_msg_hdr); kfree(bus_info->pending_msg_hdr);
bus_info->pending_msg_hdr = NULL; bus_info->pending_msg_hdr = NULL;
...@@ -1494,8 +1480,8 @@ bus_create_response(struct visor_device *bus_info, int response) ...@@ -1494,8 +1480,8 @@ bus_create_response(struct visor_device *bus_info, int response)
void void
bus_destroy_response(struct visor_device *bus_info, int response) bus_destroy_response(struct visor_device *bus_info, int response)
{ {
bus_responder(CONTROLVM_BUS_DESTROY, bus_info->pending_msg_hdr, controlvm_responder(CONTROLVM_BUS_DESTROY, bus_info->pending_msg_hdr,
response); response);
kfree(bus_info->pending_msg_hdr); kfree(bus_info->pending_msg_hdr);
bus_info->pending_msg_hdr = NULL; bus_info->pending_msg_hdr = NULL;
...@@ -1507,8 +1493,8 @@ device_create_response(struct visor_device *dev_info, int response) ...@@ -1507,8 +1493,8 @@ device_create_response(struct visor_device *dev_info, int response)
if (response >= 0) if (response >= 0)
dev_info->state.created = 1; dev_info->state.created = 1;
device_responder(CONTROLVM_DEVICE_CREATE, dev_info->pending_msg_hdr, controlvm_responder(CONTROLVM_DEVICE_CREATE, dev_info->pending_msg_hdr,
response); response);
kfree(dev_info->pending_msg_hdr); kfree(dev_info->pending_msg_hdr);
dev_info->pending_msg_hdr = NULL; dev_info->pending_msg_hdr = NULL;
...@@ -1517,8 +1503,8 @@ device_create_response(struct visor_device *dev_info, int response) ...@@ -1517,8 +1503,8 @@ device_create_response(struct visor_device *dev_info, int response)
void void
device_destroy_response(struct visor_device *dev_info, int response) device_destroy_response(struct visor_device *dev_info, int response)
{ {
device_responder(CONTROLVM_DEVICE_DESTROY, dev_info->pending_msg_hdr, controlvm_responder(CONTROLVM_DEVICE_DESTROY, dev_info->pending_msg_hdr,
response); response);
kfree(dev_info->pending_msg_hdr); kfree(dev_info->pending_msg_hdr);
dev_info->pending_msg_hdr = NULL; dev_info->pending_msg_hdr = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment