25 Jun, 2016
2 commits
-
STD_COM_FLAGS is mostly a bad name for what the drivers thinks it is.
Stop using it and pass the flags directly.cyclades defines it as 0, so we do not assign anything to freshly
tty_port_init'ed structure.Signed-off-by: Jiri Slaby
Signed-off-by: Greg Kroah-Hartman -
Do not initialize members of initialized structures to zero. They are
zeroed automatically.Part of hub6 cleanup series.
Signed-off-by: Jiri Slaby
Signed-off-by: Greg Kroah-Hartman
01 May, 2016
3 commits
-
Replace ASYNC_INITIALIZED bit in the tty_port::flags field with
TTY_PORT_INITIALIZED bit in the tty_port::iflags field. Introduce helpers
tty_port_set_initialized() and tty_port_initialized() to abstract
atomic bit ops.Note: the transforms for test_and_set_bit() and test_and_clear_bit()
are unnecessary as the state transitions are already mutually exclusive;
the tty lock prevents concurrent open/close/hangup.Signed-off-by: Peter Hurley
Signed-off-by: Greg Kroah-Hartman -
Replace ASYNC_CHECK_CD bit in the tty_port::flags field with
TTY_PORT_CHECK_CD bit in the tty_port::iflags field. Introduce helpers
tty_port_set_check_carrier() and tty_port_check_carrier() to abstract
the atomic bit ops.Signed-off-by: Peter Hurley
Signed-off-by: Greg Kroah-Hartman -
Replace ASYNC_CTS_FLOW bit in the tty_port::flags field with
TTY_PORT_CTS_FLOW bit in the tty_port::iflags field. Add
tty_port_set_cts_flow() helper to abstract the atomic bit ops.Signed-off-by: Peter Hurley
Signed-off-by: Greg Kroah-Hartman
29 Jan, 2016
1 commit
-
Expressions of the form "tty->termios.c_*flag & FLAG"
are more clearly expressed with the termios flags macros,
I_FLAG(), C_FLAG(), O_FLAG(), and L_FLAG().Convert treewide.
Signed-off-by: Peter Hurley
Acked-by: Johan Hovold
Signed-off-by: Greg Kroah-Hartman
28 Jan, 2016
1 commit
-
The chars_in_buffer() line discipline method serves no functional
purpose, other than as a (dubious) debugging aid for mostly bit-rotting
drivers. Despite being documented as an optional method, every caller
is unconditionally executed (although conditionally compiled).
Furthermore, direct tty->ldisc access without an ldisc ref is unsafe.
Lastly, N_TTY's chars_in_buffer() has warned of removal since 3.12.Signed-off-by: Peter Hurley
Signed-off-by: Greg Kroah-Hartman
14 Dec, 2015
4 commits
-
This function compiles to 58 bytes of machine code.
Signed-off-by: Denys Vlasenko
CC: Jiri Slaby
CC: linux-serial@vger.kernel.org
Reviewed-by: Peter Hurley
Signed-off-by: Greg Kroah-Hartman -
This function compiles to 52 bytes of machine code.
Signed-off-by: Denys Vlasenko
CC: Jiri Slaby
CC: linux-serial@vger.kernel.org
Reviewed-by: Peter Hurley
Signed-off-by: Greg Kroah-Hartman -
This function compiles to 35 bytes of machine code.
Signed-off-by: Denys Vlasenko
CC: Jiri Slaby
CC: linux-serial@vger.kernel.org
Reviewed-by: Peter Hurley
Signed-off-by: Greg Kroah-Hartman -
This function compiles to 32 bytes of machine code.
Signed-off-by: Denys Vlasenko
CC: Jiri Slaby
CC: linux-serial@vger.kernel.org
Reviewed-by: Peter Hurley
Signed-off-by: Greg Kroah-Hartman
18 Oct, 2015
1 commit
-
Since at least before 2.6.30, tty drivers that do not drop the tty lock
while closing cannot observe ASYNC_CLOSING set while holding the
tty lock; this includes the tty driver's open() and hangup() methods,
since the tty core calls these methods holding the tty lock.For these drivers, waiting for ASYNC_CLOSING to clear while opening
is not required, since this condition cannot occur. Similarly, even
when the open() method drops and reacquires the tty lock after
blocking, ASYNC_CLOSING cannot be set (again, for drivers that
do not drop the tty lock while closing).Now that tty port drivers no longer drop the tty lock while closing
(since 'tty: Remove tty_wait_until_sent_from_close()'), the same
conditions apply: waiting for ASYNC_CLOSING to clear while opening
is not required, nor is re-checking ASYNC_CLOSING after dropping and
reacquiring the tty lock while blocking (eg., in *_block_til_ready()).Note: The ASYNC_CLOSING flag state is still maintained since several
bitrotting drivers use it for (dubious) other purposes.Signed-off-by: Peter Hurley
Signed-off-by: Greg Kroah-Hartman
07 May, 2015
1 commit
-
tty_name no longer uses the buf parameter, so remove it along with all
the 64 byte stack buffers that used to be passed in.Mostly generated by the coccinelle script
@depends on patch@
identifier buf;
constant C;
expression tty;
@@
- char buf[C];
allmodconfig compiles, so I'm fairly confident the stack buffers
weren't used for other purposes as well.Signed-off-by: Rasmus Villemoes
Reviewed-by: Peter Hurley
Acked-by: Jesper Nilsson
Acked-by: Dmitry Torokhov
Signed-off-by: Greg Kroah-Hartman
11 Jul, 2014
1 commit
-
Since at least before 2.6.30, it has not been possible to observe
a hung up file pointer in a tty driver's open() method unless/until
the driver open() releases the tty_lock() (eg., before blocking).This is because tty_open() adds the file pointer while holding
the tty_lock() _and_ doesn't release the lock until after calling
the tty driver's open() method. [ Before tty_lock(), this was
lock_kernel(). ]Since __tty_hangup() first waits on the tty_lock() before
enumerating and hanging up the open file pointers, either
__tty_hangup() will wait for the tty_lock() or tty_open() will
not yet have added the file pointer. For example,CPU 0 | CPU 1
|
tty_open | __tty_hangup
.. | ..
tty_lock | ..
tty_reopen | tty_lock / blocks
.. |
tty_add_file(tty, filp) |
.. |
tty->ops->open(tty, filp) |
tty_port_open |
tty_port_block_til_ready |
.. |
while (1) |
.. |
tty_unlock | / unblocks
schedule | for each filp on tty->tty_files
| f_ops = tty_hung_up_fops;
| ..
| tty_unlock
tty_lock |
.. |
tty_unlock |Note that since tty_port_block_til_ready() and similar drop
the tty_lock while blocking, when woken, the file pointer
must then be tested for having been hung up.Also, fix bit-rotted drivers that used extra_count to track the
port->count bump.CC: Mikael Starvik
CC: Samuel Ortiz
CC: "David S. Miller"
Signed-off-by: Peter Hurley
Acked-by: Jesper Nilsson
Signed-off-by: Greg Kroah-Hartman
21 Dec, 2013
1 commit
-
there is an overflow in the code :
cyz_polling_cycle = (arg * HZ) / 1000,
the multiplicator arg comes from user, so it may be an overflow if
arg is a big number. And the value of cyc_polling_cycle will be
wrong when it is used next time.Reported-by: Qixue Xiao
Suggested-by: Yongjian Xu
Suggested-by: Yu Chen
Signed-off-by: Qixue Xiao
Signed-off-by: Greg Kroah-Hartman
19 Mar, 2013
1 commit
-
It allows for cleaning up on a considerable amount of places. They did
port_get, hangup, kref_put. Now the only thing needed is to call
tty_port_tty_hangup which does exactly that. And they can also decide
whether to consider CLOCAL or completely ignore that.Signed-off-by: Jiri Slaby
Signed-off-by: Greg Kroah-Hartman
16 Jan, 2013
5 commits
-
Now, the tty is not needed at all places in the ISR. So we can just
request in on demand when really needed.This cleans TX and RX paths a bit as the indentation level can be
dropped by two now when we also invert the char_count if condition.Signed-off-by: Jiri Slaby
Signed-off-by: Greg Kroah-Hartman -
Now, we start converting tty buffer functions to actually use
tty_port. This will allow us to get rid of the need of tty in many
call sites. Only tty_port will needed and hence no more
tty_port_tty_get in those paths.This is the last one: tty_schedule_flip
Signed-off-by: Jiri Slaby
Signed-off-by: Greg Kroah-Hartman -
Now, we start converting tty buffer functions to actually use
tty_port. This will allow us to get rid of the need of tty in many
call sites. Only tty_port will needed and hence no more
tty_port_tty_get in those paths.tty_insert_flip_char is the next one to proceed. This one is used all
over the code, so the patch is huge.Signed-off-by: Jiri Slaby
Signed-off-by: Greg Kroah-Hartman -
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_flagsSigned-off-by: Jiri Slaby
Signed-off-by: Greg Kroah-Hartman -
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.Here we start with tty_buffer_request_room.
Signed-off-by: Jiri Slaby
Signed-off-by: Greg Kroah-Hartman
22 Nov, 2012
3 commits
-
CONFIG_HOTPLUG is going away as an option so __devexit is no
longer needed.Signed-off-by: Bill Pemberton
Cc: Jiri Slaby
Cc: Alan Cox
Acked-by: Tobias Klauser
Cc: Lucas Tavares
Cc: Daniel Walker
Cc: Bryan Huntsman
Cc: "David S. Miller"
Cc: Peter Korsgaard
Cc: Tony Prisk
Acked-by: David Brown
Signed-off-by: Greg Kroah-Hartman -
CONFIG_HOTPLUG is going away as an option so __devinit is no longer
needed.Signed-off-by: Bill Pemberton
Cc: Jiri Slaby
Cc: Alan Cox
Cc: Lucas Tavares
Cc: "David S. Miller"
Cc: Peter Korsgaard
Cc: Tony Prisk
Acked-by: Tobias Klauser
Acked-by: Nicolas Ferre
Signed-off-by: Greg Kroah-Hartman -
CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer
needed.Signed-off-by: Bill Pemberton
Cc: Jiri Slaby
Signed-off-by: Greg Kroah-Hartman
16 Nov, 2012
1 commit
-
After commit "TTY: move tty buffers to tty_port", the tty buffers are
not freed in some drivers. This is because tty_port_destructor is not
called whenever a tty_port is freed. This was an assumption I counted
with but was unfortunately untrue. So fix the drivers to fulfil this
assumption.To be sure, the TTY buffers (and later some stuff) are gone along with
the tty_port, we have to call tty_port_destroy at tear-down places.
This is mostly where the structure containing a tty_port is freed.
This patch does exactly that -- put tty_port_destroy at those places.Signed-off-by: Jiri Slaby
Signed-off-by: Greg Kroah-Hartman
06 Sep, 2012
1 commit
-
In most of the time, the driver needs to check if the cts flow control
is enabled. But now, the driver checks the ASYNC_CTS_FLOW flag manually,
which is not a grace way. So add a new wraper function to make the code
tidy and clean.Signed-off-by: Huang Shijie
Signed-off-by: Greg Kroah-Hartman
14 Aug, 2012
1 commit
-
Currently we have no way to assign tty->port while performing tty
installation. There are two ways to provide the link tty_struct =>
tty_port. Either by calling tty_port_install from tty->ops->install or
tty_port_register_device called instead of tty_register_device when
the device is being set up after connected.In this patch we modify most of the drivers to do the latter. When the
drivers use tty_register_device and we have tty_port already, we
switch to tty_port_register_device. So we have the tty_struct =>
tty_port link for free for those.Signed-off-by: Jiri Slaby
Acked-by: Alan Cox
Signed-off-by: Greg Kroah-Hartman
11 Aug, 2012
1 commit
-
The termios and other changes mean the other protections needed on the driver
tty arrays should be adequate. Turn it all back on.This contains pieces folded in from the fixes made to the original patches
| From: Geert Uytterhoeven (fix m68k)
| From: Paul Gortmaker (fix cris)
| From: Jiri Kosina (lockdep)
| From: Eric Dumazet (lockdep)Signed-off-by: Alan Cox
Signed-off-by: Greg Kroah-Hartman
17 Jul, 2012
2 commits
-
This will let us sort out a whole pile of tty related races. The
alternative would be to keep points and refcount the termios objects.
However
1. They are tiny anyway
2. Many devices don't use the stored copies
3. We can remove a pty special caseSigned-off-by: Alan Cox
Signed-off-by: Greg Kroah-Hartman -
I sent GregKH this after the pre-requisites. He dropped the pre-requesites
for good reason and unfortunately then applied this patch. Without this
reverted you get random kernel memory corruption which will make bisecting
anything between it and the properly applied patches a complete sod.Signed-off-by: Alan Cox
Signed-off-by: Greg Kroah-Hartman
07 Jul, 2012
1 commit
-
The termios and other changes mean the other protections needed on the driver
tty arrays should be adequate. Turn it all back on.This contains pieces folded in from the fixes made to the original patches
| From: Geert Uytterhoeven (fix m68k)
| From: Paul Gortmaker (fix cris)
| From: Jiri Kosina (lockdep)
| From: Eric Dumazet (lockdep)Signed-off-by: Alan Cox
Signed-off-by: Greg Kroah-Hartman
13 Jun, 2012
1 commit
-
cy_pci_probe and cy_detect_isa reference cy_card[card_no] many times.
It makes the code hard to read. Let us add a local variable holding a
pointer to the card indexed by card_no and use that.Signed-off-by: Jiri Slaby
Signed-off-by: Greg Kroah-Hartman
03 Jun, 2012
1 commit
-
This reverts the tty layer change to use per-tty locking, because it's
not correct yet, and fixing it will require some more deep surgery.The main revert is d29f3ef39be4 ("tty_lock: Localise the lock"), but
there are several smaller commits that built upon it, they also get
reverted here. The list of reverted commits is:fde86d310886 - tty: add lockdep annotations
8f6576ad476b - tty: fix ldisc lock inversion trace
d3ca8b64b97e - pty: Fix lock inversion
b1d679afd766 - tty: drop the pty lock during hangup
abcefe5fc357 - tty/amiserial: Add missing argument for tty_unlock()
fd11b42e3598 - cris: fix missing tty arg in wait_event_interruptible_tty call
d29f3ef39be4 - tty_lock: Localise the lockThe revert had a trivial conflict in the 68360serial.c staging driver
that got removed in the meantime.Signed-off-by: Linus Torvalds
05 May, 2012
1 commit
-
In each remaining case the tty_lock is associated with a specific tty. This
means we can now lock on a per tty basis. We do need tty_lock_pair() for
the pty case. Uglier but still a step in the right direction.[fixed up calls in 3 missing drivers - gregkh]
Signed-off-by: Alan Cox
Acked-by: Arnd Bergmann
Signed-off-by: Greg Kroah-Hartman
09 Mar, 2012
3 commits
-
Checking if tty->index is in bounds is not needed. The tty has the
index set in the initial open. This is done in get_tty_driver. And it
can be only in interval num).So remove the tests which check exactly this interval. Some are
left untouched as they check against the current backing device count.
(Leaving apart that the check is racy in most of the cases.)Signed-off-by: Jiri Slaby
Signed-off-by: Greg Kroah-Hartman -
All num, magic and owner are set by alloc_tty_driver. No need to
re-set them on each allocation site.pti driver sets something different to what it passes to
alloc_tty_driver. It is not a bug, since we don't use the lines
parameter in any way. Anyway this is fixed, and now we do the right
thing.Signed-off-by: Jiri Slaby
Acked-by: Tilman Schmidt
Signed-off-by: Greg Kroah-Hartman -
TIOCSERGETLSR should be saved in a uint so the cast here to unsigned
long is a bug.Reported-by: Jiri Slaby
Signed-off-by: Dan Carpenter
Acked-by: Jiri Slaby
Signed-off-by: Greg Kroah-Hartman
23 Sep, 2011
1 commit
-
Since commit [e58aa3d2: genirq: Run irq handlers with interrupts disabled],
We run all interrupt handlers with interrupts disabled
and we even check and yell when an interrupt handler
returns with interrupts enabled (see commit [b738a50a:
genirq: Warn when handler enables interrupts]).So now this flag is a NOOP and can be removed.
Signed-off-by: Yong Zhang
Acked-by: Tobias Klauser
Signed-off-by: Greg Kroah-Hartman
24 Aug, 2011
1 commit
-
It makes the code really ugly. And since it can be enabled only before
building and only in the source files, it can be barely used by users.
That said, I've not seen anybody to use it in the past few years.This crap is copied to some more drivers over the tty tree. Since I'm
not their maintainer, I'm not sure if I should remove them too?Signed-off-by: Jiri Slaby
Signed-off-by: Greg Kroah-Hartman
27 May, 2011
1 commit
-
* 'trivial' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6:
gfs2: Drop __TIME__ usage
isdn/diva: Drop __TIME__ usage
atm: Drop __TIME__ usage
dlm: Drop __TIME__ usage
wan/pc300: Drop __TIME__ usage
parport: Drop __TIME__ usage
hdlcdrv: Drop __TIME__ usage
baycom: Drop __TIME__ usage
pmcraid: Drop __DATE__ usage
edac: Drop __DATE__ usage
rio: Drop __DATE__ usage
scsi/wd33c93: Drop __TIME__ usage
scsi/in2000: Drop __TIME__ usage
aacraid: Drop __TIME__ usage
media/cx231xx: Drop __TIME__ usage
media/radio-maxiradio: Drop __TIME__ usage
nozomi: Drop __TIME__ usage
cyclades: Drop __TIME__ usage