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/usb.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/usb.c')
-rw-r--r-- | drivers/staging/greybus/usb.c | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/drivers/staging/greybus/usb.c b/drivers/staging/greybus/usb.c index 010ef9ee831f..c66d7681d4b3 100644 --- a/drivers/staging/greybus/usb.c +++ b/drivers/staging/greybus/usb.c @@ -93,26 +93,8 @@ struct gb_usb_device { #define to_gb_usb_device(d) ((struct gb_usb_device*) d->hcd_priv) -static int get_version(struct gb_usb_device *dev) -{ - struct gb_usb_proto_version_response response; - int ret; - - ret = gb_operation_sync(dev->connection, - GB_USB_TYPE_PROTOCOL_VERSION, - NULL, 0, &response, sizeof(response)); - if (ret) - return ret; - - if (response.major > GB_USB_VERSION_MAJOR) { - pr_err("unsupported major version (%hhu > %hhu)\n", - response.major, GB_USB_VERSION_MAJOR); - return -ENOTSUPP; - } - dev->version_major = response.major; - dev->version_minor = response.minor; - return 0; -} +/* Define get_version() routine */ +define_get_version(gb_usb_device, USB); static void hcd_stop(struct usb_hcd *hcd) { |