regulator: virtio: wait for backend response forever

Since guest virtual machine may be scheduled out by host for an uncertain
time, we change the waiting for backend response from 200ms timeout to no
timeout.

Change-Id: If52f167091f67c69fdc5082404e966019de41e5e
Signed-off-by: Zhiqiang Tu <ztu@codeaurora.org>
tirimbino
Zhiqiang Tu 5 years ago
parent 6b3f84f45b
commit 26888d5a69
  1. 50
      drivers/regulator/virtio_regulator.c

@ -27,7 +27,6 @@
#include <linux/regulator/machine.h>
#include <linux/regulator/of_regulator.h>
#define VIRTIO_REGULATOR_TIMEOUT 200 /* miliseconds */
#define VIRTIO_REGULATOR_MAX_NAME 20
#define VIRTIO_REGULATOR_VOLTAGE_UNKNOWN 1
@ -78,12 +77,7 @@ static int virtio_regulator_enable(struct regulator_dev *rdev)
virtqueue_kick(vreg->vq);
ret = wait_for_completion_timeout(&vreg->rsp_avail,
msecs_to_jiffies(VIRTIO_REGULATOR_TIMEOUT));
if (!ret) {
ret = -ETIMEDOUT;
goto out;
}
wait_for_completion(&vreg->rsp_avail);
rsp = virtqueue_get_buf(vreg->vq, &len);
if (!rsp) {
@ -132,12 +126,7 @@ static int virtio_regulator_disable(struct regulator_dev *rdev)
virtqueue_kick(vreg->vq);
ret = wait_for_completion_timeout(&vreg->rsp_avail,
msecs_to_jiffies(VIRTIO_REGULATOR_TIMEOUT));
if (!ret) {
ret = -ETIMEDOUT;
goto out;
}
wait_for_completion(&vreg->rsp_avail);
rsp = virtqueue_get_buf(vreg->vq, &len);
if (!rsp) {
@ -198,12 +187,7 @@ static int virtio_regulator_set_voltage(struct regulator_dev *rdev, int min_uV,
virtqueue_kick(vreg->vq);
ret = wait_for_completion_timeout(&vreg->rsp_avail,
msecs_to_jiffies(VIRTIO_REGULATOR_TIMEOUT));
if (!ret) {
ret = -ETIMEDOUT;
goto out;
}
wait_for_completion(&vreg->rsp_avail);
rsp = virtqueue_get_buf(vreg->vq, &len);
if (!rsp) {
@ -250,12 +234,7 @@ static int virtio_regulator_get_voltage(struct regulator_dev *rdev)
virtqueue_kick(vreg->vq);
ret = wait_for_completion_timeout(&vreg->rsp_avail,
msecs_to_jiffies(VIRTIO_REGULATOR_TIMEOUT));
if (!ret) {
ret = -ETIMEDOUT;
goto out;
}
wait_for_completion(&vreg->rsp_avail);
rsp = virtqueue_get_buf(vreg->vq, &len);
if (!rsp) {
@ -309,12 +288,7 @@ static int virtio_regulator_set_mode(struct regulator_dev *rdev,
virtqueue_kick(vreg->vq);
ret = wait_for_completion_timeout(&vreg->rsp_avail,
msecs_to_jiffies(VIRTIO_REGULATOR_TIMEOUT));
if (!ret) {
ret = -ETIMEDOUT;
goto out;
}
wait_for_completion(&vreg->rsp_avail);
rsp = virtqueue_get_buf(vreg->vq, &len);
if (!rsp) {
@ -361,12 +335,7 @@ static unsigned int virtio_regulator_get_mode(struct regulator_dev *rdev)
virtqueue_kick(vreg->vq);
ret = wait_for_completion_timeout(&vreg->rsp_avail,
msecs_to_jiffies(VIRTIO_REGULATOR_TIMEOUT));
if (!ret) {
ret = -ETIMEDOUT;
goto out;
}
wait_for_completion(&vreg->rsp_avail);
rsp = virtqueue_get_buf(vreg->vq, &len);
if (!rsp) {
@ -419,12 +388,7 @@ static int virtio_regulator_set_load(struct regulator_dev *rdev, int load_ua)
virtqueue_kick(vreg->vq);
ret = wait_for_completion_timeout(&vreg->rsp_avail,
msecs_to_jiffies(VIRTIO_REGULATOR_TIMEOUT));
if (!ret) {
ret = -ETIMEDOUT;
goto out;
}
wait_for_completion(&vreg->rsp_avail);
rsp = virtqueue_get_buf(vreg->vq, &len);
if (!rsp) {

Loading…
Cancel
Save