Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 26888d5a authored by Zhiqiang Tu's avatar Zhiqiang Tu
Browse files

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: default avatarZhiqiang Tu <ztu@codeaurora.org>
parent 6b3f84f4
Loading
Loading
Loading
Loading
+7 −43
Original line number Diff line number Diff line
@@ -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) {