13 May, 2021

3 commits

  • Make tty_unregister_ldisc symmetric to tty_register_ldisc by accepting
    struct tty_ldisc_ops as a parameter instead of ldisc number. This avoids
    checking of the ldisc number bounds in tty_unregister_ldisc.

    Signed-off-by: Jiri Slaby
    Cc: William Hubbs
    Cc: Chris Brannon
    Cc: Kirk Reiser
    Cc: Samuel Thibault
    Cc: Marcel Holtmann
    Cc: Johan Hedberg
    Cc: Luiz Augusto von Dentz
    Cc: Dmitry Torokhov
    Cc: Arnd Bergmann
    Cc: "David S. Miller"
    Cc: Jakub Kicinski
    Cc: Wolfgang Grandegger
    Cc: Marc Kleine-Budde
    Cc: Andreas Koensgen
    Cc: Paul Mackerras
    Cc: Rodolfo Giometti
    Cc: Peter Ujfalusi
    Cc: Liam Girdwood
    Cc: Mark Brown
    Cc: Jaroslav Kysela
    Cc: Takashi Iwai
    Link: https://lore.kernel.org/r/20210505091928.22010-17-jslaby@suse.cz
    Signed-off-by: Greg Kroah-Hartman

    Jiri Slaby
     
  • There is no reason to pass the ldisc number to tty_register_ldisc
    separately. Just set it in the already defined tty_ldisc_ops in all the
    ldiscs.

    This simplifies tty_register_ldisc a bit too (no need to set the num
    member there).

    Signed-off-by: Jiri Slaby
    Cc: William Hubbs
    Cc: Chris Brannon
    Cc: Kirk Reiser
    Cc: Samuel Thibault
    Cc: Marcel Holtmann
    Cc: Johan Hedberg
    Cc: Luiz Augusto von Dentz
    Cc: Dmitry Torokhov
    Cc: Arnd Bergmann
    Cc: "David S. Miller"
    Cc: Jakub Kicinski
    Cc: Wolfgang Grandegger
    Cc: Marc Kleine-Budde
    Cc: Andreas Koensgen
    Cc: Paul Mackerras
    Cc: Rodolfo Giometti
    Cc: Peter Ujfalusi
    Cc: Liam Girdwood
    Cc: Mark Brown
    Cc: Jaroslav Kysela
    Cc: Takashi Iwai
    Link: https://lore.kernel.org/r/20210505091928.22010-15-jslaby@suse.cz
    Signed-off-by: Greg Kroah-Hartman

    Jiri Slaby
     
  • Char pointer (cp) passed to tty_ldisc_ops::receive_buf{,2} is const.
    There is no reason for flag pointer (fp) not to be too. So switch it in
    the definition and all uses.

    Signed-off-by: Jiri Slaby
    Cc: William Hubbs
    Cc: Chris Brannon
    Cc: Kirk Reiser
    Cc: Samuel Thibault
    Cc: Marcel Holtmann
    Cc: Johan Hedberg
    Cc: Luiz Augusto von Dentz
    Cc: Dmitry Torokhov
    Cc: Arnd Bergmann
    Cc: "David S. Miller"
    Cc: Jakub Kicinski
    Cc: Wolfgang Grandegger
    Cc: Marc Kleine-Budde
    Cc: Andreas Koensgen
    Cc: Paul Mackerras
    Cc: Liam Girdwood
    Cc: Mark Brown
    Cc: Jaroslav Kysela
    Cc: Takashi Iwai
    Cc: Peter Ujfalusi
    Link: https://lore.kernel.org/r/20210505091928.22010-12-jslaby@suse.cz
    Signed-off-by: Greg Kroah-Hartman

    Jiri Slaby
     

10 Mar, 2021

1 commit

  • First, it is never checked. Second, use of it as a debugging aid is
    at least questionable. With the current tools, I don't think anyone used
    this kind of thing for debugging purposes for years.

    On the top of that, e.g. serdev does not set this field of tty_ldisc_ops
    at all.

    So get rid of this legacy.

    Signed-off-by: Jiri Slaby
    Link: https://lore.kernel.org/r/20210302062214.29627-8-jslaby@suse.cz
    Signed-off-by: Greg Kroah-Hartman

    Jiri Slaby
     

21 Jan, 2021

