aboutsummaryrefslogtreecommitdiff
path: root/drivers/staging/greybus/usb.c
diff options
context:
space:
mode:
authorGravatar Viresh Kumar <viresh.kumar@linaro.org> 2015-01-21 18:12:36 +0530
committerGravatar Greg Kroah-Hartman <greg@kroah.com> 2015-01-22 11:29:39 +0800
commit36e79dec96f652110ae2b06bfcf9e67e1b770787 (patch)
tree333e41723bf440abb77c0dc1ea89cbacf198a480 /drivers/staging/greybus/usb.c
parentgreybus: uart: s/REQ/TYPE (diff)
downloadlinux-36e79dec96f652110ae2b06bfcf9e67e1b770787.tar.gz
linux-36e79dec96f652110ae2b06bfcf9e67e1b770787.tar.bz2
linux-36e79dec96f652110ae2b06bfcf9e67e1b770787.zip
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.c22
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)
{