Commit 441a29a5 authored by Benjamin Romer's avatar Benjamin Romer Committed by Greg Kroah-Hartman

staging: unisys: refactor pause_device()

Fix the function declaration so it is on a single line. Fix CamelCase local
variables:

busNo => bus_no
devNo => dev_no

Fix use of uuid_le_cmp() to check for 0 instead of using !uuid_le_cmp().
Signed-off-by: default avatarBryan Thompson <bryan.thompson@unisys.com>
Signed-off-by: default avatarBenjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8a05beb1
...@@ -526,32 +526,31 @@ static int create_device(struct controlvm_message *msg, char *buf) ...@@ -526,32 +526,31 @@ static int create_device(struct controlvm_message *msg, char *buf)
return result; return result;
} }
static int static int pause_device(struct controlvm_message *msg)
pause_device(struct controlvm_message *msg)
{ {
u32 busNo, devNo; u32 bus_no, dev_no;
struct bus_info *bus; struct bus_info *bus;
struct device_info *dev; struct device_info *dev;
struct guest_msgs cmd; struct guest_msgs cmd;
int retval = CONTROLVM_RESP_SUCCESS; int retval = CONTROLVM_RESP_SUCCESS;
busNo = msg->cmd.device_change_state.bus_no; bus_no = msg->cmd.device_change_state.bus_no;
devNo = msg->cmd.device_change_state.dev_no; dev_no = msg->cmd.device_change_state.dev_no;
read_lock(&bus_list_lock); read_lock(&bus_list_lock);
for (bus = bus_list; bus; bus = bus->next) { for (bus = bus_list; bus; bus = bus->next) {
if (bus->bus_no == busNo) { if (bus->bus_no == bus_no) {
/* make sure the device number is valid */ /* make sure the device number is valid */
if (devNo >= bus->device_count) { if (dev_no >= bus->device_count) {
LOGERR("CONTROLVM_DEVICE_CHANGESTATE:pause Failed: device(%d) >= deviceCount(%d).", LOGERR("CONTROLVM_DEVICE_CHANGESTATE:pause Failed: device(%d) >= deviceCount(%d).",
devNo, bus->device_count); dev_no, bus->device_count);
retval = CONTROLVM_RESP_ERROR_DEVICE_INVALID; retval = CONTROLVM_RESP_ERROR_DEVICE_INVALID;
} else { } else {
/* make sure this device exists */ /* make sure this device exists */
dev = bus->device[devNo]; dev = bus->device[dev_no];
if (!dev) { if (!dev) {
LOGERR("CONTROLVM_DEVICE_CHANGESTATE:pause Failed: device %d does not exist.", LOGERR("CONTROLVM_DEVICE_CHANGESTATE:pause Failed: device %d does not exist.",
devNo); dev_no);
retval = retval =
CONTROLVM_RESP_ERROR_ALREADY_DONE; CONTROLVM_RESP_ERROR_ALREADY_DONE;
} }
...@@ -561,7 +560,7 @@ pause_device(struct controlvm_message *msg) ...@@ -561,7 +560,7 @@ pause_device(struct controlvm_message *msg)
} }
if (!bus) { if (!bus) {
LOGERR("CONTROLVM_DEVICE_CHANGESTATE:pause Failed: bus %d does not exist", LOGERR("CONTROLVM_DEVICE_CHANGESTATE:pause Failed: bus %d does not exist",
busNo); bus_no);
retval = CONTROLVM_RESP_ERROR_BUS_INVALID; retval = CONTROLVM_RESP_ERROR_BUS_INVALID;
} }
read_unlock(&bus_list_lock); read_unlock(&bus_list_lock);
...@@ -569,12 +568,12 @@ pause_device(struct controlvm_message *msg) ...@@ -569,12 +568,12 @@ pause_device(struct controlvm_message *msg)
/* the msg is bound for virtpci; send /* the msg is bound for virtpci; send
* guest_msgs struct to callback * guest_msgs struct to callback
*/ */
if (!uuid_le_cmp(dev->channel_uuid, if (uuid_le_cmp(dev->channel_uuid,
spar_vhba_channel_protocol_uuid)) { spar_vhba_channel_protocol_uuid) == 0) {
cmd.msgtype = GUEST_PAUSE_VHBA; cmd.msgtype = GUEST_PAUSE_VHBA;
cmd.pause_vhba.chanptr = dev->chanptr; cmd.pause_vhba.chanptr = dev->chanptr;
} else if (!uuid_le_cmp(dev->channel_uuid, } else if (uuid_le_cmp(dev->channel_uuid,
spar_vnic_channel_protocol_uuid)) { spar_vnic_channel_protocol_uuid) == 0) {
cmd.msgtype = GUEST_PAUSE_VNIC; cmd.msgtype = GUEST_PAUSE_VNIC;
cmd.pause_vnic.chanptr = dev->chanptr; cmd.pause_vnic.chanptr = dev->chanptr;
} else { } else {
......
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