diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2015-01-21 18:12:36 +0530 |
---|---|---|
committer | Greg Kroah-Hartman <greg@kroah.com> | 2015-01-22 11:29:39 +0800 |
commit | 36e79dec96f652110ae2b06bfcf9e67e1b770787 (patch) | |
tree | 333e41723bf440abb77c0dc1ea89cbacf198a480 /drivers/staging/greybus/gpio.c | |
parent | 530430b717f02843fe1f2e77e6f52a41e05d6c3a (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/gpio.c')
-rw-r--r-- | drivers/staging/greybus/gpio.c | 27 |
1 files changed, 3 insertions, 24 deletions
diff --git a/drivers/staging/greybus/gpio.c b/drivers/staging/greybus/gpio.c index 4997588e2617..a93583341811 100644 --- a/drivers/staging/greybus/gpio.c +++ b/drivers/staging/greybus/gpio.c @@ -113,29 +113,8 @@ struct gb_gpio_set_debounce_request { /* debounce response has no payload */ -/* - * This request only uses the connection field, and if successful, - * fills in the major and minor protocol version of the target. - */ -static int gb_gpio_proto_version_operation(struct gb_gpio_controller *ggc) -{ - struct gb_gpio_proto_version_response response; - int ret; - - ret = gb_operation_sync(ggc->connection, GB_GPIO_TYPE_PROTOCOL_VERSION, - NULL, 0, &response, sizeof(response)); - if (ret) - return ret; - - if (response.major > GB_GPIO_VERSION_MAJOR) { - pr_err("unsupported major version (%hhu > %hhu)\n", - response.major, GB_GPIO_VERSION_MAJOR); - return -ENOTSUPP; - } - ggc->version_major = response.major; - ggc->version_minor = response.minor; - return 0; -} +/* Define get_version() routine */ +define_get_version(gb_gpio_controller, GPIO); static int gb_gpio_line_count_operation(struct gb_gpio_controller *ggc) { @@ -446,7 +425,7 @@ static int gb_gpio_controller_setup(struct gb_gpio_controller *gb_gpio_controlle int ret; /* First thing we need to do is check the version */ - ret = gb_gpio_proto_version_operation(gb_gpio_controller); + ret = get_version(gb_gpio_controller); if (ret) ; /* return ret; */ |