From: Axel Lin <axel.lin@ingics.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Pankaj Dubey <pankaj.dubey@samsung.com>,
Chanwoo Choi <cw00.choi@samsung.com>,
Hyunhee Kim <hyunhee.kim@samsung.com>,
Kyungmin Park <kyungmin.park@samsung.com>,
Jaewon Kim <jaewon02.kim@samsung.com>,
linux-input@vger.kernel.org
Subject: [PATCH] Input: regulator-haptic: Make regulator_haptic_set_voltage call regulator_haptic_toggle
Date: Mon, 22 Dec 2014 12:47:40 +0800 [thread overview]
Message-ID: <1419223660.22487.1.camel@phoenix> (raw)
All the use cases in this driver has a regulator_haptic_toggle() call after
regulator_haptic_set_voltage(). So make regulator_haptic_set_voltage() call
regulator_haptic_toggle() to simplify the code.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
drivers/input/misc/regulator-haptic.c | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/drivers/input/misc/regulator-haptic.c b/drivers/input/misc/regulator-haptic.c
index 9426221..5b18de3 100644
--- a/drivers/input/misc/regulator-haptic.c
+++ b/drivers/input/misc/regulator-haptic.c
@@ -76,6 +76,8 @@ static int regulator_haptic_set_voltage(struct regulator_haptic *haptic,
return error;
}
+ regulator_haptic_toggle(haptic, !!magnitude);
+
return 0;
}
@@ -84,7 +86,6 @@ static void regulator_haptic_work(struct work_struct *work)
struct regulator_haptic *haptic = container_of(work,
struct regulator_haptic, work);
unsigned int magnitude;
- int error;
mutex_lock(&haptic->mutex);
@@ -93,12 +94,7 @@ static void regulator_haptic_work(struct work_struct *work)
magnitude = ACCESS_ONCE(haptic->magnitude);
- error = regulator_haptic_set_voltage(haptic, magnitude);
- if (error)
- goto out;
-
- regulator_haptic_toggle(haptic, magnitude != 0);
-
+ regulator_haptic_set_voltage(haptic, magnitude);
out:
mutex_unlock(&haptic->mutex);
}
@@ -123,7 +119,6 @@ static void regulator_haptic_close(struct input_dev *input)
cancel_work_sync(&haptic->work);
regulator_haptic_set_voltage(haptic, 0);
- regulator_haptic_toggle(haptic, false);
}
static int __maybe_unused
@@ -225,7 +220,6 @@ static int __maybe_unused regulator_haptic_suspend(struct device *dev)
return error;
regulator_haptic_set_voltage(haptic, 0);
- regulator_haptic_toggle(haptic, false);
haptic->suspended = true;
@@ -245,10 +239,8 @@ static int __maybe_unused regulator_haptic_resume(struct device *dev)
haptic->suspended = false;
magnitude = ACCESS_ONCE(haptic->magnitude);
- if (magnitude) {
+ if (magnitude)
regulator_haptic_set_voltage(haptic, magnitude);
- regulator_haptic_toggle(haptic, true);
- }
mutex_unlock(&haptic->mutex);
--
1.9.1
reply other threads:[~2014-12-22 4:47 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1419223660.22487.1.camel@phoenix \
--to=axel.lin@ingics.com \
--cc=cw00.choi@samsung.com \
--cc=dmitry.torokhov@gmail.com \
--cc=hyunhee.kim@samsung.com \
--cc=jaewon02.kim@samsung.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-input@vger.kernel.org \
--cc=pankaj.dubey@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).