mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-01-19 06:56:08 +07:00
vmw_balloon: general style cleanup
Change all the remaining return values to int to avoid mistakes. Reduce indentation when possible. Reviewed-by: Xavier Deguillard <xdeguillard@vmware.com> Signed-off-by: Nadav Amit <namit@vmware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
6e4453b321
commit
22d293ee8d
@ -477,10 +477,9 @@ vmballoon_cmd(struct vmballoon *b, unsigned long cmd, unsigned long arg1,
|
|||||||
* Send "start" command to the host, communicating supported version
|
* Send "start" command to the host, communicating supported version
|
||||||
* of the protocol.
|
* of the protocol.
|
||||||
*/
|
*/
|
||||||
static bool vmballoon_send_start(struct vmballoon *b, unsigned long req_caps)
|
static int vmballoon_send_start(struct vmballoon *b, unsigned long req_caps)
|
||||||
{
|
{
|
||||||
unsigned long status, capabilities;
|
unsigned long status, capabilities;
|
||||||
bool success;
|
|
||||||
|
|
||||||
status = __vmballoon_cmd(b, VMW_BALLOON_CMD_START, req_caps, 0,
|
status = __vmballoon_cmd(b, VMW_BALLOON_CMD_START, req_caps, 0,
|
||||||
&capabilities);
|
&capabilities);
|
||||||
@ -488,14 +487,12 @@ static bool vmballoon_send_start(struct vmballoon *b, unsigned long req_caps)
|
|||||||
switch (status) {
|
switch (status) {
|
||||||
case VMW_BALLOON_SUCCESS_WITH_CAPABILITIES:
|
case VMW_BALLOON_SUCCESS_WITH_CAPABILITIES:
|
||||||
b->capabilities = capabilities;
|
b->capabilities = capabilities;
|
||||||
success = true;
|
|
||||||
break;
|
break;
|
||||||
case VMW_BALLOON_SUCCESS:
|
case VMW_BALLOON_SUCCESS:
|
||||||
b->capabilities = VMW_BALLOON_BASIC_CMDS;
|
b->capabilities = VMW_BALLOON_BASIC_CMDS;
|
||||||
success = true;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
success = false;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -509,26 +506,29 @@ static bool vmballoon_send_start(struct vmballoon *b, unsigned long req_caps)
|
|||||||
b->max_page_size = VMW_BALLOON_2M_PAGE;
|
b->max_page_size = VMW_BALLOON_2M_PAGE;
|
||||||
|
|
||||||
|
|
||||||
return success;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
|
* vmballoon_send_guest_id - communicate guest type to the host.
|
||||||
|
*
|
||||||
|
* @b: pointer to the balloon.
|
||||||
|
*
|
||||||
* Communicate guest type to the host so that it can adjust ballooning
|
* Communicate guest type to the host so that it can adjust ballooning
|
||||||
* algorithm to the one most appropriate for the guest. This command
|
* algorithm to the one most appropriate for the guest. This command
|
||||||
* is normally issued after sending "start" command and is part of
|
* is normally issued after sending "start" command and is part of
|
||||||
* standard reset sequence.
|
* standard reset sequence.
|
||||||
|
*
|
||||||
|
* Return: zero on success or appropriate error code.
|
||||||
*/
|
*/
|
||||||
static bool vmballoon_send_guest_id(struct vmballoon *b)
|
static int vmballoon_send_guest_id(struct vmballoon *b)
|
||||||
{
|
{
|
||||||
unsigned long status;
|
unsigned long status;
|
||||||
|
|
||||||
status = vmballoon_cmd(b, VMW_BALLOON_CMD_GUEST_ID,
|
status = vmballoon_cmd(b, VMW_BALLOON_CMD_GUEST_ID,
|
||||||
VMW_BALLOON_GUEST_ID, 0);
|
VMW_BALLOON_GUEST_ID, 0);
|
||||||
|
|
||||||
if (status == VMW_BALLOON_SUCCESS)
|
return status == VMW_BALLOON_SUCCESS ? 0 : -EIO;
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1215,8 +1215,15 @@ static void vmballoon_vmci_cleanup(struct vmballoon *b)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Initialize vmci doorbell, to get notified as soon as balloon changes
|
* vmballoon_vmci_init - Initialize vmci doorbell.
|
||||||
|
*
|
||||||
|
* @b: pointer to the balloon.
|
||||||
|
*
|
||||||
|
* Return: zero on success or when wakeup command not supported. Error-code
|
||||||
|
* otherwise.
|
||||||
|
*
|
||||||
|
* Initialize vmci doorbell, to get notified as soon as balloon changes.
|
||||||
*/
|
*/
|
||||||
static int vmballoon_vmci_init(struct vmballoon *b)
|
static int vmballoon_vmci_init(struct vmballoon *b)
|
||||||
{
|
{
|
||||||
@ -1278,7 +1285,7 @@ static void vmballoon_reset(struct vmballoon *b)
|
|||||||
/* free all pages, skipping monitor unlock */
|
/* free all pages, skipping monitor unlock */
|
||||||
vmballoon_pop(b);
|
vmballoon_pop(b);
|
||||||
|
|
||||||
if (!vmballoon_send_start(b, VMW_BALLOON_CAPABILITIES))
|
if (vmballoon_send_start(b, VMW_BALLOON_CAPABILITIES))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ((b->capabilities & VMW_BALLOON_BATCHED_CMDS) != 0) {
|
if ((b->capabilities & VMW_BALLOON_BATCHED_CMDS) != 0) {
|
||||||
@ -1302,7 +1309,7 @@ static void vmballoon_reset(struct vmballoon *b)
|
|||||||
if (error)
|
if (error)
|
||||||
pr_err("failed to initialize vmci doorbell\n");
|
pr_err("failed to initialize vmci doorbell\n");
|
||||||
|
|
||||||
if (!vmballoon_send_guest_id(b))
|
if (vmballoon_send_guest_id(b))
|
||||||
pr_err("failed to send guest ID to the host\n");
|
pr_err("failed to send guest ID to the host\n");
|
||||||
|
|
||||||
up_write(&b->conf_sem);
|
up_write(&b->conf_sem);
|
||||||
|
Loading…
Reference in New Issue
Block a user