OSDN Git Service

greybus: uart: Update UART to reflect field size changes
authorBryan O'Donoghue <bryan.odonoghue@linaro.org>
Mon, 29 Jun 2015 17:09:15 +0000 (18:09 +0100)
committerGreg Kroah-Hartman <gregkh@google.com>
Wed, 1 Jul 2015 02:34:47 +0000 (19:34 -0700)
The greybus UART protocol specification was updated to reduce the size of
the control field in serial-state-request and line-state-request. This
patch updates the kernel protocol driver to reflect the specification
changes. Once applied gbsim changes will be also be updated automatically
since gbsim depends on the header being modified directly.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/greybus_protocols.h
drivers/staging/greybus/uart.c

index 44522b0..6f8c15e 100644 (file)
@@ -641,7 +641,7 @@ struct gb_uart_set_line_coding_request {
 #define GB_UART_CTRL_RTS                       0x02
 
 struct gb_uart_set_control_line_state_request {
-       __le16  control;
+       __u8    control;
 };
 
 struct gb_uart_set_break_request {
@@ -654,7 +654,7 @@ struct gb_uart_set_break_request {
 #define GB_UART_CTRL_RI                                0x04
 
 struct gb_uart_serial_state_request {
-       __le16  control;
+       __u8    control;
 };
 
 /* SDIO */
index 73e3c99..7abcd1c 100644 (file)
@@ -57,8 +57,8 @@ struct gb_tty {
        struct mutex mutex;
        u8 version_major;
        u8 version_minor;
-       unsigned int ctrlin;    /* input control lines */
-       unsigned int ctrlout;   /* output control lines */
+       u8 ctrlin;      /* input control lines */
+       u8 ctrlout;     /* output control lines */
        struct gb_tty_line_coding line_coding;
 };
 
@@ -123,7 +123,7 @@ static int gb_uart_request_recv(u8 type, struct gb_operation *op)
                break;
        case GB_UART_TYPE_SERIAL_STATE:
                serial_state = request->payload;
-               gb_tty->ctrlin = le16_to_cpu(serial_state->control);
+               gb_tty->ctrlin = serial_state->control;
                break;
        default:
                dev_err(&connection->dev,
@@ -165,11 +165,11 @@ static int send_line_coding(struct gb_tty *tty)
                                 &request, sizeof(request), NULL, 0);
 }
 
-static int send_control(struct gb_tty *gb_tty, u16 control)
+static int send_control(struct gb_tty *gb_tty, u8 control)
 {
        struct gb_uart_set_control_line_state_request request;
 
-       request.control = cpu_to_le16(control);
+       request.control = control;
        return gb_operation_sync(gb_tty->connection,
                                 GB_UART_TYPE_SET_CONTROL_LINE_STATE,
                                 &request, sizeof(request), NULL, 0);
@@ -314,7 +314,7 @@ static void gb_tty_set_termios(struct tty_struct *tty,
        struct gb_tty *gb_tty = tty->driver_data;
        struct ktermios *termios = &tty->termios;
        struct gb_tty_line_coding newline;
-       int newctrl = gb_tty->ctrlout;
+       u8 newctrl = gb_tty->ctrlout;
 
        newline.rate = cpu_to_le32(tty_get_baud_rate(tty));
        newline.format = termios->c_cflag & CSTOPB ?
@@ -376,7 +376,7 @@ static int gb_tty_tiocmset(struct tty_struct *tty, unsigned int set,
                           unsigned int clear)
 {
        struct gb_tty *gb_tty = tty->driver_data;
-       unsigned int newctrl = gb_tty->ctrlout;
+       u8 newctrl = gb_tty->ctrlout;
 
        set = (set & TIOCM_DTR ? GB_UART_CTRL_DTR : 0) |
              (set & TIOCM_RTS ? GB_UART_CTRL_RTS : 0);