diff options
Diffstat (limited to 'drivers/tty/hvc/hvsi_lib.c')
-rw-r--r-- | drivers/tty/hvc/hvsi_lib.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/drivers/tty/hvc/hvsi_lib.c b/drivers/tty/hvc/hvsi_lib.c index ac2767100df5..347050ea414a 100644 --- a/drivers/tty/hvc/hvsi_lib.c +++ b/drivers/tty/hvc/hvsi_lib.c | |||
@@ -9,7 +9,7 @@ | |||
9 | 9 | ||
10 | static int hvsi_send_packet(struct hvsi_priv *pv, struct hvsi_header *packet) | 10 | static int hvsi_send_packet(struct hvsi_priv *pv, struct hvsi_header *packet) |
11 | { | 11 | { |
12 | packet->seqno = atomic_inc_return(&pv->seqno); | 12 | packet->seqno = cpu_to_be16(atomic_inc_return(&pv->seqno)); |
13 | 13 | ||
14 | /* Assumes that always succeeds, works in practice */ | 14 | /* Assumes that always succeeds, works in practice */ |
15 | return pv->put_chars(pv->termno, (char *)packet, packet->len); | 15 | return pv->put_chars(pv->termno, (char *)packet, packet->len); |
@@ -28,7 +28,7 @@ static void hvsi_start_handshake(struct hvsi_priv *pv) | |||
28 | /* Send version query */ | 28 | /* Send version query */ |
29 | q.hdr.type = VS_QUERY_PACKET_HEADER; | 29 | q.hdr.type = VS_QUERY_PACKET_HEADER; |
30 | q.hdr.len = sizeof(struct hvsi_query); | 30 | q.hdr.len = sizeof(struct hvsi_query); |
31 | q.verb = VSV_SEND_VERSION_NUMBER; | 31 | q.verb = cpu_to_be16(VSV_SEND_VERSION_NUMBER); |
32 | hvsi_send_packet(pv, &q.hdr); | 32 | hvsi_send_packet(pv, &q.hdr); |
33 | } | 33 | } |
34 | 34 | ||
@@ -40,7 +40,7 @@ static int hvsi_send_close(struct hvsi_priv *pv) | |||
40 | 40 | ||
41 | ctrl.hdr.type = VS_CONTROL_PACKET_HEADER; | 41 | ctrl.hdr.type = VS_CONTROL_PACKET_HEADER; |
42 | ctrl.hdr.len = sizeof(struct hvsi_control); | 42 | ctrl.hdr.len = sizeof(struct hvsi_control); |
43 | ctrl.verb = VSV_CLOSE_PROTOCOL; | 43 | ctrl.verb = cpu_to_be16(VSV_CLOSE_PROTOCOL); |
44 | return hvsi_send_packet(pv, &ctrl.hdr); | 44 | return hvsi_send_packet(pv, &ctrl.hdr); |
45 | } | 45 | } |
46 | 46 | ||
@@ -69,14 +69,14 @@ static void hvsi_got_control(struct hvsi_priv *pv) | |||
69 | { | 69 | { |
70 | struct hvsi_control *pkt = (struct hvsi_control *)pv->inbuf; | 70 | struct hvsi_control *pkt = (struct hvsi_control *)pv->inbuf; |
71 | 71 | ||
72 | switch (pkt->verb) { | 72 | switch (be16_to_cpu(pkt->verb)) { |
73 | case VSV_CLOSE_PROTOCOL: | 73 | case VSV_CLOSE_PROTOCOL: |
74 | /* We restart the handshaking */ | 74 | /* We restart the handshaking */ |
75 | hvsi_start_handshake(pv); | 75 | hvsi_start_handshake(pv); |
76 | break; | 76 | break; |
77 | case VSV_MODEM_CTL_UPDATE: | 77 | case VSV_MODEM_CTL_UPDATE: |
78 | /* Transition of carrier detect */ | 78 | /* Transition of carrier detect */ |
79 | hvsi_cd_change(pv, pkt->word & HVSI_TSCD); | 79 | hvsi_cd_change(pv, be32_to_cpu(pkt->word) & HVSI_TSCD); |
80 | break; | 80 | break; |
81 | } | 81 | } |
82 | } | 82 | } |
@@ -87,7 +87,7 @@ static void hvsi_got_query(struct hvsi_priv *pv) | |||
87 | struct hvsi_query_response r; | 87 | struct hvsi_query_response r; |
88 | 88 | ||
89 | /* We only handle version queries */ | 89 | /* We only handle version queries */ |
90 | if (pkt->verb != VSV_SEND_VERSION_NUMBER) | 90 | if (be16_to_cpu(pkt->verb) != VSV_SEND_VERSION_NUMBER) |
91 | return; | 91 | return; |
92 | 92 | ||
93 | pr_devel("HVSI@%x: Got version query, sending response...\n", | 93 | pr_devel("HVSI@%x: Got version query, sending response...\n", |
@@ -96,7 +96,7 @@ static void hvsi_got_query(struct hvsi_priv *pv) | |||
96 | /* Send version response */ | 96 | /* Send version response */ |
97 | r.hdr.type = VS_QUERY_RESPONSE_PACKET_HEADER; | 97 | r.hdr.type = VS_QUERY_RESPONSE_PACKET_HEADER; |
98 | r.hdr.len = sizeof(struct hvsi_query_response); | 98 | r.hdr.len = sizeof(struct hvsi_query_response); |
99 | r.verb = VSV_SEND_VERSION_NUMBER; | 99 | r.verb = cpu_to_be16(VSV_SEND_VERSION_NUMBER); |
100 | r.u.version = HVSI_VERSION; | 100 | r.u.version = HVSI_VERSION; |
101 | r.query_seqno = pkt->hdr.seqno; | 101 | r.query_seqno = pkt->hdr.seqno; |
102 | hvsi_send_packet(pv, &r.hdr); | 102 | hvsi_send_packet(pv, &r.hdr); |
@@ -112,7 +112,7 @@ static void hvsi_got_response(struct hvsi_priv *pv) | |||
112 | 112 | ||
113 | switch(r->verb) { | 113 | switch(r->verb) { |
114 | case VSV_SEND_MODEM_CTL_STATUS: | 114 | case VSV_SEND_MODEM_CTL_STATUS: |
115 | hvsi_cd_change(pv, r->u.mctrl_word & HVSI_TSCD); | 115 | hvsi_cd_change(pv, be32_to_cpu(r->u.mctrl_word) & HVSI_TSCD); |
116 | pv->mctrl_update = 1; | 116 | pv->mctrl_update = 1; |
117 | break; | 117 | break; |
118 | } | 118 | } |
@@ -265,8 +265,7 @@ int hvsilib_read_mctrl(struct hvsi_priv *pv) | |||
265 | pv->mctrl_update = 0; | 265 | pv->mctrl_update = 0; |
266 | q.hdr.type = VS_QUERY_PACKET_HEADER; | 266 | q.hdr.type = VS_QUERY_PACKET_HEADER; |
267 | q.hdr.len = sizeof(struct hvsi_query); | 267 | q.hdr.len = sizeof(struct hvsi_query); |
268 | q.hdr.seqno = atomic_inc_return(&pv->seqno); | 268 | q.verb = cpu_to_be16(VSV_SEND_MODEM_CTL_STATUS); |
269 | q.verb = VSV_SEND_MODEM_CTL_STATUS; | ||
270 | rc = hvsi_send_packet(pv, &q.hdr); | 269 | rc = hvsi_send_packet(pv, &q.hdr); |
271 | if (rc <= 0) { | 270 | if (rc <= 0) { |
272 | pr_devel("HVSI@%x: Error %d...\n", pv->termno, rc); | 271 | pr_devel("HVSI@%x: Error %d...\n", pv->termno, rc); |
@@ -304,9 +303,9 @@ int hvsilib_write_mctrl(struct hvsi_priv *pv, int dtr) | |||
304 | 303 | ||
305 | ctrl.hdr.type = VS_CONTROL_PACKET_HEADER, | 304 | ctrl.hdr.type = VS_CONTROL_PACKET_HEADER, |
306 | ctrl.hdr.len = sizeof(struct hvsi_control); | 305 | ctrl.hdr.len = sizeof(struct hvsi_control); |
307 | ctrl.verb = VSV_SET_MODEM_CTL; | 306 | ctrl.verb = cpu_to_be16(VSV_SET_MODEM_CTL); |
308 | ctrl.mask = HVSI_TSDTR; | 307 | ctrl.mask = cpu_to_be32(HVSI_TSDTR); |
309 | ctrl.word = dtr ? HVSI_TSDTR : 0; | 308 | ctrl.word = cpu_to_be32(dtr ? HVSI_TSDTR : 0); |
310 | return hvsi_send_packet(pv, &ctrl.hdr); | 309 | return hvsi_send_packet(pv, &ctrl.hdr); |
311 | } | 310 | } |
312 | 311 | ||