From 36e79dec96f652110ae2b06bfcf9e67e1b770787 Mon Sep 17 00:00:00 2001 From: Viresh Kumar Date: Wed, 21 Jan 2015 18:12:36 +0530 Subject: 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 Reviewed-by: Alex Elder Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/usb.c | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) (limited to 'drivers/staging/greybus/usb.c') 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) { -- cgit v1.2.3