Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
a3a2b130
Commit
a3a2b130
authored
Dec 29, 2002
by
Greg Kroah-Hartman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TTY: replace MIN and MAX macro usages with min() and max()
parent
e29145f4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
20 deletions
+10
-20
drivers/char/n_tty.c
drivers/char/n_tty.c
+8
-9
drivers/char/pty.c
drivers/char/pty.c
+1
-3
drivers/char/tty_io.c
drivers/char/tty_io.c
+1
-8
No files found.
drivers/char/n_tty.c
View file @
a3a2b130
...
...
@@ -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 @@ static void n_tty_receive_buf(struct tty_struct *tty, const unsigned char *cp,
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 @@ static inline int copy_from_read_buf(struct tty_struct *tty,
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
();
...
...
drivers/char/pty.c
View file @
a3a2b130
...
...
@@ -64,8 +64,6 @@ static struct termios *pts_termios_locked[UNIX98_NR_MAJORS][NR_PTYS];
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 @@ static int pty_write(struct tty_struct * tty, int from_user,
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
)
...
...
drivers/char/tty_io.c
View file @
a3a2b130
...
...
@@ -159,13 +159,6 @@ extern void tx3912_console_init(void);
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 @@ static inline ssize_t do_tty_write(
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
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment