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/uart.c | |
parent | 530430b717f02843fe1f2e77e6f52a41e05d6c3a (diff) | |
download | op-kernel-dev-36e79dec96f652110ae2b06bfcf9e67e1b770787.zip op-kernel-dev-36e79dec96f652110ae2b06bfcf9e67e1b770787.tar.gz |
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/uart.c')
-rw-r--r-- | drivers/staging/greybus/uart.c | 29 |
1 files changed, 2 insertions, 27 deletions
diff --git a/drivers/staging/greybus/uart.c b/drivers/staging/greybus/uart.c index 543c889..d0669ae 100644 --- a/drivers/staging/greybus/uart.c +++ b/drivers/staging/greybus/uart.c @@ -131,33 +131,8 @@ static DEFINE_IDR(tty_minors); static DEFINE_MUTEX(table_lock); static atomic_t reference_count = ATOMIC_INIT(0); -/* - * 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_tty *tty) -{ - struct gb_uart_proto_version_response response; - int ret; - - ret = gb_operation_sync(tty->connection, - GB_UART_TYPE_PROTOCOL_VERSION, - NULL, 0, &response, sizeof(response)); - if (ret) - return ret; - - if (response.major > GB_UART_VERSION_MAJOR) { - pr_err("unsupported major version (%hhu > %hhu)\n", - response.major, GB_UART_VERSION_MAJOR); - return -ENOTSUPP; - } - tty->version_major = response.major; - tty->version_minor = response.minor; - - pr_debug("%s: version_major = %u version_minor = %u\n", - __func__, tty->version_major, tty->version_minor); - return 0; -} +/* Define get_version() routine */ +define_get_version(gb_tty, UART); static int send_data(struct gb_tty *tty, u16 size, const u8 *data) { |