diff options
author | Jiri Slaby <jslaby@suse.cz> | 2013-01-03 09:53:02 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-01-16 01:17:29 -0500 |
commit | 2f69335710884ae6112fc8196ebe29b5cda7b79b (patch) | |
tree | c97bec97e703faace437235d3bcbbf80c078ad21 /drivers/tty | |
parent | 227434f8986c3827a1faedd1feb437acd6285315 (diff) |
TTY: convert more flipping functions
Now, we start converting tty buffer functions to actually use
tty_port. This will allow us to get rid of the need of tty pointer in
many call sites. Only tty_port will be needed and hence no more
tty_port_tty_get calls in those paths.
Now 4 string flipping ones are on turn:
* tty_insert_flip_string_flags
* tty_insert_flip_string_fixed_flag
* tty_prepare_flip_string
* tty_prepare_flip_string_flags
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r-- | drivers/tty/cyclades.c | 2 | ||||
-rw-r--r-- | drivers/tty/isicom.c | 4 | ||||
-rw-r--r-- | drivers/tty/moxa.c | 4 | ||||
-rw-r--r-- | drivers/tty/rocket.c | 2 | ||||
-rw-r--r-- | drivers/tty/serial/msm_smd_tty.c | 2 | ||||
-rw-r--r-- | drivers/tty/tty_buffer.c | 32 |
6 files changed, 23 insertions, 23 deletions
diff --git a/drivers/tty/cyclades.c b/drivers/tty/cyclades.c index b85acc74eb0d..0b7573dbf439 100644 --- a/drivers/tty/cyclades.c +++ b/drivers/tty/cyclades.c | |||
@@ -968,7 +968,7 @@ static void cyz_handle_rx(struct cyclades_port *info, struct tty_struct *tty) | |||
968 | for performance, but because of buffer boundaries, there | 968 | for performance, but because of buffer boundaries, there |
969 | may be several steps to the operation */ | 969 | may be several steps to the operation */ |
970 | while (1) { | 970 | while (1) { |
971 | len = tty_prepare_flip_string(tty, &buf, | 971 | len = tty_prepare_flip_string(port, &buf, |
972 | char_count); | 972 | char_count); |
973 | if (!len) | 973 | if (!len) |
974 | break; | 974 | break; |
diff --git a/drivers/tty/isicom.c b/drivers/tty/isicom.c index 3205b2e9090b..e9fc15f00f48 100644 --- a/drivers/tty/isicom.c +++ b/drivers/tty/isicom.c | |||
@@ -650,8 +650,8 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id) | |||
650 | break; | 650 | break; |
651 | } | 651 | } |
652 | } else { /* Data Packet */ | 652 | } else { /* Data Packet */ |
653 | 653 | count = tty_prepare_flip_string(&port->port, &rp, | |
654 | count = tty_prepare_flip_string(tty, &rp, byte_count & ~1); | 654 | byte_count & ~1); |
655 | pr_debug("%s: Can rx %d of %d bytes.\n", | 655 | pr_debug("%s: Can rx %d of %d bytes.\n", |
656 | __func__, count, byte_count); | 656 | __func__, count, byte_count); |
657 | word_count = count >> 1; | 657 | word_count = count >> 1; |
diff --git a/drivers/tty/moxa.c b/drivers/tty/moxa.c index f9d28503bdec..fcaac4870d5f 100644 --- a/drivers/tty/moxa.c +++ b/drivers/tty/moxa.c | |||
@@ -1966,7 +1966,7 @@ static int MoxaPortReadData(struct moxa_port *port) | |||
1966 | ofs = baseAddr + DynPage_addr + bufhead + head; | 1966 | ofs = baseAddr + DynPage_addr + bufhead + head; |
1967 | len = (tail >= head) ? (tail - head) : | 1967 | len = (tail >= head) ? (tail - head) : |
1968 | (rx_mask + 1 - head); | 1968 | (rx_mask + 1 - head); |
1969 | len = tty_prepare_flip_string(tty, &dst, | 1969 | len = tty_prepare_flip_string(&port->port, &dst, |
1970 | min(len, count)); | 1970 | min(len, count)); |
1971 | memcpy_fromio(dst, ofs, len); | 1971 | memcpy_fromio(dst, ofs, len); |
1972 | head = (head + len) & rx_mask; | 1972 | head = (head + len) & rx_mask; |
@@ -1978,7 +1978,7 @@ static int MoxaPortReadData(struct moxa_port *port) | |||
1978 | while (count > 0) { | 1978 | while (count > 0) { |
1979 | writew(pageno, baseAddr + Control_reg); | 1979 | writew(pageno, baseAddr + Control_reg); |
1980 | ofs = baseAddr + DynPage_addr + pageofs; | 1980 | ofs = baseAddr + DynPage_addr + pageofs; |
1981 | len = tty_prepare_flip_string(tty, &dst, | 1981 | len = tty_prepare_flip_string(&port->port, &dst, |
1982 | min(Page_size - pageofs, count)); | 1982 | min(Page_size - pageofs, count)); |
1983 | memcpy_fromio(dst, ofs, len); | 1983 | memcpy_fromio(dst, ofs, len); |
1984 | 1984 | ||
diff --git a/drivers/tty/rocket.c b/drivers/tty/rocket.c index e42009a00529..77d7bc94afaa 100644 --- a/drivers/tty/rocket.c +++ b/drivers/tty/rocket.c | |||
@@ -399,7 +399,7 @@ static void rp_do_receive(struct r_port *info, | |||
399 | * characters at time by doing repeated word IO | 399 | * characters at time by doing repeated word IO |
400 | * transfer. | 400 | * transfer. |
401 | */ | 401 | */ |
402 | space = tty_prepare_flip_string(tty, &cbuf, ToRecv); | 402 | space = tty_prepare_flip_string(&info->port, &cbuf, ToRecv); |
403 | if (space < ToRecv) { | 403 | if (space < ToRecv) { |
404 | #ifdef ROCKET_DEBUG_RECEIVE | 404 | #ifdef ROCKET_DEBUG_RECEIVE |
405 | printk(KERN_INFO "rp_do_receive:insufficient space ToRecv=%d space=%d\n", ToRecv, space); | 405 | printk(KERN_INFO "rp_do_receive:insufficient space ToRecv=%d space=%d\n", ToRecv, space); |
diff --git a/drivers/tty/serial/msm_smd_tty.c b/drivers/tty/serial/msm_smd_tty.c index 925d1fa153db..b43b4ec39269 100644 --- a/drivers/tty/serial/msm_smd_tty.c +++ b/drivers/tty/serial/msm_smd_tty.c | |||
@@ -70,7 +70,7 @@ static void smd_tty_notify(void *priv, unsigned event) | |||
70 | if (avail == 0) | 70 | if (avail == 0) |
71 | break; | 71 | break; |
72 | 72 | ||
73 | avail = tty_prepare_flip_string(tty, &ptr, avail); | 73 | avail = tty_prepare_flip_string(&info->port, &ptr, avail); |
74 | 74 | ||
75 | if (smd_read(info->ch, ptr, avail) != avail) { | 75 | if (smd_read(info->ch, ptr, avail) != avail) { |
76 | /* shouldn't be possible since we're in interrupt | 76 | /* shouldn't be possible since we're in interrupt |
diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c index f897332fb4ee..31873e42602a 100644 --- a/drivers/tty/tty_buffer.c +++ b/drivers/tty/tty_buffer.c | |||
@@ -257,7 +257,7 @@ EXPORT_SYMBOL_GPL(tty_buffer_request_room); | |||
257 | 257 | ||
258 | /** | 258 | /** |
259 | * tty_insert_flip_string_fixed_flag - Add characters to the tty buffer | 259 | * tty_insert_flip_string_fixed_flag - Add characters to the tty buffer |
260 | * @tty: tty structure | 260 | * @port: tty port |
261 | * @chars: characters | 261 | * @chars: characters |
262 | * @flag: flag value for each character | 262 | * @flag: flag value for each character |
263 | * @size: size | 263 | * @size: size |
@@ -268,10 +268,10 @@ EXPORT_SYMBOL_GPL(tty_buffer_request_room); | |||
268 | * Locking: Called functions may take port->buf.lock | 268 | * Locking: Called functions may take port->buf.lock |
269 | */ | 269 | */ |
270 | 270 | ||
271 | int tty_insert_flip_string_fixed_flag(struct tty_struct *tty, | 271 | int tty_insert_flip_string_fixed_flag(struct tty_port *port, |
272 | const unsigned char *chars, char flag, size_t size) | 272 | const unsigned char *chars, char flag, size_t size) |
273 | { | 273 | { |
274 | struct tty_bufhead *buf = &tty->port->buf; | 274 | struct tty_bufhead *buf = &port->buf; |
275 | int copied = 0; | 275 | int copied = 0; |
276 | do { | 276 | do { |
277 | int goal = min_t(size_t, size - copied, TTY_BUFFER_PAGE); | 277 | int goal = min_t(size_t, size - copied, TTY_BUFFER_PAGE); |
@@ -280,7 +280,7 @@ int tty_insert_flip_string_fixed_flag(struct tty_struct *tty, | |||
280 | struct tty_buffer *tb; | 280 | struct tty_buffer *tb; |
281 | 281 | ||
282 | spin_lock_irqsave(&buf->lock, flags); | 282 | spin_lock_irqsave(&buf->lock, flags); |
283 | space = __tty_buffer_request_room(tty->port, goal); | 283 | space = __tty_buffer_request_room(port, goal); |
284 | tb = buf->tail; | 284 | tb = buf->tail; |
285 | /* If there is no space then tb may be NULL */ | 285 | /* If there is no space then tb may be NULL */ |
286 | if (unlikely(space == 0)) { | 286 | if (unlikely(space == 0)) { |
@@ -302,7 +302,7 @@ EXPORT_SYMBOL(tty_insert_flip_string_fixed_flag); | |||
302 | 302 | ||
303 | /** | 303 | /** |
304 | * tty_insert_flip_string_flags - Add characters to the tty buffer | 304 | * tty_insert_flip_string_flags - Add characters to the tty buffer |
305 | * @tty: tty structure | 305 | * @port: tty port |
306 | * @chars: characters | 306 | * @chars: characters |
307 | * @flags: flag bytes | 307 | * @flags: flag bytes |
308 | * @size: size | 308 | * @size: size |
@@ -314,10 +314,10 @@ EXPORT_SYMBOL(tty_insert_flip_string_fixed_flag); | |||
314 | * Locking: Called functions may take port->buf.lock | 314 | * Locking: Called functions may take port->buf.lock |
315 | */ | 315 | */ |
316 | 316 | ||
317 | int tty_insert_flip_string_flags(struct tty_struct *tty, | 317 | int tty_insert_flip_string_flags(struct tty_port *port, |
318 | const unsigned char *chars, const char *flags, size_t size) | 318 | const unsigned char *chars, const char *flags, size_t size) |
319 | { | 319 | { |
320 | struct tty_bufhead *buf = &tty->port->buf; | 320 | struct tty_bufhead *buf = &port->buf; |
321 | int copied = 0; | 321 | int copied = 0; |
322 | do { | 322 | do { |
323 | int goal = min_t(size_t, size - copied, TTY_BUFFER_PAGE); | 323 | int goal = min_t(size_t, size - copied, TTY_BUFFER_PAGE); |
@@ -326,7 +326,7 @@ int tty_insert_flip_string_flags(struct tty_struct *tty, | |||
326 | struct tty_buffer *tb; | 326 | struct tty_buffer *tb; |
327 | 327 | ||
328 | spin_lock_irqsave(&buf->lock, __flags); | 328 | spin_lock_irqsave(&buf->lock, __flags); |
329 | space = __tty_buffer_request_room(tty->port, goal); | 329 | space = __tty_buffer_request_room(port, goal); |
330 | tb = buf->tail; | 330 | tb = buf->tail; |
331 | /* If there is no space then tb may be NULL */ | 331 | /* If there is no space then tb may be NULL */ |
332 | if (unlikely(space == 0)) { | 332 | if (unlikely(space == 0)) { |
@@ -376,7 +376,7 @@ EXPORT_SYMBOL(tty_schedule_flip); | |||
376 | 376 | ||
377 | /** | 377 | /** |
378 | * tty_prepare_flip_string - make room for characters | 378 | * tty_prepare_flip_string - make room for characters |
379 | * @tty: tty | 379 | * @port: tty port |
380 | * @chars: return pointer for character write area | 380 | * @chars: return pointer for character write area |
381 | * @size: desired size | 381 | * @size: desired size |
382 | * | 382 | * |
@@ -389,16 +389,16 @@ EXPORT_SYMBOL(tty_schedule_flip); | |||
389 | * Locking: May call functions taking port->buf.lock | 389 | * Locking: May call functions taking port->buf.lock |
390 | */ | 390 | */ |
391 | 391 | ||
392 | int tty_prepare_flip_string(struct tty_struct *tty, unsigned char **chars, | 392 | int tty_prepare_flip_string(struct tty_port *port, unsigned char **chars, |
393 | size_t size) | 393 | size_t size) |
394 | { | 394 | { |
395 | struct tty_bufhead *buf = &tty->port->buf; | 395 | struct tty_bufhead *buf = &port->buf; |
396 | int space; | 396 | int space; |
397 | unsigned long flags; | 397 | unsigned long flags; |
398 | struct tty_buffer *tb; | 398 | struct tty_buffer *tb; |
399 | 399 | ||
400 | spin_lock_irqsave(&buf->lock, flags); | 400 | spin_lock_irqsave(&buf->lock, flags); |
401 | space = __tty_buffer_request_room(tty->port, size); | 401 | space = __tty_buffer_request_room(port, size); |
402 | 402 | ||
403 | tb = buf->tail; | 403 | tb = buf->tail; |
404 | if (likely(space)) { | 404 | if (likely(space)) { |
@@ -413,7 +413,7 @@ EXPORT_SYMBOL_GPL(tty_prepare_flip_string); | |||
413 | 413 | ||
414 | /** | 414 | /** |
415 | * tty_prepare_flip_string_flags - make room for characters | 415 | * tty_prepare_flip_string_flags - make room for characters |
416 | * @tty: tty | 416 | * @port: tty port |
417 | * @chars: return pointer for character write area | 417 | * @chars: return pointer for character write area |
418 | * @flags: return pointer for status flag write area | 418 | * @flags: return pointer for status flag write area |
419 | * @size: desired size | 419 | * @size: desired size |
@@ -427,16 +427,16 @@ EXPORT_SYMBOL_GPL(tty_prepare_flip_string); | |||
427 | * Locking: May call functions taking port->buf.lock | 427 | * Locking: May call functions taking port->buf.lock |
428 | */ | 428 | */ |
429 | 429 | ||
430 | int tty_prepare_flip_string_flags(struct tty_struct *tty, | 430 | int tty_prepare_flip_string_flags(struct tty_port *port, |
431 | unsigned char **chars, char **flags, size_t size) | 431 | unsigned char **chars, char **flags, size_t size) |
432 | { | 432 | { |
433 | struct tty_bufhead *buf = &tty->port->buf; | 433 | struct tty_bufhead *buf = &port->buf; |
434 | int space; | 434 | int space; |
435 | unsigned long __flags; | 435 | unsigned long __flags; |
436 | struct tty_buffer *tb; | 436 | struct tty_buffer *tb; |
437 | 437 | ||
438 | spin_lock_irqsave(&buf->lock, __flags); | 438 | spin_lock_irqsave(&buf->lock, __flags); |
439 | space = __tty_buffer_request_room(tty->port, size); | 439 | space = __tty_buffer_request_room(port, size); |
440 | 440 | ||
441 | tb = buf->tail; | 441 | tb = buf->tail; |
442 | if (likely(space)) { | 442 | if (likely(space)) { |