From: Peter Hurley <peter@hurleysoftware.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jslaby@suse.cz>,
linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
Peter Hurley <peter@hurleysoftware.com>
Subject: [PATCH tty-next 3/5] tty: Rename tty buffer memory_used field
Date: Fri, 22 Nov 2013 12:09:56 -0500 [thread overview]
Message-ID: <1385140198-5822-4-git-send-email-peter@hurleysoftware.com> (raw)
In-Reply-To: <1385140198-5822-1-git-send-email-peter@hurleysoftware.com>
Trim up the memory_used field name to mem_used.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
---
drivers/tty/tty_buffer.c | 12 ++++++------
include/linux/tty.h | 2 +-
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c
index 57eb34b..e8f22f8 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)
int tty_buffer_space_avail(struct tty_port *port)
{
- int space = port->buf.mem_limit - atomic_read(&port->buf.memory_used);
+ int space = port->buf.mem_limit - atomic_read(&port->buf.mem_used);
return max(space, 0);
}
@@ -129,7 +129,7 @@ void tty_buffer_free_all(struct tty_port *port)
buf->head = &buf->sentinel;
buf->tail = &buf->sentinel;
- atomic_set(&buf->memory_used, 0);
+ atomic_set(&buf->mem_used, 0);
}
/**
@@ -162,7 +162,7 @@ static struct tty_buffer *tty_buffer_alloc(struct tty_port *port, size_t size)
/* Should possibly check if this fails for the largest buffer we
have queued and recycle that ? */
- if (atomic_read(&port->buf.memory_used) > port->buf.mem_limit)
+ if (atomic_read(&port->buf.mem_used) > port->buf.mem_limit)
return NULL;
p = kmalloc(sizeof(struct tty_buffer) + 2 * size, GFP_ATOMIC);
if (p == NULL)
@@ -170,7 +170,7 @@ static struct tty_buffer *tty_buffer_alloc(struct tty_port *port, size_t size)
found:
tty_buffer_reset(p, size);
- atomic_add(size, &port->buf.memory_used);
+ atomic_add(size, &port->buf.mem_used);
return p;
}
@@ -188,7 +188,7 @@ static void tty_buffer_free(struct tty_port *port, struct tty_buffer *b)
struct tty_bufhead *buf = &port->buf;
/* Dumb strategy for now - should keep some stats */
- WARN_ON(atomic_sub_return(b->size, &buf->memory_used) < 0);
+ WARN_ON(atomic_sub_return(b->size, &buf->mem_used) < 0);
if (b->size > MIN_TTYB_SIZE)
kfree(b);
@@ -533,7 +533,7 @@ void tty_buffer_init(struct tty_port *port)
buf->head = &buf->sentinel;
buf->tail = &buf->sentinel;
init_llist_head(&buf->free);
- atomic_set(&buf->memory_used, 0);
+ atomic_set(&buf->mem_used, 0);
atomic_set(&buf->priority, 0);
INIT_WORK(&buf->work, flush_to_ldisc);
buf->mem_limit = TTYB_DEFAULT_MEM_LIMIT;
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 58a34e7..ed9aedd 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -60,7 +60,7 @@ struct tty_bufhead {
atomic_t priority;
struct tty_buffer sentinel;
struct llist_head free; /* Free queue head */
- atomic_t memory_used; /* In-use buffers excluding free list */
+ atomic_t mem_used; /* In-use buffers excluding free list */
int mem_limit;
struct tty_buffer *tail; /* Active buffer */
};
--
1.8.1.2
next prev parent reply other threads:[~2013-11-22 17:09 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-22 17:09 [PATCH tty-next 0/5] Halve tty buffer memory consumption Peter Hurley
2013-11-22 17:09 ` [PATCH tty-next 1/5] tty: Always handle NULL flag ptr Peter Hurley
2013-11-22 22:20 ` Dmitry Torokhov
2013-11-26 2:00 ` Peter Hurley
2013-12-02 18:56 ` [PATCH v2 " Peter Hurley
2013-12-02 19:09 ` Dmitry Torokhov
2013-11-22 17:09 ` [PATCH tty-next 2/5] tty: Enable configurable tty flip buffer limit Peter Hurley
2013-11-22 17:09 ` Peter Hurley [this message]
2013-11-22 17:09 ` [PATCH tty-next 4/5] tty: Remove tty_prepare_flip_string_flags() Peter Hurley
2013-11-22 17:09 ` [PATCH tty-next 5/5] tty: Halve flip buffer GFP_ATOMIC memory consumption Peter Hurley
2013-12-09 1:01 ` Greg Kroah-Hartman
2013-12-09 13:27 ` Peter Hurley
2013-12-09 14:23 ` [PATCH tty-next v3 " Peter Hurley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1385140198-5822-4-git-send-email-peter@hurleysoftware.com \
--to=peter@hurleysoftware.com \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).