From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] minor TTY changes for 2.5.53
Date: Mon, 30 Dec 2002 01:06:17 -0800 [thread overview]
Message-ID: <20021230090617.GE29926@kroah.com> (raw)
In-Reply-To: <20021230090456.GD29926@kroah.com>
ChangeSet 1.956.3.4, 2002/12/29 23:59:37-08:00, greg@kroah.com
TTY: replace MIN and MAX macro usages with min() and max()
diff -Nru a/drivers/char/n_tty.c b/drivers/char/n_tty.c
--- a/drivers/char/n_tty.c Mon Dec 30 01:04:37 2002
+++ b/drivers/char/n_tty.c Mon Dec 30 01:04:37 2002
@@ -48,10 +48,6 @@
#define IS_CONSOLE_DEV(dev) (kdev_val(dev) == __mkdev(TTY_MAJOR,0))
#define IS_SYSCONS_DEV(dev) (kdev_val(dev) == __mkdev(TTYAUX_MAJOR,1))
-#ifndef MIN
-#define MIN(a,b) ((a) < (b) ? (a) : (b))
-#endif
-
/* number of characters left in xmit buffer before select has we have room */
#define WAKEUP_CHARS 256
@@ -725,16 +721,18 @@
if (tty->real_raw) {
spin_lock_irqsave(&tty->read_lock, cpuflags);
- i = MIN(count, MIN(N_TTY_BUF_SIZE - tty->read_cnt,
- N_TTY_BUF_SIZE - tty->read_head));
+ i = min(N_TTY_BUF_SIZE - tty->read_cnt,
+ N_TTY_BUF_SIZE - tty->read_head);
+ i = min(count, i);
memcpy(tty->read_buf + tty->read_head, cp, i);
tty->read_head = (tty->read_head + i) & (N_TTY_BUF_SIZE-1);
tty->read_cnt += i;
cp += i;
count -= i;
- i = MIN(count, MIN(N_TTY_BUF_SIZE - tty->read_cnt,
- N_TTY_BUF_SIZE - tty->read_head));
+ i = min(N_TTY_BUF_SIZE - tty->read_cnt,
+ N_TTY_BUF_SIZE - tty->read_head);
+ i = min(count, i);
memcpy(tty->read_buf + tty->read_head, cp, i);
tty->read_head = (tty->read_head + i) & (N_TTY_BUF_SIZE-1);
tty->read_cnt += i;
@@ -915,7 +913,8 @@
retval = 0;
spin_lock_irqsave(&tty->read_lock, flags);
- n = MIN(*nr, MIN(tty->read_cnt, N_TTY_BUF_SIZE - tty->read_tail));
+ n = min(tty->read_cnt, N_TTY_BUF_SIZE - tty->read_tail);
+ n = min((ssize_t)*nr, n);
spin_unlock_irqrestore(&tty->read_lock, flags);
if (n) {
mb();
diff -Nru a/drivers/char/pty.c b/drivers/char/pty.c
--- a/drivers/char/pty.c Mon Dec 30 01:04:37 2002
+++ b/drivers/char/pty.c Mon Dec 30 01:04:37 2002
@@ -64,8 +64,6 @@
static struct pty_struct ptm_state[UNIX98_NR_MAJORS][NR_PTYS];
#endif
-#define MIN(a,b) ((a) < (b) ? (a) : (b))
-
static void pty_close(struct tty_struct * tty, struct file * filp)
{
if (!tty)
@@ -156,7 +154,7 @@
n = count;
if (!n) break;
- n = MIN(n, PTY_BUF_SIZE);
+ n = min(n, PTY_BUF_SIZE);
n -= copy_from_user(temp_buffer, buf, n);
if (!n) {
if (!c)
diff -Nru a/drivers/char/tty_io.c b/drivers/char/tty_io.c
--- a/drivers/char/tty_io.c Mon Dec 30 01:04:37 2002
+++ b/drivers/char/tty_io.c Mon Dec 30 01:04:37 2002
@@ -159,13 +159,6 @@
extern void tx3912_rs_init(void);
extern void hvc_console_init(void);
-#ifndef MIN
-#define MIN(a,b) ((a) < (b) ? (a) : (b))
-#endif
-#ifndef MAX
-#define MAX(a,b) ((a) < (b) ? (b) : (a))
-#endif
-
static struct tty_struct *alloc_tty_struct(void)
{
struct tty_struct *tty;
@@ -714,7 +707,7 @@
unlock_kernel();
} else {
for (;;) {
- unsigned long size = MAX(PAGE_SIZE*2,16384);
+ unsigned long size = max((unsigned long)PAGE_SIZE*2, 16384UL);
if (size > count)
size = count;
lock_kernel();
prev parent reply other threads:[~2002-12-30 9:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-12-30 9:02 [BK PATCH] minor TTY changes for 2.5.53 Greg KH
2002-12-30 9:03 ` [PATCH] " Greg KH
2002-12-30 9:04 ` Greg KH
2002-12-30 9:04 ` Greg KH
2002-12-30 9:06 ` Greg KH [this message]
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=20021230090617.GE29926@kroah.com \
--to=greg@kroah.com \
--cc=linux-kernel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.