summaryrefslogtreecommitdiff
path: root/drivers/staging/greybus/vibrator.c
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2015-01-21 18:12:36 +0530
committerGreg Kroah-Hartman <greg@kroah.com>2015-01-22 11:29:39 +0800
commit36e79dec96f652110ae2b06bfcf9e67e1b770787 (patch)
tree333e41723bf440abb77c0dc1ea89cbacf198a480 /drivers/staging/greybus/vibrator.c
parent530430b717f02843fe1f2e77e6f52a41e05d6c3a (diff)
greybus: create get_version() routines with the help of a macro
This gets rid of lots of duplication of code. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Diffstat (limited to 'drivers/staging/greybus/vibrator.c')
-rw-r--r--drivers/staging/greybus/vibrator.c30
1 files changed, 2 insertions, 28 deletions
diff --git a/drivers/staging/greybus/vibrator.c b/drivers/staging/greybus/vibrator.c
index b5332df7039c..141ccdbf7b64 100644
--- a/drivers/staging/greybus/vibrator.c
+++ b/drivers/staging/greybus/vibrator.c
@@ -43,34 +43,8 @@ struct gb_vibrator_on_request {
__le16 timeout_ms;
};
-/*
- * This request only uses the connection field, and if successful,
- * fills in the major and minor protocol version of the target.
- */
-static int get_version(struct gb_vibrator_device *vib)
-{
- struct gb_connection *connection = vib->connection;
- struct gb_vibrator_proto_version_response version_response;
- int retval;
-
- retval = gb_operation_sync(connection,
- GB_VIBRATOR_TYPE_PROTOCOL_VERSION,
- NULL, 0,
- &version_response, sizeof(version_response));
- if (retval)
- return retval;
-
- if (version_response.major > GB_VIBRATOR_VERSION_MAJOR) {
- dev_err(&connection->dev,
- "unsupported major version (%hhu > %hhu)\n",
- version_response.major, GB_VIBRATOR_VERSION_MAJOR);
- return -ENOTSUPP;
- }
-
- vib->version_major = version_response.major;
- vib->version_minor = version_response.minor;
- return 0;
-}
+/* Define get_version() routine */
+define_get_version(gb_vibrator_device, VIBRATOR);
static int turn_on(struct gb_vibrator_device *vib, u16 timeout_ms)
{