aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/tty_buffer.c
diff options
context:
space:
mode:
authorPeter Hurley <peter@hurleysoftware.com>2013-11-22 12:09:56 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-12-08 19:57:38 -0500
commit5dda4ca5585270c7d6854da5f83e8e8d3e157094 (patch)
tree118b0d649f8867ec75207ba9ccb41b1e978c11c9 /drivers/tty/tty_buffer.c
parent4d18e6eff81e1d4d81d0942d5b7e96904b3b32df (diff)
tty: Rename tty buffer memory_used field
Trim up the memory_used field name to mem_used. Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/tty_buffer.c')
-rw-r--r--drivers/tty/tty_buffer.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c
index 57eb34b2ec24..e8f22f833b4e 100644
--- a/drivers/tty/tty_buffer.c
+++ b/drivers/tty/tty_buffer.c
@@ -89,7 +89,7 @@ void tty_buffer_unlock_exclusive(struct tty_port *port)
89 89
90int tty_buffer_space_avail(struct tty_port *port) 90int tty_buffer_space_avail(struct tty_port *port)
91{ 91{
92 int space = port->buf.mem_limit - atomic_read(&port->buf.memory_used); 92 int space = port->buf.mem_limit - atomic_read(&port->buf.mem_used);
93 return max(space, 0); 93 return max(space, 0);
94} 94}
95 95
@@ -129,7 +129,7 @@ void tty_buffer_free_all(struct tty_port *port)
129 buf->head = &buf->sentinel; 129 buf->head = &buf->sentinel;
130 buf->tail = &buf->sentinel; 130 buf->tail = &buf->sentinel;
131 131
132 atomic_set(&buf->memory_used, 0); 132 atomic_set(&buf->mem_used, 0);
133} 133}
134 134
135/** 135/**
@@ -162,7 +162,7 @@ static struct tty_buffer *tty_buffer_alloc(struct tty_port *port, size_t size)
162 162
163 /* Should possibly check if this fails for the largest buffer we 163 /* Should possibly check if this fails for the largest buffer we
164 have queued and recycle that ? */ 164 have queued and recycle that ? */
165 if (atomic_read(&port->buf.memory_used) > port->buf.mem_limit) 165 if (atomic_read(&port->buf.mem_used) > port->buf.mem_limit)
166 return NULL; 166 return NULL;
167 p = kmalloc(sizeof(struct tty_buffer) + 2 * size, GFP_ATOMIC); 167 p = kmalloc(sizeof(struct tty_buffer) + 2 * size, GFP_ATOMIC);
168 if (p == NULL) 168 if (p == NULL)
@@ -170,7 +170,7 @@ static struct tty_buffer *tty_buffer_alloc(struct tty_port *port, size_t size)
170 170
171found: 171found:
172 tty_buffer_reset(p, size); 172 tty_buffer_reset(p, size);
173 atomic_add(size, &port->buf.memory_used); 173 atomic_add(size, &port->buf.mem_used);
174 return p; 174 return p;
175} 175}
176 176
@@ -188,7 +188,7 @@ static void tty_buffer_free(struct tty_port *port, struct tty_buffer *b)
188 struct tty_bufhead *buf = &port->buf; 188 struct tty_bufhead *buf = &port->buf;
189 189
190 /* Dumb strategy for now - should keep some stats */ 190 /* Dumb strategy for now - should keep some stats */
191 WARN_ON(atomic_sub_return(b->size, &buf->memory_used) < 0); 191 WARN_ON(atomic_sub_return(b->size, &buf->mem_used) < 0);
192 192
193 if (b->size > MIN_TTYB_SIZE) 193 if (b->size > MIN_TTYB_SIZE)
194 kfree(b); 194 kfree(b);
@@ -533,7 +533,7 @@ void tty_buffer_init(struct tty_port *port)
533 buf->head = &buf->sentinel; 533 buf->head = &buf->sentinel;
534 buf->tail = &buf->sentinel; 534 buf->tail = &buf->sentinel;
535 init_llist_head(&buf->free); 535 init_llist_head(&buf->free);
536 atomic_set(&buf->memory_used, 0); 536 atomic_set(&buf->mem_used, 0);
537 atomic_set(&buf->priority, 0); 537 atomic_set(&buf->priority, 0);
538 INIT_WORK(&buf->work, flush_to_ldisc); 538 INIT_WORK(&buf->work, flush_to_ldisc);
539 buf->mem_limit = TTYB_DEFAULT_MEM_LIMIT; 539 buf->mem_limit = TTYB_DEFAULT_MEM_LIMIT;