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

Commit 1b83535c authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "regulator: virtio: wait for backend response forever"

parents 3934139e 26888d5a
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) {