OSDN Git Service

greybus: uart: Tidy naming convention to more closely match spec
authorBryan O'Donoghue <bryan.odonoghue@linaro.org>
Tue, 2 Jun 2015 12:40:45 +0000 (13:40 +0100)
committerGreg Kroah-Hartman <gregkh@google.com>
Thu, 4 Jun 2015 05:05:48 +0000 (14:05 +0900)
Update tabs and naming of structures to match the naming used in the greybus
specification more closely.

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 04f3b22..642f942 100644 (file)
@@ -561,35 +561,38 @@ struct gb_svc_conn_destroy_request {
 #define GB_UART_TYPE_SET_BREAK                 0x06
 #define GB_UART_TYPE_SERIAL_STATE              0x07    /* Unsolicited data */
 
+/* Represents data from AP -> Module */
 struct gb_uart_send_data_request {
        __le16  size;
        __u8    data[0];
 };
 
-struct gb_serial_line_coding {
+/* Represents data from Module -> AP */
+struct gb_uart_recv_data_request {
+       __le16  size;
+       __u8    data[0];
+};
+
+struct gb_uart_set_line_coding_request {
        __le32  rate;
        __u8    format;
-#define GB_SERIAL_1_STOP_BITS          0
-#define GB_SERIAL_1_5_STOP_BITS                1
-#define GB_SERIAL_2_STOP_BITS          2
+#define GB_SERIAL_1_STOP_BITS                  0
+#define GB_SERIAL_1_5_STOP_BITS                        1
+#define GB_SERIAL_2_STOP_BITS                  2
 
        __u8    parity;
-#define GB_SERIAL_NO_PARITY            0
-#define GB_SERIAL_ODD_PARITY           1
-#define GB_SERIAL_EVEN_PARITY          2
-#define GB_SERIAL_MARK_PARITY          3
-#define GB_SERIAL_SPACE_PARITY         4
-
-       __u8    data;
-};
+#define GB_SERIAL_NO_PARITY                    0
+#define GB_SERIAL_ODD_PARITY                   1
+#define GB_SERIAL_EVEN_PARITY                  2
+#define GB_SERIAL_MARK_PARITY                  3
+#define GB_SERIAL_SPACE_PARITY                 4
 
-struct gb_uart_set_line_coding_request {
-       struct gb_serial_line_coding    line_coding;
+       __u8    data_bits;
 };
 
 /* output control lines */
-#define GB_UART_CTRL_DTR               0x01
-#define GB_UART_CTRL_RTS               0x02
+#define GB_UART_CTRL_DTR                       0x01
+#define GB_UART_CTRL_RTS                       0x02
 
 struct gb_uart_set_control_line_state_request {
        __le16  control;
@@ -600,14 +603,14 @@ struct gb_uart_set_break_request {
 };
 
 /* input control lines and line errors */
-#define GB_UART_CTRL_DCD               0x01
-#define GB_UART_CTRL_DSR               0x02
-#define GB_UART_CTRL_BRK               0x04
-#define GB_UART_CTRL_RI                        0x08
-
-#define GB_UART_CTRL_FRAMING           0x10
-#define GB_UART_CTRL_PARITY            0x20
-#define GB_UART_CTRL_OVERRUN           0x40
+#define GB_UART_CTRL_DCD                       0x01
+#define GB_UART_CTRL_DSR                       0x02
+#define GB_UART_CTRL_BRK                       0x04
+#define GB_UART_CTRL_RI                                0x08
+
+#define GB_UART_CTRL_FRAMING                   0x10
+#define GB_UART_CTRL_PARITY                    0x20
+#define GB_UART_CTRL_OVERRUN                   0x40
 
 struct gb_uart_serial_state_request {
        __u16   control;
index a4c0127..673eec4 100644 (file)
 #define GB_NUM_MINORS  255     /* 255 is enough for anyone... */
 #define GB_NAME                "ttyGB"
 
+struct gb_tty_line_coding {
+       __le32  rate;
+       __u8    format;
+       __u8    parity;
+       __u8    data_bits;
+};
+
 struct gb_tty {
        struct tty_port port;
        struct gb_connection *connection;
@@ -50,10 +57,9 @@ struct gb_tty {
        u8 version_minor;
        unsigned int ctrlin;    /* input control lines */
        unsigned int ctrlout;   /* output control lines */
-       struct gb_serial_line_coding line_coding;
+       struct gb_tty_line_coding line_coding;
 };
 
-
 static struct tty_driver *gb_tty_driver;
 static DEFINE_IDR(tty_minors);
 static DEFINE_MUTEX(table_lock);
@@ -87,7 +93,7 @@ static int send_line_coding(struct gb_tty *tty)
 {
        struct gb_uart_set_line_coding_request request;
 
-       memcpy(&request.line_coding, &tty->line_coding,
+       memcpy(&request, &tty->line_coding,
               sizeof(tty->line_coding));
        return gb_operation_sync(tty->connection, GB_UART_TYPE_SET_LINE_CODING,
                                 &request, sizeof(request), NULL, 0);
@@ -245,7 +251,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_serial_line_coding newline;
+       struct gb_tty_line_coding newline;
        int newctrl = gb_tty->ctrlout;
 
        newline.rate = cpu_to_le32(tty_get_baud_rate(tty));
@@ -256,17 +262,17 @@ static void gb_tty_set_termios(struct tty_struct *tty,
 
        switch (termios->c_cflag & CSIZE) {
        case CS5:
-               newline.data = 5;
+               newline.data_bits = 5;
                break;
        case CS6:
-               newline.data = 6;
+               newline.data_bits = 6;
                break;
        case CS7:
-               newline.data = 7;
+               newline.data_bits = 7;
                break;
        case CS8:
        default:
-               newline.data = 8;
+               newline.data_bits = 8;
                break;
        }
 
@@ -571,7 +577,7 @@ static int gb_uart_connection_init(struct gb_connection *connection)
        gb_tty->line_coding.rate = cpu_to_le32(9600);
        gb_tty->line_coding.format = GB_SERIAL_1_STOP_BITS;
        gb_tty->line_coding.parity = GB_SERIAL_NO_PARITY;
-       gb_tty->line_coding.data = 8;
+       gb_tty->line_coding.data_bits = 8;
        send_line_coding(gb_tty);
 
        tty_dev = tty_port_register_device(&gb_tty->port, gb_tty_driver, minor,