From 03b3b1a2405ccd71570cd5ec1fe4abd7bb4891cb Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Wed, 5 May 2021 11:19:15 +0200 Subject: tty: make tty_operations::write_room return uint Line disciplines expect a positive value or zero returned from tty->ops->write_room (invoked by tty_write_room). So make this assumption explicit by using unsigned int as a return value. Both of tty->ops->write_room and tty_write_room. Signed-off-by: Jiri Slaby Acked-by: Laurentiu Tudor Acked-by: Alex Elder Acked-by: Max Filippov # xtensa Acked-by: David Sterba Acked-By: Anton Ivanov Acked-by: Geert Uytterhoeven Cc: Richard Henderson Cc: Ivan Kokshaysky Cc: Matt Turner Cc: "James E.J. Bottomley" Cc: Helge Deller Cc: Jeff Dike Cc: Richard Weinberger Cc: Chris Zankel Cc: Arnd Bergmann Cc: Samuel Iglesias Gonsalvez Cc: Jens Taprogge Cc: Karsten Keil Cc: Scott Branden Cc: Ulf Hansson Cc: "David S. Miller" Cc: Jakub Kicinski Cc: Heiko Carstens Cc: Vasily Gorbik Cc: Christian Borntraeger Cc: David Lin Cc: Johan Hovold Cc: Jiri Kosina Cc: Shawn Guo Cc: Sascha Hauer Cc: Oliver Neukum Cc: Felipe Balbi Cc: Mathias Nyman Cc: Marcel Holtmann Cc: Johan Hedberg Cc: Luiz Augusto von Dentz Link: https://lore.kernel.org/r/20210505091928.22010-23-jslaby@suse.cz Signed-off-by: Greg Kroah-Hartman --- drivers/isdn/capi/capi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/isdn') diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c index fdf87acccd06..c50c454006b3 100644 --- a/drivers/isdn/capi/capi.c +++ b/drivers/isdn/capi/capi.c @@ -1175,14 +1175,14 @@ static void capinc_tty_flush_chars(struct tty_struct *tty) handle_minor_recv(mp); } -static int capinc_tty_write_room(struct tty_struct *tty) +static unsigned int capinc_tty_write_room(struct tty_struct *tty) { struct capiminor *mp = tty->driver_data; - int room; + unsigned int room; room = CAPINC_MAX_SENDQUEUE-skb_queue_len(&mp->outqueue); room *= CAPI_MAX_BLKSIZE; - pr_debug("capinc_tty_write_room = %d\n", room); + pr_debug("capinc_tty_write_room = %u\n", room); return room; } -- cgit From fff4ef17a9400fcd276b5c3a00ce5793f6c465e6 Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Wed, 5 May 2021 11:19:19 +0200 Subject: tty: make tty_operations::chars_in_buffer return uint tty_operations::chars_in_buffer is another hook which is expected to return values >= 0. So make it explicit by the return type too -- use unsigned int. Signed-off-by: Jiri Slaby Acked-By: Anton Ivanov Acked-by: David Sterba Cc: Jeff Dike Cc: Richard Weinberger Cc: Arnd Bergmann Cc: Samuel Iglesias Gonsalvez Cc: Jens Taprogge Cc: Karsten Keil Cc: Ulf Hansson Cc: "David S. Miller" Cc: Jakub Kicinski Cc: Heiko Carstens Cc: Vasily Gorbik Cc: Christian Borntraeger Cc: David Lin Cc: Johan Hovold Cc: Alex Elder Cc: Jiri Kosina Cc: Shawn Guo Cc: Sascha Hauer Cc: Oliver Neukum Cc: Felipe Balbi Cc: Mathias Nyman Cc: Marcel Holtmann Cc: Johan Hedberg Cc: Luiz Augusto von Dentz Link: https://lore.kernel.org/r/20210505091928.22010-27-jslaby@suse.cz Signed-off-by: Greg Kroah-Hartman --- drivers/isdn/capi/capi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/isdn') diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c index c50c454006b3..dae80197ad9c 100644 --- a/drivers/isdn/capi/capi.c +++ b/drivers/isdn/capi/capi.c @@ -1186,7 +1186,7 @@ static unsigned int capinc_tty_write_room(struct tty_struct *tty) return room; } -static int capinc_tty_chars_in_buffer(struct tty_struct *tty) +static unsigned int capinc_tty_chars_in_buffer(struct tty_struct *tty) { struct capiminor *mp = tty->driver_data; -- cgit From 4fb266e1976ed664252d172c4889c639abd53930 Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Wed, 5 May 2021 11:19:23 +0200 Subject: tty: remove empty tty_operations::flush_buffer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit tty_operations::flush_buffer is optional. If it doesn't exist, nothing is called. So remove almost¹ empty flush_buffer implementations. ¹ capi had an useless pr_debug in it. Signed-off-by: Jiri Slaby Cc: Karsten Keil Cc: Heiko Carstens Cc: Vasily Gorbik Cc: Christian Borntraeger Link: https://lore.kernel.org/r/20210505091928.22010-31-jslaby@suse.cz Signed-off-by: Greg Kroah-Hartman --- drivers/isdn/capi/capi.c | 6 ------ 1 file changed, 6 deletions(-) (limited to 'drivers/isdn') diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c index dae80197ad9c..6d99b93bb09e 100644 --- a/drivers/isdn/capi/capi.c +++ b/drivers/isdn/capi/capi.c @@ -1249,11 +1249,6 @@ static int capinc_tty_break_ctl(struct tty_struct *tty, int state) return 0; } -static void capinc_tty_flush_buffer(struct tty_struct *tty) -{ - pr_debug("capinc_tty_flush_buffer\n"); -} - static void capinc_tty_set_ldisc(struct tty_struct *tty) { pr_debug("capinc_tty_set_ldisc\n"); @@ -1279,7 +1274,6 @@ static const struct tty_operations capinc_ops = { .start = capinc_tty_start, .hangup = capinc_tty_hangup, .break_ctl = capinc_tty_break_ctl, - .flush_buffer = capinc_tty_flush_buffer, .set_ldisc = capinc_tty_set_ldisc, .send_xchar = capinc_tty_send_xchar, .install = capinc_tty_install, -- cgit From 4da872befc83e65b106211272f18ff78a308ec97 Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Wed, 5 May 2021 11:19:24 +0200 Subject: tty: remove empty tty_operations::set_termios MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit tty_operations::set_termios is optional. If it doesn't exist, nothing is called. So remove almost¹ empty set_termios implementations. ¹ capi had an useless pr_debug in it. Signed-off-by: Jiri Slaby Cc: Jeff Dike Cc: Richard Weinberger Cc: Karsten Keil Acked-By: Anton Ivanov Link: https://lore.kernel.org/r/20210505091928.22010-32-jslaby@suse.cz Signed-off-by: Greg Kroah-Hartman --- drivers/isdn/capi/capi.c | 6 ------ 1 file changed, 6 deletions(-) (limited to 'drivers/isdn') diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c index 6d99b93bb09e..693b0bc31395 100644 --- a/drivers/isdn/capi/capi.c +++ b/drivers/isdn/capi/capi.c @@ -1197,11 +1197,6 @@ static unsigned int capinc_tty_chars_in_buffer(struct tty_struct *tty) return mp->outbytes; } -static void capinc_tty_set_termios(struct tty_struct *tty, struct ktermios *old) -{ - pr_debug("capinc_tty_set_termios\n"); -} - static void capinc_tty_throttle(struct tty_struct *tty) { struct capiminor *mp = tty->driver_data; @@ -1267,7 +1262,6 @@ static const struct tty_operations capinc_ops = { .flush_chars = capinc_tty_flush_chars, .write_room = capinc_tty_write_room, .chars_in_buffer = capinc_tty_chars_in_buffer, - .set_termios = capinc_tty_set_termios, .throttle = capinc_tty_throttle, .unthrottle = capinc_tty_unthrottle, .stop = capinc_tty_stop, -- cgit From 3e679e1da5ef01825df87d0ed96bef8cb2e39635 Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Wed, 5 May 2021 11:19:25 +0200 Subject: isdn: capi, remove optional tty ops break_ctl and set_ldisc are optional tty_operations hooks. Given capi does nothing useful in them, just remove these. Signed-off-by: Jiri Slaby Cc: Karsten Keil Cc: netdev@vger.kernel.org Link: https://lore.kernel.org/r/20210505091928.22010-33-jslaby@suse.cz Signed-off-by: Greg Kroah-Hartman --- drivers/isdn/capi/capi.c | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'drivers/isdn') diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c index 693b0bc31395..bf8a8809eff1 100644 --- a/drivers/isdn/capi/capi.c +++ b/drivers/isdn/capi/capi.c @@ -1238,17 +1238,6 @@ static void capinc_tty_hangup(struct tty_struct *tty) tty_port_hangup(&mp->port); } -static int capinc_tty_break_ctl(struct tty_struct *tty, int state) -{ - pr_debug("capinc_tty_break_ctl(%d)\n", state); - return 0; -} - -static void capinc_tty_set_ldisc(struct tty_struct *tty) -{ - pr_debug("capinc_tty_set_ldisc\n"); -} - static void capinc_tty_send_xchar(struct tty_struct *tty, char ch) { pr_debug("capinc_tty_send_xchar(%d)\n", ch); @@ -1267,8 +1256,6 @@ static const struct tty_operations capinc_ops = { .stop = capinc_tty_stop, .start = capinc_tty_start, .hangup = capinc_tty_hangup, - .break_ctl = capinc_tty_break_ctl, - .set_ldisc = capinc_tty_set_ldisc, .send_xchar = capinc_tty_send_xchar, .install = capinc_tty_install, .cleanup = capinc_tty_cleanup, -- cgit From 1bf42296634178b2435e2b313443864467bbb848 Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Wed, 5 May 2021 11:19:26 +0200 Subject: isdn: capi, drop useless pr_debugs capi have many pr_debugs in tty_operations hooks to print only a functions name. We have better debugging aids in the kernel many years now. So remove these useless pr_debugs. Signed-off-by: Jiri Slaby Cc: Karsten Keil Cc: netdev@vger.kernel.org Link: https://lore.kernel.org/r/20210505091928.22010-34-jslaby@suse.cz Signed-off-by: Greg Kroah-Hartman --- drivers/isdn/capi/capi.c | 7 ------- 1 file changed, 7 deletions(-) (limited to 'drivers/isdn') diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c index bf8a8809eff1..d5f9261fa879 100644 --- a/drivers/isdn/capi/capi.c +++ b/drivers/isdn/capi/capi.c @@ -1158,8 +1158,6 @@ static void capinc_tty_flush_chars(struct tty_struct *tty) struct capiminor *mp = tty->driver_data; struct sk_buff *skb; - pr_debug("capinc_tty_flush_chars\n"); - spin_lock_bh(&mp->outlock); skb = mp->outskb; if (skb) { @@ -1200,7 +1198,6 @@ static unsigned int capinc_tty_chars_in_buffer(struct tty_struct *tty) static void capinc_tty_throttle(struct tty_struct *tty) { struct capiminor *mp = tty->driver_data; - pr_debug("capinc_tty_throttle\n"); mp->ttyinstop = 1; } @@ -1208,7 +1205,6 @@ static void capinc_tty_unthrottle(struct tty_struct *tty) { struct capiminor *mp = tty->driver_data; - pr_debug("capinc_tty_unthrottle\n"); mp->ttyinstop = 0; handle_minor_recv(mp); } @@ -1217,7 +1213,6 @@ static void capinc_tty_stop(struct tty_struct *tty) { struct capiminor *mp = tty->driver_data; - pr_debug("capinc_tty_stop\n"); mp->ttyoutstop = 1; } @@ -1225,7 +1220,6 @@ static void capinc_tty_start(struct tty_struct *tty) { struct capiminor *mp = tty->driver_data; - pr_debug("capinc_tty_start\n"); mp->ttyoutstop = 0; handle_minor_send(mp); } @@ -1234,7 +1228,6 @@ static void capinc_tty_hangup(struct tty_struct *tty) { struct capiminor *mp = tty->driver_data; - pr_debug("capinc_tty_hangup\n"); tty_port_hangup(&mp->port); } -- cgit