* [PATCH 01/44] MAINTAINERS: orphan mxser
@ 2021-03-02 6:21 Jiri Slaby
2021-03-02 6:21 ` [PATCH 02/44] MAINTAINERS: drop cyclades.com reference Jiri Slaby
` (41 more replies)
0 siblings, 42 replies; 61+ messages in thread
From: Jiri Slaby @ 2021-03-02 6:21 UTC (permalink / raw)
To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby
I cannot maintain this driver for years due to missing HW. Let's orphan
the entry in MAINTAINERS. And likely drop the driver later as these
devices are likely gone from this world. Mxser provides different
(out-of-tree) drivers for their current devices.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
MAINTAINERS | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/MAINTAINERS b/MAINTAINERS
index 973a937386fa..24abc010d177 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -12089,8 +12089,7 @@ F: drivers/media/pci/meye/
F: include/uapi/linux/meye.h
MOXA SMARTIO/INDUSTIO/INTELLIO SERIAL CARD
-M: Jiri Slaby <jirislaby@kernel.org>
-S: Maintained
+S: Orphan
F: Documentation/driver-api/serial/moxa-smartio.rst
F: drivers/tty/mxser.*
--
2.30.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PATCH 02/44] MAINTAINERS: drop cyclades.com reference
2021-03-02 6:21 [PATCH 01/44] MAINTAINERS: orphan mxser Jiri Slaby
@ 2021-03-02 6:21 ` Jiri Slaby
2021-03-02 6:21 ` [PATCH 03/44] PCI: remove synclink entries from pci_ids Jiri Slaby
` (40 subsequent siblings)
41 siblings, 0 replies; 61+ messages in thread
From: Jiri Slaby @ 2021-03-02 6:21 UTC (permalink / raw)
To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby
cyclades.com is a dead domain.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
MAINTAINERS | 1 -
1 file changed, 1 deletion(-)
diff --git a/MAINTAINERS b/MAINTAINERS
index 24abc010d177..7bfca0e2d5ab 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4885,7 +4885,6 @@ F: include/uapi/linux/cyclades.h
CYCLADES PC300 DRIVER
S: Orphan
-W: http://www.cyclades.com/
F: drivers/net/wan/pc300*
CYPRESS_FIRMWARE MEDIA DRIVER
--
2.30.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PATCH 03/44] PCI: remove synclink entries from pci_ids
2021-03-02 6:21 [PATCH 01/44] MAINTAINERS: orphan mxser Jiri Slaby
2021-03-02 6:21 ` [PATCH 02/44] MAINTAINERS: drop cyclades.com reference Jiri Slaby
@ 2021-03-02 6:21 ` Jiri Slaby
2021-03-06 23:47 ` Krzysztof Wilczyński
2021-03-12 22:12 ` Bjorn Helgaas
2021-03-02 6:21 ` [PATCH 04/44] vgacon: comment on vga_rolled_over Jiri Slaby
` (39 subsequent siblings)
41 siblings, 2 replies; 61+ messages in thread
From: Jiri Slaby @ 2021-03-02 6:21 UTC (permalink / raw)
To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby, Bjorn Helgaas, linux-pci
The drivers were removed in a1f714b44e34 (tty: Remove redundant synclink
driver) and 3d608a591b2b (tty: Remove redundant synclinkmp driver).
So remove also the PCI ID entries.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: linux-pci@vger.kernel.org
---
include/linux/pci_ids.h | 2 --
1 file changed, 2 deletions(-)
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index a76ccb697bef..8a18517696c1 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2065,8 +2065,6 @@
#define PCI_DEVICE_ID_EXAR_XR17V358 0x0358
#define PCI_VENDOR_ID_MICROGATE 0x13c0
-#define PCI_DEVICE_ID_MICROGATE_USC 0x0010
-#define PCI_DEVICE_ID_MICROGATE_SCA 0x0030
#define PCI_VENDOR_ID_3WARE 0x13C1
#define PCI_DEVICE_ID_3WARE_1000 0x1000
--
2.30.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PATCH 04/44] vgacon: comment on vga_rolled_over
2021-03-02 6:21 [PATCH 01/44] MAINTAINERS: orphan mxser Jiri Slaby
2021-03-02 6:21 ` [PATCH 02/44] MAINTAINERS: drop cyclades.com reference Jiri Slaby
2021-03-02 6:21 ` [PATCH 03/44] PCI: remove synclink entries from pci_ids Jiri Slaby
@ 2021-03-02 6:21 ` Jiri Slaby
2021-03-11 13:08 ` Daniel Vetter
2021-03-02 6:21 ` [PATCH 06/44] tty: isicom, remove this orphan Jiri Slaby
` (38 subsequent siblings)
41 siblings, 1 reply; 61+ messages in thread
From: Jiri Slaby @ 2021-03-02 6:21 UTC (permalink / raw)
To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby, dri-devel, linux-fbdev
Long time ago, I figured out what this number is good for and documented
that locally. But never submitted, so do it now.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: dri-devel@lists.freedesktop.org
Cc: linux-fbdev@vger.kernel.org
---
drivers/video/console/vgacon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
index 962c12be9774..0d26e821e73b 100644
--- a/drivers/video/console/vgacon.c
+++ b/drivers/video/console/vgacon.c
@@ -96,7 +96,7 @@ static bool vga_is_gfx;
static bool vga_512_chars;
static int vga_video_font_height;
static int vga_scan_lines __read_mostly;
-static unsigned int vga_rolled_over;
+static unsigned int vga_rolled_over; /* last vc_origin offset before wrap */
static bool vgacon_text_mode_force;
static bool vga_hardscroll_enabled;
--
2.30.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PATCH 06/44] tty: isicom, remove this orphan
2021-03-02 6:21 [PATCH 01/44] MAINTAINERS: orphan mxser Jiri Slaby
` (2 preceding siblings ...)
2021-03-02 6:21 ` [PATCH 04/44] vgacon: comment on vga_rolled_over Jiri Slaby
@ 2021-03-02 6:21 ` Jiri Slaby
2021-03-02 6:21 ` [PATCH 08/44] tty: remove TTY_LDISC_MAGIC Jiri Slaby
` (37 subsequent siblings)
41 siblings, 0 replies; 61+ messages in thread
From: Jiri Slaby @ 2021-03-02 6:21 UTC (permalink / raw)
To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby
The Isicom driver was orphaned by commit d86b3001a1a6 (MAINTAINERS:
orphan isicom) 10 years ago. Noone stepped up to take care of them and
to fix all the issues the driver has.
So it's time to drop the driver with all its traces.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
Documentation/admin-guide/devices.txt | 2 +-
Documentation/process/magic-number.rst | 1 -
.../it_IT/process/magic-number.rst | 1 -
.../zh_CN/process/magic-number.rst | 1 -
MAINTAINERS | 5 -
drivers/tty/Kconfig | 10 -
drivers/tty/Makefile | 1 -
drivers/tty/isicom.c | 1699 -----------------
include/linux/isicom.h | 85 -
9 files changed, 1 insertion(+), 1804 deletions(-)
delete mode 100644 drivers/tty/isicom.c
delete mode 100644 include/linux/isicom.h
diff --git a/Documentation/admin-guide/devices.txt b/Documentation/admin-guide/devices.txt
index b5bd9d46e031..ef41f77cb979 100644
--- a/Documentation/admin-guide/devices.txt
+++ b/Documentation/admin-guide/devices.txt
@@ -289,7 +289,7 @@
152 = /dev/kpoll Kernel Poll Driver
153 = /dev/mergemem Memory merge device
154 = /dev/pmu Macintosh PowerBook power manager
- 155 = /dev/isictl MultiTech ISICom serial control
+ 155 =
156 = /dev/lcd Front panel LCD display
157 = /dev/ac Applicom Intl Profibus card
158 = /dev/nwbutton Netwinder external button
diff --git a/Documentation/process/magic-number.rst b/Documentation/process/magic-number.rst
index d4a30c09bd03..c36f21eecefb 100644
--- a/Documentation/process/magic-number.rst
+++ b/Documentation/process/magic-number.rst
@@ -77,7 +77,6 @@ DB_MAGIC 0x4442 fc_info ``drivers/net/ip
DL_MAGIC 0x444d fc_info ``drivers/net/iph5526_novram.c``
FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
FF_MAGIC 0x4646 fc_info ``drivers/net/iph5526_novram.c``
-ISICOM_MAGIC 0x4d54 isi_port ``include/linux/isicom.h``
PTY_MAGIC 0x5001 ``drivers/char/pty.c``
PPP_MAGIC 0x5002 ppp ``include/linux/if_pppvar.h``
SSTATE_MAGIC 0x5302 serial_state ``include/linux/serial.h``
diff --git a/Documentation/translations/it_IT/process/magic-number.rst b/Documentation/translations/it_IT/process/magic-number.rst
index 0df2e7e32cd8..440087f9f402 100644
--- a/Documentation/translations/it_IT/process/magic-number.rst
+++ b/Documentation/translations/it_IT/process/magic-number.rst
@@ -83,7 +83,6 @@ DB_MAGIC 0x4442 fc_info ``drivers/net/ip
DL_MAGIC 0x444d fc_info ``drivers/net/iph5526_novram.c``
FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
FF_MAGIC 0x4646 fc_info ``drivers/net/iph5526_novram.c``
-ISICOM_MAGIC 0x4d54 isi_port ``include/linux/isicom.h``
PTY_MAGIC 0x5001 ``drivers/char/pty.c``
PPP_MAGIC 0x5002 ppp ``include/linux/if_pppvar.h``
SSTATE_MAGIC 0x5302 serial_state ``include/linux/serial.h``
diff --git a/Documentation/translations/zh_CN/process/magic-number.rst b/Documentation/translations/zh_CN/process/magic-number.rst
index 82d62f6a4406..e91bec4ec156 100644
--- a/Documentation/translations/zh_CN/process/magic-number.rst
+++ b/Documentation/translations/zh_CN/process/magic-number.rst
@@ -66,7 +66,6 @@ DB_MAGIC 0x4442 fc_info ``drivers/net/ip
DL_MAGIC 0x444d fc_info ``drivers/net/iph5526_novram.c``
FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
FF_MAGIC 0x4646 fc_info ``drivers/net/iph5526_novram.c``
-ISICOM_MAGIC 0x4d54 isi_port ``include/linux/isicom.h``
PTY_MAGIC 0x5001 ``drivers/char/pty.c``
PPP_MAGIC 0x5002 ppp ``include/linux/if_pppvar.h``
SSTATE_MAGIC 0x5302 serial_state ``include/linux/serial.h``
diff --git a/MAINTAINERS b/MAINTAINERS
index fd45767da24c..549145c5fb0b 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -12225,11 +12225,6 @@ F: drivers/mux/
F: include/dt-bindings/mux/
F: include/linux/mux/
-MULTITECH MULTIPORT CARD (ISICOM)
-S: Orphan
-F: drivers/tty/isicom.c
-F: include/linux/isicom.h
-
MUSB MULTIPOINT HIGH SPEED DUAL-ROLE CONTROLLER
M: Bin Liu <b-liu@ti.com>
L: linux-usb@vger.kernel.org
diff --git a/drivers/tty/Kconfig b/drivers/tty/Kconfig
index 397523a8095e..0031aa8f8b16 100644
--- a/drivers/tty/Kconfig
+++ b/drivers/tty/Kconfig
@@ -238,16 +238,6 @@ config SYNCLINK_GT
synchronous and asynchronous serial adapters
manufactured by Microgate Systems, Ltd. (www.microgate.com)
-config ISI
- tristate "Multi-Tech multiport card support"
- depends on SERIAL_NONSTANDARD && PCI
- select FW_LOADER
- help
- This is a driver for the Multi-Tech cards which provide several
- serial ports. The driver is experimental and can currently only be
- built as a module. The module will be called isicom.
- If you want to do that, choose M here.
-
config N_HDLC
tristate "HDLC line discipline support"
depends on SERIAL_NONSTANDARD
diff --git a/drivers/tty/Makefile b/drivers/tty/Makefile
index 94eb2bf75763..a34055bc8b7a 100644
--- a/drivers/tty/Makefile
+++ b/drivers/tty/Makefile
@@ -18,7 +18,6 @@ obj-$(CONFIG_SERIAL_DEV_BUS) += serdev/
# tty drivers
obj-$(CONFIG_AMIGA_BUILTIN_SERIAL) += amiserial.o
-obj-$(CONFIG_ISI) += isicom.o
obj-$(CONFIG_MOXA_INTELLIO) += moxa.o
obj-$(CONFIG_MOXA_SMARTIO) += mxser.o
obj-$(CONFIG_NOZOMI) += nozomi.o
diff --git a/drivers/tty/isicom.c b/drivers/tty/isicom.c
deleted file mode 100644
index 3b2f9fb01aa0..000000000000
--- a/drivers/tty/isicom.c
+++ /dev/null
@@ -1,1699 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Original driver code supplied by Multi-Tech
- *
- * Changes
- * 1/9/98 alan@lxorguk.ukuu.org.uk
- * Merge to 2.0.x kernel tree
- * Obtain and use official major/minors
- * Loader switched to a misc device
- * (fixed range check bug as a side effect)
- * Printk clean up
- * 9/12/98 alan@lxorguk.ukuu.org.uk
- * Rough port to 2.1.x
- *
- * 10/6/99 sameer Merged the ISA and PCI drivers to
- * a new unified driver.
- *
- * 3/9/99 sameer Added support for ISI4616 cards.
- *
- * 16/9/99 sameer We do not force RTS low anymore.
- * This is to prevent the firmware
- * from getting confused.
- *
- * 26/10/99 sameer Cosmetic changes:The driver now
- * dumps the Port Count information
- * along with I/O address and IRQ.
- *
- * 13/12/99 sameer Fixed the problem with IRQ sharing.
- *
- * 10/5/00 sameer Fixed isicom_shutdown_board()
- * to not lower DTR on all the ports
- * when the last port on the card is
- * closed.
- *
- * 10/5/00 sameer Signal mask setup command added
- * to isicom_setup_port and
- * isicom_shutdown_port.
- *
- * 24/5/00 sameer The driver is now SMP aware.
- *
- *
- * 27/11/00 Vinayak P Risbud Fixed the Driver Crash Problem
- *
- *
- * 03/01/01 anil .s Added support for resetting the
- * internal modems on ISI cards.
- *
- * 08/02/01 anil .s Upgraded the driver for kernel
- * 2.4.x
- *
- * 11/04/01 Kevin Fixed firmware load problem with
- * ISIHP-4X card
- *
- * 30/04/01 anil .s Fixed the remote login through
- * ISI port problem. Now the link
- * does not go down before password
- * prompt.
- *
- * 03/05/01 anil .s Fixed the problem with IRQ sharing
- * among ISI-PCI cards.
- *
- * 03/05/01 anil .s Added support to display the version
- * info during insmod as well as module
- * listing by lsmod.
- *
- * 10/05/01 anil .s Done the modifications to the source
- * file and Install script so that the
- * same installation can be used for
- * 2.2.x and 2.4.x kernel.
- *
- * 06/06/01 anil .s Now we drop both dtr and rts during
- * shutdown_port as well as raise them
- * during isicom_config_port.
- *
- * 09/06/01 acme@conectiva.com.br use capable, not suser, do
- * restore_flags on failure in
- * isicom_send_break, verify put_user
- * result
- *
- * 11/02/03 ranjeeth Added support for 230 Kbps and 460 Kbps
- * Baud index extended to 21
- *
- * 20/03/03 ranjeeth Made to work for Linux Advanced server.
- * Taken care of license warning.
- *
- * 10/12/03 Ravindra Made to work for Fedora Core 1 of
- * Red Hat Distribution
- *
- * 06/01/05 Alan Cox Merged the ISI and base kernel strands
- * into a single 2.6 driver
- *
- * ***********************************************************
- *
- * To use this driver you also need the support package. You
- * can find this in RPM format on
- * ftp://ftp.linux.org.uk/pub/linux/alan
- *
- * You can find the original tools for this direct from Multitech
- * ftp://ftp.multitech.com/ISI-Cards/
- *
- * Having installed the cards the module options (/etc/modprobe.d/)
- *
- * options isicom io=card1,card2,card3,card4 irq=card1,card2,card3,card4
- *
- * Omit those entries for boards you don't have installed.
- *
- * TODO
- * Merge testing
- * 64-bit verification
- */
-
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-#include <linux/module.h>
-#include <linux/firmware.h>
-#include <linux/kernel.h>
-#include <linux/tty.h>
-#include <linux/tty_flip.h>
-#include <linux/termios.h>
-#include <linux/fs.h>
-#include <linux/sched.h>
-#include <linux/serial.h>
-#include <linux/mm.h>
-#include <linux/interrupt.h>
-#include <linux/timer.h>
-#include <linux/delay.h>
-#include <linux/ioport.h>
-#include <linux/slab.h>
-
-#include <linux/uaccess.h>
-#include <linux/io.h>
-
-#include <linux/pci.h>
-
-#include <linux/isicom.h>
-
-#define InterruptTheCard(base) outw(0, (base) + 0xc)
-#define ClearInterrupt(base) inw((base) + 0x0a)
-
-#ifdef DEBUG
-#define isicom_paranoia_check(a, b, c) __isicom_paranoia_check((a), (b), (c))
-#else
-#define isicom_paranoia_check(a, b, c) 0
-#endif
-
-static int isicom_probe(struct pci_dev *, const struct pci_device_id *);
-static void isicom_remove(struct pci_dev *);
-
-static const struct pci_device_id isicom_pci_tbl[] = {
- { PCI_DEVICE(VENDOR_ID, 0x2028) },
- { PCI_DEVICE(VENDOR_ID, 0x2051) },
- { PCI_DEVICE(VENDOR_ID, 0x2052) },
- { PCI_DEVICE(VENDOR_ID, 0x2053) },
- { PCI_DEVICE(VENDOR_ID, 0x2054) },
- { PCI_DEVICE(VENDOR_ID, 0x2055) },
- { PCI_DEVICE(VENDOR_ID, 0x2056) },
- { PCI_DEVICE(VENDOR_ID, 0x2057) },
- { PCI_DEVICE(VENDOR_ID, 0x2058) },
- { 0 }
-};
-MODULE_DEVICE_TABLE(pci, isicom_pci_tbl);
-
-static struct pci_driver isicom_driver = {
- .name = "isicom",
- .id_table = isicom_pci_tbl,
- .probe = isicom_probe,
- .remove = isicom_remove
-};
-
-static int prev_card = 3; /* start servicing isi_card[0] */
-static struct tty_driver *isicom_normal;
-
-static void isicom_tx(struct timer_list *unused);
-static void isicom_start(struct tty_struct *tty);
-
-static DEFINE_TIMER(tx, isicom_tx);
-
-/* baud index mappings from linux defns to isi */
-
-static signed char linuxb_to_isib[] = {
- -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 13, 15, 16, 17, 18, 19, 20, 21
-};
-
-struct isi_board {
- unsigned long base;
- int irq;
- unsigned char port_count;
- unsigned short status;
- unsigned short port_status; /* each bit for each port */
- unsigned short shift_count;
- struct isi_port *ports;
- signed char count;
- spinlock_t card_lock; /* Card wide lock 11/5/00 -sameer */
- unsigned long flags;
- unsigned int index;
-};
-
-struct isi_port {
- unsigned short magic;
- struct tty_port port;
- u16 channel;
- u16 status;
- struct isi_board *card;
- unsigned char *xmit_buf;
- int xmit_head;
- int xmit_tail;
- int xmit_cnt;
-};
-
-static struct isi_board isi_card[BOARD_COUNT];
-static struct isi_port isi_ports[PORT_COUNT];
-
-/*
- * Locking functions for card level locking. We need to own both
- * the kernel lock for the card and have the card in a position that
- * it wants to talk.
- */
-
-static int WaitTillCardIsFree(unsigned long base)
-{
- unsigned int count = 0;
-
- while (!(inw(base + 0xe) & 0x1) && count++ < 100)
- mdelay(1);
-
- return !(inw(base + 0xe) & 0x1);
-}
-
-static int lock_card(struct isi_board *card)
-{
- unsigned long base = card->base;
- unsigned int retries, a;
-
- for (retries = 0; retries < 10; retries++) {
- spin_lock_irqsave(&card->card_lock, card->flags);
- for (a = 0; a < 10; a++) {
- if (inw(base + 0xe) & 0x1)
- return 1;
- udelay(10);
- }
- spin_unlock_irqrestore(&card->card_lock, card->flags);
- msleep(10);
- }
- pr_warn("Failed to lock Card (0x%lx)\n", card->base);
-
- return 0; /* Failed to acquire the card! */
-}
-
-static void unlock_card(struct isi_board *card)
-{
- spin_unlock_irqrestore(&card->card_lock, card->flags);
-}
-
-/*
- * ISI Card specific ops ...
- */
-
-/* card->lock HAS to be held */
-static void raise_dtr(struct isi_port *port)
-{
- struct isi_board *card = port->card;
- unsigned long base = card->base;
- u16 channel = port->channel;
-
- if (WaitTillCardIsFree(base))
- return;
-
- outw(0x8000 | (channel << card->shift_count) | 0x02, base);
- outw(0x0504, base);
- InterruptTheCard(base);
- port->status |= ISI_DTR;
-}
-
-/* card->lock HAS to be held */
-static void drop_dtr(struct isi_port *port)
-{
- struct isi_board *card = port->card;
- unsigned long base = card->base;
- u16 channel = port->channel;
-
- if (WaitTillCardIsFree(base))
- return;
-
- outw(0x8000 | (channel << card->shift_count) | 0x02, base);
- outw(0x0404, base);
- InterruptTheCard(base);
- port->status &= ~ISI_DTR;
-}
-
-/* card->lock HAS to be held */
-static inline void raise_rts(struct isi_port *port)
-{
- struct isi_board *card = port->card;
- unsigned long base = card->base;
- u16 channel = port->channel;
-
- if (WaitTillCardIsFree(base))
- return;
-
- outw(0x8000 | (channel << card->shift_count) | 0x02, base);
- outw(0x0a04, base);
- InterruptTheCard(base);
- port->status |= ISI_RTS;
-}
-
-/* card->lock HAS to be held */
-static inline void drop_rts(struct isi_port *port)
-{
- struct isi_board *card = port->card;
- unsigned long base = card->base;
- u16 channel = port->channel;
-
- if (WaitTillCardIsFree(base))
- return;
-
- outw(0x8000 | (channel << card->shift_count) | 0x02, base);
- outw(0x0804, base);
- InterruptTheCard(base);
- port->status &= ~ISI_RTS;
-}
-
-/* card->lock MUST NOT be held */
-
-static void isicom_dtr_rts(struct tty_port *port, int on)
-{
- struct isi_port *ip = container_of(port, struct isi_port, port);
- struct isi_board *card = ip->card;
- unsigned long base = card->base;
- u16 channel = ip->channel;
-
- if (!lock_card(card))
- return;
-
- if (on) {
- outw(0x8000 | (channel << card->shift_count) | 0x02, base);
- outw(0x0f04, base);
- InterruptTheCard(base);
- ip->status |= (ISI_DTR | ISI_RTS);
- } else {
- outw(0x8000 | (channel << card->shift_count) | 0x02, base);
- outw(0x0C04, base);
- InterruptTheCard(base);
- ip->status &= ~(ISI_DTR | ISI_RTS);
- }
- unlock_card(card);
-}
-
-/* card->lock HAS to be held */
-static void drop_dtr_rts(struct isi_port *port)
-{
- struct isi_board *card = port->card;
- unsigned long base = card->base;
- u16 channel = port->channel;
-
- if (WaitTillCardIsFree(base))
- return;
-
- outw(0x8000 | (channel << card->shift_count) | 0x02, base);
- outw(0x0c04, base);
- InterruptTheCard(base);
- port->status &= ~(ISI_RTS | ISI_DTR);
-}
-
-/*
- * ISICOM Driver specific routines ...
- *
- */
-
-static inline int __isicom_paranoia_check(struct isi_port const *port,
- char *name, const char *routine)
-{
- if (!port) {
- pr_warn("Warning: bad isicom magic for dev %s in %s\n",
- name, routine);
- return 1;
- }
- if (port->magic != ISICOM_MAGIC) {
- pr_warn("Warning: NULL isicom port for dev %s in %s\n",
- name, routine);
- return 1;
- }
-
- return 0;
-}
-
-/*
- * Transmitter.
- *
- * We shovel data into the card buffers on a regular basis. The card
- * will do the rest of the work for us.
- */
-
-static void isicom_tx(struct timer_list *unused)
-{
- unsigned long flags, base;
- unsigned int retries;
- short count = (BOARD_COUNT-1), card;
- short txcount, wrd, residue, word_count, cnt;
- struct isi_port *port;
- struct tty_struct *tty;
-
- /* find next active board */
- card = (prev_card + 1) & 0x0003;
- while (count-- > 0) {
- if (isi_card[card].status & BOARD_ACTIVE)
- break;
- card = (card + 1) & 0x0003;
- }
- if (!(isi_card[card].status & BOARD_ACTIVE))
- goto sched_again;
-
- prev_card = card;
-
- count = isi_card[card].port_count;
- port = isi_card[card].ports;
- base = isi_card[card].base;
-
- spin_lock_irqsave(&isi_card[card].card_lock, flags);
- for (retries = 0; retries < 100; retries++) {
- if (inw(base + 0xe) & 0x1)
- break;
- udelay(2);
- }
- if (retries >= 100)
- goto unlock;
-
- tty = tty_port_tty_get(&port->port);
- if (tty == NULL)
- goto put_unlock;
-
- for (; count > 0; count--, port++) {
- /* port not active or tx disabled to force flow control */
- if (!tty_port_initialized(&port->port) ||
- !(port->status & ISI_TXOK))
- continue;
-
- txcount = min_t(short, TX_SIZE, port->xmit_cnt);
- if (txcount <= 0 || tty->stopped || tty->hw_stopped)
- continue;
-
- if (!(inw(base + 0x02) & (1 << port->channel)))
- continue;
-
- pr_debug("txing %d bytes, port%d.\n",
- txcount, port->channel + 1);
- outw((port->channel << isi_card[card].shift_count) | txcount,
- base);
- residue = NO;
- wrd = 0;
- while (1) {
- cnt = min_t(int, txcount, (SERIAL_XMIT_SIZE
- - port->xmit_tail));
- if (residue == YES) {
- residue = NO;
- if (cnt > 0) {
- wrd |= (port->port.xmit_buf[port->xmit_tail]
- << 8);
- port->xmit_tail = (port->xmit_tail + 1)
- & (SERIAL_XMIT_SIZE - 1);
- port->xmit_cnt--;
- txcount--;
- cnt--;
- outw(wrd, base);
- } else {
- outw(wrd, base);
- break;
- }
- }
- if (cnt <= 0)
- break;
- word_count = cnt >> 1;
- outsw(base, port->port.xmit_buf+port->xmit_tail, word_count);
- port->xmit_tail = (port->xmit_tail
- + (word_count << 1)) & (SERIAL_XMIT_SIZE - 1);
- txcount -= (word_count << 1);
- port->xmit_cnt -= (word_count << 1);
- if (cnt & 0x0001) {
- residue = YES;
- wrd = port->port.xmit_buf[port->xmit_tail];
- port->xmit_tail = (port->xmit_tail + 1)
- & (SERIAL_XMIT_SIZE - 1);
- port->xmit_cnt--;
- txcount--;
- }
- }
-
- InterruptTheCard(base);
- if (port->xmit_cnt <= 0)
- port->status &= ~ISI_TXOK;
- if (port->xmit_cnt <= WAKEUP_CHARS)
- tty_wakeup(tty);
- }
-
-put_unlock:
- tty_kref_put(tty);
-unlock:
- spin_unlock_irqrestore(&isi_card[card].card_lock, flags);
- /* schedule another tx for hopefully in about 10ms */
-sched_again:
- mod_timer(&tx, jiffies + msecs_to_jiffies(10));
-}
-
-/*
- * Main interrupt handler routine
- */
-
-static irqreturn_t isicom_interrupt(int irq, void *dev_id)
-{
- struct isi_board *card = dev_id;
- struct isi_port *port;
- struct tty_struct *tty;
- unsigned long base;
- u16 header, word_count, count, channel;
- short byte_count;
- unsigned char *rp;
-
- if (!card || !(card->status & FIRMWARE_LOADED))
- return IRQ_NONE;
-
- base = card->base;
-
- /* did the card interrupt us? */
- if (!(inw(base + 0x0e) & 0x02))
- return IRQ_NONE;
-
- spin_lock(&card->card_lock);
-
- /*
- * disable any interrupts from the PCI card and lower the
- * interrupt line
- */
- outw(0x8000, base+0x04);
- ClearInterrupt(base);
-
- inw(base); /* get the dummy word out */
- header = inw(base);
- channel = (header & 0x7800) >> card->shift_count;
- byte_count = header & 0xff;
-
- if (channel + 1 > card->port_count) {
- pr_warn("%s(0x%lx): %d(channel) > port_count\n",
- __func__, base, channel + 1);
- outw(0x0000, base+0x04); /* enable interrupts */
- spin_unlock(&card->card_lock);
- return IRQ_HANDLED;
- }
- port = card->ports + channel;
- if (!tty_port_initialized(&port->port)) {
- outw(0x0000, base+0x04); /* enable interrupts */
- spin_unlock(&card->card_lock);
- return IRQ_HANDLED;
- }
-
- tty = tty_port_tty_get(&port->port);
- if (tty == NULL) {
- while (byte_count > 1) {
- inw(base);
- byte_count -= 2;
- }
- if (byte_count & 0x01)
- inw(base);
- outw(0x0000, base+0x04); /* enable interrupts */
- spin_unlock(&card->card_lock);
- return IRQ_HANDLED;
- }
-
- if (header & 0x8000) { /* Status Packet */
- header = inw(base);
- switch (header & 0xff) {
- case 0: /* Change in EIA signals */
- if (tty_port_check_carrier(&port->port)) {
- if (port->status & ISI_DCD) {
- if (!(header & ISI_DCD)) {
- /* Carrier has been lost */
- pr_debug("%s: DCD->low.\n",
- __func__);
- port->status &= ~ISI_DCD;
- tty_hangup(tty);
- }
- } else if (header & ISI_DCD) {
- /* Carrier has been detected */
- pr_debug("%s: DCD->high.\n",
- __func__);
- port->status |= ISI_DCD;
- wake_up_interruptible(&port->port.open_wait);
- }
- } else {
- if (header & ISI_DCD)
- port->status |= ISI_DCD;
- else
- port->status &= ~ISI_DCD;
- }
-
- if (tty_port_cts_enabled(&port->port)) {
- if (tty->hw_stopped) {
- if (header & ISI_CTS) {
- tty->hw_stopped = 0;
- /* start tx ing */
- port->status |= (ISI_TXOK
- | ISI_CTS);
- tty_wakeup(tty);
- }
- } else if (!(header & ISI_CTS)) {
- tty->hw_stopped = 1;
- /* stop tx ing */
- port->status &= ~(ISI_TXOK | ISI_CTS);
- }
- } else {
- if (header & ISI_CTS)
- port->status |= ISI_CTS;
- else
- port->status &= ~ISI_CTS;
- }
-
- if (header & ISI_DSR)
- port->status |= ISI_DSR;
- else
- port->status &= ~ISI_DSR;
-
- if (header & ISI_RI)
- port->status |= ISI_RI;
- else
- port->status &= ~ISI_RI;
-
- break;
-
- case 1: /* Received Break !!! */
- tty_insert_flip_char(&port->port, 0, TTY_BREAK);
- if (port->port.flags & ASYNC_SAK)
- do_SAK(tty);
- tty_flip_buffer_push(&port->port);
- break;
-
- case 2: /* Statistics */
- pr_debug("%s: stats!!!\n", __func__);
- break;
-
- default:
- pr_debug("%s: Unknown code in status packet.\n",
- __func__);
- break;
- }
- } else { /* Data Packet */
- count = tty_prepare_flip_string(&port->port, &rp,
- byte_count & ~1);
- pr_debug("%s: Can rx %d of %d bytes.\n",
- __func__, count, byte_count);
- word_count = count >> 1;
- insw(base, rp, word_count);
- byte_count -= (word_count << 1);
- if (count & 0x0001) {
- tty_insert_flip_char(&port->port, inw(base) & 0xff,
- TTY_NORMAL);
- byte_count -= 2;
- }
- if (byte_count > 0) {
- pr_debug("%s(0x%lx:%d): Flip buffer overflow! dropping bytes...\n",
- __func__, base, channel + 1);
- /* drain out unread xtra data */
- while (byte_count > 0) {
- inw(base);
- byte_count -= 2;
- }
- }
- tty_flip_buffer_push(&port->port);
- }
- outw(0x0000, base+0x04); /* enable interrupts */
- spin_unlock(&card->card_lock);
- tty_kref_put(tty);
-
- return IRQ_HANDLED;
-}
-
-static void isicom_config_port(struct tty_struct *tty)
-{
- struct isi_port *port = tty->driver_data;
- struct isi_board *card = port->card;
- unsigned long baud;
- unsigned long base = card->base;
- u16 channel_setup, channel = port->channel,
- shift_count = card->shift_count;
- unsigned char flow_ctrl;
-
- /* FIXME: Switch to new tty baud API */
- baud = C_BAUD(tty);
- if (baud & CBAUDEX) {
- baud &= ~CBAUDEX;
-
- /* if CBAUDEX bit is on and the baud is set to either 50 or 75
- * then the card is programmed for 57.6Kbps or 115Kbps
- * respectively.
- */
-
- /* 1,2,3,4 => 57.6, 115.2, 230, 460 kbps resp. */
- if (baud < 1 || baud > 4)
- tty->termios.c_cflag &= ~CBAUDEX;
- else
- baud += 15;
- }
- if (baud == 15) {
-
- /* the ASYNC_SPD_HI and ASYNC_SPD_VHI options are set
- * by the set_serial_info ioctl ... this is done by
- * the 'setserial' utility.
- */
-
- if ((port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
- baud++; /* 57.6 Kbps */
- if ((port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
- baud += 2; /* 115 Kbps */
- if ((port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI)
- baud += 3; /* 230 kbps*/
- if ((port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP)
- baud += 4; /* 460 kbps*/
- }
- if (linuxb_to_isib[baud] == -1) {
- /* hang up */
- drop_dtr(port);
- return;
- } else
- raise_dtr(port);
-
- if (WaitTillCardIsFree(base) == 0) {
- outw(0x8000 | (channel << shift_count) | 0x03, base);
- outw(linuxb_to_isib[baud] << 8 | 0x03, base);
- channel_setup = 0;
- switch (C_CSIZE(tty)) {
- case CS5:
- channel_setup |= ISICOM_CS5;
- break;
- case CS6:
- channel_setup |= ISICOM_CS6;
- break;
- case CS7:
- channel_setup |= ISICOM_CS7;
- break;
- case CS8:
- channel_setup |= ISICOM_CS8;
- break;
- }
-
- if (C_CSTOPB(tty))
- channel_setup |= ISICOM_2SB;
- if (C_PARENB(tty)) {
- channel_setup |= ISICOM_EVPAR;
- if (C_PARODD(tty))
- channel_setup |= ISICOM_ODPAR;
- }
- outw(channel_setup, base);
- InterruptTheCard(base);
- }
- tty_port_set_check_carrier(&port->port, !C_CLOCAL(tty));
-
- /* flow control settings ...*/
- flow_ctrl = 0;
- tty_port_set_cts_flow(&port->port, C_CRTSCTS(tty));
- if (C_CRTSCTS(tty))
- flow_ctrl |= ISICOM_CTSRTS;
- if (I_IXON(tty))
- flow_ctrl |= ISICOM_RESPOND_XONXOFF;
- if (I_IXOFF(tty))
- flow_ctrl |= ISICOM_INITIATE_XONXOFF;
-
- if (WaitTillCardIsFree(base) == 0) {
- outw(0x8000 | (channel << shift_count) | 0x04, base);
- outw(flow_ctrl << 8 | 0x05, base);
- outw((STOP_CHAR(tty)) << 8 | (START_CHAR(tty)), base);
- InterruptTheCard(base);
- }
-
- /* rx enabled -> enable port for rx on the card */
- if (C_CREAD(tty)) {
- card->port_status |= (1 << channel);
- outw(card->port_status, base + 0x02);
- }
-}
-
-/* open et all */
-
-static inline void isicom_setup_board(struct isi_board *bp)
-{
- int channel;
- struct isi_port *port;
-
- bp->count++;
- if (!(bp->status & BOARD_INIT)) {
- port = bp->ports;
- for (channel = 0; channel < bp->port_count; channel++, port++)
- drop_dtr_rts(port);
- }
- bp->status |= BOARD_ACTIVE | BOARD_INIT;
-}
-
-/* Activate and thus setup board are protected from races against shutdown
- by the tty_port mutex */
-
-static int isicom_activate(struct tty_port *tport, struct tty_struct *tty)
-{
- struct isi_port *port = container_of(tport, struct isi_port, port);
- struct isi_board *card = port->card;
- unsigned long flags;
-
- if (tty_port_alloc_xmit_buf(tport) < 0)
- return -ENOMEM;
-
- spin_lock_irqsave(&card->card_lock, flags);
- isicom_setup_board(card);
-
- port->xmit_cnt = port->xmit_head = port->xmit_tail = 0;
-
- /* discard any residual data */
- if (WaitTillCardIsFree(card->base) == 0) {
- outw(0x8000 | (port->channel << card->shift_count) | 0x02,
- card->base);
- outw(((ISICOM_KILLTX | ISICOM_KILLRX) << 8) | 0x06, card->base);
- InterruptTheCard(card->base);
- }
- isicom_config_port(tty);
- spin_unlock_irqrestore(&card->card_lock, flags);
-
- return 0;
-}
-
-static int isicom_carrier_raised(struct tty_port *port)
-{
- struct isi_port *ip = container_of(port, struct isi_port, port);
- return (ip->status & ISI_DCD)?1 : 0;
-}
-
-static struct tty_port *isicom_find_port(struct tty_struct *tty)
-{
- struct isi_port *port;
- struct isi_board *card;
- unsigned int board;
- int line = tty->index;
-
- board = BOARD(line);
- card = &isi_card[board];
-
- if (!(card->status & FIRMWARE_LOADED))
- return NULL;
-
- /* open on a port greater than the port count for the card !!! */
- if (line > ((board * 16) + card->port_count - 1))
- return NULL;
-
- port = &isi_ports[line];
- if (isicom_paranoia_check(port, tty->name, "isicom_open"))
- return NULL;
-
- return &port->port;
-}
-
-static int isicom_open(struct tty_struct *tty, struct file *filp)
-{
- struct isi_port *port;
- struct tty_port *tport;
-
- tport = isicom_find_port(tty);
- if (tport == NULL)
- return -ENODEV;
- port = container_of(tport, struct isi_port, port);
-
- tty->driver_data = port;
- return tty_port_open(tport, tty, filp);
-}
-
-/* close et all */
-
-/* card->lock HAS to be held */
-static void isicom_shutdown_port(struct isi_port *port)
-{
- struct isi_board *card = port->card;
-
- if (--card->count < 0) {
- pr_debug("%s: bad board(0x%lx) count %d.\n",
- __func__, card->base, card->count);
- card->count = 0;
- }
- /* last port was closed, shutdown that board too */
- if (!card->count)
- card->status &= BOARD_ACTIVE;
-}
-
-static void isicom_flush_buffer(struct tty_struct *tty)
-{
- struct isi_port *port = tty->driver_data;
- struct isi_board *card = port->card;
- unsigned long flags;
-
- if (isicom_paranoia_check(port, tty->name, "isicom_flush_buffer"))
- return;
-
- spin_lock_irqsave(&card->card_lock, flags);
- port->xmit_cnt = port->xmit_head = port->xmit_tail = 0;
- spin_unlock_irqrestore(&card->card_lock, flags);
-
- tty_wakeup(tty);
-}
-
-static void isicom_shutdown(struct tty_port *port)
-{
- struct isi_port *ip = container_of(port, struct isi_port, port);
- struct isi_board *card = ip->card;
- unsigned long flags;
-
- /* indicate to the card that no more data can be received
- on this port */
- spin_lock_irqsave(&card->card_lock, flags);
- card->port_status &= ~(1 << ip->channel);
- outw(card->port_status, card->base + 0x02);
- isicom_shutdown_port(ip);
- spin_unlock_irqrestore(&card->card_lock, flags);
- tty_port_free_xmit_buf(port);
-}
-
-static void isicom_close(struct tty_struct *tty, struct file *filp)
-{
- struct isi_port *ip = tty->driver_data;
- struct tty_port *port;
-
- if (ip == NULL)
- return;
-
- port = &ip->port;
- if (isicom_paranoia_check(ip, tty->name, "isicom_close"))
- return;
- tty_port_close(port, tty, filp);
-}
-
-/* write et all */
-static int isicom_write(struct tty_struct *tty, const unsigned char *buf,
- int count)
-{
- struct isi_port *port = tty->driver_data;
- struct isi_board *card = port->card;
- unsigned long flags;
- int cnt, total = 0;
-
- if (isicom_paranoia_check(port, tty->name, "isicom_write"))
- return 0;
-
- spin_lock_irqsave(&card->card_lock, flags);
-
- while (1) {
- cnt = min_t(int, count, min(SERIAL_XMIT_SIZE - port->xmit_cnt
- - 1, SERIAL_XMIT_SIZE - port->xmit_head));
- if (cnt <= 0)
- break;
-
- memcpy(port->port.xmit_buf + port->xmit_head, buf, cnt);
- port->xmit_head = (port->xmit_head + cnt) & (SERIAL_XMIT_SIZE
- - 1);
- port->xmit_cnt += cnt;
- buf += cnt;
- count -= cnt;
- total += cnt;
- }
- if (port->xmit_cnt && !tty->stopped && !tty->hw_stopped)
- port->status |= ISI_TXOK;
- spin_unlock_irqrestore(&card->card_lock, flags);
- return total;
-}
-
-/* put_char et all */
-static int isicom_put_char(struct tty_struct *tty, unsigned char ch)
-{
- struct isi_port *port = tty->driver_data;
- struct isi_board *card = port->card;
- unsigned long flags;
-
- if (isicom_paranoia_check(port, tty->name, "isicom_put_char"))
- return 0;
-
- spin_lock_irqsave(&card->card_lock, flags);
- if (port->xmit_cnt >= SERIAL_XMIT_SIZE - 1) {
- spin_unlock_irqrestore(&card->card_lock, flags);
- return 0;
- }
-
- port->port.xmit_buf[port->xmit_head++] = ch;
- port->xmit_head &= (SERIAL_XMIT_SIZE - 1);
- port->xmit_cnt++;
- spin_unlock_irqrestore(&card->card_lock, flags);
- return 1;
-}
-
-/* flush_chars et all */
-static void isicom_flush_chars(struct tty_struct *tty)
-{
- struct isi_port *port = tty->driver_data;
-
- if (isicom_paranoia_check(port, tty->name, "isicom_flush_chars"))
- return;
-
- if (port->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped ||
- !port->port.xmit_buf)
- return;
-
- /* this tells the transmitter to consider this port for
- data output to the card ... that's the best we can do. */
- port->status |= ISI_TXOK;
-}
-
-/* write_room et all */
-static int isicom_write_room(struct tty_struct *tty)
-{
- struct isi_port *port = tty->driver_data;
- int free;
-
- if (isicom_paranoia_check(port, tty->name, "isicom_write_room"))
- return 0;
-
- free = SERIAL_XMIT_SIZE - port->xmit_cnt - 1;
- if (free < 0)
- free = 0;
- return free;
-}
-
-/* chars_in_buffer et all */
-static int isicom_chars_in_buffer(struct tty_struct *tty)
-{
- struct isi_port *port = tty->driver_data;
- if (isicom_paranoia_check(port, tty->name, "isicom_chars_in_buffer"))
- return 0;
- return port->xmit_cnt;
-}
-
-/* ioctl et all */
-static int isicom_send_break(struct tty_struct *tty, int length)
-{
- struct isi_port *port = tty->driver_data;
- struct isi_board *card = port->card;
- unsigned long base = card->base;
-
- if (length == -1)
- return -EOPNOTSUPP;
-
- if (!lock_card(card))
- return -EINVAL;
-
- outw(0x8000 | ((port->channel) << (card->shift_count)) | 0x3, base);
- outw((length & 0xff) << 8 | 0x00, base);
- outw((length & 0xff00u), base);
- InterruptTheCard(base);
-
- unlock_card(card);
- return 0;
-}
-
-static int isicom_tiocmget(struct tty_struct *tty)
-{
- struct isi_port *port = tty->driver_data;
- /* just send the port status */
- u16 status = port->status;
-
- if (isicom_paranoia_check(port, tty->name, "isicom_ioctl"))
- return -ENODEV;
-
- return ((status & ISI_RTS) ? TIOCM_RTS : 0) |
- ((status & ISI_DTR) ? TIOCM_DTR : 0) |
- ((status & ISI_DCD) ? TIOCM_CAR : 0) |
- ((status & ISI_DSR) ? TIOCM_DSR : 0) |
- ((status & ISI_CTS) ? TIOCM_CTS : 0) |
- ((status & ISI_RI ) ? TIOCM_RI : 0);
-}
-
-static int isicom_tiocmset(struct tty_struct *tty,
- unsigned int set, unsigned int clear)
-{
- struct isi_port *port = tty->driver_data;
- unsigned long flags;
-
- if (isicom_paranoia_check(port, tty->name, "isicom_ioctl"))
- return -ENODEV;
-
- spin_lock_irqsave(&port->card->card_lock, flags);
- if (set & TIOCM_RTS)
- raise_rts(port);
- if (set & TIOCM_DTR)
- raise_dtr(port);
-
- if (clear & TIOCM_RTS)
- drop_rts(port);
- if (clear & TIOCM_DTR)
- drop_dtr(port);
- spin_unlock_irqrestore(&port->card->card_lock, flags);
-
- return 0;
-}
-
-static int isicom_set_serial_info(struct tty_struct *tty,
- struct serial_struct *ss)
-{
- struct isi_port *port = tty->driver_data;
- int reconfig_port;
-
- if (isicom_paranoia_check(port, tty->name, "isicom_ioctl"))
- return -ENODEV;
-
- mutex_lock(&port->port.mutex);
- reconfig_port = ((port->port.flags & ASYNC_SPD_MASK) !=
- (ss->flags & ASYNC_SPD_MASK));
-
- if (!capable(CAP_SYS_ADMIN)) {
- if ((ss->close_delay != port->port.close_delay) ||
- (ss->closing_wait != port->port.closing_wait) ||
- ((ss->flags & ~ASYNC_USR_MASK) !=
- (port->port.flags & ~ASYNC_USR_MASK))) {
- mutex_unlock(&port->port.mutex);
- return -EPERM;
- }
- port->port.flags = ((port->port.flags & ~ASYNC_USR_MASK) |
- (ss->flags & ASYNC_USR_MASK));
- } else {
- port->port.close_delay = ss->close_delay;
- port->port.closing_wait = ss->closing_wait;
- port->port.flags = ((port->port.flags & ~ASYNC_FLAGS) |
- (ss->flags & ASYNC_FLAGS));
- }
- if (reconfig_port) {
- unsigned long flags;
- spin_lock_irqsave(&port->card->card_lock, flags);
- isicom_config_port(tty);
- spin_unlock_irqrestore(&port->card->card_lock, flags);
- }
- mutex_unlock(&port->port.mutex);
- return 0;
-}
-
-static int isicom_get_serial_info(struct tty_struct *tty,
- struct serial_struct *ss)
-{
- struct isi_port *port = tty->driver_data;
-
- if (isicom_paranoia_check(port, tty->name, "isicom_ioctl"))
- return -ENODEV;
-
- mutex_lock(&port->port.mutex);
-/* ss->type = ? */
- ss->line = port - isi_ports;
- ss->port = port->card->base;
- ss->irq = port->card->irq;
- ss->flags = port->port.flags;
-/* ss->baud_base = ? */
- ss->close_delay = port->port.close_delay;
- ss->closing_wait = port->port.closing_wait;
- mutex_unlock(&port->port.mutex);
- return 0;
-}
-
-/* set_termios et all */
-static void isicom_set_termios(struct tty_struct *tty,
- struct ktermios *old_termios)
-{
- struct isi_port *port = tty->driver_data;
- unsigned long flags;
-
- if (isicom_paranoia_check(port, tty->name, "isicom_set_termios"))
- return;
-
- if (tty->termios.c_cflag == old_termios->c_cflag &&
- tty->termios.c_iflag == old_termios->c_iflag)
- return;
-
- spin_lock_irqsave(&port->card->card_lock, flags);
- isicom_config_port(tty);
- spin_unlock_irqrestore(&port->card->card_lock, flags);
-
- if ((old_termios->c_cflag & CRTSCTS) && !C_CRTSCTS(tty)) {
- tty->hw_stopped = 0;
- isicom_start(tty);
- }
-}
-
-/* throttle et all */
-static void isicom_throttle(struct tty_struct *tty)
-{
- struct isi_port *port = tty->driver_data;
- struct isi_board *card = port->card;
-
- if (isicom_paranoia_check(port, tty->name, "isicom_throttle"))
- return;
-
- /* tell the card that this port cannot handle any more data for now */
- card->port_status &= ~(1 << port->channel);
- outw(card->port_status, card->base + 0x02);
-}
-
-/* unthrottle et all */
-static void isicom_unthrottle(struct tty_struct *tty)
-{
- struct isi_port *port = tty->driver_data;
- struct isi_board *card = port->card;
-
- if (isicom_paranoia_check(port, tty->name, "isicom_unthrottle"))
- return;
-
- /* tell the card that this port is ready to accept more data */
- card->port_status |= (1 << port->channel);
- outw(card->port_status, card->base + 0x02);
-}
-
-/* stop et all */
-static void isicom_stop(struct tty_struct *tty)
-{
- struct isi_port *port = tty->driver_data;
-
- if (isicom_paranoia_check(port, tty->name, "isicom_stop"))
- return;
-
- /* this tells the transmitter not to consider this port for
- data output to the card. */
- port->status &= ~ISI_TXOK;
-}
-
-/* start et all */
-static void isicom_start(struct tty_struct *tty)
-{
- struct isi_port *port = tty->driver_data;
-
- if (isicom_paranoia_check(port, tty->name, "isicom_start"))
- return;
-
- /* this tells the transmitter to consider this port for
- data output to the card. */
- port->status |= ISI_TXOK;
-}
-
-static void isicom_hangup(struct tty_struct *tty)
-{
- struct isi_port *port = tty->driver_data;
-
- if (isicom_paranoia_check(port, tty->name, "isicom_hangup"))
- return;
- tty_port_hangup(&port->port);
-}
-
-
-/*
- * Driver init and deinit functions
- */
-
-static const struct tty_operations isicom_ops = {
- .open = isicom_open,
- .close = isicom_close,
- .write = isicom_write,
- .put_char = isicom_put_char,
- .flush_chars = isicom_flush_chars,
- .write_room = isicom_write_room,
- .chars_in_buffer = isicom_chars_in_buffer,
- .set_termios = isicom_set_termios,
- .throttle = isicom_throttle,
- .unthrottle = isicom_unthrottle,
- .stop = isicom_stop,
- .start = isicom_start,
- .hangup = isicom_hangup,
- .flush_buffer = isicom_flush_buffer,
- .tiocmget = isicom_tiocmget,
- .tiocmset = isicom_tiocmset,
- .break_ctl = isicom_send_break,
- .get_serial = isicom_get_serial_info,
- .set_serial = isicom_set_serial_info,
-};
-
-static const struct tty_port_operations isicom_port_ops = {
- .carrier_raised = isicom_carrier_raised,
- .dtr_rts = isicom_dtr_rts,
- .activate = isicom_activate,
- .shutdown = isicom_shutdown,
-};
-
-static int reset_card(struct pci_dev *pdev,
- const unsigned int card, unsigned int *signature)
-{
- struct isi_board *board = pci_get_drvdata(pdev);
- unsigned long base = board->base;
- unsigned int sig, portcount = 0;
- int retval = 0;
-
- dev_dbg(&pdev->dev, "ISILoad:Resetting Card%d at 0x%lx\n", card + 1,
- base);
-
- inw(base + 0x8);
-
- msleep(10);
-
- outw(0, base + 0x8); /* Reset */
-
- msleep(1000);
-
- sig = inw(base + 0x4) & 0xff;
-
- if (sig != 0xa5 && sig != 0xbb && sig != 0xcc && sig != 0xdd &&
- sig != 0xee) {
- dev_warn(&pdev->dev, "ISILoad:Card%u reset failure (Possible "
- "bad I/O Port Address 0x%lx).\n", card + 1, base);
- dev_dbg(&pdev->dev, "Sig=0x%x\n", sig);
- retval = -EIO;
- goto end;
- }
-
- msleep(10);
-
- portcount = inw(base + 0x2);
- if (!(inw(base + 0xe) & 0x1) || (portcount != 0 && portcount != 4 &&
- portcount != 8 && portcount != 16)) {
- dev_err(&pdev->dev, "ISILoad:PCI Card%d reset failure.\n",
- card + 1);
- retval = -EIO;
- goto end;
- }
-
- switch (sig) {
- case 0xa5:
- case 0xbb:
- case 0xdd:
- board->port_count = (portcount == 4) ? 4 : 8;
- board->shift_count = 12;
- break;
- case 0xcc:
- case 0xee:
- board->port_count = 16;
- board->shift_count = 11;
- break;
- }
- dev_info(&pdev->dev, "-Done\n");
- *signature = sig;
-
-end:
- return retval;
-}
-
-static int load_firmware(struct pci_dev *pdev,
- const unsigned int index, const unsigned int signature)
-{
- struct isi_board *board = pci_get_drvdata(pdev);
- const struct firmware *fw;
- unsigned long base = board->base;
- unsigned int a;
- u16 word_count, status;
- int retval = -EIO;
- char *name;
- u8 *data;
-
- struct stframe {
- u16 addr;
- u16 count;
- u8 data[0];
- } *frame;
-
- switch (signature) {
- case 0xa5:
- name = "isi608.bin";
- break;
- case 0xbb:
- name = "isi608em.bin";
- break;
- case 0xcc:
- name = "isi616em.bin";
- break;
- case 0xdd:
- name = "isi4608.bin";
- break;
- case 0xee:
- name = "isi4616.bin";
- break;
- default:
- dev_err(&pdev->dev, "Unknown signature.\n");
- goto end;
- }
-
- retval = request_firmware(&fw, name, &pdev->dev);
- if (retval)
- goto end;
-
- retval = -EIO;
-
- for (frame = (struct stframe *)fw->data;
- frame < (struct stframe *)(fw->data + fw->size);
- frame = (struct stframe *)((u8 *)(frame + 1) +
- frame->count)) {
- if (WaitTillCardIsFree(base))
- goto errrelfw;
-
- outw(0xf0, base); /* start upload sequence */
- outw(0x00, base);
- outw(frame->addr, base); /* lsb of address */
-
- word_count = frame->count / 2 + frame->count % 2;
- outw(word_count, base);
- InterruptTheCard(base);
-
- udelay(100); /* 0x2f */
-
- if (WaitTillCardIsFree(base))
- goto errrelfw;
-
- status = inw(base + 0x4);
- if (status != 0) {
- dev_warn(&pdev->dev, "Card%d rejected load header:\n"
- "Address:0x%x\n"
- "Count:0x%x\n"
- "Status:0x%x\n",
- index + 1, frame->addr, frame->count, status);
- goto errrelfw;
- }
- outsw(base, frame->data, word_count);
-
- InterruptTheCard(base);
-
- udelay(50); /* 0x0f */
-
- if (WaitTillCardIsFree(base))
- goto errrelfw;
-
- status = inw(base + 0x4);
- if (status != 0) {
- dev_err(&pdev->dev, "Card%d got out of sync.Card "
- "Status:0x%x\n", index + 1, status);
- goto errrelfw;
- }
- }
-
-/* XXX: should we test it by reading it back and comparing with original like
- * in load firmware package? */
- for (frame = (struct stframe *)fw->data;
- frame < (struct stframe *)(fw->data + fw->size);
- frame = (struct stframe *)((u8 *)(frame + 1) +
- frame->count)) {
- if (WaitTillCardIsFree(base))
- goto errrelfw;
-
- outw(0xf1, base); /* start download sequence */
- outw(0x00, base);
- outw(frame->addr, base); /* lsb of address */
-
- word_count = (frame->count >> 1) + frame->count % 2;
- outw(word_count + 1, base);
- InterruptTheCard(base);
-
- udelay(50); /* 0xf */
-
- if (WaitTillCardIsFree(base))
- goto errrelfw;
-
- status = inw(base + 0x4);
- if (status != 0) {
- dev_warn(&pdev->dev, "Card%d rejected verify header:\n"
- "Address:0x%x\n"
- "Count:0x%x\n"
- "Status: 0x%x\n",
- index + 1, frame->addr, frame->count, status);
- goto errrelfw;
- }
-
- data = kmalloc_array(word_count, 2, GFP_KERNEL);
- if (data == NULL) {
- dev_err(&pdev->dev, "Card%d, firmware upload "
- "failed, not enough memory\n", index + 1);
- goto errrelfw;
- }
- inw(base);
- insw(base, data, word_count);
- InterruptTheCard(base);
-
- for (a = 0; a < frame->count; a++)
- if (data[a] != frame->data[a]) {
- kfree(data);
- dev_err(&pdev->dev, "Card%d, firmware upload "
- "failed\n", index + 1);
- goto errrelfw;
- }
- kfree(data);
-
- udelay(50); /* 0xf */
-
- if (WaitTillCardIsFree(base))
- goto errrelfw;
-
- status = inw(base + 0x4);
- if (status != 0) {
- dev_err(&pdev->dev, "Card%d verify got out of sync. "
- "Card Status:0x%x\n", index + 1, status);
- goto errrelfw;
- }
- }
-
- /* xfer ctrl */
- if (WaitTillCardIsFree(base))
- goto errrelfw;
-
- outw(0xf2, base);
- outw(0x800, base);
- outw(0x0, base);
- outw(0x0, base);
- InterruptTheCard(base);
- outw(0x0, base + 0x4); /* for ISI4608 cards */
-
- board->status |= FIRMWARE_LOADED;
- retval = 0;
-
-errrelfw:
- release_firmware(fw);
-end:
- return retval;
-}
-
-/*
- * Insmod can set static symbols so keep these static
- */
-static unsigned int card_count;
-
-static int isicom_probe(struct pci_dev *pdev,
- const struct pci_device_id *ent)
-{
- unsigned int signature, index;
- int retval = -EPERM;
- struct isi_board *board = NULL;
-
- if (card_count >= BOARD_COUNT)
- goto err;
-
- retval = pci_enable_device(pdev);
- if (retval) {
- dev_err(&pdev->dev, "failed to enable\n");
- goto err;
- }
-
- dev_info(&pdev->dev, "ISI PCI Card(Device ID 0x%x)\n", ent->device);
-
- /* allot the first empty slot in the array */
- for (index = 0; index < BOARD_COUNT; index++) {
- if (isi_card[index].base == 0) {
- board = &isi_card[index];
- break;
- }
- }
- if (index == BOARD_COUNT) {
- retval = -ENODEV;
- goto err_disable;
- }
-
- board->index = index;
- board->base = pci_resource_start(pdev, 3);
- board->irq = pdev->irq;
- card_count++;
-
- pci_set_drvdata(pdev, board);
-
- retval = pci_request_region(pdev, 3, ISICOM_NAME);
- if (retval) {
- dev_err(&pdev->dev, "I/O Region 0x%lx-0x%lx is busy. Card%d "
- "will be disabled.\n", board->base, board->base + 15,
- index + 1);
- retval = -EBUSY;
- goto errdec;
- }
-
- retval = request_irq(board->irq, isicom_interrupt,
- IRQF_SHARED, ISICOM_NAME, board);
- if (retval < 0) {
- dev_err(&pdev->dev, "Could not install handler at Irq %d. "
- "Card%d will be disabled.\n", board->irq, index + 1);
- goto errunrr;
- }
-
- retval = reset_card(pdev, index, &signature);
- if (retval < 0)
- goto errunri;
-
- retval = load_firmware(pdev, index, signature);
- if (retval < 0)
- goto errunri;
-
- for (index = 0; index < board->port_count; index++) {
- struct tty_port *tport = &board->ports[index].port;
- tty_port_init(tport);
- tport->ops = &isicom_port_ops;
- tport->close_delay = 50 * HZ/100;
- tport->closing_wait = 3000 * HZ/100;
- tty_port_register_device(tport, isicom_normal,
- board->index * 16 + index, &pdev->dev);
- }
-
- return 0;
-
-errunri:
- free_irq(board->irq, board);
-errunrr:
- pci_release_region(pdev, 3);
-errdec:
- board->base = 0;
- card_count--;
-err_disable:
- pci_disable_device(pdev);
-err:
- return retval;
-}
-
-static void isicom_remove(struct pci_dev *pdev)
-{
- struct isi_board *board = pci_get_drvdata(pdev);
- unsigned int i;
-
- for (i = 0; i < board->port_count; i++) {
- tty_unregister_device(isicom_normal, board->index * 16 + i);
- tty_port_destroy(&board->ports[i].port);
- }
-
- free_irq(board->irq, board);
- pci_release_region(pdev, 3);
- board->base = 0;
- card_count--;
- pci_disable_device(pdev);
-}
-
-static int __init isicom_init(void)
-{
- int retval, idx, channel;
- struct isi_port *port;
-
- for (idx = 0; idx < BOARD_COUNT; idx++) {
- port = &isi_ports[idx * 16];
- isi_card[idx].ports = port;
- spin_lock_init(&isi_card[idx].card_lock);
- for (channel = 0; channel < 16; channel++, port++) {
- port->magic = ISICOM_MAGIC;
- port->card = &isi_card[idx];
- port->channel = channel;
- port->status = 0;
- /* . . . */
- }
- isi_card[idx].base = 0;
- isi_card[idx].irq = 0;
- }
-
- /* tty driver structure initialization */
- isicom_normal = alloc_tty_driver(PORT_COUNT);
- if (!isicom_normal) {
- retval = -ENOMEM;
- goto error;
- }
-
- isicom_normal->name = "ttyM";
- isicom_normal->major = ISICOM_NMAJOR;
- isicom_normal->minor_start = 0;
- isicom_normal->type = TTY_DRIVER_TYPE_SERIAL;
- isicom_normal->subtype = SERIAL_TYPE_NORMAL;
- isicom_normal->init_termios = tty_std_termios;
- isicom_normal->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL |
- CLOCAL;
- isicom_normal->flags = TTY_DRIVER_REAL_RAW |
- TTY_DRIVER_DYNAMIC_DEV | TTY_DRIVER_HARDWARE_BREAK;
- tty_set_operations(isicom_normal, &isicom_ops);
-
- retval = tty_register_driver(isicom_normal);
- if (retval) {
- pr_debug("Couldn't register the dialin driver\n");
- goto err_puttty;
- }
-
- retval = pci_register_driver(&isicom_driver);
- if (retval < 0) {
- pr_err("Unable to register pci driver.\n");
- goto err_unrtty;
- }
-
- mod_timer(&tx, jiffies + 1);
-
- return 0;
-err_unrtty:
- tty_unregister_driver(isicom_normal);
-err_puttty:
- put_tty_driver(isicom_normal);
-error:
- return retval;
-}
-
-static void __exit isicom_exit(void)
-{
- del_timer_sync(&tx);
-
- pci_unregister_driver(&isicom_driver);
- tty_unregister_driver(isicom_normal);
- put_tty_driver(isicom_normal);
-}
-
-module_init(isicom_init);
-module_exit(isicom_exit);
-
-MODULE_AUTHOR("MultiTech");
-MODULE_DESCRIPTION("Driver for the ISI series of cards by MultiTech");
-MODULE_LICENSE("GPL");
-MODULE_FIRMWARE("isi608.bin");
-MODULE_FIRMWARE("isi608em.bin");
-MODULE_FIRMWARE("isi616em.bin");
-MODULE_FIRMWARE("isi4608.bin");
-MODULE_FIRMWARE("isi4616.bin");
diff --git a/include/linux/isicom.h b/include/linux/isicom.h
deleted file mode 100644
index 7de6822d7b1a..000000000000
--- a/include/linux/isicom.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef _LINUX_ISICOM_H
-#define _LINUX_ISICOM_H
-
-#define YES 1
-#define NO 0
-
-/*
- * ISICOM Driver definitions ...
- *
- */
-
-#define ISICOM_NAME "ISICom"
-
-/*
- * PCI definitions
- */
-
-#define DEVID_COUNT 9
-#define VENDOR_ID 0x10b5
-
-/*
- * These are now officially allocated numbers
- */
-
-#define ISICOM_NMAJOR 112 /* normal */
-#define ISICOM_CMAJOR 113 /* callout */
-#define ISICOM_MAGIC (('M' << 8) | 'T')
-
-#define WAKEUP_CHARS 256 /* hard coded for now */
-#define TX_SIZE 254
-
-#define BOARD_COUNT 4
-#define PORT_COUNT (BOARD_COUNT*16)
-
-/* character sizes */
-
-#define ISICOM_CS5 0x0000
-#define ISICOM_CS6 0x0001
-#define ISICOM_CS7 0x0002
-#define ISICOM_CS8 0x0003
-
-/* stop bits */
-
-#define ISICOM_1SB 0x0000
-#define ISICOM_2SB 0x0004
-
-/* parity */
-
-#define ISICOM_NOPAR 0x0000
-#define ISICOM_ODPAR 0x0008
-#define ISICOM_EVPAR 0x0018
-
-/* flow control */
-
-#define ISICOM_CTSRTS 0x03
-#define ISICOM_INITIATE_XONXOFF 0x04
-#define ISICOM_RESPOND_XONXOFF 0x08
-
-#define BOARD(line) (((line) >> 4) & 0x3)
-
- /* isi kill queue bitmap */
-
-#define ISICOM_KILLTX 0x01
-#define ISICOM_KILLRX 0x02
-
- /* isi_board status bitmap */
-
-#define FIRMWARE_LOADED 0x0001
-#define BOARD_ACTIVE 0x0002
-#define BOARD_INIT 0x0004
-
- /* isi_port status bitmap */
-
-#define ISI_CTS 0x1000
-#define ISI_DSR 0x2000
-#define ISI_RI 0x4000
-#define ISI_DCD 0x8000
-#define ISI_DTR 0x0100
-#define ISI_RTS 0x0200
-
-
-#define ISI_TXOK 0x0001
-
-#endif /* ISICOM_H */
--
2.30.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PATCH 08/44] tty: remove TTY_LDISC_MAGIC
2021-03-02 6:21 [PATCH 01/44] MAINTAINERS: orphan mxser Jiri Slaby
` (3 preceding siblings ...)
2021-03-02 6:21 ` [PATCH 06/44] tty: isicom, remove this orphan Jiri Slaby
@ 2021-03-02 6:21 ` Jiri Slaby
2021-03-02 6:21 ` [PATCH 09/44] tty: n_tty, set tty_ldisc_ops::owner Jiri Slaby
` (36 subsequent siblings)
41 siblings, 0 replies; 61+ messages in thread
From: Jiri Slaby @ 2021-03-02 6:21 UTC (permalink / raw)
To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby
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 <jslaby@suse.cz>
---
Documentation/process/magic-number.rst | 1 -
Documentation/translations/it_IT/process/magic-number.rst | 1 -
Documentation/translations/zh_CN/process/magic-number.rst | 1 -
drivers/accessibility/speakup/spk_ttyio.c | 1 -
drivers/bluetooth/hci_ldisc.c | 1 -
drivers/misc/ti-st/st_core.c | 1 -
drivers/net/caif/caif_serial.c | 1 -
drivers/net/can/slcan.c | 1 -
drivers/net/hamradio/6pack.c | 1 -
drivers/net/hamradio/mkiss.c | 1 -
drivers/net/ppp/ppp_async.c | 1 -
drivers/net/ppp/ppp_synctty.c | 1 -
drivers/net/slip/slip.c | 1 -
drivers/pps/clients/pps-ldisc.c | 3 ---
drivers/tty/n_gsm.c | 1 -
drivers/tty/n_hdlc.c | 1 -
drivers/tty/n_null.c | 1 -
drivers/tty/n_r3964.c | 1 -
drivers/tty/n_tty.c | 1 -
include/linux/tty_ldisc.h | 3 ---
net/nfc/nci/uart.c | 1 -
sound/soc/codecs/cx20442.c | 1 -
sound/soc/ti/ams-delta.c | 1 -
23 files changed, 27 deletions(-)
diff --git a/Documentation/process/magic-number.rst b/Documentation/process/magic-number.rst
index 89992fe4863f..f5ba36e96461 100644
--- a/Documentation/process/magic-number.rst
+++ b/Documentation/process/magic-number.rst
@@ -88,7 +88,6 @@ TTY_MAGIC 0x5401 tty_struct ``include/linux/
MGSL_MAGIC 0x5401 mgsl_info ``drivers/char/synclink.c``
TTY_DRIVER_MAGIC 0x5402 tty_driver ``include/linux/tty_driver.h``
MGSLPC_MAGIC 0x5402 mgslpc_info ``drivers/char/pcmcia/synclink_cs.c``
-TTY_LDISC_MAGIC 0x5403 tty_ldisc ``include/linux/tty_ldisc.h``
USB_SERIAL_MAGIC 0x6702 usb_serial ``drivers/usb/serial/usb-serial.h``
FULL_DUPLEX_MAGIC 0x6969 ``drivers/net/ethernet/dec/tulip/de2104x.c``
USB_BLUETOOTH_MAGIC 0x6d02 usb_bluetooth ``drivers/usb/class/bluetty.c``
diff --git a/Documentation/translations/it_IT/process/magic-number.rst b/Documentation/translations/it_IT/process/magic-number.rst
index 9be170ec0d02..e8c782d155a3 100644
--- a/Documentation/translations/it_IT/process/magic-number.rst
+++ b/Documentation/translations/it_IT/process/magic-number.rst
@@ -94,7 +94,6 @@ TTY_MAGIC 0x5401 tty_struct ``include/linux/
MGSL_MAGIC 0x5401 mgsl_info ``drivers/char/synclink.c``
TTY_DRIVER_MAGIC 0x5402 tty_driver ``include/linux/tty_driver.h``
MGSLPC_MAGIC 0x5402 mgslpc_info ``drivers/char/pcmcia/synclink_cs.c``
-TTY_LDISC_MAGIC 0x5403 tty_ldisc ``include/linux/tty_ldisc.h``
USB_SERIAL_MAGIC 0x6702 usb_serial ``drivers/usb/serial/usb-serial.h``
FULL_DUPLEX_MAGIC 0x6969 ``drivers/net/ethernet/dec/tulip/de2104x.c``
USB_BLUETOOTH_MAGIC 0x6d02 usb_bluetooth ``drivers/usb/class/bluetty.c``
diff --git a/Documentation/translations/zh_CN/process/magic-number.rst b/Documentation/translations/zh_CN/process/magic-number.rst
index 191d705349ef..42f0635ca70a 100644
--- a/Documentation/translations/zh_CN/process/magic-number.rst
+++ b/Documentation/translations/zh_CN/process/magic-number.rst
@@ -77,7 +77,6 @@ TTY_MAGIC 0x5401 tty_struct ``include/linux/
MGSL_MAGIC 0x5401 mgsl_info ``drivers/char/synclink.c``
TTY_DRIVER_MAGIC 0x5402 tty_driver ``include/linux/tty_driver.h``
MGSLPC_MAGIC 0x5402 mgslpc_info ``drivers/char/pcmcia/synclink_cs.c``
-TTY_LDISC_MAGIC 0x5403 tty_ldisc ``include/linux/tty_ldisc.h``
USB_SERIAL_MAGIC 0x6702 usb_serial ``drivers/usb/serial/usb-serial.h``
FULL_DUPLEX_MAGIC 0x6969 ``drivers/net/ethernet/dec/tulip/de2104x.c``
USB_BLUETOOTH_MAGIC 0x6d02 usb_bluetooth ``drivers/usb/class/bluetty.c``
diff --git a/drivers/accessibility/speakup/spk_ttyio.c b/drivers/accessibility/speakup/spk_ttyio.c
index 9af1d4c124d3..2e39fcf492d8 100644
--- a/drivers/accessibility/speakup/spk_ttyio.c
+++ b/drivers/accessibility/speakup/spk_ttyio.c
@@ -104,7 +104,6 @@ static int spk_ttyio_receive_buf2(struct tty_struct *tty,
static struct tty_ldisc_ops spk_ttyio_ldisc_ops = {
.owner = THIS_MODULE,
- .magic = TTY_LDISC_MAGIC,
.name = "speakup_ldisc",
.open = spk_ttyio_ldisc_open,
.close = spk_ttyio_ldisc_close,
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
index 637c5b8c2aa1..71a4ca505e09 100644
--- a/drivers/bluetooth/hci_ldisc.c
+++ b/drivers/bluetooth/hci_ldisc.c
@@ -821,7 +821,6 @@ static __poll_t hci_uart_tty_poll(struct tty_struct *tty,
static struct tty_ldisc_ops hci_uart_ldisc = {
.owner = THIS_MODULE,
- .magic = TTY_LDISC_MAGIC,
.name = "n_hci",
.open = hci_uart_tty_open,
.close = hci_uart_tty_close,
diff --git a/drivers/misc/ti-st/st_core.c b/drivers/misc/ti-st/st_core.c
index 5a0a5fc3d3ab..071844b58073 100644
--- a/drivers/misc/ti-st/st_core.c
+++ b/drivers/misc/ti-st/st_core.c
@@ -845,7 +845,6 @@ static void st_tty_flush_buffer(struct tty_struct *tty)
}
static struct tty_ldisc_ops st_ldisc_ops = {
- .magic = TTY_LDISC_MAGIC,
.name = "n_st",
.open = st_tty_open,
.close = st_tty_close,
diff --git a/drivers/net/caif/caif_serial.c b/drivers/net/caif/caif_serial.c
index 8215cd77301f..675c374b32ee 100644
--- a/drivers/net/caif/caif_serial.c
+++ b/drivers/net/caif/caif_serial.c
@@ -382,7 +382,6 @@ static void ldisc_close(struct tty_struct *tty)
/* The line discipline structure. */
static struct tty_ldisc_ops caif_ldisc = {
.owner = THIS_MODULE,
- .magic = TTY_LDISC_MAGIC,
.name = "n_caif",
.open = ldisc_open,
.close = ldisc_close,
diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c
index 30c8d53c9745..31ba6664503d 100644
--- a/drivers/net/can/slcan.c
+++ b/drivers/net/can/slcan.c
@@ -697,7 +697,6 @@ static int slcan_ioctl(struct tty_struct *tty, struct file *file,
static struct tty_ldisc_ops slc_ldisc = {
.owner = THIS_MODULE,
- .magic = TTY_LDISC_MAGIC,
.name = "slcan",
.open = slcan_open,
.close = slcan_close,
diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c
index 71d6629e65c9..6f71eff9c52e 100644
--- a/drivers/net/hamradio/6pack.c
+++ b/drivers/net/hamradio/6pack.c
@@ -749,7 +749,6 @@ static int sixpack_ioctl(struct tty_struct *tty, struct file *file,
static struct tty_ldisc_ops sp_ldisc = {
.owner = THIS_MODULE,
- .magic = TTY_LDISC_MAGIC,
.name = "6pack",
.open = sixpack_open,
.close = sixpack_close,
diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c
index 17be2bb2985c..65154224d5b8 100644
--- a/drivers/net/hamradio/mkiss.c
+++ b/drivers/net/hamradio/mkiss.c
@@ -933,7 +933,6 @@ static void mkiss_write_wakeup(struct tty_struct *tty)
static struct tty_ldisc_ops ax_ldisc = {
.owner = THIS_MODULE,
- .magic = TTY_LDISC_MAGIC,
.name = "mkiss",
.open = mkiss_open,
.close = mkiss_close,
diff --git a/drivers/net/ppp/ppp_async.c b/drivers/net/ppp/ppp_async.c
index 2a91caa4f37b..8b41aa3fb64e 100644
--- a/drivers/net/ppp/ppp_async.c
+++ b/drivers/net/ppp/ppp_async.c
@@ -372,7 +372,6 @@ ppp_asynctty_wakeup(struct tty_struct *tty)
static struct tty_ldisc_ops ppp_ldisc = {
.owner = THIS_MODULE,
- .magic = TTY_LDISC_MAGIC,
.name = "ppp",
.open = ppp_asynctty_open,
.close = ppp_asynctty_close,
diff --git a/drivers/net/ppp/ppp_synctty.c b/drivers/net/ppp/ppp_synctty.c
index d8890923a9e3..576b6a93bf23 100644
--- a/drivers/net/ppp/ppp_synctty.c
+++ b/drivers/net/ppp/ppp_synctty.c
@@ -365,7 +365,6 @@ ppp_sync_wakeup(struct tty_struct *tty)
static struct tty_ldisc_ops ppp_sync_ldisc = {
.owner = THIS_MODULE,
- .magic = TTY_LDISC_MAGIC,
.name = "pppsync",
.open = ppp_sync_open,
.close = ppp_sync_close,
diff --git a/drivers/net/slip/slip.c b/drivers/net/slip/slip.c
index f81fb0b13a94..1ab124eba8eb 100644
--- a/drivers/net/slip/slip.c
+++ b/drivers/net/slip/slip.c
@@ -1263,7 +1263,6 @@ static int sl_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
static struct tty_ldisc_ops sl_ldisc = {
.owner = THIS_MODULE,
- .magic = TTY_LDISC_MAGIC,
.name = "slip",
.open = slip_open,
.close = slip_close,
diff --git a/drivers/pps/clients/pps-ldisc.c b/drivers/pps/clients/pps-ldisc.c
index 4fd0cbf7f931..bf26cc56b863 100644
--- a/drivers/pps/clients/pps-ldisc.c
+++ b/drivers/pps/clients/pps-ldisc.c
@@ -13,8 +13,6 @@
#include <linux/pps_kernel.h>
#include <linux/bug.h>
-#define PPS_TTY_MAGIC 0x0001
-
static void pps_tty_dcd_change(struct tty_struct *tty, unsigned int status)
{
struct pps_device *pps;
@@ -114,7 +112,6 @@ static int __init pps_tty_init(void)
/* Init PPS_TTY data */
pps_ldisc_ops.owner = THIS_MODULE;
- pps_ldisc_ops.magic = PPS_TTY_MAGIC;
pps_ldisc_ops.name = "pps_tty";
pps_ldisc_ops.dcd_change = pps_tty_dcd_change;
pps_ldisc_ops.open = pps_tty_open;
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index 51dafc06f541..b063bc608a8c 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -2849,7 +2849,6 @@ static int gsm_create_network(struct gsm_dlci *dlci, struct gsm_netconfig *nc)
/* Line discipline for real tty */
static struct tty_ldisc_ops tty_ldisc_packet = {
.owner = THIS_MODULE,
- .magic = TTY_LDISC_MAGIC,
.name = "n_gsm",
.open = gsmld_open,
.close = gsmld_close,
diff --git a/drivers/tty/n_hdlc.c b/drivers/tty/n_hdlc.c
index 1363e659dc1d..290c757db1b9 100644
--- a/drivers/tty/n_hdlc.c
+++ b/drivers/tty/n_hdlc.c
@@ -787,7 +787,6 @@ static struct n_hdlc_buf *n_hdlc_buf_get(struct n_hdlc_buf_list *buf_list)
static struct tty_ldisc_ops n_hdlc_ldisc = {
.owner = THIS_MODULE,
- .magic = TTY_LDISC_MAGIC,
.name = "hdlc",
.open = n_hdlc_tty_open,
.close = n_hdlc_tty_close,
diff --git a/drivers/tty/n_null.c b/drivers/tty/n_null.c
index ce03ae78f5c6..b8f67b5f1ef8 100644
--- a/drivers/tty/n_null.c
+++ b/drivers/tty/n_null.c
@@ -40,7 +40,6 @@ static void n_null_receivebuf(struct tty_struct *tty,
static struct tty_ldisc_ops null_ldisc = {
.owner = THIS_MODULE,
- .magic = TTY_LDISC_MAGIC,
.name = "n_null",
.open = n_null_open,
.close = n_null_close,
diff --git a/drivers/tty/n_r3964.c b/drivers/tty/n_r3964.c
index 3161f0a535e3..2eb76ea1d88d 100644
--- a/drivers/tty/n_r3964.c
+++ b/drivers/tty/n_r3964.c
@@ -146,7 +146,6 @@ static void r3964_receive_buf(struct tty_struct *tty, const unsigned char *cp,
static struct tty_ldisc_ops tty_ldisc_N_R3964 = {
.owner = THIS_MODULE,
- .magic = TTY_LDISC_MAGIC,
.name = "R3964",
.open = r3964_open,
.close = r3964_close,
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 87ec15dbe10d..7c53185bce57 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -2488,7 +2488,6 @@ static int n_tty_ioctl(struct tty_struct *tty, struct file *file,
}
static struct tty_ldisc_ops n_tty_ops = {
- .magic = TTY_LDISC_MAGIC,
.name = "n_tty",
.open = n_tty_open,
.close = n_tty_close,
diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h
index 572a07976116..31284b55bd4f 100644
--- a/include/linux/tty_ldisc.h
+++ b/include/linux/tty_ldisc.h
@@ -173,7 +173,6 @@ extern int ldsem_down_write_nested(struct ld_semaphore *sem, int subclass,
struct tty_ldisc_ops {
- int magic;
char *name;
int num;
int flags;
@@ -218,8 +217,6 @@ struct tty_ldisc {
struct tty_struct *tty;
};
-#define TTY_LDISC_MAGIC 0x5403
-
#define LDISC_FLAG_DEFINED 0x00000001
#define MODULE_ALIAS_LDISC(ldisc) \
diff --git a/net/nfc/nci/uart.c b/net/nfc/nci/uart.c
index 1204c438e87d..16d009c9b6a0 100644
--- a/net/nfc/nci/uart.c
+++ b/net/nfc/nci/uart.c
@@ -453,7 +453,6 @@ void nci_uart_set_config(struct nci_uart *nu, int baudrate, int flow_ctrl)
EXPORT_SYMBOL_GPL(nci_uart_set_config);
static struct tty_ldisc_ops nci_uart_ldisc = {
- .magic = TTY_LDISC_MAGIC,
.owner = THIS_MODULE,
.name = "n_nci",
.open = nci_uart_tty_open,
diff --git a/sound/soc/codecs/cx20442.c b/sound/soc/codecs/cx20442.c
index 161be8b7d131..61dfa86d444d 100644
--- a/sound/soc/codecs/cx20442.c
+++ b/sound/soc/codecs/cx20442.c
@@ -285,7 +285,6 @@ static void v253_wakeup(struct tty_struct *tty)
}
struct tty_ldisc_ops v253_ops = {
- .magic = TTY_LDISC_MAGIC,
.name = "cx20442",
.owner = THIS_MODULE,
.open = v253_open,
diff --git a/sound/soc/ti/ams-delta.c b/sound/soc/ti/ams-delta.c
index 57feb473a579..98198c7cc872 100644
--- a/sound/soc/ti/ams-delta.c
+++ b/sound/soc/ti/ams-delta.c
@@ -395,7 +395,6 @@ static void cx81801_wakeup(struct tty_struct *tty)
}
static struct tty_ldisc_ops cx81801_ops = {
- .magic = TTY_LDISC_MAGIC,
.name = "cx81801",
.owner = THIS_MODULE,
.open = cx81801_open,
--
2.30.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PATCH 09/44] tty: n_tty, set tty_ldisc_ops::owner
2021-03-02 6:21 [PATCH 01/44] MAINTAINERS: orphan mxser Jiri Slaby
` (4 preceding siblings ...)
2021-03-02 6:21 ` [PATCH 08/44] tty: remove TTY_LDISC_MAGIC Jiri Slaby
@ 2021-03-02 6:21 ` Jiri Slaby
2021-03-02 6:21 ` [PATCH 10/44] tty: imx, use ms_to_ktime Jiri Slaby
` (35 subsequent siblings)
41 siblings, 0 replies; 61+ messages in thread
From: Jiri Slaby @ 2021-03-02 6:21 UTC (permalink / raw)
To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby
Set tty_ldisc_ops::owner to THIS_MODULE. This has no effect currently as
n_tty cannot be built as a module. If someone ever tries to modularize
tty, we wouldn't manage module's reference count as in other ldiscs. So
fix this just in case.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/tty/n_tty.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 7c53185bce57..a6f3c5c148eb 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -2488,6 +2488,7 @@ static int n_tty_ioctl(struct tty_struct *tty, struct file *file,
}
static struct tty_ldisc_ops n_tty_ops = {
+ .owner = THIS_MODULE,
.name = "n_tty",
.open = n_tty_open,
.close = n_tty_close,
--
2.30.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PATCH 10/44] tty: imx, use ms_to_ktime
2021-03-02 6:21 [PATCH 01/44] MAINTAINERS: orphan mxser Jiri Slaby
` (5 preceding siblings ...)
2021-03-02 6:21 ` [PATCH 09/44] tty: n_tty, set tty_ldisc_ops::owner Jiri Slaby
@ 2021-03-02 6:21 ` Jiri Slaby
2021-03-02 6:59 ` Uwe Kleine-König
2021-03-02 6:21 ` [PATCH 11/44] tty: 8250, " Jiri Slaby
` (34 subsequent siblings)
41 siblings, 1 reply; 61+ messages in thread
From: Jiri Slaby @ 2021-03-02 6:21 UTC (permalink / raw)
To: gregkh
Cc: linux-serial, linux-kernel, Jiri Slaby, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team
This really eliminates multiplications from the assembly. I would have
thought they are optimized by inlining ktime_set, but not on x86_64 with
gcc 10.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: NXP Linux Team <linux-imx@nxp.com>
---
drivers/tty/serial/imx.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 8257597d034d..3f69356937ef 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -394,11 +394,7 @@ static void imx_uart_rts_inactive(struct imx_port *sport, u32 *ucr2)
static void start_hrtimer_ms(struct hrtimer *hrt, unsigned long msec)
{
- long sec = msec / MSEC_PER_SEC;
- long nsec = (msec % MSEC_PER_SEC) * 1000000;
- ktime_t t = ktime_set(sec, nsec);
-
- hrtimer_start(hrt, t, HRTIMER_MODE_REL);
+ hrtimer_start(hrt, ms_to_ktime(msec), HRTIMER_MODE_REL);
}
/* called with port.lock taken and irqs off */
--
2.30.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PATCH 11/44] tty: 8250, use ms_to_ktime
2021-03-02 6:21 [PATCH 01/44] MAINTAINERS: orphan mxser Jiri Slaby
` (6 preceding siblings ...)
2021-03-02 6:21 ` [PATCH 10/44] tty: imx, use ms_to_ktime Jiri Slaby
@ 2021-03-02 6:21 ` Jiri Slaby
2021-03-02 6:21 ` [PATCH 12/44] tty: 8250, cleanup em485 timers Jiri Slaby
` (33 subsequent siblings)
41 siblings, 0 replies; 61+ messages in thread
From: Jiri Slaby @ 2021-03-02 6:21 UTC (permalink / raw)
To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby
This really eliminates multiplications from the assembly. I would have
thought they are optimized by inlining ktime_set, but not on x86_64 with
gcc 10.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/tty/serial/8250/8250_port.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index b0af13074cd3..167c1e3e53bc 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -1487,11 +1487,7 @@ static enum hrtimer_restart serial8250_em485_handle_stop_tx(struct hrtimer *t)
static void start_hrtimer_ms(struct hrtimer *hrt, unsigned long msec)
{
- long sec = msec / 1000;
- long nsec = (msec % 1000) * 1000000;
- ktime_t t = ktime_set(sec, nsec);
-
- hrtimer_start(hrt, t, HRTIMER_MODE_REL);
+ hrtimer_start(hrt, ms_to_ktime(msec), HRTIMER_MODE_REL);
}
static void __stop_tx_rs485(struct uart_8250_port *p)
--
2.30.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PATCH 12/44] tty: 8250, cleanup em485 timers
2021-03-02 6:21 [PATCH 01/44] MAINTAINERS: orphan mxser Jiri Slaby
` (7 preceding siblings ...)
2021-03-02 6:21 ` [PATCH 11/44] tty: 8250, " Jiri Slaby
@ 2021-03-02 6:21 ` Jiri Slaby
2021-03-02 6:21 ` [PATCH 13/44] tty: 8250/serial_cs, propagate errors in simple_config Jiri Slaby
` (32 subsequent siblings)
41 siblings, 0 replies; 61+ messages in thread
From: Jiri Slaby @ 2021-03-02 6:21 UTC (permalink / raw)
To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby
Initialize the variables directly by initializers in definitions. This
is expected/usual for these kind of callback.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/tty/serial/8250/8250_port.c | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index 167c1e3e53bc..9019f8f626bb 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -1466,13 +1466,11 @@ EXPORT_SYMBOL_GPL(serial8250_em485_stop_tx);
static enum hrtimer_restart serial8250_em485_handle_stop_tx(struct hrtimer *t)
{
- struct uart_8250_em485 *em485;
- struct uart_8250_port *p;
+ struct uart_8250_em485 *em485 = container_of(t, struct uart_8250_em485,
+ stop_tx_timer);
+ struct uart_8250_port *p = em485->port;
unsigned long flags;
- em485 = container_of(t, struct uart_8250_em485, stop_tx_timer);
- p = em485->port;
-
serial8250_rpm_get(p);
spin_lock_irqsave(&p->port.lock, flags);
if (em485->active_timer == &em485->stop_tx_timer) {
@@ -1482,6 +1480,7 @@ static enum hrtimer_restart serial8250_em485_handle_stop_tx(struct hrtimer *t)
}
spin_unlock_irqrestore(&p->port.lock, flags);
serial8250_rpm_put(p);
+
return HRTIMER_NORESTART;
}
@@ -1629,19 +1628,18 @@ static inline void start_tx_rs485(struct uart_port *port)
static enum hrtimer_restart serial8250_em485_handle_start_tx(struct hrtimer *t)
{
- struct uart_8250_em485 *em485;
- struct uart_8250_port *p;
+ struct uart_8250_em485 *em485 = container_of(t, struct uart_8250_em485,
+ start_tx_timer);
+ struct uart_8250_port *p = em485->port;
unsigned long flags;
- em485 = container_of(t, struct uart_8250_em485, start_tx_timer);
- p = em485->port;
-
spin_lock_irqsave(&p->port.lock, flags);
if (em485->active_timer == &em485->start_tx_timer) {
__start_tx(&p->port);
em485->active_timer = NULL;
}
spin_unlock_irqrestore(&p->port.lock, flags);
+
return HRTIMER_NORESTART;
}
--
2.30.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PATCH 13/44] tty: 8250/serial_cs, propagate errors in simple_config
2021-03-02 6:21 [PATCH 01/44] MAINTAINERS: orphan mxser Jiri Slaby
` (8 preceding siblings ...)
2021-03-02 6:21 ` [PATCH 12/44] tty: 8250, cleanup em485 timers Jiri Slaby
@ 2021-03-02 6:21 ` Jiri Slaby
2021-03-02 6:21 ` [PATCH 14/44] net: caif: inline register_ldisc Jiri Slaby
` (31 subsequent siblings)
41 siblings, 0 replies; 61+ messages in thread
From: Jiri Slaby @ 2021-03-02 6:21 UTC (permalink / raw)
To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby
The caller expects from the others (pfc_config and multi_config) to
return standard error values. So do the same for simple_config too.
We invert the if condition to handle the error case.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/tty/serial/8250/serial_cs.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/tty/serial/8250/serial_cs.c b/drivers/tty/serial/8250/serial_cs.c
index 35ff6627c61b..63ea9c4da3d5 100644
--- a/drivers/tty/serial/8250/serial_cs.c
+++ b/drivers/tty/serial/8250/serial_cs.c
@@ -456,11 +456,11 @@ static int simple_config(struct pcmcia_device *link)
* its base address, then try to grab any standard serial port
* address, and finally try to get any free port.
*/
- if (!pcmcia_loop_config(link, simple_config_check_notpicky, NULL))
- goto found_port;
-
- dev_warn(&link->dev, "no usable port range found, giving up\n");
- return -1;
+ ret = pcmcia_loop_config(link, simple_config_check_notpicky, NULL);
+ if (ret) {
+ dev_warn(&link->dev, "no usable port range found, giving up\n");
+ return ret;
+ }
found_port:
if (info->multi && (info->manfid == MANFID_3COM))
@@ -474,7 +474,7 @@ static int simple_config(struct pcmcia_device *link)
ret = pcmcia_enable_device(link);
if (ret != 0)
- return -1;
+ return ret;
return setup_serial(link, info, link->resource[0]->start, link->irq);
}
--
2.30.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PATCH 14/44] net: caif: inline register_ldisc
2021-03-02 6:21 [PATCH 01/44] MAINTAINERS: orphan mxser Jiri Slaby
` (9 preceding siblings ...)
2021-03-02 6:21 ` [PATCH 13/44] tty: 8250/serial_cs, propagate errors in simple_config Jiri Slaby
@ 2021-03-02 6:21 ` Jiri Slaby
2021-03-02 6:21 ` [PATCH 15/44] net: nfc: nci: remove memset of nci_uart_drivers Jiri Slaby
` (30 subsequent siblings)
41 siblings, 0 replies; 61+ messages in thread
From: Jiri Slaby @ 2021-03-02 6:21 UTC (permalink / raw)
To: gregkh
Cc: linux-serial, linux-kernel, Jiri Slaby, David S. Miller,
Jakub Kicinski, netdev
register_ldisc only calls tty_register_ldisc. Inline register_ldisc into
the only caller of register_ldisc, i.e. caif_ser_init. Now,
caif_ser_init is symmetric to caif_ser_exit in this regard.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org
---
drivers/net/caif/caif_serial.c | 17 ++++-------------
1 file changed, 4 insertions(+), 13 deletions(-)
diff --git a/drivers/net/caif/caif_serial.c b/drivers/net/caif/caif_serial.c
index 675c374b32ee..da6fffb4d5a8 100644
--- a/drivers/net/caif/caif_serial.c
+++ b/drivers/net/caif/caif_serial.c
@@ -389,18 +389,6 @@ static struct tty_ldisc_ops caif_ldisc = {
.write_wakeup = ldisc_tx_wakeup
};
-static int register_ldisc(void)
-{
- int result;
-
- result = tty_register_ldisc(N_CAIF, &caif_ldisc);
- if (result < 0) {
- pr_err("cannot register CAIF ldisc=%d err=%d\n", N_CAIF,
- result);
- return result;
- }
- return result;
-}
static const struct net_device_ops netdev_ops = {
.ndo_open = caif_net_open,
.ndo_stop = caif_net_close,
@@ -443,7 +431,10 @@ static int __init caif_ser_init(void)
{
int ret;
- ret = register_ldisc();
+ ret = tty_register_ldisc(N_CAIF, &caif_ldisc);
+ if (ret < 0)
+ pr_err("cannot register CAIF ldisc=%d err=%d\n", N_CAIF, ret);
+
debugfsdir = debugfs_create_dir("caif_serial", NULL);
return ret;
}
--
2.30.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PATCH 15/44] net: nfc: nci: remove memset of nci_uart_drivers
2021-03-02 6:21 [PATCH 01/44] MAINTAINERS: orphan mxser Jiri Slaby
` (10 preceding siblings ...)
2021-03-02 6:21 ` [PATCH 14/44] net: caif: inline register_ldisc Jiri Slaby
@ 2021-03-02 6:21 ` Jiri Slaby
2021-03-02 6:21 ` [PATCH 16/44] net: nfc: nci: drop nci_uart_ops::recv_buf Jiri Slaby
` (29 subsequent siblings)
41 siblings, 0 replies; 61+ messages in thread
From: Jiri Slaby @ 2021-03-02 6:21 UTC (permalink / raw)
To: gregkh
Cc: linux-serial, linux-kernel, Jiri Slaby, David S. Miller,
Jakub Kicinski, netdev
nci_uart_drivers is a global definition, so there is no need to
initialize its memory to zero during module load.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org
---
net/nfc/nci/uart.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/net/nfc/nci/uart.c b/net/nfc/nci/uart.c
index 16d009c9b6a0..c9987d1cccdf 100644
--- a/net/nfc/nci/uart.c
+++ b/net/nfc/nci/uart.c
@@ -468,7 +468,6 @@ static struct tty_ldisc_ops nci_uart_ldisc = {
static int __init nci_uart_init(void)
{
- memset(nci_uart_drivers, 0, sizeof(nci_uart_drivers));
return tty_register_ldisc(N_NCI, &nci_uart_ldisc);
}
--
2.30.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PATCH 16/44] net: nfc: nci: drop nci_uart_ops::recv_buf
2021-03-02 6:21 [PATCH 01/44] MAINTAINERS: orphan mxser Jiri Slaby
` (11 preceding siblings ...)
2021-03-02 6:21 ` [PATCH 15/44] net: nfc: nci: remove memset of nci_uart_drivers Jiri Slaby
@ 2021-03-02 6:21 ` Jiri Slaby
2021-03-02 6:21 ` [PATCH 17/44] net: nfc: nci: drop nci_uart_default_recv Jiri Slaby
` (28 subsequent siblings)
41 siblings, 0 replies; 61+ messages in thread
From: Jiri Slaby @ 2021-03-02 6:21 UTC (permalink / raw)
To: gregkh
Cc: linux-serial, linux-kernel, Jiri Slaby, David S. Miller,
Jakub Kicinski, netdev
There is noone setting nci_uart_ops::recv_buf, so the default one
(nci_uart_default_recv_buf) is always used. So drop this hook, move
nci_uart_default_recv_buf before the use in nci_uart_tty_receive and
remove unused parameter flags.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org
---
include/net/nfc/nci_core.h | 2 -
net/nfc/nci/uart.c | 136 ++++++++++++++++++-------------------
2 files changed, 67 insertions(+), 71 deletions(-)
diff --git a/include/net/nfc/nci_core.h b/include/net/nfc/nci_core.h
index 43c9c5d2bedb..bd76e8e082c0 100644
--- a/include/net/nfc/nci_core.h
+++ b/include/net/nfc/nci_core.h
@@ -430,8 +430,6 @@ struct nci_uart_ops {
int (*open)(struct nci_uart *nci_uart);
void (*close)(struct nci_uart *nci_uart);
int (*recv)(struct nci_uart *nci_uart, struct sk_buff *skb);
- int (*recv_buf)(struct nci_uart *nci_uart, const u8 *data, char *flags,
- int count);
int (*send)(struct nci_uart *nci_uart, struct sk_buff *skb);
void (*tx_start)(struct nci_uart *nci_uart);
void (*tx_done)(struct nci_uart *nci_uart);
diff --git a/net/nfc/nci/uart.c b/net/nfc/nci/uart.c
index c9987d1cccdf..5cf7d3729d5f 100644
--- a/net/nfc/nci/uart.c
+++ b/net/nfc/nci/uart.c
@@ -229,6 +229,72 @@ static void nci_uart_tty_wakeup(struct tty_struct *tty)
nci_uart_tx_wakeup(nu);
}
+/* -- Default recv_buf handler --
+ *
+ * This handler supposes that NCI frames are sent over UART link without any
+ * framing. It reads NCI header, retrieve the packet size and once all packet
+ * bytes are received it passes it to nci_uart driver for processing.
+ */
+static int nci_uart_default_recv_buf(struct nci_uart *nu, const u8 *data,
+ int count)
+{
+ int chunk_len;
+
+ if (!nu->ndev) {
+ nfc_err(nu->tty->dev,
+ "receive data from tty but no NCI dev is attached yet, drop buffer\n");
+ return 0;
+ }
+
+ /* Decode all incoming data in packets
+ * and enqueue then for processing.
+ */
+ while (count > 0) {
+ /* If this is the first data of a packet, allocate a buffer */
+ if (!nu->rx_skb) {
+ nu->rx_packet_len = -1;
+ nu->rx_skb = nci_skb_alloc(nu->ndev,
+ NCI_MAX_PACKET_SIZE,
+ GFP_ATOMIC);
+ if (!nu->rx_skb)
+ return -ENOMEM;
+ }
+
+ /* Eat byte after byte till full packet header is received */
+ if (nu->rx_skb->len < NCI_CTRL_HDR_SIZE) {
+ skb_put_u8(nu->rx_skb, *data++);
+ --count;
+ continue;
+ }
+
+ /* Header was received but packet len was not read */
+ if (nu->rx_packet_len < 0)
+ nu->rx_packet_len = NCI_CTRL_HDR_SIZE +
+ nci_plen(nu->rx_skb->data);
+
+ /* Compute how many bytes are missing and how many bytes can
+ * be consumed.
+ */
+ chunk_len = nu->rx_packet_len - nu->rx_skb->len;
+ if (count < chunk_len)
+ chunk_len = count;
+ skb_put_data(nu->rx_skb, data, chunk_len);
+ data += chunk_len;
+ count -= chunk_len;
+
+ /* Chcek if packet is fully received */
+ if (nu->rx_packet_len == nu->rx_skb->len) {
+ /* Pass RX packet to driver */
+ if (nu->ops.recv(nu, nu->rx_skb) != 0)
+ nfc_err(nu->tty->dev, "corrupted RX packet\n");
+ /* Next packet will be a new one */
+ nu->rx_skb = NULL;
+ }
+ }
+
+ return 0;
+}
+
/* nci_uart_tty_receive()
*
* Called by tty low level driver when receive data is
@@ -250,7 +316,7 @@ static void nci_uart_tty_receive(struct tty_struct *tty, const u8 *data,
return;
spin_lock(&nu->rx_lock);
- nu->ops.recv_buf(nu, (void *)data, flags, count);
+ nci_uart_default_recv_buf(nu, data, count);
spin_unlock(&nu->rx_lock);
tty_unthrottle(tty);
@@ -321,72 +387,6 @@ static int nci_uart_send(struct nci_uart *nu, struct sk_buff *skb)
return 0;
}
-/* -- Default recv_buf handler --
- *
- * This handler supposes that NCI frames are sent over UART link without any
- * framing. It reads NCI header, retrieve the packet size and once all packet
- * bytes are received it passes it to nci_uart driver for processing.
- */
-static int nci_uart_default_recv_buf(struct nci_uart *nu, const u8 *data,
- char *flags, int count)
-{
- int chunk_len;
-
- if (!nu->ndev) {
- nfc_err(nu->tty->dev,
- "receive data from tty but no NCI dev is attached yet, drop buffer\n");
- return 0;
- }
-
- /* Decode all incoming data in packets
- * and enqueue then for processing.
- */
- while (count > 0) {
- /* If this is the first data of a packet, allocate a buffer */
- if (!nu->rx_skb) {
- nu->rx_packet_len = -1;
- nu->rx_skb = nci_skb_alloc(nu->ndev,
- NCI_MAX_PACKET_SIZE,
- GFP_ATOMIC);
- if (!nu->rx_skb)
- return -ENOMEM;
- }
-
- /* Eat byte after byte till full packet header is received */
- if (nu->rx_skb->len < NCI_CTRL_HDR_SIZE) {
- skb_put_u8(nu->rx_skb, *data++);
- --count;
- continue;
- }
-
- /* Header was received but packet len was not read */
- if (nu->rx_packet_len < 0)
- nu->rx_packet_len = NCI_CTRL_HDR_SIZE +
- nci_plen(nu->rx_skb->data);
-
- /* Compute how many bytes are missing and how many bytes can
- * be consumed.
- */
- chunk_len = nu->rx_packet_len - nu->rx_skb->len;
- if (count < chunk_len)
- chunk_len = count;
- skb_put_data(nu->rx_skb, data, chunk_len);
- data += chunk_len;
- count -= chunk_len;
-
- /* Chcek if packet is fully received */
- if (nu->rx_packet_len == nu->rx_skb->len) {
- /* Pass RX packet to driver */
- if (nu->ops.recv(nu, nu->rx_skb) != 0)
- nfc_err(nu->tty->dev, "corrupted RX packet\n");
- /* Next packet will be a new one */
- nu->rx_skb = NULL;
- }
- }
-
- return 0;
-}
-
/* -- Default recv handler -- */
static int nci_uart_default_recv(struct nci_uart *nu, struct sk_buff *skb)
{
@@ -403,8 +403,6 @@ int nci_uart_register(struct nci_uart *nu)
nu->ops.send = nci_uart_send;
/* Install default handlers if not overridden */
- if (!nu->ops.recv_buf)
- nu->ops.recv_buf = nci_uart_default_recv_buf;
if (!nu->ops.recv)
nu->ops.recv = nci_uart_default_recv;
--
2.30.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PATCH 17/44] net: nfc: nci: drop nci_uart_default_recv
2021-03-02 6:21 [PATCH 01/44] MAINTAINERS: orphan mxser Jiri Slaby
` (12 preceding siblings ...)
2021-03-02 6:21 ` [PATCH 16/44] net: nfc: nci: drop nci_uart_ops::recv_buf Jiri Slaby
@ 2021-03-02 6:21 ` Jiri Slaby
2021-03-02 6:21 ` [PATCH 18/44] tty: con3215, remove tasklet for tty_wakeup Jiri Slaby
` (27 subsequent siblings)
41 siblings, 0 replies; 61+ messages in thread
From: Jiri Slaby @ 2021-03-02 6:21 UTC (permalink / raw)
To: gregkh
Cc: linux-serial, linux-kernel, Jiri Slaby, David S. Miller,
Jakub Kicinski, netdev
nci_uart_register returns -EINVAL immediately when nu->ops.recv is not
set. So the same 'if' later never triggers so nci_uart_default_recv is
never used. Drop it.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org
---
net/nfc/nci/uart.c | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/net/nfc/nci/uart.c b/net/nfc/nci/uart.c
index 5cf7d3729d5f..9958b37d8f9d 100644
--- a/net/nfc/nci/uart.c
+++ b/net/nfc/nci/uart.c
@@ -387,12 +387,6 @@ static int nci_uart_send(struct nci_uart *nu, struct sk_buff *skb)
return 0;
}
-/* -- Default recv handler -- */
-static int nci_uart_default_recv(struct nci_uart *nu, struct sk_buff *skb)
-{
- return nci_recv_frame(nu->ndev, skb);
-}
-
int nci_uart_register(struct nci_uart *nu)
{
if (!nu || !nu->ops.open ||
@@ -402,10 +396,6 @@ int nci_uart_register(struct nci_uart *nu)
/* Set the send callback */
nu->ops.send = nci_uart_send;
- /* Install default handlers if not overridden */
- if (!nu->ops.recv)
- nu->ops.recv = nci_uart_default_recv;
-
/* Add this driver in the driver list */
if (nci_uart_drivers[nu->driver]) {
pr_err("driver %d is already registered\n", nu->driver);
--
2.30.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PATCH 18/44] tty: con3215, remove tasklet for tty_wakeup
2021-03-02 6:21 [PATCH 01/44] MAINTAINERS: orphan mxser Jiri Slaby
` (13 preceding siblings ...)
2021-03-02 6:21 ` [PATCH 17/44] net: nfc: nci: drop nci_uart_default_recv Jiri Slaby
@ 2021-03-02 6:21 ` Jiri Slaby
2021-03-02 6:21 ` [PATCH 19/44] tty: con3215, remove unneeded tty checks Jiri Slaby
` (26 subsequent siblings)
41 siblings, 0 replies; 61+ messages in thread
From: Jiri Slaby @ 2021-03-02 6:21 UTC (permalink / raw)
To: gregkh
Cc: linux-serial, linux-kernel, Jiri Slaby, Martin Schwidefsky,
Heiko Carstens, linux390, linux-s390
tty_wakeup is safe to be called from all contexts. No need to schedule
a tasklet for that. Let us call it directly like in other drivers.
And delete the tasklet completely.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: linux390@de.ibm.com
Cc: linux-s390@vger.kernel.org
---
drivers/s390/char/con3215.c | 20 +-------------------
1 file changed, 1 insertion(+), 19 deletions(-)
diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c
index 671efee612af..5923a1f133ef 100644
--- a/drivers/s390/char/con3215.c
+++ b/drivers/s390/char/con3215.c
@@ -85,7 +85,6 @@ struct raw3215_info {
int written; /* number of bytes in write requests */
struct raw3215_req *queued_read; /* pointer to queued read requests */
struct raw3215_req *queued_write;/* pointer to queued write requests */
- struct tasklet_struct tlet; /* tasklet to invoke tty_wakeup */
wait_queue_head_t empty_wait; /* wait queue for flushing */
struct timer_list timer; /* timer for delayed output */
int line_pos; /* position on the line (for tabs) */
@@ -329,21 +328,6 @@ static inline void raw3215_try_io(struct raw3215_info *raw)
}
}
-/*
- * Call tty_wakeup from tasklet context
- */
-static void raw3215_wakeup(unsigned long data)
-{
- struct raw3215_info *raw = (struct raw3215_info *) data;
- struct tty_struct *tty;
-
- tty = tty_port_tty_get(&raw->port);
- if (tty) {
- tty_wakeup(tty);
- tty_kref_put(tty);
- }
-}
-
/*
* Try to start the next IO and wake up processes waiting on the tty.
*/
@@ -352,7 +336,7 @@ static void raw3215_next_io(struct raw3215_info *raw, struct tty_struct *tty)
raw3215_mk_write_req(raw);
raw3215_try_io(raw);
if (tty && RAW3215_BUFFER_SIZE - raw->count >= RAW3215_MIN_SPACE)
- tasklet_schedule(&raw->tlet);
+ tty_wakeup(tty);
}
/*
@@ -644,7 +628,6 @@ static struct raw3215_info *raw3215_alloc_info(void)
timer_setup(&info->timer, raw3215_timeout, 0);
init_waitqueue_head(&info->empty_wait);
- tasklet_init(&info->tlet, raw3215_wakeup, (unsigned long)info);
tty_port_init(&info->port);
return info;
@@ -936,7 +919,6 @@ static void tty3215_close(struct tty_struct *tty, struct file * filp)
tty->closing = 1;
/* Shutdown the terminal */
raw3215_shutdown(raw);
- tasklet_kill(&raw->tlet);
tty->closing = 0;
tty_port_tty_set(&raw->port, NULL);
}
--
2.30.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PATCH 19/44] tty: con3215, remove unneeded tty checks
2021-03-02 6:21 [PATCH 01/44] MAINTAINERS: orphan mxser Jiri Slaby
` (14 preceding siblings ...)
2021-03-02 6:21 ` [PATCH 18/44] tty: con3215, remove tasklet for tty_wakeup Jiri Slaby
@ 2021-03-02 6:21 ` Jiri Slaby
2021-03-02 6:21 ` [PATCH 20/44] tty: con3215, remove tty->driver_data casts Jiri Slaby
` (25 subsequent siblings)
41 siblings, 0 replies; 61+ messages in thread
From: Jiri Slaby @ 2021-03-02 6:21 UTC (permalink / raw)
To: gregkh
Cc: linux-serial, linux-kernel, Jiri Slaby, Martin Schwidefsky,
Heiko Carstens, linux390, linux-s390
There is no need to check tty in these functions as it's always
non-NULL. So remove the tests.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: linux390@de.ibm.com
Cc: linux-s390@vger.kernel.org
---
drivers/s390/char/con3215.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c
index 5923a1f133ef..ae0dd9c1595c 100644
--- a/drivers/s390/char/con3215.c
+++ b/drivers/s390/char/con3215.c
@@ -948,8 +948,6 @@ static int tty3215_write(struct tty_struct * tty,
struct raw3215_info *raw;
int i, written;
- if (!tty)
- return 0;
raw = (struct raw3215_info *) tty->driver_data;
written = count;
while (count > 0) {
@@ -975,8 +973,6 @@ static int tty3215_put_char(struct tty_struct *tty, unsigned char ch)
{
struct raw3215_info *raw;
- if (!tty)
- return 0;
raw = (struct raw3215_info *) tty->driver_data;
raw3215_putchar(raw, ch);
return 1;
--
2.30.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PATCH 20/44] tty: con3215, remove tty->driver_data casts
2021-03-02 6:21 [PATCH 01/44] MAINTAINERS: orphan mxser Jiri Slaby
` (15 preceding siblings ...)
2021-03-02 6:21 ` [PATCH 19/44] tty: con3215, remove unneeded tty checks Jiri Slaby
@ 2021-03-02 6:21 ` Jiri Slaby
2021-03-02 6:21 ` [PATCH 21/44] tty: jsm_tty, make char+error handling readable Jiri Slaby
` (24 subsequent siblings)
41 siblings, 0 replies; 61+ messages in thread
From: Jiri Slaby @ 2021-03-02 6:21 UTC (permalink / raw)
To: gregkh
Cc: linux-serial, linux-kernel, Jiri Slaby, Martin Schwidefsky,
Heiko Carstens, linux390, linux-s390
Casts of 'void *' pointer are superfluous. So remove them.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: linux390@de.ibm.com
Cc: linux-s390@vger.kernel.org
---
drivers/s390/char/con3215.c | 32 +++++++++++---------------------
1 file changed, 11 insertions(+), 21 deletions(-)
diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c
index ae0dd9c1595c..d26947d743bc 100644
--- a/drivers/s390/char/con3215.c
+++ b/drivers/s390/char/con3215.c
@@ -911,9 +911,8 @@ static int tty3215_open(struct tty_struct *tty, struct file * filp)
*/
static void tty3215_close(struct tty_struct *tty, struct file * filp)
{
- struct raw3215_info *raw;
+ struct raw3215_info *raw = tty->driver_data;
- raw = (struct raw3215_info *) tty->driver_data;
if (raw == NULL || tty->count > 1)
return;
tty->closing = 1;
@@ -928,9 +927,7 @@ static void tty3215_close(struct tty_struct *tty, struct file * filp)
*/
static int tty3215_write_room(struct tty_struct *tty)
{
- struct raw3215_info *raw;
-
- raw = (struct raw3215_info *) tty->driver_data;
+ struct raw3215_info *raw = tty->driver_data;
/* Subtract TAB_STOP_SIZE to allow for a tab, 8 <<< 64K */
if ((RAW3215_BUFFER_SIZE - raw->count - TAB_STOP_SIZE) >= 0)
@@ -945,10 +942,9 @@ static int tty3215_write_room(struct tty_struct *tty)
static int tty3215_write(struct tty_struct * tty,
const unsigned char *buf, int count)
{
- struct raw3215_info *raw;
+ struct raw3215_info *raw = tty->driver_data;
int i, written;
- raw = (struct raw3215_info *) tty->driver_data;
written = count;
while (count > 0) {
for (i = 0; i < count; i++)
@@ -971,10 +967,10 @@ static int tty3215_write(struct tty_struct * tty,
*/
static int tty3215_put_char(struct tty_struct *tty, unsigned char ch)
{
- struct raw3215_info *raw;
+ struct raw3215_info *raw = tty->driver_data;
- raw = (struct raw3215_info *) tty->driver_data;
raw3215_putchar(raw, ch);
+
return 1;
}
@@ -987,17 +983,15 @@ static void tty3215_flush_chars(struct tty_struct *tty)
*/
static int tty3215_chars_in_buffer(struct tty_struct *tty)
{
- struct raw3215_info *raw;
+ struct raw3215_info *raw = tty->driver_data;
- raw = (struct raw3215_info *) tty->driver_data;
return raw->count;
}
static void tty3215_flush_buffer(struct tty_struct *tty)
{
- struct raw3215_info *raw;
+ struct raw3215_info *raw = tty->driver_data;
- raw = (struct raw3215_info *) tty->driver_data;
raw3215_flush_buffer(raw);
tty_wakeup(tty);
}
@@ -1007,9 +1001,8 @@ static void tty3215_flush_buffer(struct tty_struct *tty)
*/
static void tty3215_throttle(struct tty_struct * tty)
{
- struct raw3215_info *raw;
+ struct raw3215_info *raw = tty->driver_data;
- raw = (struct raw3215_info *) tty->driver_data;
raw->flags |= RAW3215_THROTTLED;
}
@@ -1018,10 +1011,9 @@ static void tty3215_throttle(struct tty_struct * tty)
*/
static void tty3215_unthrottle(struct tty_struct * tty)
{
- struct raw3215_info *raw;
+ struct raw3215_info *raw = tty->driver_data;
unsigned long flags;
- raw = (struct raw3215_info *) tty->driver_data;
if (raw->flags & RAW3215_THROTTLED) {
spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags);
raw->flags &= ~RAW3215_THROTTLED;
@@ -1035,9 +1027,8 @@ static void tty3215_unthrottle(struct tty_struct * tty)
*/
static void tty3215_stop(struct tty_struct *tty)
{
- struct raw3215_info *raw;
+ struct raw3215_info *raw = tty->driver_data;
- raw = (struct raw3215_info *) tty->driver_data;
raw->flags |= RAW3215_STOPPED;
}
@@ -1046,10 +1037,9 @@ static void tty3215_stop(struct tty_struct *tty)
*/
static void tty3215_start(struct tty_struct *tty)
{
- struct raw3215_info *raw;
+ struct raw3215_info *raw = tty->driver_data;
unsigned long flags;
- raw = (struct raw3215_info *) tty->driver_data;
if (raw->flags & RAW3215_STOPPED) {
spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags);
raw->flags &= ~RAW3215_STOPPED;
--
2.30.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PATCH 21/44] tty: jsm_tty, make char+error handling readable
2021-03-02 6:21 [PATCH 01/44] MAINTAINERS: orphan mxser Jiri Slaby
` (16 preceding siblings ...)
2021-03-02 6:21 ` [PATCH 20/44] tty: con3215, remove tty->driver_data casts Jiri Slaby
@ 2021-03-02 6:21 ` Jiri Slaby
2021-03-02 6:21 ` [PATCH 22/44] tty: nozomi, remove struct buffer Jiri Slaby
` (23 subsequent siblings)
41 siblings, 0 replies; 61+ messages in thread
From: Jiri Slaby @ 2021-03-02 6:21 UTC (permalink / raw)
To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby
The code for char+error handling in jsm_input was complete mess of
letters. Introduce 3 new local variables and use them with care.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/tty/serial/jsm/jsm_tty.c | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)
diff --git a/drivers/tty/serial/jsm/jsm_tty.c b/drivers/tty/serial/jsm/jsm_tty.c
index 512b77195e9f..8e42a7682c63 100644
--- a/drivers/tty/serial/jsm/jsm_tty.c
+++ b/drivers/tty/serial/jsm/jsm_tty.c
@@ -603,18 +603,22 @@ void jsm_input(struct jsm_channel *ch)
if (I_PARMRK(tp) || I_BRKINT(tp) || I_INPCK(tp)) {
for (i = 0; i < s; i++) {
+ u8 chr = ch->ch_rqueue[tail + i];
+ u8 error = ch->ch_equeue[tail + i];
+ char flag = TTY_NORMAL;
+
/*
- * Give the Linux ld the flags in the
- * format it likes.
+ * Give the Linux ld the flags in the format it
+ * likes.
*/
- if (*(ch->ch_equeue + tail + i) & UART_LSR_BI)
- tty_insert_flip_char(port, *(ch->ch_rqueue +tail +i), TTY_BREAK);
- else if (*(ch->ch_equeue +tail +i) & UART_LSR_PE)
- tty_insert_flip_char(port, *(ch->ch_rqueue +tail +i), TTY_PARITY);
- else if (*(ch->ch_equeue +tail +i) & UART_LSR_FE)
- tty_insert_flip_char(port, *(ch->ch_rqueue +tail +i), TTY_FRAME);
- else
- tty_insert_flip_char(port, *(ch->ch_rqueue +tail +i), TTY_NORMAL);
+ if (error & UART_LSR_BI)
+ flag = TTY_BREAK;
+ else if (error & UART_LSR_PE)
+ flag = TTY_PARITY;
+ else if (error & UART_LSR_FE)
+ flag = TTY_FRAME;
+
+ tty_insert_flip_char(port, chr, flag);
}
} else {
tty_insert_flip_string(port, ch->ch_rqueue + tail, s);
--
2.30.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PATCH 22/44] tty: nozomi, remove struct buffer
2021-03-02 6:21 [PATCH 01/44] MAINTAINERS: orphan mxser Jiri Slaby
` (17 preceding siblings ...)
2021-03-02 6:21 ` [PATCH 21/44] tty: jsm_tty, make char+error handling readable Jiri Slaby
@ 2021-03-02 6:21 ` Jiri Slaby
2021-03-02 6:21 ` [PATCH 23/44] tty: nozomi, remove init/exit messages Jiri Slaby
` (22 subsequent siblings)
41 siblings, 0 replies; 61+ messages in thread
From: Jiri Slaby @ 2021-03-02 6:21 UTC (permalink / raw)
To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby
It is unused.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/tty/nozomi.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/drivers/tty/nozomi.c b/drivers/tty/nozomi.c
index 861e95043191..83490925a3e2 100644
--- a/drivers/tty/nozomi.c
+++ b/drivers/tty/nozomi.c
@@ -359,12 +359,6 @@ struct nozomi {
u32 open_ttys;
};
-/* This is a data packet that is read or written to/from card */
-struct buffer {
- u32 size; /* size is the length of the data buffer */
- u8 *data;
-} __attribute__ ((packed));
-
/* Global variables */
static const struct pci_device_id nozomi_pci_tbl[] = {
{PCI_DEVICE(0x1931, 0x000c)}, /* Nozomi HSDPA */
--
2.30.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PATCH 23/44] tty: nozomi, remove init/exit messages
2021-03-02 6:21 [PATCH 01/44] MAINTAINERS: orphan mxser Jiri Slaby
` (18 preceding siblings ...)
2021-03-02 6:21 ` [PATCH 22/44] tty: nozomi, remove struct buffer Jiri Slaby
@ 2021-03-02 6:21 ` Jiri Slaby
2021-03-02 6:21 ` [PATCH 24/44] tty: nozomi, remove useless debug prints Jiri Slaby
` (21 subsequent siblings)
41 siblings, 0 replies; 61+ messages in thread
From: Jiri Slaby @ 2021-03-02 6:21 UTC (permalink / raw)
To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby
Remove useless prints from init and exit functions. The version is
artificial anyway.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/tty/nozomi.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/drivers/tty/nozomi.c b/drivers/tty/nozomi.c
index 83490925a3e2..1ec975d66528 100644
--- a/drivers/tty/nozomi.c
+++ b/drivers/tty/nozomi.c
@@ -47,9 +47,6 @@
#include <linux/delay.h>
-
-#define VERSION_STRING DRIVER_DESC " 2.1d"
-
/* Default debug printout level */
#define NOZOMI_DEBUG_LEVEL 0x00
static int debug = NOZOMI_DEBUG_LEVEL;
@@ -89,7 +86,6 @@ do { \
/* Defines */
#define NOZOMI_NAME "nozomi"
#define NOZOMI_NAME_TTY "nozomi_tty"
-#define DRIVER_DESC "Nozomi driver"
#define NTTY_TTY_MAXMINORS 256
#define NTTY_FIFO_BUFFER_SIZE 8192
@@ -1841,8 +1837,6 @@ static __init int nozomi_init(void)
{
int ret;
- printk(KERN_INFO "Initializing %s\n", VERSION_STRING);
-
ntty_driver = alloc_tty_driver(NTTY_TTY_MAXMINORS);
if (!ntty_driver)
return -ENOMEM;
@@ -1882,7 +1876,6 @@ static __init int nozomi_init(void)
static __exit void nozomi_exit(void)
{
- printk(KERN_INFO "Unloading %s\n", DRIVER_DESC);
pci_unregister_driver(&nozomi_driver);
tty_unregister_driver(ntty_driver);
put_tty_driver(ntty_driver);
@@ -1892,4 +1885,4 @@ module_init(nozomi_init);
module_exit(nozomi_exit);
MODULE_LICENSE("Dual BSD/GPL");
-MODULE_DESCRIPTION(DRIVER_DESC);
+MODULE_DESCRIPTION("Nozomi driver");
--
2.30.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PATCH 24/44] tty: nozomi, remove useless debug prints
2021-03-02 6:21 [PATCH 01/44] MAINTAINERS: orphan mxser Jiri Slaby
` (19 preceding siblings ...)
2021-03-02 6:21 ` [PATCH 23/44] tty: nozomi, remove init/exit messages Jiri Slaby
@ 2021-03-02 6:21 ` Jiri Slaby
2021-03-02 6:21 ` [PATCH 25/44] tty: vcc, make globals static Jiri Slaby
` (20 subsequent siblings)
41 siblings, 0 replies; 61+ messages in thread
From: Jiri Slaby @ 2021-03-02 6:21 UTC (permalink / raw)
To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby
These are either commented out or can be printed by tracing mechanisms.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/tty/nozomi.c | 11 -----------
1 file changed, 11 deletions(-)
diff --git a/drivers/tty/nozomi.c b/drivers/tty/nozomi.c
index 1ec975d66528..9a2d78ace49b 100644
--- a/drivers/tty/nozomi.c
+++ b/drivers/tty/nozomi.c
@@ -777,7 +777,6 @@ static int receive_data(enum port_type index, struct nozomi *dc)
int i, ret;
size = __le32_to_cpu(readl(addr));
- /* DBG1( "%d bytes port: %d", size, index); */
if (tty && tty_throttled(tty)) {
DBG1("No room in tty, don't read data, don't ack interrupt, "
@@ -1308,8 +1307,6 @@ static int nozomi_card_init(struct pci_dev *pdev,
int ndev_idx;
int i;
- dev_dbg(&pdev->dev, "Init, new card found\n");
-
for (ndev_idx = 0; ndev_idx < ARRAY_SIZE(ndevs); ndev_idx++)
if (!ndevs[ndev_idx])
break;
@@ -1443,8 +1440,6 @@ static void tty_exit(struct nozomi *dc)
{
unsigned int i;
- DBG1(" ");
-
for (i = 0; i < MAX_PORT; ++i)
tty_port_tty_hangup(&dc->port[i].port, false);
@@ -1609,8 +1604,6 @@ static int ntty_write(struct tty_struct *tty, const unsigned char *buffer,
struct port *port = tty->driver_data;
unsigned long flags;
- /* DBG1( "WRITEx: %d, index = %d", count, index); */
-
if (!dc || !port)
return -ENODEV;
@@ -1736,8 +1729,6 @@ static int ntty_ioctl(struct tty_struct *tty,
struct port *port = tty->driver_data;
int rval = -ENOIOCTLCMD;
- DBG1("******** IOCTL, cmd: %d", cmd);
-
switch (cmd) {
case TIOCMIWAIT: {
struct async_icount cprev = port->tty_icount;
@@ -1763,7 +1754,6 @@ static void ntty_unthrottle(struct tty_struct *tty)
struct nozomi *dc = get_dc_by_tty(tty);
unsigned long flags;
- DBG1("UNTHROTTLE");
spin_lock_irqsave(&dc->spin_mutex, flags);
enable_transmit_dl(tty->index % MAX_PORT, dc);
set_rts(tty, 1);
@@ -1780,7 +1770,6 @@ static void ntty_throttle(struct tty_struct *tty)
struct nozomi *dc = get_dc_by_tty(tty);
unsigned long flags;
- DBG1("THROTTLE");
spin_lock_irqsave(&dc->spin_mutex, flags);
set_rts(tty, 0);
spin_unlock_irqrestore(&dc->spin_mutex, flags);
--
2.30.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PATCH 25/44] tty: vcc, make globals static
2021-03-02 6:21 [PATCH 01/44] MAINTAINERS: orphan mxser Jiri Slaby
` (20 preceding siblings ...)
2021-03-02 6:21 ` [PATCH 24/44] tty: nozomi, remove useless debug prints Jiri Slaby
@ 2021-03-02 6:21 ` Jiri Slaby
2021-03-02 6:21 ` [PATCH 26/44] tty: vcc, drop version dump Jiri Slaby
` (19 subsequent siblings)
41 siblings, 0 replies; 61+ messages in thread
From: Jiri Slaby @ 2021-03-02 6:21 UTC (permalink / raw)
To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby
These are used only in this unit, so make them static.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/tty/vcc.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/tty/vcc.c b/drivers/tty/vcc.c
index e2d6205f83ce..50bf9011a0c4 100644
--- a/drivers/tty/vcc.c
+++ b/drivers/tty/vcc.c
@@ -66,9 +66,9 @@ static struct tty_driver *vcc_tty_driver;
static struct vcc_port *vcc_table[VCC_MAX_PORTS];
static DEFINE_SPINLOCK(vcc_table_lock);
-int vcc_dbg;
-int vcc_dbg_ldc;
-int vcc_dbg_vio;
+static unsigned int vcc_dbg;
+static unsigned int vcc_dbg_ldc;
+static unsigned int vcc_dbg_vio;
module_param(vcc_dbg, uint, 0664);
module_param(vcc_dbg_ldc, uint, 0664);
--
2.30.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PATCH 26/44] tty: vcc, drop version dump
2021-03-02 6:21 [PATCH 01/44] MAINTAINERS: orphan mxser Jiri Slaby
` (21 preceding siblings ...)
2021-03-02 6:21 ` [PATCH 25/44] tty: vcc, make globals static Jiri Slaby
@ 2021-03-02 6:21 ` Jiri Slaby
2021-03-02 6:21 ` [PATCH 27/44] tty: vcc, use name strings directly Jiri Slaby
` (18 subsequent siblings)
41 siblings, 0 replies; 61+ messages in thread
From: Jiri Slaby @ 2021-03-02 6:21 UTC (permalink / raw)
To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby, David S. Miller,
sparclinux
The version number is artificial, no need to dump it to logs during
initialization.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: <sparclinux@vger.kernel.org>
---
drivers/tty/vcc.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/drivers/tty/vcc.c b/drivers/tty/vcc.c
index 50bf9011a0c4..31b8a9a77375 100644
--- a/drivers/tty/vcc.c
+++ b/drivers/tty/vcc.c
@@ -14,16 +14,9 @@
#include <asm/vio.h>
#include <asm/ldc.h>
-#define DRV_MODULE_NAME "vcc"
-#define DRV_MODULE_VERSION "1.1"
-#define DRV_MODULE_RELDATE "July 1, 2017"
-
-static char version[] =
- DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")";
-
MODULE_DESCRIPTION("Sun LDOM virtual console concentrator driver");
MODULE_LICENSE("GPL");
-MODULE_VERSION(DRV_MODULE_VERSION);
+MODULE_VERSION("1.1");
struct vcc_port {
struct vio_driver_state vio;
@@ -1066,8 +1059,6 @@ static int vcc_tty_init(void)
{
int rv;
- pr_info("VCC: %s\n", version);
-
vcc_tty_driver = tty_alloc_driver(VCC_MAX_PORTS, VCC_TTY_FLAGS);
if (IS_ERR(vcc_tty_driver)) {
pr_err("VCC: TTY driver alloc failed\n");
--
2.30.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PATCH 27/44] tty: vcc, use name strings directly
2021-03-02 6:21 [PATCH 01/44] MAINTAINERS: orphan mxser Jiri Slaby
` (22 preceding siblings ...)
2021-03-02 6:21 ` [PATCH 26/44] tty: vcc, drop version dump Jiri Slaby
@ 2021-03-02 6:21 ` Jiri Slaby
2021-03-02 6:21 ` [PATCH 28/44] tty: vcc, remove useless tty checks Jiri Slaby
` (17 subsequent siblings)
41 siblings, 0 replies; 61+ messages in thread
From: Jiri Slaby @ 2021-03-02 6:21 UTC (permalink / raw)
To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby, David S. Miller,
sparclinux
Do not define global variables for driver/device names, use the strings
directly.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: sparclinux@vger.kernel.org
---
drivers/tty/vcc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/tty/vcc.c b/drivers/tty/vcc.c
index 31b8a9a77375..a6cdbd170a61 100644
--- a/drivers/tty/vcc.c
+++ b/drivers/tty/vcc.c
@@ -52,8 +52,6 @@ struct vcc_port {
#define VCC_CTL_BREAK -1
#define VCC_CTL_HUP -2
-static const char vcc_driver_name[] = "vcc";
-static const char vcc_device_node[] = "vcc";
static struct tty_driver *vcc_tty_driver;
static struct vcc_port *vcc_table[VCC_MAX_PORTS];
@@ -1065,8 +1063,8 @@ static int vcc_tty_init(void)
return PTR_ERR(vcc_tty_driver);
}
- vcc_tty_driver->driver_name = vcc_driver_name;
- vcc_tty_driver->name = vcc_device_node;
+ vcc_tty_driver->driver_name = "vcc";
+ vcc_tty_driver->name = "vcc";
vcc_tty_driver->minor_start = VCC_MINOR_START;
vcc_tty_driver->type = TTY_DRIVER_TYPE_SYSTEM;
--
2.30.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PATCH 28/44] tty: vcc, remove useless tty checks
2021-03-02 6:21 [PATCH 01/44] MAINTAINERS: orphan mxser Jiri Slaby
` (23 preceding siblings ...)
2021-03-02 6:21 ` [PATCH 27/44] tty: vcc, use name strings directly Jiri Slaby
@ 2021-03-02 6:21 ` Jiri Slaby
2021-03-02 6:21 ` [PATCH 29/44] tty: xtensa/iss, drop serial_version & serial_name Jiri Slaby
` (16 subsequent siblings)
41 siblings, 0 replies; 61+ messages in thread
From: Jiri Slaby @ 2021-03-02 6:21 UTC (permalink / raw)
To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby, David S. Miller,
sparclinux
All these functions are called with a valid tty pointer, no need to
check that.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: sparclinux@vger.kernel.org
---
drivers/tty/vcc.c | 45 ---------------------------------------------
1 file changed, 45 deletions(-)
diff --git a/drivers/tty/vcc.c b/drivers/tty/vcc.c
index a6cdbd170a61..04a792749816 100644
--- a/drivers/tty/vcc.c
+++ b/drivers/tty/vcc.c
@@ -726,11 +726,6 @@ static int vcc_open(struct tty_struct *tty, struct file *vcc_file)
{
struct vcc_port *port;
- if (unlikely(!tty)) {
- pr_err("VCC: open: Invalid TTY handle\n");
- return -ENXIO;
- }
-
if (tty->count > 1)
return -EBUSY;
@@ -764,11 +759,6 @@ static int vcc_open(struct tty_struct *tty, struct file *vcc_file)
static void vcc_close(struct tty_struct *tty, struct file *vcc_file)
{
- if (unlikely(!tty)) {
- pr_err("VCC: close: Invalid TTY handle\n");
- return;
- }
-
if (unlikely(tty->count > 1))
return;
@@ -796,11 +786,6 @@ static void vcc_hangup(struct tty_struct *tty)
{
struct vcc_port *port;
- if (unlikely(!tty)) {
- pr_err("VCC: hangup: Invalid TTY handle\n");
- return;
- }
-
port = vcc_get_ne(tty->index);
if (unlikely(!port)) {
pr_err("VCC: hangup: Failed to find VCC port\n");
@@ -830,11 +815,6 @@ static int vcc_write(struct tty_struct *tty, const unsigned char *buf,
int tosend = 0;
int rv = -EINVAL;
- if (unlikely(!tty)) {
- pr_err("VCC: write: Invalid TTY handle\n");
- return -ENXIO;
- }
-
port = vcc_get_ne(tty->index);
if (unlikely(!port)) {
pr_err("VCC: write: Failed to find VCC port");
@@ -895,11 +875,6 @@ static int vcc_write_room(struct tty_struct *tty)
struct vcc_port *port;
u64 num;
- if (unlikely(!tty)) {
- pr_err("VCC: write_room: Invalid TTY handle\n");
- return -ENXIO;
- }
-
port = vcc_get_ne(tty->index);
if (unlikely(!port)) {
pr_err("VCC: write_room: Failed to find VCC port\n");
@@ -918,11 +893,6 @@ static int vcc_chars_in_buffer(struct tty_struct *tty)
struct vcc_port *port;
u64 num;
- if (unlikely(!tty)) {
- pr_err("VCC: chars_in_buffer: Invalid TTY handle\n");
- return -ENXIO;
- }
-
port = vcc_get_ne(tty->index);
if (unlikely(!port)) {
pr_err("VCC: chars_in_buffer: Failed to find VCC port\n");
@@ -941,11 +911,6 @@ static int vcc_break_ctl(struct tty_struct *tty, int state)
struct vcc_port *port;
unsigned long flags;
- if (unlikely(!tty)) {
- pr_err("VCC: break_ctl: Invalid TTY handle\n");
- return -ENXIO;
- }
-
port = vcc_get_ne(tty->index);
if (unlikely(!port)) {
pr_err("VCC: break_ctl: Failed to find VCC port\n");
@@ -976,11 +941,6 @@ static int vcc_install(struct tty_driver *driver, struct tty_struct *tty)
struct tty_port *port_tty;
int ret;
- if (unlikely(!tty)) {
- pr_err("VCC: install: Invalid TTY handle\n");
- return -ENXIO;
- }
-
if (tty->index >= VCC_MAX_PORTS)
return -EINVAL;
@@ -1015,11 +975,6 @@ static void vcc_cleanup(struct tty_struct *tty)
{
struct vcc_port *port;
- if (unlikely(!tty)) {
- pr_err("VCC: cleanup: Invalid TTY handle\n");
- return;
- }
-
port = vcc_get(tty->index, true);
if (port) {
port->tty = NULL;
--
2.30.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PATCH 29/44] tty: xtensa/iss, drop serial_version & serial_name
2021-03-02 6:21 [PATCH 01/44] MAINTAINERS: orphan mxser Jiri Slaby
` (24 preceding siblings ...)
2021-03-02 6:21 ` [PATCH 28/44] tty: vcc, remove useless tty checks Jiri Slaby
@ 2021-03-02 6:21 ` Jiri Slaby
2021-03-02 6:45 ` Max Filippov
2021-03-02 6:22 ` [PATCH 30/44] tty: xtensa/iss, don't reassign to tty->port Jiri Slaby
` (15 subsequent siblings)
41 siblings, 1 reply; 61+ messages in thread
From: Jiri Slaby @ 2021-03-02 6:21 UTC (permalink / raw)
To: gregkh
Cc: linux-serial, linux-kernel, Jiri Slaby, Chris Zankel,
Max Filippov, linux-xtensa
There is no need to print the information during module load. Neither to
print some artificial version. So drop these strings and a print.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Chris Zankel <chris@zankel.net>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Cc: linux-xtensa@linux-xtensa.org
---
arch/xtensa/platforms/iss/console.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/arch/xtensa/platforms/iss/console.c b/arch/xtensa/platforms/iss/console.c
index af81a62faba6..1179011044a7 100644
--- a/arch/xtensa/platforms/iss/console.c
+++ b/arch/xtensa/platforms/iss/console.c
@@ -37,9 +37,6 @@ static struct timer_list serial_timer;
static DEFINE_SPINLOCK(timer_lock);
-static char *serial_version = "0.1";
-static char *serial_name = "ISS serial driver";
-
/*
* This routine is called whenever a serial port is opened. It
* enables interrupts for a serial port, linking in its async structure into
@@ -149,7 +146,7 @@ static void rs_wait_until_sent(struct tty_struct *tty, int timeout)
static int rs_proc_show(struct seq_file *m, void *v)
{
- seq_printf(m, "serinfo:1.0 driver:%s\n", serial_version);
+ seq_printf(m, "serinfo:1.0 driver:0.1\n");
return 0;
}
@@ -172,8 +169,6 @@ int __init rs_init(void)
serial_driver = alloc_tty_driver(SERIAL_MAX_NUM_LINES);
- pr_info("%s %s\n", serial_name, serial_version);
-
/* Initialize the tty_driver structure */
serial_driver->driver_name = "iss_serial";
--
2.30.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PATCH 30/44] tty: xtensa/iss, don't reassign to tty->port
2021-03-02 6:21 [PATCH 01/44] MAINTAINERS: orphan mxser Jiri Slaby
` (25 preceding siblings ...)
2021-03-02 6:21 ` [PATCH 29/44] tty: xtensa/iss, drop serial_version & serial_name Jiri Slaby
@ 2021-03-02 6:22 ` Jiri Slaby
2021-03-02 7:12 ` Max Filippov
2021-03-02 6:22 ` [PATCH 31/44] tty: xtensa/iss, remove stale comments Jiri Slaby
` (14 subsequent siblings)
41 siblings, 1 reply; 61+ messages in thread
From: Jiri Slaby @ 2021-03-02 6:22 UTC (permalink / raw)
To: gregkh
Cc: linux-serial, linux-kernel, Jiri Slaby, Chris Zankel,
Max Filippov, linux-xtensa
We already do tty_port_link_device in rs_init, so we don't need to
reassign a port to tty->port. It would be too late in tty::ops::open
anyway.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Chris Zankel <chris@zankel.net>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Cc: linux-xtensa@linux-xtensa.org
---
arch/xtensa/platforms/iss/console.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/arch/xtensa/platforms/iss/console.c b/arch/xtensa/platforms/iss/console.c
index 1179011044a7..5d7f9c638437 100644
--- a/arch/xtensa/platforms/iss/console.c
+++ b/arch/xtensa/platforms/iss/console.c
@@ -48,7 +48,6 @@ static void rs_poll(struct timer_list *);
static int rs_open(struct tty_struct *tty, struct file * filp)
{
- tty->port = &serial_port;
spin_lock_bh(&timer_lock);
if (tty->count == 1) {
timer_setup(&serial_timer, rs_poll, 0);
--
2.30.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PATCH 31/44] tty: xtensa/iss, remove stale comments
2021-03-02 6:21 [PATCH 01/44] MAINTAINERS: orphan mxser Jiri Slaby
` (26 preceding siblings ...)
2021-03-02 6:22 ` [PATCH 30/44] tty: xtensa/iss, don't reassign to tty->port Jiri Slaby
@ 2021-03-02 6:22 ` Jiri Slaby
2021-03-02 6:49 ` Max Filippov
2021-03-02 6:22 ` [PATCH 32/44] tty: xtensa/iss, setup the timer statically Jiri Slaby
` (13 subsequent siblings)
41 siblings, 1 reply; 61+ messages in thread
From: Jiri Slaby @ 2021-03-02 6:22 UTC (permalink / raw)
To: gregkh
Cc: linux-serial, linux-kernel, Jiri Slaby, Chris Zankel,
Max Filippov, linux-xtensa
These are likely taken over from amiserial. iss doesn't do anything of
that.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Chris Zankel <chris@zankel.net>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Cc: linux-xtensa@linux-xtensa.org
---
arch/xtensa/platforms/iss/console.c | 18 ------------------
1 file changed, 18 deletions(-)
diff --git a/arch/xtensa/platforms/iss/console.c b/arch/xtensa/platforms/iss/console.c
index 5d7f9c638437..3b89d9ceb06a 100644
--- a/arch/xtensa/platforms/iss/console.c
+++ b/arch/xtensa/platforms/iss/console.c
@@ -37,13 +37,6 @@ static struct timer_list serial_timer;
static DEFINE_SPINLOCK(timer_lock);
-/*
- * This routine is called whenever a serial port is opened. It
- * enables interrupts for a serial port, linking in its async structure into
- * the IRQ chain. It also performs the serial-specific
- * initialization for the tty structure.
- */
-
static void rs_poll(struct timer_list *);
static int rs_open(struct tty_struct *tty, struct file * filp)
@@ -58,17 +51,6 @@ static int rs_open(struct tty_struct *tty, struct file * filp)
return 0;
}
-
-/*
- * ------------------------------------------------------------
- * iss_serial_close()
- *
- * This routine is called when the serial port gets closed. First, we
- * wait for the last remaining data to be sent. Then, we unlink its
- * async structure from the interrupt chain if necessary, and we free
- * that IRQ if nothing is left in the chain.
- * ------------------------------------------------------------
- */
static void rs_close(struct tty_struct *tty, struct file * filp)
{
spin_lock_bh(&timer_lock);
--
2.30.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PATCH 32/44] tty: xtensa/iss, setup the timer statically
2021-03-02 6:21 [PATCH 01/44] MAINTAINERS: orphan mxser Jiri Slaby
` (27 preceding siblings ...)
2021-03-02 6:22 ` [PATCH 31/44] tty: xtensa/iss, remove stale comments Jiri Slaby
@ 2021-03-02 6:22 ` Jiri Slaby
2021-03-02 6:52 ` Max Filippov
2021-03-02 6:22 ` [PATCH 33/44] tty: xtensa/iss, make rs_init static Jiri Slaby
` (12 subsequent siblings)
41 siblings, 1 reply; 61+ messages in thread
From: Jiri Slaby @ 2021-03-02 6:22 UTC (permalink / raw)
To: gregkh
Cc: linux-serial, linux-kernel, Jiri Slaby, Chris Zankel,
Max Filippov, linux-xtensa
Use DEFINE_TIMER and avoid runtime initialization of the serial_timer.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Chris Zankel <chris@zankel.net>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Cc: linux-xtensa@linux-xtensa.org
---
arch/xtensa/platforms/iss/console.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/arch/xtensa/platforms/iss/console.c b/arch/xtensa/platforms/iss/console.c
index 3b89d9ceb06a..8ea261b8c022 100644
--- a/arch/xtensa/platforms/iss/console.c
+++ b/arch/xtensa/platforms/iss/console.c
@@ -31,21 +31,18 @@
#define SERIAL_MAX_NUM_LINES 1
#define SERIAL_TIMER_VALUE (HZ / 10)
+static void rs_poll(struct timer_list *);
+
static struct tty_driver *serial_driver;
static struct tty_port serial_port;
-static struct timer_list serial_timer;
-
+static DEFINE_TIMER(serial_timer, rs_poll);
static DEFINE_SPINLOCK(timer_lock);
-static void rs_poll(struct timer_list *);
-
static int rs_open(struct tty_struct *tty, struct file * filp)
{
spin_lock_bh(&timer_lock);
- if (tty->count == 1) {
- timer_setup(&serial_timer, rs_poll, 0);
+ if (tty->count == 1)
mod_timer(&serial_timer, jiffies + SERIAL_TIMER_VALUE);
- }
spin_unlock_bh(&timer_lock);
return 0;
--
2.30.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PATCH 33/44] tty: xtensa/iss, make rs_init static
2021-03-02 6:21 [PATCH 01/44] MAINTAINERS: orphan mxser Jiri Slaby
` (28 preceding siblings ...)
2021-03-02 6:22 ` [PATCH 32/44] tty: xtensa/iss, setup the timer statically Jiri Slaby
@ 2021-03-02 6:22 ` Jiri Slaby
2021-03-02 6:55 ` Max Filippov
2021-03-02 6:22 ` [PATCH 34/44] tty: do not check tty_unregister_driver's return value Jiri Slaby
` (11 subsequent siblings)
41 siblings, 1 reply; 61+ messages in thread
From: Jiri Slaby @ 2021-03-02 6:22 UTC (permalink / raw)
To: gregkh
Cc: linux-serial, linux-kernel, Jiri Slaby, Chris Zankel,
Max Filippov, linux-xtensa
To fix the warning:
warning: no previous prototype for 'rs_init'
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Chris Zankel <chris@zankel.net>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Cc: linux-xtensa@linux-xtensa.org
---
arch/xtensa/platforms/iss/console.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/xtensa/platforms/iss/console.c b/arch/xtensa/platforms/iss/console.c
index 8ea261b8c022..1e215cf5ad03 100644
--- a/arch/xtensa/platforms/iss/console.c
+++ b/arch/xtensa/platforms/iss/console.c
@@ -141,7 +141,7 @@ static const struct tty_operations serial_ops = {
.proc_show = rs_proc_show,
};
-int __init rs_init(void)
+static int __init rs_init(void)
{
tty_port_init(&serial_port);
--
2.30.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PATCH 34/44] tty: do not check tty_unregister_driver's return value
2021-03-02 6:21 [PATCH 01/44] MAINTAINERS: orphan mxser Jiri Slaby
` (29 preceding siblings ...)
2021-03-02 6:22 ` [PATCH 33/44] tty: xtensa/iss, make rs_init static Jiri Slaby
@ 2021-03-02 6:22 ` Jiri Slaby
2021-03-02 6:57 ` Max Filippov
2021-03-02 11:14 ` David Sterba
2021-03-02 6:22 ` [PATCH 35/44] tty: let tty_unregister_driver return void Jiri Slaby
` (10 subsequent siblings)
41 siblings, 2 replies; 61+ messages in thread
From: Jiri Slaby @ 2021-03-02 6:22 UTC (permalink / raw)
To: gregkh
Cc: linux-serial, linux-kernel, Jiri Slaby, Chris Zankel,
Max Filippov, linux-xtensa, Jiri Kosina, David Sterba
These drivers check tty_unregister_driver return value. But they don't
handle a failure correctly (they free the driver in any case). So stop
checking tty_unregister_driver return value and remove also the prints.
In the next patch, tty_unregister_driver's return type will be switched
to void.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Chris Zankel <chris@zankel.net>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Cc: linux-xtensa@linux-xtensa.org
Cc: Jiri Kosina <jikos@kernel.org>
Cc: David Sterba <dsterba@suse.com>
---
arch/xtensa/platforms/iss/console.c | 6 +-----
drivers/tty/amiserial.c | 8 ++------
drivers/tty/ipwireless/tty.c | 7 +------
drivers/tty/moxa.c | 4 +---
drivers/tty/serial/kgdb_nmi.c | 4 +---
drivers/tty/synclink_gt.c | 5 +----
6 files changed, 7 insertions(+), 27 deletions(-)
diff --git a/arch/xtensa/platforms/iss/console.c b/arch/xtensa/platforms/iss/console.c
index 1e215cf5ad03..a3dda25a4e45 100644
--- a/arch/xtensa/platforms/iss/console.c
+++ b/arch/xtensa/platforms/iss/console.c
@@ -171,11 +171,7 @@ static int __init rs_init(void)
static __exit void rs_exit(void)
{
- int error;
-
- if ((error = tty_unregister_driver(serial_driver)))
- pr_err("ISS_SERIAL: failed to unregister serial driver (%d)\n",
- error);
+ tty_unregister_driver(serial_driver);
put_tty_driver(serial_driver);
tty_port_destroy(&serial_port);
}
diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c
index 18b78ea110ef..0c8157fab17f 100644
--- a/drivers/tty/amiserial.c
+++ b/drivers/tty/amiserial.c
@@ -1622,21 +1622,17 @@ static int __init amiga_serial_probe(struct platform_device *pdev)
static int __exit amiga_serial_remove(struct platform_device *pdev)
{
- int error;
struct serial_state *state = platform_get_drvdata(pdev);
/* printk("Unloading %s: version %s\n", serial_name, serial_version); */
- error = tty_unregister_driver(serial_driver);
- if (error)
- printk("SERIAL: failed to unregister serial driver (%d)\n",
- error);
+ tty_unregister_driver(serial_driver);
put_tty_driver(serial_driver);
tty_port_destroy(&state->tport);
free_irq(IRQ_AMIGA_TBE, state);
free_irq(IRQ_AMIGA_RBF, state);
- return error;
+ return 0;
}
static struct platform_driver amiga_serial_driver = {
diff --git a/drivers/tty/ipwireless/tty.c b/drivers/tty/ipwireless/tty.c
index 6dacbc5e286c..1836746991b5 100644
--- a/drivers/tty/ipwireless/tty.c
+++ b/drivers/tty/ipwireless/tty.c
@@ -596,13 +596,8 @@ int ipwireless_tty_init(void)
void ipwireless_tty_release(void)
{
- int ret;
-
- ret = tty_unregister_driver(ipw_tty_driver);
+ tty_unregister_driver(ipw_tty_driver);
put_tty_driver(ipw_tty_driver);
- if (ret != 0)
- printk(KERN_ERR IPWIRELESS_PCCARD_NAME
- ": tty_unregister_driver failed with code %d\n", ret);
}
int ipwireless_tty_is_modem(struct ipw_tty *tty)
diff --git a/drivers/tty/moxa.c b/drivers/tty/moxa.c
index 9f13f7d49dd7..32eb6b5e510f 100644
--- a/drivers/tty/moxa.c
+++ b/drivers/tty/moxa.c
@@ -1118,9 +1118,7 @@ static void __exit moxa_exit(void)
del_timer_sync(&moxaTimer);
- if (tty_unregister_driver(moxaDriver))
- printk(KERN_ERR "Couldn't unregister MOXA Intellio family "
- "serial driver\n");
+ tty_unregister_driver(moxaDriver);
put_tty_driver(moxaDriver);
}
diff --git a/drivers/tty/serial/kgdb_nmi.c b/drivers/tty/serial/kgdb_nmi.c
index 6004c0c1d173..db059b66438e 100644
--- a/drivers/tty/serial/kgdb_nmi.c
+++ b/drivers/tty/serial/kgdb_nmi.c
@@ -373,9 +373,7 @@ int kgdb_unregister_nmi_console(void)
if (ret)
return ret;
- ret = tty_unregister_driver(kgdb_nmi_tty_driver);
- if (ret)
- return ret;
+ tty_unregister_driver(kgdb_nmi_tty_driver);
put_tty_driver(kgdb_nmi_tty_driver);
return 0;
diff --git a/drivers/tty/synclink_gt.c b/drivers/tty/synclink_gt.c
index 644173786bf0..4727a41158b0 100644
--- a/drivers/tty/synclink_gt.c
+++ b/drivers/tty/synclink_gt.c
@@ -3705,7 +3705,6 @@ static const struct tty_operations ops = {
static void slgt_cleanup(void)
{
- int rc;
struct slgt_info *info;
struct slgt_info *tmp;
@@ -3714,9 +3713,7 @@ static void slgt_cleanup(void)
if (serial_driver) {
for (info=slgt_device_list ; info != NULL ; info=info->next_device)
tty_unregister_device(serial_driver, info->line);
- rc = tty_unregister_driver(serial_driver);
- if (rc)
- DBGERR(("tty_unregister_driver error=%d\n", rc));
+ tty_unregister_driver(serial_driver);
put_tty_driver(serial_driver);
}
--
2.30.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PATCH 35/44] tty: let tty_unregister_driver return void
2021-03-02 6:21 [PATCH 01/44] MAINTAINERS: orphan mxser Jiri Slaby
` (30 preceding siblings ...)
2021-03-02 6:22 ` [PATCH 34/44] tty: do not check tty_unregister_driver's return value Jiri Slaby
@ 2021-03-02 6:22 ` Jiri Slaby
2021-03-02 6:22 ` [PATCH 36/44] tty: localise ptychar and make it const Jiri Slaby
` (9 subsequent siblings)
41 siblings, 0 replies; 61+ messages in thread
From: Jiri Slaby @ 2021-03-02 6:22 UTC (permalink / raw)
To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby
Now that noone checks the return value, switch the return type of
tty_unregister_driver to void. We can do that as we always return zero.
Generally, drivers are not allowed to call tty_unregister_driver while
there are open devices.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/tty/tty_io.c | 9 +--------
include/linux/tty.h | 2 +-
2 files changed, 2 insertions(+), 9 deletions(-)
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 74733ec8f565..c8cbf08b6dcf 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -3525,21 +3525,14 @@ EXPORT_SYMBOL(tty_register_driver);
/*
* Called by a tty driver to unregister itself.
*/
-int tty_unregister_driver(struct tty_driver *driver)
+void tty_unregister_driver(struct tty_driver *driver)
{
-#if 0
- /* FIXME */
- if (driver->refcount)
- return -EBUSY;
-#endif
unregister_chrdev_region(MKDEV(driver->major, driver->minor_start),
driver->num);
mutex_lock(&tty_mutex);
list_del(&driver->tty_drivers);
mutex_unlock(&tty_mutex);
- return 0;
}
-
EXPORT_SYMBOL(tty_unregister_driver);
dev_t tty_devnum(struct tty_struct *tty)
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 95fc2f100f12..51f56e5ec955 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -482,7 +482,7 @@ extern void stop_tty(struct tty_struct *tty);
extern void __start_tty(struct tty_struct *tty);
extern void start_tty(struct tty_struct *tty);
extern int tty_register_driver(struct tty_driver *driver);
-extern int tty_unregister_driver(struct tty_driver *driver);
+extern void tty_unregister_driver(struct tty_driver *driver);
extern struct device *tty_register_device(struct tty_driver *driver,
unsigned index, struct device *dev);
extern struct device *tty_register_device_attr(struct tty_driver *driver,
--
2.30.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PATCH 36/44] tty: localise ptychar and make it const
2021-03-02 6:21 [PATCH 01/44] MAINTAINERS: orphan mxser Jiri Slaby
` (31 preceding siblings ...)
2021-03-02 6:22 ` [PATCH 35/44] tty: let tty_unregister_driver return void Jiri Slaby
@ 2021-03-02 6:22 ` Jiri Slaby
2021-03-02 6:22 ` [PATCH 37/44] USB: serial/keyspan, drop unneeded forward declarations Jiri Slaby
` (8 subsequent siblings)
41 siblings, 0 replies; 61+ messages in thread
From: Jiri Slaby @ 2021-03-02 6:22 UTC (permalink / raw)
To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby
ptychar was not const, so mark it as such. And move this variable to the
only place where it's used.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/tty/tty_io.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index c8cbf08b6dcf..7cf57e6cadbf 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -1196,8 +1196,6 @@ int tty_send_xchar(struct tty_struct *tty, char ch)
return 0;
}
-static char ptychar[] = "pqrstuvwxyzabcde";
-
/**
* pty_line_name - generate name for a pty
* @driver: the tty driver in use
@@ -1211,6 +1209,7 @@ static char ptychar[] = "pqrstuvwxyzabcde";
*/
static void pty_line_name(struct tty_driver *driver, int index, char *p)
{
+ static const char ptychar[] = "pqrstuvwxyzabcde";
int i = index + driver->name_base;
/* ->name is initialized to "ttyp", but "tty" is expected */
sprintf(p, "%s%c%x",
--
2.30.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PATCH 37/44] USB: serial/keyspan, drop unneeded forward declarations
2021-03-02 6:21 [PATCH 01/44] MAINTAINERS: orphan mxser Jiri Slaby
` (32 preceding siblings ...)
2021-03-02 6:22 ` [PATCH 36/44] tty: localise ptychar and make it const Jiri Slaby
@ 2021-03-02 6:22 ` Jiri Slaby
2021-03-03 19:17 ` Greg KH
2021-03-02 6:22 ` [PATCH 38/44] USB: serial/io_edgeport, " Jiri Slaby
` (7 subsequent siblings)
41 siblings, 1 reply; 61+ messages in thread
From: Jiri Slaby @ 2021-03-02 6:22 UTC (permalink / raw)
To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby, Johan Hovold
Forward declarations make the code larger, harder to follow and rewrite.
Harder as the declarations are often omitted from global changes. Remove
forward declarations which are not really needed, i.e. when the
definition of the function is before its first use.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Johan Hovold <johan@kernel.org>
---
drivers/usb/serial/keyspan.c | 20 --------------------
1 file changed, 20 deletions(-)
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
index 622077dcc344..b04a029e3657 100644
--- a/drivers/usb/serial/keyspan.c
+++ b/drivers/usb/serial/keyspan.c
@@ -41,27 +41,7 @@
#define DRIVER_AUTHOR "Hugh Blemings <hugh@misc.nu"
#define DRIVER_DESC "Keyspan USB to Serial Converter Driver"
-/* Function prototypes for Keyspan serial converter */
-static int keyspan_open(struct tty_struct *tty, struct usb_serial_port *port);
-static void keyspan_close(struct usb_serial_port *port);
-static void keyspan_dtr_rts(struct usb_serial_port *port, int on);
-static int keyspan_startup(struct usb_serial *serial);
-static void keyspan_disconnect(struct usb_serial *serial);
-static void keyspan_release(struct usb_serial *serial);
-static int keyspan_port_probe(struct usb_serial_port *port);
-static void keyspan_port_remove(struct usb_serial_port *port);
-static int keyspan_write_room(struct tty_struct *tty);
-static int keyspan_write(struct tty_struct *tty, struct usb_serial_port *port,
- const unsigned char *buf, int count);
static void keyspan_send_setup(struct usb_serial_port *port, int reset_port);
-static void keyspan_set_termios(struct tty_struct *tty,
- struct usb_serial_port *port,
- struct ktermios *old);
-static void keyspan_break_ctl(struct tty_struct *tty, int break_state);
-static int keyspan_tiocmget(struct tty_struct *tty);
-static int keyspan_tiocmset(struct tty_struct *tty, unsigned int set,
- unsigned int clear);
-static int keyspan_fake_startup(struct usb_serial *serial);
static int keyspan_usa19_calc_baud(struct usb_serial_port *port,
u32 baud_rate, u32 baudclk,
--
2.30.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PATCH 38/44] USB: serial/io_edgeport, drop unneeded forward declarations
2021-03-02 6:21 [PATCH 01/44] MAINTAINERS: orphan mxser Jiri Slaby
` (33 preceding siblings ...)
2021-03-02 6:22 ` [PATCH 37/44] USB: serial/keyspan, drop unneeded forward declarations Jiri Slaby
@ 2021-03-02 6:22 ` Jiri Slaby
2021-03-03 19:17 ` Greg KH
2021-03-02 6:22 ` [PATCH 39/44] tty: synclink_gt, " Jiri Slaby
` (6 subsequent siblings)
41 siblings, 1 reply; 61+ messages in thread
From: Jiri Slaby @ 2021-03-02 6:22 UTC (permalink / raw)
To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby, Johan Hovold
Forward declarations make the code larger and rewrites harder. Harder as
they are often omitted from global changes. Remove forward declarations
which are not really needed, i.e. the definition of the function is
before its first use.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Johan Hovold <johan@kernel.org>
---
drivers/usb/serial/io_edgeport.c | 41 --------------------------------
1 file changed, 41 deletions(-)
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
index a493670c06e6..54b476a228d6 100644
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -265,35 +265,7 @@ static atomic_t CmdUrbs = ATOMIC_INIT(0);
/* local function prototypes */
-/* function prototypes for all URB callbacks */
-static void edge_interrupt_callback(struct urb *urb);
-static void edge_bulk_in_callback(struct urb *urb);
-static void edge_bulk_out_data_callback(struct urb *urb);
-static void edge_bulk_out_cmd_callback(struct urb *urb);
-
-/* function prototypes for the usbserial callbacks */
-static int edge_open(struct tty_struct *tty, struct usb_serial_port *port);
static void edge_close(struct usb_serial_port *port);
-static int edge_write(struct tty_struct *tty, struct usb_serial_port *port,
- const unsigned char *buf, int count);
-static int edge_write_room(struct tty_struct *tty);
-static int edge_chars_in_buffer(struct tty_struct *tty);
-static void edge_throttle(struct tty_struct *tty);
-static void edge_unthrottle(struct tty_struct *tty);
-static void edge_set_termios(struct tty_struct *tty,
- struct usb_serial_port *port,
- struct ktermios *old_termios);
-static int edge_ioctl(struct tty_struct *tty,
- unsigned int cmd, unsigned long arg);
-static void edge_break(struct tty_struct *tty, int break_state);
-static int edge_tiocmget(struct tty_struct *tty);
-static int edge_tiocmset(struct tty_struct *tty,
- unsigned int set, unsigned int clear);
-static int edge_startup(struct usb_serial *serial);
-static void edge_disconnect(struct usb_serial *serial);
-static void edge_release(struct usb_serial *serial);
-static int edge_port_probe(struct usb_serial_port *port);
-static void edge_port_remove(struct usb_serial_port *port);
/* function prototypes for all of our local functions */
@@ -309,8 +281,6 @@ static void handle_new_lsr(struct edgeport_port *edge_port, __u8 lsrData,
static int send_iosp_ext_cmd(struct edgeport_port *edge_port, __u8 command,
__u8 param);
static int calc_baud_rate_divisor(struct device *dev, int baud_rate, int *divisor);
-static int send_cmd_write_baud_rate(struct edgeport_port *edge_port,
- int baudRate);
static void change_port_settings(struct tty_struct *tty,
struct edgeport_port *edge_port,
struct ktermios *old_termios);
@@ -321,19 +291,8 @@ static int write_cmd_usb(struct edgeport_port *edge_port,
static void send_more_port_data(struct edgeport_serial *edge_serial,
struct edgeport_port *edge_port);
-static int sram_write(struct usb_serial *serial, __u16 extAddr, __u16 addr,
- __u16 length, const __u8 *data);
-static int rom_read(struct usb_serial *serial, __u16 extAddr, __u16 addr,
- __u16 length, __u8 *data);
static int rom_write(struct usb_serial *serial, __u16 extAddr, __u16 addr,
__u16 length, const __u8 *data);
-static void get_manufacturing_desc(struct edgeport_serial *edge_serial);
-static void get_boot_desc(struct edgeport_serial *edge_serial);
-static void load_application_firmware(struct edgeport_serial *edge_serial);
-
-static void unicode_to_ascii(char *string, int buflen,
- __le16 *unicode, int unicode_size);
-
/* ************************************************************************ */
/* ************************************************************************ */
--
2.30.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PATCH 39/44] tty: synclink_gt, drop unneeded forward declarations
2021-03-02 6:21 [PATCH 01/44] MAINTAINERS: orphan mxser Jiri Slaby
` (34 preceding siblings ...)
2021-03-02 6:22 ` [PATCH 38/44] USB: serial/io_edgeport, " Jiri Slaby
@ 2021-03-02 6:22 ` Jiri Slaby
2021-03-02 6:22 ` [PATCH 40/44] tty: hvc, " Jiri Slaby
` (5 subsequent siblings)
41 siblings, 0 replies; 61+ messages in thread
From: Jiri Slaby @ 2021-03-02 6:22 UTC (permalink / raw)
To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby
Forward declarations make the code larger and rewrites harder. Harder as
they are often omitted from global changes. Remove forward declarations
which are not really needed, i.e. the definition of the function is
before its first use.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/tty/synclink_gt.c | 57 +--------------------------------------
1 file changed, 1 insertion(+), 56 deletions(-)
diff --git a/drivers/tty/synclink_gt.c b/drivers/tty/synclink_gt.c
index 4727a41158b0..1db908f62fde 100644
--- a/drivers/tty/synclink_gt.c
+++ b/drivers/tty/synclink_gt.c
@@ -137,37 +137,14 @@ MODULE_PARM_DESC(maxframe, "Maximum frame size used by device (4096 to 65535)");
*/
static struct tty_driver *serial_driver;
-static int open(struct tty_struct *tty, struct file * filp);
-static void close(struct tty_struct *tty, struct file * filp);
-static void hangup(struct tty_struct *tty);
-static void set_termios(struct tty_struct *tty, struct ktermios *old_termios);
-
-static int write(struct tty_struct *tty, const unsigned char *buf, int count);
-static int put_char(struct tty_struct *tty, unsigned char ch);
-static void send_xchar(struct tty_struct *tty, char ch);
static void wait_until_sent(struct tty_struct *tty, int timeout);
-static int write_room(struct tty_struct *tty);
-static void flush_chars(struct tty_struct *tty);
static void flush_buffer(struct tty_struct *tty);
-static void tx_hold(struct tty_struct *tty);
static void tx_release(struct tty_struct *tty);
-static int ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg);
-static int chars_in_buffer(struct tty_struct *tty);
-static void throttle(struct tty_struct * tty);
-static void unthrottle(struct tty_struct * tty);
-static int set_break(struct tty_struct *tty, int break_state);
-
/*
- * generic HDLC support and callbacks
+ * generic HDLC support
*/
-#if SYNCLINK_GENERIC_HDLC
#define dev_to_port(D) (dev_to_hdlc(D)->priv)
-static void hdlcdev_tx_done(struct slgt_info *info);
-static void hdlcdev_rx(struct slgt_info *info, char *buf, int size);
-static int hdlcdev_init(struct slgt_info *info);
-static void hdlcdev_exit(struct slgt_info *info);
-#endif
/*
@@ -186,9 +163,6 @@ struct cond_wait {
wait_queue_entry_t wait;
unsigned int data;
};
-static void init_cond_wait(struct cond_wait *w, unsigned int data);
-static void add_cond_wait(struct cond_wait **head, struct cond_wait *w);
-static void remove_cond_wait(struct cond_wait **head, struct cond_wait *w);
static void flush_cond_wait(struct cond_wait **head);
/*
@@ -443,12 +417,8 @@ static void shutdown(struct slgt_info *info);
static void program_hw(struct slgt_info *info);
static void change_params(struct slgt_info *info);
-static int register_test(struct slgt_info *info);
-static int irq_test(struct slgt_info *info);
-static int loopback_test(struct slgt_info *info);
static int adapter_test(struct slgt_info *info);
-static void reset_adapter(struct slgt_info *info);
static void reset_port(struct slgt_info *info);
static void async_mode(struct slgt_info *info);
static void sync_mode(struct slgt_info *info);
@@ -457,14 +427,12 @@ static void rx_stop(struct slgt_info *info);
static void rx_start(struct slgt_info *info);
static void reset_rbufs(struct slgt_info *info);
static void free_rbufs(struct slgt_info *info, unsigned int first, unsigned int last);
-static void rdma_reset(struct slgt_info *info);
static bool rx_get_frame(struct slgt_info *info);
static bool rx_get_buf(struct slgt_info *info);
static void tx_start(struct slgt_info *info);
static void tx_stop(struct slgt_info *info);
static void tx_set_idle(struct slgt_info *info);
-static unsigned int free_tbuf_count(struct slgt_info *info);
static unsigned int tbuf_bytes(struct slgt_info *info);
static void reset_tbufs(struct slgt_info *info);
static void tdma_reset(struct slgt_info *info);
@@ -472,26 +440,10 @@ static bool tx_load(struct slgt_info *info, const char *buf, unsigned int count)
static void get_signals(struct slgt_info *info);
static void set_signals(struct slgt_info *info);
-static void enable_loopback(struct slgt_info *info);
static void set_rate(struct slgt_info *info, u32 data_rate);
-static int bh_action(struct slgt_info *info);
-static void bh_handler(struct work_struct *work);
static void bh_transmit(struct slgt_info *info);
-static void isr_serial(struct slgt_info *info);
-static void isr_rdma(struct slgt_info *info);
static void isr_txeom(struct slgt_info *info, unsigned short status);
-static void isr_tdma(struct slgt_info *info);
-
-static int alloc_dma_bufs(struct slgt_info *info);
-static void free_dma_bufs(struct slgt_info *info);
-static int alloc_desc(struct slgt_info *info);
-static void free_desc(struct slgt_info *info);
-static int alloc_bufs(struct slgt_info *info, struct slgt_desc *bufs, int count);
-static void free_bufs(struct slgt_info *info, struct slgt_desc *bufs, int count);
-
-static int alloc_tmp_rbuf(struct slgt_info *info);
-static void free_tmp_rbuf(struct slgt_info *info);
static void tx_timeout(struct timer_list *t);
static void rx_timeout(struct timer_list *t);
@@ -509,10 +461,6 @@ static int tx_abort(struct slgt_info *info);
static int rx_enable(struct slgt_info *info, int enable);
static int modem_input_wait(struct slgt_info *info,int arg);
static int wait_mgsl_event(struct slgt_info *info, int __user *mask_ptr);
-static int tiocmget(struct tty_struct *tty);
-static int tiocmset(struct tty_struct *tty,
- unsigned int set, unsigned int clear);
-static int set_break(struct tty_struct *tty, int break_state);
static int get_interface(struct slgt_info *info, int __user *if_mode);
static int set_interface(struct slgt_info *info, int if_mode);
static int set_gpio(struct slgt_info *info, struct gpio_desc __user *gpio);
@@ -526,9 +474,6 @@ static int set_xctrl(struct slgt_info *info, int if_mode);
/*
* driver functions
*/
-static void add_device(struct slgt_info *info);
-static void device_init(int adapter_num, struct pci_dev *pdev);
-static int claim_resources(struct slgt_info *info);
static void release_resources(struct slgt_info *info);
/*
--
2.30.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PATCH 40/44] tty: hvc, drop unneeded forward declarations
2021-03-02 6:21 [PATCH 01/44] MAINTAINERS: orphan mxser Jiri Slaby
` (35 preceding siblings ...)
2021-03-02 6:22 ` [PATCH 39/44] tty: synclink_gt, " Jiri Slaby
@ 2021-03-02 6:22 ` Jiri Slaby
2021-03-02 19:09 ` Tyrel Datwyler
2021-03-03 7:44 ` Uwe Kleine-König
2021-03-02 6:22 ` [PATCH 41/44] tty: n_gsm, remove duplicates of parameters Jiri Slaby
` (4 subsequent siblings)
41 siblings, 2 replies; 61+ messages in thread
From: Jiri Slaby @ 2021-03-02 6:22 UTC (permalink / raw)
To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby, linuxppc-dev
Forward declarations make the code larger and rewrites harder. Harder as
they are often omitted from global changes. Remove forward declarations
which are not really needed, i.e. the definition of the function is
before its first use.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: linuxppc-dev@lists.ozlabs.org
---
drivers/tty/hvc/hvcs.c | 25 -------------------------
1 file changed, 25 deletions(-)
diff --git a/drivers/tty/hvc/hvcs.c b/drivers/tty/hvc/hvcs.c
index c90848919644..0b89d878a108 100644
--- a/drivers/tty/hvc/hvcs.c
+++ b/drivers/tty/hvc/hvcs.c
@@ -290,36 +290,11 @@ static LIST_HEAD(hvcs_structs);
static DEFINE_SPINLOCK(hvcs_structs_lock);
static DEFINE_MUTEX(hvcs_init_mutex);
-static void hvcs_unthrottle(struct tty_struct *tty);
-static void hvcs_throttle(struct tty_struct *tty);
-static irqreturn_t hvcs_handle_interrupt(int irq, void *dev_instance);
-
-static int hvcs_write(struct tty_struct *tty,
- const unsigned char *buf, int count);
-static int hvcs_write_room(struct tty_struct *tty);
-static int hvcs_chars_in_buffer(struct tty_struct *tty);
-
-static int hvcs_has_pi(struct hvcs_struct *hvcsd);
-static void hvcs_set_pi(struct hvcs_partner_info *pi,
- struct hvcs_struct *hvcsd);
static int hvcs_get_pi(struct hvcs_struct *hvcsd);
static int hvcs_rescan_devices_list(void);
-static int hvcs_partner_connect(struct hvcs_struct *hvcsd);
static void hvcs_partner_free(struct hvcs_struct *hvcsd);
-static int hvcs_enable_device(struct hvcs_struct *hvcsd,
- uint32_t unit_address, unsigned int irq, struct vio_dev *dev);
-
-static int hvcs_open(struct tty_struct *tty, struct file *filp);
-static void hvcs_close(struct tty_struct *tty, struct file *filp);
-static void hvcs_hangup(struct tty_struct * tty);
-
-static int hvcs_probe(struct vio_dev *dev,
- const struct vio_device_id *id);
-static int hvcs_remove(struct vio_dev *dev);
-static int __init hvcs_module_init(void);
-static void __exit hvcs_module_exit(void);
static int hvcs_initialize(void);
#define HVCS_SCHED_READ 0x00000001
--
2.30.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PATCH 41/44] tty: n_gsm, remove duplicates of parameters
2021-03-02 6:21 [PATCH 01/44] MAINTAINERS: orphan mxser Jiri Slaby
` (36 preceding siblings ...)
2021-03-02 6:22 ` [PATCH 40/44] tty: hvc, " Jiri Slaby
@ 2021-03-02 6:22 ` Jiri Slaby
2021-03-02 6:22 ` [PATCH 42/44] tty: cleanup tty_chars_in_buffer Jiri Slaby
` (3 subsequent siblings)
41 siblings, 0 replies; 61+ messages in thread
From: Jiri Slaby @ 2021-03-02 6:22 UTC (permalink / raw)
To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby
dp, f, and i are only duplicates of gsmld_receive_buf's parameters. Use
the parameters directly (cp, fp, and count) and delete these local
variables.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/tty/n_gsm.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index b063bc608a8c..7e1d19805aa4 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -2416,27 +2416,24 @@ static void gsmld_receive_buf(struct tty_struct *tty, const unsigned char *cp,
char *fp, int count)
{
struct gsm_mux *gsm = tty->disc_data;
- const unsigned char *dp;
- char *f;
- int i;
char flags = TTY_NORMAL;
if (debug & 4)
print_hex_dump_bytes("gsmld_receive: ", DUMP_PREFIX_OFFSET,
cp, count);
- for (i = count, dp = cp, f = fp; i; i--, dp++) {
- if (f)
- flags = *f++;
+ for (; count; count--, cp++) {
+ if (fp)
+ flags = *fp++;
switch (flags) {
case TTY_NORMAL:
- gsm->receive(gsm, *dp);
+ gsm->receive(gsm, *cp);
break;
case TTY_OVERRUN:
case TTY_BREAK:
case TTY_PARITY:
case TTY_FRAME:
- gsm_error(gsm, *dp, flags);
+ gsm_error(gsm, *cp, flags);
break;
default:
WARN_ONCE(1, "%s: unknown flag %d\n",
--
2.30.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PATCH 42/44] tty: cleanup tty_chars_in_buffer
2021-03-02 6:21 [PATCH 01/44] MAINTAINERS: orphan mxser Jiri Slaby
` (37 preceding siblings ...)
2021-03-02 6:22 ` [PATCH 41/44] tty: n_gsm, remove duplicates of parameters Jiri Slaby
@ 2021-03-02 6:22 ` Jiri Slaby
2021-03-02 6:22 ` [PATCH 43/44] tty: make everyone's chars_in_buffer return >= 0 Jiri Slaby
` (2 subsequent siblings)
41 siblings, 0 replies; 61+ messages in thread
From: Jiri Slaby @ 2021-03-02 6:22 UTC (permalink / raw)
To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby
There is no need for 'else' when the 'if' part already returned. This
makes tty_chars_in_buffer similar to tty_write_room too.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/tty/tty_ioctl.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/tty/tty_ioctl.c b/drivers/tty/tty_ioctl.c
index 4de1c6ddb8ff..deffaefcf41d 100644
--- a/drivers/tty/tty_ioctl.c
+++ b/drivers/tty/tty_ioctl.c
@@ -57,8 +57,7 @@ int tty_chars_in_buffer(struct tty_struct *tty)
{
if (tty->ops->chars_in_buffer)
return tty->ops->chars_in_buffer(tty);
- else
- return 0;
+ return 0;
}
EXPORT_SYMBOL(tty_chars_in_buffer);
--
2.30.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PATCH 43/44] tty: make everyone's chars_in_buffer return >= 0
2021-03-02 6:21 [PATCH 01/44] MAINTAINERS: orphan mxser Jiri Slaby
` (38 preceding siblings ...)
2021-03-02 6:22 ` [PATCH 42/44] tty: cleanup tty_chars_in_buffer Jiri Slaby
@ 2021-03-02 6:22 ` Jiri Slaby
2021-03-02 6:22 ` [PATCH 44/44] tty: make everyone's write_room " Jiri Slaby
2021-03-03 19:19 ` [PATCH 01/44] MAINTAINERS: orphan mxser Greg KH
41 siblings, 0 replies; 61+ messages in thread
From: Jiri Slaby @ 2021-03-02 6:22 UTC (permalink / raw)
To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby
The tty line disciplines don't expect tty_operations::chars_in_buffer to
return negative values. Fix the two drivers which violate this.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/tty/n_gsm.c | 2 +-
drivers/tty/vcc.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index 7e1d19805aa4..da10e975829f 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -3056,7 +3056,7 @@ static int gsmtty_chars_in_buffer(struct tty_struct *tty)
{
struct gsm_dlci *dlci = tty->driver_data;
if (dlci->state == DLCI_CLOSED)
- return -EINVAL;
+ return 0;
return kfifo_len(&dlci->fifo);
}
diff --git a/drivers/tty/vcc.c b/drivers/tty/vcc.c
index 04a792749816..3106df98558a 100644
--- a/drivers/tty/vcc.c
+++ b/drivers/tty/vcc.c
@@ -896,7 +896,7 @@ static int vcc_chars_in_buffer(struct tty_struct *tty)
port = vcc_get_ne(tty->index);
if (unlikely(!port)) {
pr_err("VCC: chars_in_buffer: Failed to find VCC port\n");
- return -ENODEV;
+ return 0;
}
num = port->chars_in_buffer;
--
2.30.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* [PATCH 44/44] tty: make everyone's write_room return >= 0
2021-03-02 6:21 [PATCH 01/44] MAINTAINERS: orphan mxser Jiri Slaby
` (39 preceding siblings ...)
2021-03-02 6:22 ` [PATCH 43/44] tty: make everyone's chars_in_buffer return >= 0 Jiri Slaby
@ 2021-03-02 6:22 ` Jiri Slaby
2021-03-05 10:18 ` Johan Hovold
2021-03-03 19:19 ` [PATCH 01/44] MAINTAINERS: orphan mxser Greg KH
41 siblings, 1 reply; 61+ messages in thread
From: Jiri Slaby @ 2021-03-02 6:22 UTC (permalink / raw)
To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby
The tty line disciplines don't expect tty_operations::write_room to
return negative values. Fix the five drivers which violate this.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/staging/gdm724x/gdm_tty.c | 2 +-
drivers/tty/ipwireless/tty.c | 4 ++--
drivers/tty/n_gsm.c | 2 +-
drivers/tty/vcc.c | 2 +-
drivers/usb/serial/mos7720.c | 2 +-
5 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/gdm724x/gdm_tty.c b/drivers/staging/gdm724x/gdm_tty.c
index 6e813693a766..0ccc8c24e754 100644
--- a/drivers/staging/gdm724x/gdm_tty.c
+++ b/drivers/staging/gdm724x/gdm_tty.c
@@ -188,7 +188,7 @@ static int gdm_tty_write_room(struct tty_struct *tty)
struct gdm *gdm = tty->driver_data;
if (!GDM_TTY_READY(gdm))
- return -ENODEV;
+ return 0;
return WRITE_SIZE;
}
diff --git a/drivers/tty/ipwireless/tty.c b/drivers/tty/ipwireless/tty.c
index 1836746991b5..99bb2f149ff5 100644
--- a/drivers/tty/ipwireless/tty.c
+++ b/drivers/tty/ipwireless/tty.c
@@ -235,10 +235,10 @@ static int ipw_write_room(struct tty_struct *linux_tty)
/* FIXME: Exactly how is the tty object locked here .. */
if (!tty)
- return -ENODEV;
+ return 0;
if (!tty->port.count)
- return -EINVAL;
+ return 0;
room = IPWIRELESS_TX_QUEUE_SIZE - tty->tx_bytes_queued;
if (room < 0)
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index da10e975829f..9e12f9cb1a98 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -3048,7 +3048,7 @@ static int gsmtty_write_room(struct tty_struct *tty)
{
struct gsm_dlci *dlci = tty->driver_data;
if (dlci->state == DLCI_CLOSED)
- return -EINVAL;
+ return 0;
return TX_SIZE - kfifo_len(&dlci->fifo);
}
diff --git a/drivers/tty/vcc.c b/drivers/tty/vcc.c
index 3106df98558a..0a3a71e14df4 100644
--- a/drivers/tty/vcc.c
+++ b/drivers/tty/vcc.c
@@ -878,7 +878,7 @@ static int vcc_write_room(struct tty_struct *tty)
port = vcc_get_ne(tty->index);
if (unlikely(!port)) {
pr_err("VCC: write_room: Failed to find VCC port\n");
- return -ENODEV;
+ return 0;
}
num = VCC_BUFF_LEN - port->chars_in_buffer;
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
index 701dfb32b129..bb3d39307d93 100644
--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -1042,7 +1042,7 @@ static int mos7720_write_room(struct tty_struct *tty)
mos7720_port = usb_get_serial_port_data(port);
if (mos7720_port == NULL)
- return -ENODEV;
+ return 0;
/* FIXME: Locking */
for (i = 0; i < NUM_URBS; ++i) {
--
2.30.1
^ permalink raw reply related [flat|nested] 61+ messages in thread
* Re: [PATCH 29/44] tty: xtensa/iss, drop serial_version & serial_name
2021-03-02 6:21 ` [PATCH 29/44] tty: xtensa/iss, drop serial_version & serial_name Jiri Slaby
@ 2021-03-02 6:45 ` Max Filippov
0 siblings, 0 replies; 61+ messages in thread
From: Max Filippov @ 2021-03-02 6:45 UTC (permalink / raw)
To: Jiri Slaby
Cc: Greg Kroah-Hartman, linux-serial, LKML, Chris Zankel,
open list:TENSILICA XTENSA PORT (xtensa)
On Mon, Mar 1, 2021 at 10:22 PM Jiri Slaby <jslaby@suse.cz> wrote:
>
> There is no need to print the information during module load. Neither to
> print some artificial version. So drop these strings and a print.
>
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> Cc: Chris Zankel <chris@zankel.net>
> Cc: Max Filippov <jcmvbkbc@gmail.com>
> Cc: linux-xtensa@linux-xtensa.org
> ---
> arch/xtensa/platforms/iss/console.c | 7 +------
> 1 file changed, 1 insertion(+), 6 deletions(-)
Acked-by: Max Filippov <jcmvbkbc@gmail.com>
--
Thanks.
-- Max
^ permalink raw reply [flat|nested] 61+ messages in thread
* Re: [PATCH 31/44] tty: xtensa/iss, remove stale comments
2021-03-02 6:22 ` [PATCH 31/44] tty: xtensa/iss, remove stale comments Jiri Slaby
@ 2021-03-02 6:49 ` Max Filippov
0 siblings, 0 replies; 61+ messages in thread
From: Max Filippov @ 2021-03-02 6:49 UTC (permalink / raw)
To: Jiri Slaby
Cc: Greg Kroah-Hartman, linux-serial, LKML, Chris Zankel,
open list:TENSILICA XTENSA PORT (xtensa)
On Mon, Mar 1, 2021 at 10:22 PM Jiri Slaby <jslaby@suse.cz> wrote:
>
> These are likely taken over from amiserial. iss doesn't do anything of
> that.
>
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> Cc: Chris Zankel <chris@zankel.net>
> Cc: Max Filippov <jcmvbkbc@gmail.com>
> Cc: linux-xtensa@linux-xtensa.org
> ---
> arch/xtensa/platforms/iss/console.c | 18 ------------------
> 1 file changed, 18 deletions(-)
Acked-by: Max Filippov <jcmvbkbc@gmail.com>
--
Thanks.
-- Max
^ permalink raw reply [flat|nested] 61+ messages in thread
* Re: [PATCH 32/44] tty: xtensa/iss, setup the timer statically
2021-03-02 6:22 ` [PATCH 32/44] tty: xtensa/iss, setup the timer statically Jiri Slaby
@ 2021-03-02 6:52 ` Max Filippov
0 siblings, 0 replies; 61+ messages in thread
From: Max Filippov @ 2021-03-02 6:52 UTC (permalink / raw)
To: Jiri Slaby
Cc: Greg Kroah-Hartman, linux-serial, LKML, Chris Zankel,
open list:TENSILICA XTENSA PORT (xtensa)
On Mon, Mar 1, 2021 at 10:22 PM Jiri Slaby <jslaby@suse.cz> wrote:
>
> Use DEFINE_TIMER and avoid runtime initialization of the serial_timer.
>
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> Cc: Chris Zankel <chris@zankel.net>
> Cc: Max Filippov <jcmvbkbc@gmail.com>
> Cc: linux-xtensa@linux-xtensa.org
> ---
> arch/xtensa/platforms/iss/console.c | 11 ++++-------
> 1 file changed, 4 insertions(+), 7 deletions(-)
Acked-by: Max Filippov <jcmvbkbc@gmail.com>
--
Thanks.
-- Max
^ permalink raw reply [flat|nested] 61+ messages in thread
* Re: [PATCH 33/44] tty: xtensa/iss, make rs_init static
2021-03-02 6:22 ` [PATCH 33/44] tty: xtensa/iss, make rs_init static Jiri Slaby
@ 2021-03-02 6:55 ` Max Filippov
0 siblings, 0 replies; 61+ messages in thread
From: Max Filippov @ 2021-03-02 6:55 UTC (permalink / raw)
To: Jiri Slaby
Cc: Greg Kroah-Hartman, linux-serial, LKML, Chris Zankel,
open list:TENSILICA XTENSA PORT (xtensa)
On Mon, Mar 1, 2021 at 10:22 PM Jiri Slaby <jslaby@suse.cz> wrote:
>
> To fix the warning:
> warning: no previous prototype for 'rs_init'
>
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> Cc: Chris Zankel <chris@zankel.net>
> Cc: Max Filippov <jcmvbkbc@gmail.com>
> Cc: linux-xtensa@linux-xtensa.org
> ---
> arch/xtensa/platforms/iss/console.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Acked-by: Max Filippov <jcmvbkbc@gmail.com>
--
Thanks.
-- Max
^ permalink raw reply [flat|nested] 61+ messages in thread
* Re: [PATCH 34/44] tty: do not check tty_unregister_driver's return value
2021-03-02 6:22 ` [PATCH 34/44] tty: do not check tty_unregister_driver's return value Jiri Slaby
@ 2021-03-02 6:57 ` Max Filippov
2021-03-02 11:14 ` David Sterba
1 sibling, 0 replies; 61+ messages in thread
From: Max Filippov @ 2021-03-02 6:57 UTC (permalink / raw)
To: Jiri Slaby
Cc: Greg Kroah-Hartman, linux-serial, LKML, Chris Zankel,
open list:TENSILICA XTENSA PORT (xtensa), Jiri Kosina,
David Sterba
On Mon, Mar 1, 2021 at 10:22 PM Jiri Slaby <jslaby@suse.cz> wrote:
>
> These drivers check tty_unregister_driver return value. But they don't
> handle a failure correctly (they free the driver in any case). So stop
> checking tty_unregister_driver return value and remove also the prints.
>
> In the next patch, tty_unregister_driver's return type will be switched
> to void.
>
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> Cc: Chris Zankel <chris@zankel.net>
> Cc: Max Filippov <jcmvbkbc@gmail.com>
> Cc: linux-xtensa@linux-xtensa.org
> Cc: Jiri Kosina <jikos@kernel.org>
> Cc: David Sterba <dsterba@suse.com>
> ---
> arch/xtensa/platforms/iss/console.c | 6 +-----
> drivers/tty/amiserial.c | 8 ++------
> drivers/tty/ipwireless/tty.c | 7 +------
> drivers/tty/moxa.c | 4 +---
> drivers/tty/serial/kgdb_nmi.c | 4 +---
> drivers/tty/synclink_gt.c | 5 +----
> 6 files changed, 7 insertions(+), 27 deletions(-)
Reviewed-by: Max Filippov <jcmvbkbc@gmail.com>
--
Thanks.
-- Max
^ permalink raw reply [flat|nested] 61+ messages in thread
* Re: [PATCH 10/44] tty: imx, use ms_to_ktime
2021-03-02 6:21 ` [PATCH 10/44] tty: imx, use ms_to_ktime Jiri Slaby
@ 2021-03-02 6:59 ` Uwe Kleine-König
0 siblings, 0 replies; 61+ messages in thread
From: Uwe Kleine-König @ 2021-03-02 6:59 UTC (permalink / raw)
To: Jiri Slaby
Cc: gregkh, Fabio Estevam, linux-serial, Sascha Hauer, linux-kernel,
NXP Linux Team, Pengutronix Kernel Team, Shawn Guo, Ahmad Fatoum
[-- Attachment #1: Type: text/plain, Size: 2997 bytes --]
Hello Jiri,
On Tue, Mar 02, 2021 at 07:21:40AM +0100, Jiri Slaby wrote:
> This really eliminates multiplications from the assembly. I would have
> thought they are optimized by inlining ktime_set, but not on x86_64 with
> gcc 10.
>
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> Cc: Shawn Guo <shawnguo@kernel.org>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
> Cc: Fabio Estevam <festevam@gmail.com>
> Cc: NXP Linux Team <linux-imx@nxp.com>
> ---
> drivers/tty/serial/imx.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
> index 8257597d034d..3f69356937ef 100644
> --- a/drivers/tty/serial/imx.c
> +++ b/drivers/tty/serial/imx.c
> @@ -394,11 +394,7 @@ static void imx_uart_rts_inactive(struct imx_port *sport, u32 *ucr2)
>
> static void start_hrtimer_ms(struct hrtimer *hrt, unsigned long msec)
> {
> - long sec = msec / MSEC_PER_SEC;
> - long nsec = (msec % MSEC_PER_SEC) * 1000000;
> - ktime_t t = ktime_set(sec, nsec);
> -
> - hrtimer_start(hrt, t, HRTIMER_MODE_REL);
> + hrtimer_start(hrt, ms_to_ktime(msec), HRTIMER_MODE_REL);
> }
What about:
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 8257597d034d..8731d4f82cb8 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -392,15 +392,6 @@ static void imx_uart_rts_inactive(struct imx_port *sport, u32 *ucr2)
mctrl_gpio_set(sport->gpios, sport->port.mctrl);
}
-static void start_hrtimer_ms(struct hrtimer *hrt, unsigned long msec)
-{
- long sec = msec / MSEC_PER_SEC;
- long nsec = (msec % MSEC_PER_SEC) * 1000000;
- ktime_t t = ktime_set(sec, nsec);
-
- hrtimer_start(hrt, t, HRTIMER_MODE_REL);
-}
-
/* called with port.lock taken and irqs off */
static void imx_uart_start_rx(struct uart_port *port)
{
@@ -457,8 +448,9 @@ static void imx_uart_stop_tx(struct uart_port *port)
if (port->rs485.flags & SER_RS485_ENABLED) {
if (sport->tx_state == SEND) {
sport->tx_state = WAIT_AFTER_SEND;
- start_hrtimer_ms(&sport->trigger_stop_tx,
- port->rs485.delay_rts_after_send);
+ hrtimer_start(&sport->trigger_stop_tx,
+ ms_to_ktime(port->rs485.delay_rts_after_send),
+ HRTIMER_MODE_REL);
return;
}
@@ -697,8 +689,9 @@ static void imx_uart_start_tx(struct uart_port *port)
imx_uart_stop_rx(port);
sport->tx_state = WAIT_AFTER_RTS;
- start_hrtimer_ms(&sport->trigger_start_tx,
- port->rs485.delay_rts_before_send);
+ hrtimer_start(&sport->trigger_start_tx,
+ ms_to_ktime(port->rs485.delay_rts_before_send),
+ HRTIMER_MODE_REL);
return;
}
instead?
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply related [flat|nested] 61+ messages in thread
* Re: [PATCH 30/44] tty: xtensa/iss, don't reassign to tty->port
2021-03-02 6:22 ` [PATCH 30/44] tty: xtensa/iss, don't reassign to tty->port Jiri Slaby
@ 2021-03-02 7:12 ` Max Filippov
0 siblings, 0 replies; 61+ messages in thread
From: Max Filippov @ 2021-03-02 7:12 UTC (permalink / raw)
To: Jiri Slaby
Cc: Greg Kroah-Hartman, linux-serial, LKML, Chris Zankel,
open list:TENSILICA XTENSA PORT (xtensa)
On Mon, Mar 1, 2021 at 10:22 PM Jiri Slaby <jslaby@suse.cz> wrote:
>
> We already do tty_port_link_device in rs_init, so we don't need to
> reassign a port to tty->port. It would be too late in tty::ops::open
> anyway.
>
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> Cc: Chris Zankel <chris@zankel.net>
> Cc: Max Filippov <jcmvbkbc@gmail.com>
> Cc: linux-xtensa@linux-xtensa.org
> ---
> arch/xtensa/platforms/iss/console.c | 1 -
> 1 file changed, 1 deletion(-)
Acked-by: Max Filippov <jcmvbkbc@gmail.com>
--
Thanks.
-- Max
^ permalink raw reply [flat|nested] 61+ messages in thread
* Re: [PATCH 34/44] tty: do not check tty_unregister_driver's return value
2021-03-02 6:22 ` [PATCH 34/44] tty: do not check tty_unregister_driver's return value Jiri Slaby
2021-03-02 6:57 ` Max Filippov
@ 2021-03-02 11:14 ` David Sterba
1 sibling, 0 replies; 61+ messages in thread
From: David Sterba @ 2021-03-02 11:14 UTC (permalink / raw)
To: Jiri Slaby
Cc: gregkh, linux-serial, linux-kernel, Chris Zankel, Max Filippov,
linux-xtensa, Jiri Kosina, David Sterba
On Tue, Mar 02, 2021 at 07:22:04AM +0100, Jiri Slaby wrote:
> These drivers check tty_unregister_driver return value. But they don't
> handle a failure correctly (they free the driver in any case). So stop
> checking tty_unregister_driver return value and remove also the prints.
>
> In the next patch, tty_unregister_driver's return type will be switched
> to void.
>
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> Cc: Chris Zankel <chris@zankel.net>
> Cc: Max Filippov <jcmvbkbc@gmail.com>
> Cc: linux-xtensa@linux-xtensa.org
> Cc: Jiri Kosina <jikos@kernel.org>
> Cc: David Sterba <dsterba@suse.com>
> ---
For
> drivers/tty/ipwireless/tty.c | 7 +------
Acked-by: David Sterba <dsterba@suse.com>
Thanks.
^ permalink raw reply [flat|nested] 61+ messages in thread
* Re: [PATCH 40/44] tty: hvc, drop unneeded forward declarations
2021-03-02 6:22 ` [PATCH 40/44] tty: hvc, " Jiri Slaby
@ 2021-03-02 19:09 ` Tyrel Datwyler
2021-03-03 7:44 ` Uwe Kleine-König
1 sibling, 0 replies; 61+ messages in thread
From: Tyrel Datwyler @ 2021-03-02 19:09 UTC (permalink / raw)
To: Jiri Slaby, gregkh; +Cc: linuxppc-dev, linux-kernel, linux-serial
On 3/1/21 10:22 PM, Jiri Slaby wrote:
> Forward declarations make the code larger and rewrites harder. Harder as
> they are often omitted from global changes. Remove forward declarations
> which are not really needed, i.e. the definition of the function is
> before its first use.
>
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> Cc: linuxppc-dev@lists.ozlabs.org
Reviewed-by: Tyrel Datwyler <tyreld@linux.ibm.com>
> ---
> drivers/tty/hvc/hvcs.c | 25 -------------------------
> 1 file changed, 25 deletions(-)
>
> diff --git a/drivers/tty/hvc/hvcs.c b/drivers/tty/hvc/hvcs.c
> index c90848919644..0b89d878a108 100644
> --- a/drivers/tty/hvc/hvcs.c
> +++ b/drivers/tty/hvc/hvcs.c
> @@ -290,36 +290,11 @@ static LIST_HEAD(hvcs_structs);
> static DEFINE_SPINLOCK(hvcs_structs_lock);
> static DEFINE_MUTEX(hvcs_init_mutex);
>
> -static void hvcs_unthrottle(struct tty_struct *tty);
> -static void hvcs_throttle(struct tty_struct *tty);
> -static irqreturn_t hvcs_handle_interrupt(int irq, void *dev_instance);
> -
> -static int hvcs_write(struct tty_struct *tty,
> - const unsigned char *buf, int count);
> -static int hvcs_write_room(struct tty_struct *tty);
> -static int hvcs_chars_in_buffer(struct tty_struct *tty);
> -
> -static int hvcs_has_pi(struct hvcs_struct *hvcsd);
> -static void hvcs_set_pi(struct hvcs_partner_info *pi,
> - struct hvcs_struct *hvcsd);
> static int hvcs_get_pi(struct hvcs_struct *hvcsd);
> static int hvcs_rescan_devices_list(void);
>
> -static int hvcs_partner_connect(struct hvcs_struct *hvcsd);
> static void hvcs_partner_free(struct hvcs_struct *hvcsd);
>
> -static int hvcs_enable_device(struct hvcs_struct *hvcsd,
> - uint32_t unit_address, unsigned int irq, struct vio_dev *dev);
> -
> -static int hvcs_open(struct tty_struct *tty, struct file *filp);
> -static void hvcs_close(struct tty_struct *tty, struct file *filp);
> -static void hvcs_hangup(struct tty_struct * tty);
> -
> -static int hvcs_probe(struct vio_dev *dev,
> - const struct vio_device_id *id);
> -static int hvcs_remove(struct vio_dev *dev);
> -static int __init hvcs_module_init(void);
> -static void __exit hvcs_module_exit(void);
> static int hvcs_initialize(void);
>
> #define HVCS_SCHED_READ 0x00000001
>
^ permalink raw reply [flat|nested] 61+ messages in thread
* Re: [PATCH 40/44] tty: hvc, drop unneeded forward declarations
2021-03-02 6:22 ` [PATCH 40/44] tty: hvc, " Jiri Slaby
2021-03-02 19:09 ` Tyrel Datwyler
@ 2021-03-03 7:44 ` Uwe Kleine-König
1 sibling, 0 replies; 61+ messages in thread
From: Uwe Kleine-König @ 2021-03-03 7:44 UTC (permalink / raw)
To: Jiri Slaby, Michael Ellerman
Cc: gregkh, linux-serial, linux-kernel, linuxppc-dev
[-- Attachment #1: Type: text/plain, Size: 2712 bytes --]
Hello Jiri,
On Tue, Mar 02, 2021 at 07:22:10AM +0100, Jiri Slaby wrote:
> Forward declarations make the code larger and rewrites harder. Harder as
> they are often omitted from global changes. Remove forward declarations
> which are not really needed, i.e. the definition of the function is
> before its first use.
>
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> Cc: linuxppc-dev@lists.ozlabs.org
> ---
> drivers/tty/hvc/hvcs.c | 25 -------------------------
note this conflicts with commit 386a966f5ce71a0364b158c5d0a6971f4e418ea8
that currently sits in the powerpc tree. I think it's easy to resolve.
Other than that:
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Best regards
Uwe
> 1 file changed, 25 deletions(-)
>
> diff --git a/drivers/tty/hvc/hvcs.c b/drivers/tty/hvc/hvcs.c
> index c90848919644..0b89d878a108 100644
> --- a/drivers/tty/hvc/hvcs.c
> +++ b/drivers/tty/hvc/hvcs.c
> @@ -290,36 +290,11 @@ static LIST_HEAD(hvcs_structs);
> static DEFINE_SPINLOCK(hvcs_structs_lock);
> static DEFINE_MUTEX(hvcs_init_mutex);
>
> -static void hvcs_unthrottle(struct tty_struct *tty);
> -static void hvcs_throttle(struct tty_struct *tty);
> -static irqreturn_t hvcs_handle_interrupt(int irq, void *dev_instance);
> -
> -static int hvcs_write(struct tty_struct *tty,
> - const unsigned char *buf, int count);
> -static int hvcs_write_room(struct tty_struct *tty);
> -static int hvcs_chars_in_buffer(struct tty_struct *tty);
> -
> -static int hvcs_has_pi(struct hvcs_struct *hvcsd);
> -static void hvcs_set_pi(struct hvcs_partner_info *pi,
> - struct hvcs_struct *hvcsd);
> static int hvcs_get_pi(struct hvcs_struct *hvcsd);
> static int hvcs_rescan_devices_list(void);
>
> -static int hvcs_partner_connect(struct hvcs_struct *hvcsd);
> static void hvcs_partner_free(struct hvcs_struct *hvcsd);
>
> -static int hvcs_enable_device(struct hvcs_struct *hvcsd,
> - uint32_t unit_address, unsigned int irq, struct vio_dev *dev);
> -
> -static int hvcs_open(struct tty_struct *tty, struct file *filp);
> -static void hvcs_close(struct tty_struct *tty, struct file *filp);
> -static void hvcs_hangup(struct tty_struct * tty);
> -
> -static int hvcs_probe(struct vio_dev *dev,
> - const struct vio_device_id *id);
> -static int hvcs_remove(struct vio_dev *dev);
> -static int __init hvcs_module_init(void);
> -static void __exit hvcs_module_exit(void);
> static int hvcs_initialize(void);
>
> #define HVCS_SCHED_READ 0x00000001
> --
> 2.30.1
>
>
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 61+ messages in thread
* Re: [PATCH 37/44] USB: serial/keyspan, drop unneeded forward declarations
2021-03-02 6:22 ` [PATCH 37/44] USB: serial/keyspan, drop unneeded forward declarations Jiri Slaby
@ 2021-03-03 19:17 ` Greg KH
2021-03-05 10:10 ` Johan Hovold
2021-03-15 8:43 ` Johan Hovold
0 siblings, 2 replies; 61+ messages in thread
From: Greg KH @ 2021-03-03 19:17 UTC (permalink / raw)
To: Jiri Slaby; +Cc: linux-serial, linux-kernel, Johan Hovold
On Tue, Mar 02, 2021 at 07:22:07AM +0100, Jiri Slaby wrote:
> Forward declarations make the code larger, harder to follow and rewrite.
> Harder as the declarations are often omitted from global changes. Remove
> forward declarations which are not really needed, i.e. when the
> definition of the function is before its first use.
>
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> Cc: Johan Hovold <johan@kernel.org>
> ---
> drivers/usb/serial/keyspan.c | 20 --------------------
> 1 file changed, 20 deletions(-)
I'll let Johan take this through his tree:
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
^ permalink raw reply [flat|nested] 61+ messages in thread
* Re: [PATCH 38/44] USB: serial/io_edgeport, drop unneeded forward declarations
2021-03-02 6:22 ` [PATCH 38/44] USB: serial/io_edgeport, " Jiri Slaby
@ 2021-03-03 19:17 ` Greg KH
0 siblings, 0 replies; 61+ messages in thread
From: Greg KH @ 2021-03-03 19:17 UTC (permalink / raw)
To: Jiri Slaby; +Cc: linux-serial, linux-kernel, Johan Hovold
On Tue, Mar 02, 2021 at 07:22:08AM +0100, Jiri Slaby wrote:
> Forward declarations make the code larger and rewrites harder. Harder as
> they are often omitted from global changes. Remove forward declarations
> which are not really needed, i.e. the definition of the function is
> before its first use.
>
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> Cc: Johan Hovold <johan@kernel.org>
> ---
> drivers/usb/serial/io_edgeport.c | 41 --------------------------------
> 1 file changed, 41 deletions(-)
I'll let Johan take this through his tree:
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
^ permalink raw reply [flat|nested] 61+ messages in thread
* Re: [PATCH 01/44] MAINTAINERS: orphan mxser
2021-03-02 6:21 [PATCH 01/44] MAINTAINERS: orphan mxser Jiri Slaby
` (40 preceding siblings ...)
2021-03-02 6:22 ` [PATCH 44/44] tty: make everyone's write_room " Jiri Slaby
@ 2021-03-03 19:19 ` Greg KH
41 siblings, 0 replies; 61+ messages in thread
From: Greg KH @ 2021-03-03 19:19 UTC (permalink / raw)
To: Jiri Slaby; +Cc: linux-serial, linux-kernel
On Tue, Mar 02, 2021 at 07:21:31AM +0100, Jiri Slaby wrote:
> I cannot maintain this driver for years due to missing HW. Let's orphan
> the entry in MAINTAINERS. And likely drop the driver later as these
> devices are likely gone from this world. Mxser provides different
> (out-of-tree) drivers for their current devices.
>
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> ---
> MAINTAINERS | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
Thanks for the series, and dropping the abandonded drivers. All now
queued up except for the 2 usb-serial driver cleanups.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 61+ messages in thread
* Re: [PATCH 37/44] USB: serial/keyspan, drop unneeded forward declarations
2021-03-03 19:17 ` Greg KH
@ 2021-03-05 10:10 ` Johan Hovold
2021-03-15 8:43 ` Johan Hovold
1 sibling, 0 replies; 61+ messages in thread
From: Johan Hovold @ 2021-03-05 10:10 UTC (permalink / raw)
To: Greg KH; +Cc: Jiri Slaby, linux-serial, linux-kernel
On Wed, Mar 03, 2021 at 08:17:11PM +0100, Greg Kroah-Hartman wrote:
> On Tue, Mar 02, 2021 at 07:22:07AM +0100, Jiri Slaby wrote:
> > Forward declarations make the code larger, harder to follow and rewrite.
> > Harder as the declarations are often omitted from global changes. Remove
> > forward declarations which are not really needed, i.e. when the
> > definition of the function is before its first use.
> >
> > Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> > Cc: Johan Hovold <johan@kernel.org>
> > ---
> > drivers/usb/serial/keyspan.c | 20 --------------------
> > 1 file changed, 20 deletions(-)
>
> I'll let Johan take this through his tree:
>
> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Thanks, I'll pick these two up next week.
Jiri, was there ever a cover letter to this series? It took a while for
all 44 (!) patches to hit the lists (or my inbox), but I never could
figure out whether there was an overall theme to it that made you post
it all as a single series in the first place.
Johan
^ permalink raw reply [flat|nested] 61+ messages in thread
* Re: [PATCH 44/44] tty: make everyone's write_room return >= 0
2021-03-02 6:22 ` [PATCH 44/44] tty: make everyone's write_room " Jiri Slaby
@ 2021-03-05 10:18 ` Johan Hovold
0 siblings, 0 replies; 61+ messages in thread
From: Johan Hovold @ 2021-03-05 10:18 UTC (permalink / raw)
To: Jiri Slaby; +Cc: gregkh, linux-serial, linux-kernel
On Tue, Mar 02, 2021 at 07:22:14AM +0100, Jiri Slaby wrote:
> The tty line disciplines don't expect tty_operations::write_room to
> return negative values. Fix the five drivers which violate this.
>
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> ---
> drivers/staging/gdm724x/gdm_tty.c | 2 +-
> drivers/tty/ipwireless/tty.c | 4 ++--
> drivers/tty/n_gsm.c | 2 +-
> drivers/tty/vcc.c | 2 +-
> drivers/usb/serial/mos7720.c | 2 +-
> 5 files changed, 6 insertions(+), 6 deletions(-)
> diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
> index 701dfb32b129..bb3d39307d93 100644
> --- a/drivers/usb/serial/mos7720.c
> +++ b/drivers/usb/serial/mos7720.c
> @@ -1042,7 +1042,7 @@ static int mos7720_write_room(struct tty_struct *tty)
>
> mos7720_port = usb_get_serial_port_data(port);
> if (mos7720_port == NULL)
> - return -ENODEV;
> + return 0;
This test is bogus and could just be removed, but that's for another
patch.
>
> /* FIXME: Locking */
> for (i = 0; i < NUM_URBS; ++i) {
Johan
^ permalink raw reply [flat|nested] 61+ messages in thread
* Re: [PATCH 03/44] PCI: remove synclink entries from pci_ids
2021-03-02 6:21 ` [PATCH 03/44] PCI: remove synclink entries from pci_ids Jiri Slaby
@ 2021-03-06 23:47 ` Krzysztof Wilczyński
2021-03-12 22:12 ` Bjorn Helgaas
1 sibling, 0 replies; 61+ messages in thread
From: Krzysztof Wilczyński @ 2021-03-06 23:47 UTC (permalink / raw)
To: Jiri Slaby; +Cc: gregkh, linux-serial, linux-kernel, Bjorn Helgaas, linux-pci
Hi Jiri,
> The drivers were removed in a1f714b44e34 (tty: Remove redundant synclink
> driver) and 3d608a591b2b (tty: Remove redundant synclinkmp driver).
>
> So remove also the PCI ID entries.
[...]
Thank you!
Reviewed-by: Krzysztof Wilczyński <kw@linux.com>
Krzysztof
^ permalink raw reply [flat|nested] 61+ messages in thread
* Re: [PATCH 04/44] vgacon: comment on vga_rolled_over
2021-03-02 6:21 ` [PATCH 04/44] vgacon: comment on vga_rolled_over Jiri Slaby
@ 2021-03-11 13:08 ` Daniel Vetter
0 siblings, 0 replies; 61+ messages in thread
From: Daniel Vetter @ 2021-03-11 13:08 UTC (permalink / raw)
To: Jiri Slaby; +Cc: gregkh, dri-devel, linux-kernel, linux-serial, linux-fbdev
On Tue, Mar 02, 2021 at 07:21:34AM +0100, Jiri Slaby wrote:
> Long time ago, I figured out what this number is good for and documented
> that locally. But never submitted, so do it now.
>
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> Cc: dri-devel@lists.freedesktop.org
> Cc: linux-fbdev@vger.kernel.org
I think Greg volunteered to take care of these ... Also my brain is toast
and I'm not even close to ready to grok vc code to review this properly
:-/
Cheers, Daniel
> ---
> drivers/video/console/vgacon.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
> index 962c12be9774..0d26e821e73b 100644
> --- a/drivers/video/console/vgacon.c
> +++ b/drivers/video/console/vgacon.c
> @@ -96,7 +96,7 @@ static bool vga_is_gfx;
> static bool vga_512_chars;
> static int vga_video_font_height;
> static int vga_scan_lines __read_mostly;
> -static unsigned int vga_rolled_over;
> +static unsigned int vga_rolled_over; /* last vc_origin offset before wrap */
>
> static bool vgacon_text_mode_force;
> static bool vga_hardscroll_enabled;
> --
> 2.30.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
^ permalink raw reply [flat|nested] 61+ messages in thread
* Re: [PATCH 03/44] PCI: remove synclink entries from pci_ids
2021-03-02 6:21 ` [PATCH 03/44] PCI: remove synclink entries from pci_ids Jiri Slaby
2021-03-06 23:47 ` Krzysztof Wilczyński
@ 2021-03-12 22:12 ` Bjorn Helgaas
1 sibling, 0 replies; 61+ messages in thread
From: Bjorn Helgaas @ 2021-03-12 22:12 UTC (permalink / raw)
To: Jiri Slaby; +Cc: gregkh, linux-serial, linux-kernel, Bjorn Helgaas, linux-pci
On Tue, Mar 02, 2021 at 07:21:33AM +0100, Jiri Slaby wrote:
> The drivers were removed in a1f714b44e34 (tty: Remove redundant synclink
> driver) and 3d608a591b2b (tty: Remove redundant synclinkmp driver).
>
> So remove also the PCI ID entries.
>
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Applied with Krzysztof's reviewed-by to pci/misc for v5.13, thanks!
> Cc: Bjorn Helgaas <bhelgaas@google.com>
> Cc: linux-pci@vger.kernel.org
> ---
> include/linux/pci_ids.h | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
> index a76ccb697bef..8a18517696c1 100644
> --- a/include/linux/pci_ids.h
> +++ b/include/linux/pci_ids.h
> @@ -2065,8 +2065,6 @@
> #define PCI_DEVICE_ID_EXAR_XR17V358 0x0358
>
> #define PCI_VENDOR_ID_MICROGATE 0x13c0
> -#define PCI_DEVICE_ID_MICROGATE_USC 0x0010
> -#define PCI_DEVICE_ID_MICROGATE_SCA 0x0030
>
> #define PCI_VENDOR_ID_3WARE 0x13C1
> #define PCI_DEVICE_ID_3WARE_1000 0x1000
> --
> 2.30.1
>
^ permalink raw reply [flat|nested] 61+ messages in thread
* Re: [PATCH 37/44] USB: serial/keyspan, drop unneeded forward declarations
2021-03-03 19:17 ` Greg KH
2021-03-05 10:10 ` Johan Hovold
@ 2021-03-15 8:43 ` Johan Hovold
1 sibling, 0 replies; 61+ messages in thread
From: Johan Hovold @ 2021-03-15 8:43 UTC (permalink / raw)
To: Greg KH; +Cc: Jiri Slaby, linux-serial, linux-kernel
On Wed, Mar 03, 2021 at 08:17:11PM +0100, Greg Kroah-Hartman wrote:
> On Tue, Mar 02, 2021 at 07:22:07AM +0100, Jiri Slaby wrote:
> > Forward declarations make the code larger, harder to follow and rewrite.
> > Harder as the declarations are often omitted from global changes. Remove
> > forward declarations which are not really needed, i.e. when the
> > definition of the function is before its first use.
> >
> > Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> > Cc: Johan Hovold <johan@kernel.org>
> > ---
> > drivers/usb/serial/keyspan.c | 20 --------------------
> > 1 file changed, 20 deletions(-)
>
> I'll let Johan take this through his tree:
>
> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Now applied.
Johan
^ permalink raw reply [flat|nested] 61+ messages in thread
end of thread, other threads:[~2021-03-15 8:43 UTC | newest]
Thread overview: 61+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-02 6:21 [PATCH 01/44] MAINTAINERS: orphan mxser Jiri Slaby
2021-03-02 6:21 ` [PATCH 02/44] MAINTAINERS: drop cyclades.com reference Jiri Slaby
2021-03-02 6:21 ` [PATCH 03/44] PCI: remove synclink entries from pci_ids Jiri Slaby
2021-03-06 23:47 ` Krzysztof Wilczyński
2021-03-12 22:12 ` Bjorn Helgaas
2021-03-02 6:21 ` [PATCH 04/44] vgacon: comment on vga_rolled_over Jiri Slaby
2021-03-11 13:08 ` Daniel Vetter
2021-03-02 6:21 ` [PATCH 06/44] tty: isicom, remove this orphan Jiri Slaby
2021-03-02 6:21 ` [PATCH 08/44] tty: remove TTY_LDISC_MAGIC Jiri Slaby
2021-03-02 6:21 ` [PATCH 09/44] tty: n_tty, set tty_ldisc_ops::owner Jiri Slaby
2021-03-02 6:21 ` [PATCH 10/44] tty: imx, use ms_to_ktime Jiri Slaby
2021-03-02 6:59 ` Uwe Kleine-König
2021-03-02 6:21 ` [PATCH 11/44] tty: 8250, " Jiri Slaby
2021-03-02 6:21 ` [PATCH 12/44] tty: 8250, cleanup em485 timers Jiri Slaby
2021-03-02 6:21 ` [PATCH 13/44] tty: 8250/serial_cs, propagate errors in simple_config Jiri Slaby
2021-03-02 6:21 ` [PATCH 14/44] net: caif: inline register_ldisc Jiri Slaby
2021-03-02 6:21 ` [PATCH 15/44] net: nfc: nci: remove memset of nci_uart_drivers Jiri Slaby
2021-03-02 6:21 ` [PATCH 16/44] net: nfc: nci: drop nci_uart_ops::recv_buf Jiri Slaby
2021-03-02 6:21 ` [PATCH 17/44] net: nfc: nci: drop nci_uart_default_recv Jiri Slaby
2021-03-02 6:21 ` [PATCH 18/44] tty: con3215, remove tasklet for tty_wakeup Jiri Slaby
2021-03-02 6:21 ` [PATCH 19/44] tty: con3215, remove unneeded tty checks Jiri Slaby
2021-03-02 6:21 ` [PATCH 20/44] tty: con3215, remove tty->driver_data casts Jiri Slaby
2021-03-02 6:21 ` [PATCH 21/44] tty: jsm_tty, make char+error handling readable Jiri Slaby
2021-03-02 6:21 ` [PATCH 22/44] tty: nozomi, remove struct buffer Jiri Slaby
2021-03-02 6:21 ` [PATCH 23/44] tty: nozomi, remove init/exit messages Jiri Slaby
2021-03-02 6:21 ` [PATCH 24/44] tty: nozomi, remove useless debug prints Jiri Slaby
2021-03-02 6:21 ` [PATCH 25/44] tty: vcc, make globals static Jiri Slaby
2021-03-02 6:21 ` [PATCH 26/44] tty: vcc, drop version dump Jiri Slaby
2021-03-02 6:21 ` [PATCH 27/44] tty: vcc, use name strings directly Jiri Slaby
2021-03-02 6:21 ` [PATCH 28/44] tty: vcc, remove useless tty checks Jiri Slaby
2021-03-02 6:21 ` [PATCH 29/44] tty: xtensa/iss, drop serial_version & serial_name Jiri Slaby
2021-03-02 6:45 ` Max Filippov
2021-03-02 6:22 ` [PATCH 30/44] tty: xtensa/iss, don't reassign to tty->port Jiri Slaby
2021-03-02 7:12 ` Max Filippov
2021-03-02 6:22 ` [PATCH 31/44] tty: xtensa/iss, remove stale comments Jiri Slaby
2021-03-02 6:49 ` Max Filippov
2021-03-02 6:22 ` [PATCH 32/44] tty: xtensa/iss, setup the timer statically Jiri Slaby
2021-03-02 6:52 ` Max Filippov
2021-03-02 6:22 ` [PATCH 33/44] tty: xtensa/iss, make rs_init static Jiri Slaby
2021-03-02 6:55 ` Max Filippov
2021-03-02 6:22 ` [PATCH 34/44] tty: do not check tty_unregister_driver's return value Jiri Slaby
2021-03-02 6:57 ` Max Filippov
2021-03-02 11:14 ` David Sterba
2021-03-02 6:22 ` [PATCH 35/44] tty: let tty_unregister_driver return void Jiri Slaby
2021-03-02 6:22 ` [PATCH 36/44] tty: localise ptychar and make it const Jiri Slaby
2021-03-02 6:22 ` [PATCH 37/44] USB: serial/keyspan, drop unneeded forward declarations Jiri Slaby
2021-03-03 19:17 ` Greg KH
2021-03-05 10:10 ` Johan Hovold
2021-03-15 8:43 ` Johan Hovold
2021-03-02 6:22 ` [PATCH 38/44] USB: serial/io_edgeport, " Jiri Slaby
2021-03-03 19:17 ` Greg KH
2021-03-02 6:22 ` [PATCH 39/44] tty: synclink_gt, " Jiri Slaby
2021-03-02 6:22 ` [PATCH 40/44] tty: hvc, " Jiri Slaby
2021-03-02 19:09 ` Tyrel Datwyler
2021-03-03 7:44 ` Uwe Kleine-König
2021-03-02 6:22 ` [PATCH 41/44] tty: n_gsm, remove duplicates of parameters Jiri Slaby
2021-03-02 6:22 ` [PATCH 42/44] tty: cleanup tty_chars_in_buffer Jiri Slaby
2021-03-02 6:22 ` [PATCH 43/44] tty: make everyone's chars_in_buffer return >= 0 Jiri Slaby
2021-03-02 6:22 ` [PATCH 44/44] tty: make everyone's write_room " Jiri Slaby
2021-03-05 10:18 ` Johan Hovold
2021-03-03 19:19 ` [PATCH 01/44] MAINTAINERS: orphan mxser Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).