1 commit

  • The tty line discipline .read() function was passed the final user
    pointer destination as an argument, which doesn't match the 'write()'
    function, and makes it very inconvenient to do a splice method for
    ttys.

    This is a conversion to use a kernel buffer instead.

    NOTE! It does this by passing the tty line discipline ->read() function
    an additional "cookie" to fill in, and an offset into the cookie data.

    The line discipline can fill in the cookie data with its own private
    information, and then the reader will repeat the read until either the
    cookie is cleared or it runs out of data.

    The only real user of this is N_HDLC, which can use this to handle big
    packets, even if the kernel buffer is smaller than the whole packet.

    Cc: Christoph Hellwig
    Cc: Greg Kroah-Hartman
    Cc: Al Viro
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

08 Nov, 2017

2 commits

  • Now that the SPDX tag is in all tty files, that identifies the license
    in a specific and legally-defined manner. So the extra GPL text wording
    can be removed as it is no longer needed at all.

    This is done on a quest to remove the 700+ different ways that files in
    the kernel describe the GPL license text. And there's unneeded stuff
    like the address (sometimes incorrect) for the FSF which is never
    needed.

    No copyright headers or other non-license-description text was removed.

    Cc: Jiri Slaby
    Cc: James Hogan
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     
  • It's good to have SPDX identifiers in all files to make it easier to
    audit the kernel tree for correct licenses.

    Update the drivers/tty files files with the correct SPDX license
    identifier based on the license text in the file itself. The SPDX
    identifier is a legally binding shorthand, which can be used instead of
    the full boiler plate text.

    This work is based on a script and data from Thomas Gleixner, Philippe
    Ombredanne, and Kate Stewart.

    Cc: Jiri Slaby
    Cc: Benjamin Herrenschmidt
    Cc: Paul Mackerras
    Cc: Michael Ellerman
    Cc: Chris Metcalf
    Cc: Jiri Kosina
    Cc: David Sterba
    Cc: James Hogan
    Cc: Rob Herring
    Cc: Eric Anholt
    Cc: Stefan Wahren
    Cc: Florian Fainelli
    Cc: Ray Jui
    Cc: Scott Branden
    Cc: bcm-kernel-feedback-list@broadcom.com
    Cc: "James E.J. Bottomley"
    Cc: Helge Deller
    Cc: Joachim Eastwood
    Cc: Matthias Brugger
    Cc: Masahiro Yamada
    Cc: Tobias Klauser
    Cc: Russell King
    Cc: Vineet Gupta
    Cc: Richard Genoud
    Cc: Alexander Shiyan
    Cc: Baruch Siach
    Cc: "Maciej W. Rozycki"
    Cc: "Uwe Kleine-König"
    Cc: Pat Gefre
    Cc: "Guilherme G. Piccoli"
    Cc: Jason Wessel
    Cc: Vladimir Zapolskiy
    Cc: Sylvain Lemieux
    Cc: Carlo Caione
    Cc: Kevin Hilman
    Cc: Liviu Dudau
    Cc: Sudeep Holla
    Cc: Lorenzo Pieralisi
    Cc: Andy Gross
    Cc: David Brown
    Cc: "Andreas Färber"
    Cc: Kevin Cernekee
    Cc: Laxman Dewangan
    Cc: Thierry Reding
    Cc: Jonathan Hunter
    Cc: Barry Song
    Cc: Patrice Chotard
    Cc: Maxime Coquelin
    Cc: Alexandre Torgue
    Cc: "David S. Miller"
    Cc: Peter Korsgaard
    Cc: Timur Tabi
    Cc: Tony Prisk
    Cc: Michal Simek
    Cc: "Sören Brinkmann"
    Cc: Thomas Gleixner
    Cc: Kate Stewart
    Cc: Philippe Ombredanne
    Cc: Jiri Slaby
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

03 Jun, 2017

1 commit

  • Historically the N_TTY driver could never fail but this has become broken over
    time. Rather than trying to rewrite half the ldisc layer to fix the breakage
    introduce a second level of fallback with an N_NULL ldisc which cannot fail,
    and thus restore the guarantees required by the ldisc layer.

    We still try and fail to N_TTY first. It's much more useful to find yourself
    back in your old ldisc (first attempt) or in N_TTY (second attempt), and while
    I'm not aware of any code out there that makes those assumptions it's good to
    drive(r) defensively.

    Signed-off-by: Alan Cox
    Reported-by: Dmitry Vyukov
    Tested-by: Dmitry Vyukov
    Signed-off-by: Greg Kroah-Hartman

    Alan Cox