From patchwork Fri Jun 18 06:14:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 463503 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 54B8AC48BDF for ; Fri, 18 Jun 2021 06:15:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 321B5611CE for ; Fri, 18 Jun 2021 06:15:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232870AbhFRGR2 (ORCPT ); Fri, 18 Jun 2021 02:17:28 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:58858 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232819AbhFRGR1 (ORCPT ); Fri, 18 Jun 2021 02:17:27 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 57E4921B51; Fri, 18 Jun 2021 06:15:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996917; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=a0/sPTdXkqy+3O70CwUG3/nPI/FpLgT1W1rjqdxAiPo=; b=ICEeLxj3DTRSoZhfbvjTs1ZFlYlCSRysZ3b20/YyPd6M+9I0E9XH1OU6ItVHh0S6M6ISB2 Bq6lRsedFTOn++4+avBm3qZCfjGHo5L67G0MyT03VuL2V4YYcyrx6ww2p/3WjvEE1SJimR /FQmnLoNQSRXSpCgQh6wwWWOiqx6FRw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996917; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=a0/sPTdXkqy+3O70CwUG3/nPI/FpLgT1W1rjqdxAiPo=; b=tEVWJ+ocnjQd3ZxLKtN9bsd+8rdwuZmeEkh0tJXxqvRegiV97W0tq+R8+IE4xBbLnRAZpS TwpLYo4YCD1n0rBg== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 31197A3BC5; Fri, 18 Jun 2021 06:15:17 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 01/70] mxser: drop ISA support Date: Fri, 18 Jun 2021 08:14:07 +0200 Message-Id: <20210618061516.662-2-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org While mxser PCI cards are still around and produced (Moxa provided me with two recently), ISA cards are obsolete for a long time. I haven't seen anyone using the cards and the ISA code paths are barely tested. Hence, remove ISA support from mxser driver so that we can clean the driver up. Signed-off-by: Jiri Slaby --- .../driver-api/serial/moxa-smartio.rst | 107 +----- drivers/tty/Kconfig | 2 +- drivers/tty/mxser.c | 348 +----------------- 3 files changed, 17 insertions(+), 440 deletions(-) diff --git a/Documentation/driver-api/serial/moxa-smartio.rst b/Documentation/driver-api/serial/moxa-smartio.rst index 156100f17c3f..aedda2546242 100644 --- a/Documentation/driver-api/serial/moxa-smartio.rst +++ b/Documentation/driver-api/serial/moxa-smartio.rst @@ -37,8 +37,7 @@ Date: 01/21/2008 CP-102U, CP-102UL, CP-102UF CP-132U-I, CP-132UL, CP-132, CP-132I, CP132S, CP-132IS, - CI-132, CI-132I, CI-132IS, - (C102H, C102HI, C102HIS, C102P, CP-102, CP-102S) + (CP-102, CP-102S) - 4 ports multiport board CP-104EL, @@ -46,10 +45,7 @@ Date: 01/21/2008 CP-134U, CP-134U-I, C104H/PCI, C104HS/PCI, CP-114, CP-114I, CP-114S, CP-114IS, CP-114UL, - C104H, C104HS, - CI-104J, CI-104JS, - CI-134, CI-134I, CI-134IS, - (C114HI, CT-114I, C104P), + (C114HI, CT-114I), POS-104UL, CB-114, CB-134I @@ -58,8 +54,6 @@ Date: 01/21/2008 CP-118EL, CP-168EL, CP-118U, CP-168U, C168H/PCI, - C168H, C168HS, - (C168P), CB-108 This driver and installation procedure have been developed upon Linux Kernel @@ -78,9 +72,6 @@ Date: 01/21/2008 Monitor program to observe data count and line status signals. - msterm A simple terminal program which is useful in testing serial ports. - - io-irq.exe - Configuration program to setup ISA boards. Please note that - this program can only be executed under DOS. All the drivers and utilities are published in form of source code under GNU General Public License in this version. Please refer to GNU General @@ -112,17 +103,6 @@ Date: 01/21/2008 3.1 Hardware installation ========================= - There are two types of buses, ISA and PCI, for Smartio/Industio - family multiport board. - -ISA board ---------- - - You'll have to configure CAP address, I/O address, Interrupt Vector - as well as IRQ before installing this driver. Please refer to hardware - installation procedure in User's Manual before proceed any further. - Please make sure the JP1 is open after the ISA board is set properly. - PCI/UPCI board -------------- @@ -194,16 +174,6 @@ Device naming when more than 2 boards installed Under Kernel 2.6 and upper, the cum Device is Obsolete. So use ttyM* device instead. -Board sequence --------------- - - This driver will activate ISA boards according to the parameter set - in the driver. After all specified ISA board activated, PCI board - will be installed in the system automatically driven. - Therefore the board number is sorted by the CAP address of ISA boards. - For PCI boards, their sequence will be after ISA boards and C168H/PCI - has higher priority than C104H/PCI boards. - 3.4 Module driver configuration =============================== @@ -274,12 +244,10 @@ Board sequence :: - # modprobe mxser + # modprobe mxser will activate the module driver. You may run "lsmod" to check - if "mxser" is activated. If the MOXA board is ISA board, the - is needed. Please refer to section "3.4.5" for more - information. + if "mxser" is activated. ------------- Load MOXA driver on boot -------------------- @@ -296,13 +264,6 @@ Board sequence achieved by rc file. We offer one "rc.mxser" file to simplify the procedure under "moxa/mxser/driver". - But if you use ISA board, please modify the "modprobe ..." command - to add the argument (see "3.4.5" section). After modifying the - rc.mxser, please try to execute "/moxa/mxser/driver/rc.mxser" - manually to make sure the modification is ok. If any error - encountered, please try to modify again. If the modification is - completed, follow the below step. - Run following command for setting rc files:: # cd /moxa/mxser/driver @@ -316,21 +277,6 @@ Board sequence Reboot and check if moxa.o activated by "lsmod" command. -3.4.5. specify CAP address --------------------------- - - If you'd like to drive Smartio/Industio ISA boards in the system, - you'll have to add parameter to specify CAP address of given - board while activating "mxser.o". The format for parameters are - as follows.:: - - modprobe mxser ioaddr=0x???,0x???,0x???,0x??? - | | | | - | | | +- 4th ISA board - | | +------ 3rd ISA board - | +------------ 2nd ISA board - +-------------------1st ISA board - 3.5 Static driver configuration for Linux kernel 2.4.x and 2.6.x ================================================================ @@ -357,35 +303,7 @@ Board sequence # cd /usr/src/linux/drivers/char # ln -s /moxa/mxser/driver/mxser.c mxser.c -3.5.3 Add CAP address list for ISA boards. ------------------------------------------- - - For PCI boards user, please skip this step. - - In module mode, the CAP address for ISA board is given by - parameter. In static driver configuration, you'll have to - assign it within driver's source code. If you will not - install any ISA boards, you may skip to next portion. - The instructions to modify driver source code are as - below. - - a. run:: - - # cd /moxa/mxser/driver - # vi mxser.c - - b. Find the array mxserBoardCAP[] as below:: - - static int mxserBoardCAP[] = {0x00, 0x00, 0x00, 0x00}; - - c. Change the address within this array using vi. For - example, to driver 2 ISA boards with CAP address - 0x280 and 0x180 as 1st and 2nd board. Just to change - the source code as follows:: - - static int mxserBoardCAP[] = {0x280, 0x180, 0x00, 0x00}; - -3.5.4 Setup kernel configuration +3.5.3 Setup kernel configuration -------------------------------- Configure the kernel:: @@ -398,7 +316,7 @@ Board sequence SmartIO support] driver with "[*]" for built-in (not "[M]"), then select [Exit] to exit this program. -3.5.5 Rebuild kernel +3.5.4 Rebuild kernel -------------------- The following are for Linux kernel rebuilding, for your @@ -426,14 +344,14 @@ Board sequence directory /usr/src/linux. -3.5.6 Make tty device and special file +3.5.5 Make tty device and special file -------------------------------------- :: # cd /moxa/mxser/driver # ./msmknod -3.5.7 Make utility +3.5.6 Make utility ------------------ :: @@ -441,7 +359,7 @@ Board sequence # cd /moxa/mxser/utility # make clean; make install -3.5.8 Reboot +3.5.7 Reboot ------------ @@ -591,13 +509,6 @@ msterm - Terminal Emulation Each port within the same multiport board shares the same IRQ. Please set one IRQ (IRQ doesn't equal to zero) for one Moxa board. - Error msg: - No interrupt vector be set for Moxa ISA board(CAP=xxx). - - Solution: - Moxa ISA board needs an interrupt vector.Please refer to user's manual - "Hardware Installation" chapter to set interrupt vector. - Error msg: Couldn't install MOXA Smartio/Industio family driver! diff --git a/drivers/tty/Kconfig b/drivers/tty/Kconfig index f6a7fd6d3bb6..476c11278235 100644 --- a/drivers/tty/Kconfig +++ b/drivers/tty/Kconfig @@ -204,7 +204,7 @@ config MOXA_INTELLIO config MOXA_SMARTIO tristate "Moxa SmartIO support v. 2.0" - depends on SERIAL_NONSTANDARD && (PCI || EISA || ISA) + depends on SERIAL_NONSTANDARD && PCI help Say Y here if you have a Moxa SmartIO multiport serial card and/or want to help develop a new version of this driver. diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index a74e6146a748..3a00f180f54a 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -70,18 +70,8 @@ #define PCI_DEVICE_ID_CB134I 0x1341 #define PCI_DEVICE_ID_CP138U 0x1380 - -#define C168_ASIC_ID 1 -#define C104_ASIC_ID 2 -#define C102_ASIC_ID 0xB -#define CI132_ASIC_ID 4 -#define CI134_ASIC_ID 3 -#define CI104J_ASIC_ID 5 - #define MXSER_HIGHBAUD 1 -#define MXSER_HAS2 2 -/* This is only for PCI */ static const struct { int type; int tx_fifo; @@ -105,14 +95,14 @@ struct mxser_cardinfo { }; static const struct mxser_cardinfo mxser_cards[] = { -/* 0*/ { "C168 series", 8, }, - { "C104 series", 4, }, - { "CI-104J series", 4, }, +/* 0*/ { }, + { }, + { }, { "C168H/PCI series", 8, }, { "C104H/PCI series", 4, }, -/* 5*/ { "C102 series", 4, MXSER_HAS2 }, /* C102-ISA */ - { "CI-132 series", 4, MXSER_HAS2 }, - { "CI-134 series", 4, }, +/* 5*/ { }, + { }, + { }, { "CP-132 series", 2, }, { "CP-114 series", 4, }, /*10*/ { "CT-114 series", 4, }, @@ -172,15 +162,12 @@ static const struct pci_device_id mxser_pcibrds[] = { }; MODULE_DEVICE_TABLE(pci, mxser_pcibrds); -static unsigned long ioaddr[MXSER_BOARDS]; static int ttymajor = MXSERMAJOR; /* Variables for insmod */ MODULE_AUTHOR("Casper Yang"); MODULE_DESCRIPTION("MOXA Smartio/Industio Family Multiport Board Device Driver"); -module_param_hw_array(ioaddr, ulong, ioport, NULL, 0); -MODULE_PARM_DESC(ioaddr, "ISA io addresses to look for a moxa board"); module_param(ttymajor, int, 0); MODULE_LICENSE("GPL"); @@ -300,7 +287,6 @@ static void mxser_enable_must_enchance_mode(unsigned long baseio) outb(oldlcr, baseio + UART_LCR); } -#ifdef CONFIG_PCI static void mxser_disable_must_enchance_mode(unsigned long baseio) { u8 oldlcr; @@ -315,7 +301,6 @@ static void mxser_disable_must_enchance_mode(unsigned long baseio) outb(efr, baseio + MOXA_MUST_EFR_REGISTER); outb(oldlcr, baseio + UART_LCR); } -#endif static void mxser_set_must_xon1_value(unsigned long baseio, u8 value) { @@ -387,7 +372,6 @@ static void mxser_set_must_enum_value(unsigned long baseio, u8 value) outb(oldlcr, baseio + UART_LCR); } -#ifdef CONFIG_PCI static void mxser_get_must_hardware_id(unsigned long baseio, u8 *pId) { u8 oldlcr; @@ -404,7 +388,6 @@ static void mxser_get_must_hardware_id(unsigned long baseio, u8 *pId) *pId = inb(baseio + MOXA_MUST_HWID_REGISTER); outb(oldlcr, baseio + UART_LCR); } -#endif static void SET_MOXA_MUST_NO_SOFTWARE_FLOW_CONTROL(unsigned long baseio) { @@ -483,7 +466,6 @@ static void mxser_disable_must_rx_software_flow_control(unsigned long baseio) outb(oldlcr, baseio + UART_LCR); } -#ifdef CONFIG_PCI static int CheckIsMoxaMust(unsigned long io) { u8 oldmcr, hwid; @@ -506,7 +488,6 @@ static int CheckIsMoxaMust(unsigned long io) } return MOXA_OTHER_UART; } -#endif static void process_txrx_fifo(struct mxser_port *info) { @@ -1398,109 +1379,6 @@ static int mxser_tiocmset(struct tty_struct *tty, return 0; } -static int __init mxser_program_mode(int port) -{ - int id, i, j, n; - - outb(0, port); - outb(0, port); - outb(0, port); - (void)inb(port); - (void)inb(port); - outb(0, port); - (void)inb(port); - - id = inb(port + 1) & 0x1F; - if ((id != C168_ASIC_ID) && - (id != C104_ASIC_ID) && - (id != C102_ASIC_ID) && - (id != CI132_ASIC_ID) && - (id != CI134_ASIC_ID) && - (id != CI104J_ASIC_ID)) - return -1; - for (i = 0, j = 0; i < 4; i++) { - n = inb(port + 2); - if (n == 'M') { - j = 1; - } else if ((j == 1) && (n == 1)) { - j = 2; - break; - } else - j = 0; - } - if (j != 2) - id = -2; - return id; -} - -static void __init mxser_normal_mode(int port) -{ - int i, n; - - outb(0xA5, port + 1); - outb(0x80, port + 3); - outb(12, port + 0); /* 9600 bps */ - outb(0, port + 1); - outb(0x03, port + 3); /* 8 data bits */ - outb(0x13, port + 4); /* loop back mode */ - for (i = 0; i < 16; i++) { - n = inb(port + 5); - if ((n & 0x61) == 0x60) - break; - if ((n & 1) == 1) - (void)inb(port); - } - outb(0x00, port + 4); -} - -#define CHIP_SK 0x01 /* Serial Data Clock in Eprom */ -#define CHIP_DO 0x02 /* Serial Data Output in Eprom */ -#define CHIP_CS 0x04 /* Serial Chip Select in Eprom */ -#define CHIP_DI 0x08 /* Serial Data Input in Eprom */ -#define EN_CCMD 0x000 /* Chip's command register */ -#define EN0_RSARLO 0x008 /* Remote start address reg 0 */ -#define EN0_RSARHI 0x009 /* Remote start address reg 1 */ -#define EN0_RCNTLO 0x00A /* Remote byte count reg WR */ -#define EN0_RCNTHI 0x00B /* Remote byte count reg WR */ -#define EN0_DCFG 0x00E /* Data configuration reg WR */ -#define EN0_PORT 0x010 /* Rcv missed frame error counter RD */ -#define ENC_PAGE0 0x000 /* Select page 0 of chip registers */ -#define ENC_PAGE3 0x0C0 /* Select page 3 of chip registers */ -static int __init mxser_read_register(int port, unsigned short *regs) -{ - int i, k, value, id; - unsigned int j; - - id = mxser_program_mode(port); - if (id < 0) - return id; - for (i = 0; i < 14; i++) { - k = (i & 0x3F) | 0x180; - for (j = 0x100; j > 0; j >>= 1) { - outb(CHIP_CS, port); - if (k & j) { - outb(CHIP_CS | CHIP_DO, port); - outb(CHIP_CS | CHIP_DO | CHIP_SK, port); /* A? bit of read */ - } else { - outb(CHIP_CS, port); - outb(CHIP_CS | CHIP_SK, port); /* A? bit of read */ - } - } - (void)inb(port); - value = 0; - for (k = 0, j = 0x8000; k < 16; k++, j >>= 1) { - outb(CHIP_CS, port); - outb(CHIP_CS | CHIP_SK, port); - if (inb(port) & CHIP_DI) - value |= j; - } - regs[i] = value; - outb(0, port); - } - mxser_normal_mode(port); - return id; -} - static int mxser_ioctl_special(unsigned int cmd, void __user *argp) { struct mxser_port *ip; @@ -2346,37 +2224,6 @@ static const struct tty_port_operations mxser_port_ops = { * The MOXA Smartio/Industio serial driver boot-time initialization code! */ -static bool allow_overlapping_vector; -module_param(allow_overlapping_vector, bool, S_IRUGO); -MODULE_PARM_DESC(allow_overlapping_vector, "whether we allow ISA cards to be configured such that vector overlabs IO ports (default=no)"); - -static bool mxser_overlapping_vector(struct mxser_board *brd) -{ - return allow_overlapping_vector && - brd->vector >= brd->ports[0].ioaddr && - brd->vector < brd->ports[0].ioaddr + 8 * brd->info->nports; -} - -static int mxser_request_vector(struct mxser_board *brd) -{ - if (mxser_overlapping_vector(brd)) - return 0; - return request_region(brd->vector, 1, "mxser(vector)") ? 0 : -EIO; -} - -static void mxser_release_vector(struct mxser_board *brd) -{ - if (mxser_overlapping_vector(brd)) - return; - release_region(brd->vector, 1); -} - -static void mxser_release_ISA_res(struct mxser_board *brd) -{ - release_region(brd->ports[0].ioaddr, 8 * brd->info->nports); - mxser_release_vector(brd); -} - static int mxser_initbrd(struct mxser_board *brd) { struct mxser_port *info; @@ -2439,125 +2286,9 @@ static void mxser_board_remove(struct mxser_board *brd) free_irq(brd->irq, brd); } -static int __init mxser_get_ISA_conf(int cap, struct mxser_board *brd) -{ - int id, i, bits, ret; - unsigned short regs[16], irq; - unsigned char scratch, scratch2; - - brd->chip_flag = MOXA_OTHER_UART; - - id = mxser_read_register(cap, regs); - switch (id) { - case C168_ASIC_ID: - brd->info = &mxser_cards[0]; - break; - case C104_ASIC_ID: - brd->info = &mxser_cards[1]; - break; - case CI104J_ASIC_ID: - brd->info = &mxser_cards[2]; - break; - case C102_ASIC_ID: - brd->info = &mxser_cards[5]; - break; - case CI132_ASIC_ID: - brd->info = &mxser_cards[6]; - break; - case CI134_ASIC_ID: - brd->info = &mxser_cards[7]; - break; - default: - return 0; - } - - irq = 0; - /* some ISA cards have 2 ports, but we want to see them as 4-port (why?) - Flag-hack checks if configuration should be read as 2-port here. */ - if (brd->info->nports == 2 || (brd->info->flags & MXSER_HAS2)) { - irq = regs[9] & 0xF000; - irq = irq | (irq >> 4); - if (irq != (regs[9] & 0xFF00)) - goto err_irqconflict; - } else if (brd->info->nports == 4) { - irq = regs[9] & 0xF000; - irq = irq | (irq >> 4); - irq = irq | (irq >> 8); - if (irq != regs[9]) - goto err_irqconflict; - } else if (brd->info->nports == 8) { - irq = regs[9] & 0xF000; - irq = irq | (irq >> 4); - irq = irq | (irq >> 8); - if ((irq != regs[9]) || (irq != regs[10])) - goto err_irqconflict; - } - - if (!irq) { - printk(KERN_ERR "mxser: interrupt number unset\n"); - return -EIO; - } - brd->irq = ((int)(irq & 0xF000) >> 12); - for (i = 0; i < 8; i++) - brd->ports[i].ioaddr = (int) regs[i + 1] & 0xFFF8; - if ((regs[12] & 0x80) == 0) { - printk(KERN_ERR "mxser: invalid interrupt vector\n"); - return -EIO; - } - brd->vector = (int)regs[11]; /* interrupt vector */ - if (id == 1) - brd->vector_mask = 0x00FF; - else - brd->vector_mask = 0x000F; - for (i = 7, bits = 0x0100; i >= 0; i--, bits <<= 1) { - if (regs[12] & bits) { - brd->ports[i].baud_base = 921600; - brd->ports[i].max_baud = 921600; - } else { - brd->ports[i].baud_base = 115200; - brd->ports[i].max_baud = 115200; - } - } - scratch2 = inb(cap + UART_LCR) & (~UART_LCR_DLAB); - outb(scratch2 | UART_LCR_DLAB, cap + UART_LCR); - outb(0, cap + UART_EFR); /* EFR is the same as FCR */ - outb(scratch2, cap + UART_LCR); - outb(UART_FCR_ENABLE_FIFO, cap + UART_FCR); - scratch = inb(cap + UART_IIR); - - if (scratch & 0xC0) - brd->uart_type = PORT_16550A; - else - brd->uart_type = PORT_16450; - if (!request_region(brd->ports[0].ioaddr, 8 * brd->info->nports, - "mxser(IO)")) { - printk(KERN_ERR "mxser: can't request ports I/O region: " - "0x%.8lx-0x%.8lx\n", - brd->ports[0].ioaddr, brd->ports[0].ioaddr + - 8 * brd->info->nports - 1); - return -EIO; - } - - ret = mxser_request_vector(brd); - if (ret) { - release_region(brd->ports[0].ioaddr, 8 * brd->info->nports); - printk(KERN_ERR "mxser: can't request interrupt vector region: " - "0x%.8lx-0x%.8lx\n", - brd->ports[0].ioaddr, brd->ports[0].ioaddr + - 8 * brd->info->nports - 1); - return ret; - } - return brd->info->nports; - -err_irqconflict: - printk(KERN_ERR "mxser: invalid interrupt number\n"); - return -EIO; -} - static int mxser_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { -#ifdef CONFIG_PCI struct mxser_board *brd; unsigned int i, j; unsigned long ioaddress; @@ -2673,14 +2404,10 @@ static int mxser_probe(struct pci_dev *pdev, pci_disable_device(pdev); err: return retval; -#else - return -ENODEV; -#endif } static void mxser_remove(struct pci_dev *pdev) { -#ifdef CONFIG_PCI struct mxser_board *brd = pci_get_drvdata(pdev); mxser_board_remove(brd); @@ -2689,7 +2416,6 @@ static void mxser_remove(struct pci_dev *pdev) pci_release_region(pdev, 3); pci_disable_device(pdev); brd->info = NULL; -#endif } static struct pci_driver mxser_driver = { @@ -2701,9 +2427,6 @@ static struct pci_driver mxser_driver = { static int __init mxser_module_init(void) { - struct mxser_board *brd; - struct device *tty_dev; - unsigned int b, i, m; int retval; mxvar_sdriver = alloc_tty_driver(MXSER_PORTS + 1); @@ -2731,57 +2454,10 @@ static int __init mxser_module_init(void) goto err_put; } - /* Start finding ISA boards here */ - for (m = 0, b = 0; b < MXSER_BOARDS; b++) { - if (!ioaddr[b]) - continue; - - brd = &mxser_boards[m]; - retval = mxser_get_ISA_conf(ioaddr[b], brd); - if (retval <= 0) { - brd->info = NULL; - continue; - } - - printk(KERN_INFO "mxser: found MOXA %s board (CAP=0x%lx)\n", - brd->info->name, ioaddr[b]); - - /* mxser_initbrd will hook ISR. */ - if (mxser_initbrd(brd) < 0) { - mxser_release_ISA_res(brd); - brd->info = NULL; - continue; - } - - brd->idx = m * MXSER_PORTS_PER_BOARD; - for (i = 0; i < brd->info->nports; i++) { - tty_dev = tty_port_register_device(&brd->ports[i].port, - mxvar_sdriver, brd->idx + i, NULL); - if (IS_ERR(tty_dev)) { - for (; i > 0; i--) - tty_unregister_device(mxvar_sdriver, - brd->idx + i - 1); - for (i = 0; i < brd->info->nports; i++) - tty_port_destroy(&brd->ports[i].port); - free_irq(brd->irq, brd); - mxser_release_ISA_res(brd); - brd->info = NULL; - break; - } - } - if (brd->info == NULL) - continue; - - m++; - } - retval = pci_register_driver(&mxser_driver); if (retval) { printk(KERN_ERR "mxser: can't register pci driver\n"); - if (!m) { - retval = -ENODEV; - goto err_unr; - } /* else: we have some ISA cards under control */ + goto err_unr; } return 0; @@ -2794,19 +2470,9 @@ static int __init mxser_module_init(void) static void __exit mxser_module_exit(void) { - unsigned int i; - pci_unregister_driver(&mxser_driver); - - for (i = 0; i < MXSER_BOARDS; i++) /* ISA remains */ - if (mxser_boards[i].info != NULL) - mxser_board_remove(&mxser_boards[i]); tty_unregister_driver(mxvar_sdriver); put_tty_driver(mxvar_sdriver); - - for (i = 0; i < MXSER_BOARDS; i++) - if (mxser_boards[i].info != NULL) - mxser_release_ISA_res(&mxser_boards[i]); } module_init(mxser_module_init); From patchwork Fri Jun 18 06:14:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 464165 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, UPPERCASE_50_75, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8EC88C48BE8 for ; Fri, 18 Jun 2021 06:15:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 70A8F61154 for ; Fri, 18 Jun 2021 06:15:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232860AbhFRGR1 (ORCPT ); Fri, 18 Jun 2021 02:17:27 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:58876 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232841AbhFRGR1 (ORCPT ); Fri, 18 Jun 2021 02:17:27 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 85EEE21B52; Fri, 18 Jun 2021 06:15:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996917; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rxA0lKs8Z+czelyrY3foDizE8Kt9dob8xZvBzoIG1oo=; b=WV1G3B5L/WgL9mOzaIshkAgD7YHUAQCugiFvS/h+ta/BYIfQCQ9W9+SH3xkK+xRrSGUUAe SvoiWqDU9QLXm/SF5u4b6qcPT3aYqtB2dUH0IrdCtnxZl2eUxt20DJSISWMJdsgWW+LMw6 QSkQrOp1KGNJIeiaWJeEp7I9UiU6ozA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996917; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rxA0lKs8Z+czelyrY3foDizE8Kt9dob8xZvBzoIG1oo=; b=rf4tHmfxWuf5jtDdT8Hew80RPIiiugiBopEF1NXNWEB1rn6Ytg7wv3k1yDhKH+MnUPeqIs gqLJRmCvvaXTASAA== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 6977BA3B99; Fri, 18 Jun 2021 06:15:17 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 02/70] mxser: renumber mxser_cards Date: Fri, 18 Jun 2021 08:14:08 +0200 Message-Id: <20210618061516.662-3-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org After the ISA cards removal in the previous patch, the mxser_cards array has holes in it. So renumber the array while updating PCI device's driver_data. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 80 +++++++++++++++++++++------------------------ 1 file changed, 37 insertions(+), 43 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 3a00f180f54a..ef539f084e55 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -95,69 +95,63 @@ struct mxser_cardinfo { }; static const struct mxser_cardinfo mxser_cards[] = { -/* 0*/ { }, - { }, - { }, - { "C168H/PCI series", 8, }, +/* 0*/ { "C168H/PCI series", 8, }, { "C104H/PCI series", 4, }, -/* 5*/ { }, - { }, - { }, { "CP-132 series", 2, }, { "CP-114 series", 4, }, -/*10*/ { "CT-114 series", 4, }, - { "CP-102 series", 2, MXSER_HIGHBAUD }, + { "CT-114 series", 4, }, +/* 5*/ { "CP-102 series", 2, MXSER_HIGHBAUD }, { "CP-104U series", 4, }, { "CP-168U series", 8, }, { "CP-132U series", 2, }, -/*15*/ { "CP-134U series", 4, }, - { "CP-104JU series", 4, }, + { "CP-134U series", 4, }, +/*10*/ { "CP-104JU series", 4, }, { "Moxa UC7000 Serial", 8, }, /* RC7000 */ { "CP-118U series", 8, }, { "CP-102UL series", 2, }, -/*20*/ { "CP-102U series", 2, }, - { "CP-118EL series", 8, }, + { "CP-102U series", 2, }, +/*15*/ { "CP-118EL series", 8, }, { "CP-168EL series", 8, }, { "CP-104EL series", 4, }, { "CB-108 series", 8, }, -/*25*/ { "CB-114 series", 4, }, - { "CB-134I series", 4, }, + { "CB-114 series", 4, }, +/*20*/ { "CB-134I series", 4, }, { "CP-138U series", 8, }, { "POS-104UL series", 4, }, { "CP-114UL series", 4, }, -/*30*/ { "CP-102UF series", 2, }, - { "CP-112UL series", 2, }, + { "CP-102UF series", 2, }, +/*25*/ { "CP-112UL series", 2, }, }; /* driver_data correspond to the lines in the structure above see also ISA probe function before you change something */ static const struct pci_device_id mxser_pcibrds[] = { - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_C168), .driver_data = 3 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_C104), .driver_data = 4 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP132), .driver_data = 8 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP114), .driver_data = 9 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CT114), .driver_data = 10 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP102), .driver_data = 11 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP104U), .driver_data = 12 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP168U), .driver_data = 13 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP132U), .driver_data = 14 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP134U), .driver_data = 15 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP104JU),.driver_data = 16 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_RC7000), .driver_data = 17 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP118U), .driver_data = 18 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP102UL),.driver_data = 19 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP102U), .driver_data = 20 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP118EL),.driver_data = 21 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP168EL),.driver_data = 22 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP104EL),.driver_data = 23 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CB108), .driver_data = 24 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CB114), .driver_data = 25 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CB134I), .driver_data = 26 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CP138U), .driver_data = 27 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_POS104UL), .driver_data = 28 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CP114UL), .driver_data = 29 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CP102UF), .driver_data = 30 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CP112UL), .driver_data = 31 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_C168), .driver_data = 0 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_C104), .driver_data = 1 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP132), .driver_data = 2 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP114), .driver_data = 3 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CT114), .driver_data = 4 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP102), .driver_data = 5 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP104U), .driver_data = 6 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP168U), .driver_data = 7 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP132U), .driver_data = 8 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP134U), .driver_data = 9 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP104JU),.driver_data = 10 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_RC7000), .driver_data = 11 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP118U), .driver_data = 12 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP102UL),.driver_data = 13 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP102U), .driver_data = 14 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP118EL),.driver_data = 15 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP168EL),.driver_data = 16 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP104EL),.driver_data = 17 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CB108), .driver_data = 18 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CB114), .driver_data = 19 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CB134I), .driver_data = 20 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CP138U), .driver_data = 21 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_POS104UL), .driver_data = 22 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CP114UL), .driver_data = 23 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CP102UF), .driver_data = 24 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CP112UL), .driver_data = 25 }, { } }; MODULE_DEVICE_TABLE(pci, mxser_pcibrds); From patchwork Fri Jun 18 06:14:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 464164 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1D1DC49EA2 for ; Fri, 18 Jun 2021 06:15:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B8957613C2 for ; Fri, 18 Jun 2021 06:15:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232892AbhFRGRc (ORCPT ); Fri, 18 Jun 2021 02:17:32 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:58890 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232845AbhFRGR1 (ORCPT ); Fri, 18 Jun 2021 02:17:27 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id CA44F21B42; Fri, 18 Jun 2021 06:15:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996917; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=08gJWBTpAoie9gQ/mqnyJiGPBdl6ZbNG2vmUHjM+/xo=; b=ecJyI/2iVO0eNjSIJtb7EkTj6ZmlLM3ER5l01A+n2xYbSw9SNxZalcgzaauk3rf/v8o31G hAh4fgPlvNYT+zxAgNrKlhIG/2JxUCd948obkDIQPBETMvOg47dh1UnamDst/IserDe82P sK9a67dT0rkAPE2KLSP59UKAb5TJhcE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996917; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=08gJWBTpAoie9gQ/mqnyJiGPBdl6ZbNG2vmUHjM+/xo=; b=ttoSj8P/vgbHJs5bnvwvV4zEI70Ty6SKYHz7HyMaON87ZYeOPvRYeABbnLdizVCnUgTmHg 7Si9q8CCpYufC6Aw== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 9A4B5A3B99; Fri, 18 Jun 2021 06:15:17 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 03/70] mxser: remove info printout from init Date: Fri, 18 Jun 2021 08:14:09 +0200 Message-Id: <20210618061516.662-4-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org There is no reason/desire to print module information upon module load. Drop this printk (and a version define). Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index ef539f084e55..d91f8e791aab 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -43,7 +43,6 @@ #include "mxser.h" -#define MXSER_VERSION "2.0.5" /* 1.14 */ #define MXSERMAJOR 174 #define MXSER_BOARDS 4 /* Max. boards */ @@ -2427,9 +2426,6 @@ static int __init mxser_module_init(void) if (!mxvar_sdriver) return -ENOMEM; - printk(KERN_INFO "MOXA Smartio/Industio family driver version %s\n", - MXSER_VERSION); - /* Initialize the tty_driver structure */ mxvar_sdriver->name = "ttyMI"; mxvar_sdriver->major = ttymajor; From patchwork Fri Jun 18 06:14:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 463502 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7BFDC48BE8 for ; Fri, 18 Jun 2021 06:15:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B3C8F61154 for ; Fri, 18 Jun 2021 06:15:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232819AbhFRGRk (ORCPT ); Fri, 18 Jun 2021 02:17:40 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:58898 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232846AbhFRGR1 (ORCPT ); Fri, 18 Jun 2021 02:17:27 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id F060C21B4C; Fri, 18 Jun 2021 06:15:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996917; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tXGOhdln+pG9u9TiQDZ26g25kUECzjYEBniA8nuTcFo=; b=ZXw5koD9tuA3Am21CglZsdgyPQVPHRGSLKDKBrbNqXrl5UeYl6P/B0oI8uMAhpYySt/Nbv SSmFEBKAYaVmYgN3a4kwK/PHLIpweB0YmmHf9C+1tf9LNmr3D8MJNCG3FCitqLF4k0Lhxj mxHG91B9Va4LN6Y892+gijKM5HvMsxc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996917; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tXGOhdln+pG9u9TiQDZ26g25kUECzjYEBniA8nuTcFo=; b=XTK5oInusD5jJYJ60pA3j6rt2BXtujUb1DRwPXWTIKGO1xfVSfwmrTbE3OKEuppmi7KTqW QdMc8CEnryjbBfCg== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id D16C6A3BA3; Fri, 18 Jun 2021 06:15:17 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 04/70] mxser: integrate mxser.h into .c Date: Fri, 18 Jun 2021 08:14:10 +0200 Message-Id: <20210618061516.662-5-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org As mxser.h serves only mxser.c, integrate the definitions into .c and drop .h. There are some "semi-public" ioctl definitions, but they are mostly go away in the next patches. If something, they would need to live in an uapi header anyway. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 130 +++++++++++++++++++++++++++++++++++++- drivers/tty/mxser.h | 151 -------------------------------------------- 2 files changed, 129 insertions(+), 152 deletions(-) delete mode 100644 drivers/tty/mxser.h diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index d91f8e791aab..0c779559f978 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -41,7 +41,135 @@ #include #include -#include "mxser.h" +/* + * Semi-public control interfaces + */ + +/* + * MOXA ioctls + */ + +#define MOXA 0x400 +#define MOXA_GETDATACOUNT (MOXA + 23) +#define MOXA_DIAGNOSE (MOXA + 50) +#define MOXA_CHKPORTENABLE (MOXA + 60) +#define MOXA_HighSpeedOn (MOXA + 61) +#define MOXA_GET_MAJOR (MOXA + 63) +#define MOXA_GETMSTATUS (MOXA + 65) +#define MOXA_SET_OP_MODE (MOXA + 66) +#define MOXA_GET_OP_MODE (MOXA + 67) + +#define RS232_MODE 0 +#define RS485_2WIRE_MODE 1 +#define RS422_MODE 2 +#define RS485_4WIRE_MODE 3 +#define OP_MODE_MASK 3 + +#define MOXA_SDS_RSTICOUNTER (MOXA + 69) +#define MOXA_ASPP_OQUEUE (MOXA + 70) +#define MOXA_ASPP_MON (MOXA + 73) +#define MOXA_ASPP_LSTATUS (MOXA + 74) +#define MOXA_ASPP_MON_EXT (MOXA + 75) +#define MOXA_SET_BAUD_METHOD (MOXA + 76) + +/* --------------------------------------------------- */ + +#define NPPI_NOTIFY_PARITY 0x01 +#define NPPI_NOTIFY_FRAMING 0x02 +#define NPPI_NOTIFY_HW_OVERRUN 0x04 +#define NPPI_NOTIFY_SW_OVERRUN 0x08 +#define NPPI_NOTIFY_BREAK 0x10 + +#define NPPI_NOTIFY_CTSHOLD 0x01 /* Tx hold by CTS low */ +#define NPPI_NOTIFY_DSRHOLD 0x02 /* Tx hold by DSR low */ +#define NPPI_NOTIFY_XOFFHOLD 0x08 /* Tx hold by Xoff received */ +#define NPPI_NOTIFY_XOFFXENT 0x10 /* Xoff Sent */ + +/* + * Follow just what Moxa Must chip defines. + * + * When LCR register (offset 0x03) writes the following value, the Must chip + * will enter enchance mode. And write value on EFR (offset 0x02) bit 6,7 to + * change bank. + */ +#define MOXA_MUST_ENTER_ENCHANCE 0xBF + +/* when enhance mode enabled, access on general bank register */ +#define MOXA_MUST_GDL_REGISTER 0x07 +#define MOXA_MUST_GDL_MASK 0x7F +#define MOXA_MUST_GDL_HAS_BAD_DATA 0x80 + +#define MOXA_MUST_LSR_RERR 0x80 /* error in receive FIFO */ +/* enchance register bank select and enchance mode setting register */ +/* when LCR register equals to 0xBF */ +#define MOXA_MUST_EFR_REGISTER 0x02 +#define MOXA_MUST_EFR_EFRB_ENABLE 0x10 /* enchance mode enable */ +/* enchance register bank set 0, 1, 2 */ +#define MOXA_MUST_EFR_BANK0 0x00 +#define MOXA_MUST_EFR_BANK1 0x40 +#define MOXA_MUST_EFR_BANK2 0x80 +#define MOXA_MUST_EFR_BANK3 0xC0 +#define MOXA_MUST_EFR_BANK_MASK 0xC0 + +/* set XON1 value register, when LCR=0xBF and change to bank0 */ +#define MOXA_MUST_XON1_REGISTER 0x04 + +/* set XON2 value register, when LCR=0xBF and change to bank0 */ +#define MOXA_MUST_XON2_REGISTER 0x05 + +/* set XOFF1 value register, when LCR=0xBF and change to bank0 */ +#define MOXA_MUST_XOFF1_REGISTER 0x06 + +/* set XOFF2 value register, when LCR=0xBF and change to bank0 */ +#define MOXA_MUST_XOFF2_REGISTER 0x07 + +#define MOXA_MUST_RBRTL_REGISTER 0x04 +#define MOXA_MUST_RBRTH_REGISTER 0x05 +#define MOXA_MUST_RBRTI_REGISTER 0x06 +#define MOXA_MUST_THRTL_REGISTER 0x07 +#define MOXA_MUST_ENUM_REGISTER 0x04 +#define MOXA_MUST_HWID_REGISTER 0x05 +#define MOXA_MUST_ECR_REGISTER 0x06 +#define MOXA_MUST_CSR_REGISTER 0x07 + +#define MOXA_MUST_FCR_GDA_MODE_ENABLE 0x20 /* good data mode enable */ +#define MOXA_MUST_FCR_GDA_ONLY_ENABLE 0x10 /* only good data put into RxFIFO */ + +#define MOXA_MUST_IER_ECTSI 0x80 /* enable CTS interrupt */ +#define MOXA_MUST_IER_ERTSI 0x40 /* enable RTS interrupt */ +#define MOXA_MUST_IER_XINT 0x20 /* enable Xon/Xoff interrupt */ +#define MOXA_MUST_IER_EGDAI 0x10 /* enable GDA interrupt */ + +#define MOXA_MUST_RECV_ISR (UART_IER_RDI | MOXA_MUST_IER_EGDAI) + +/* GDA interrupt pending */ +#define MOXA_MUST_IIR_GDA 0x1C +#define MOXA_MUST_IIR_RDA 0x04 +#define MOXA_MUST_IIR_RTO 0x0C +#define MOXA_MUST_IIR_LSR 0x06 + +/* received Xon/Xoff or specical interrupt pending */ +#define MOXA_MUST_IIR_XSC 0x10 + +/* RTS/CTS change state interrupt pending */ +#define MOXA_MUST_IIR_RTSCTS 0x20 +#define MOXA_MUST_IIR_MASK 0x3E + +#define MOXA_MUST_MCR_XON_FLAG 0x40 +#define MOXA_MUST_MCR_XON_ANY 0x80 +#define MOXA_MUST_MCR_TX_XON 0x08 + +#define MOXA_MUST_EFR_SF_MASK 0x0F /* software flow control on chip mask value */ +#define MOXA_MUST_EFR_SF_TX1 0x08 /* send Xon1/Xoff1 */ +#define MOXA_MUST_EFR_SF_TX2 0x04 /* send Xon2/Xoff2 */ +#define MOXA_MUST_EFR_SF_TX12 0x0C /* send Xon1,Xon2/Xoff1,Xoff2 */ +#define MOXA_MUST_EFR_SF_TX_NO 0x00 /* don't send Xon/Xoff */ +#define MOXA_MUST_EFR_SF_TX_MASK 0x0C /* Tx software flow control mask */ +#define MOXA_MUST_EFR_SF_RX_NO 0x00 /* don't receive Xon/Xoff */ +#define MOXA_MUST_EFR_SF_RX1 0x02 /* receive Xon1/Xoff1 */ +#define MOXA_MUST_EFR_SF_RX2 0x01 /* receive Xon2/Xoff2 */ +#define MOXA_MUST_EFR_SF_RX12 0x03 /* receive Xon1,Xon2/Xoff1,Xoff2 */ +#define MOXA_MUST_EFR_SF_RX_MASK 0x03 /* Rx software flow control mask */ #define MXSERMAJOR 174 diff --git a/drivers/tty/mxser.h b/drivers/tty/mxser.h deleted file mode 100644 index e6cb15626567..000000000000 --- a/drivers/tty/mxser.h +++ /dev/null @@ -1,151 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _MXSER_H -#define _MXSER_H - -/* - * Semi-public control interfaces - */ - -/* - * MOXA ioctls - */ - -#define MOXA 0x400 -#define MOXA_GETDATACOUNT (MOXA + 23) -#define MOXA_DIAGNOSE (MOXA + 50) -#define MOXA_CHKPORTENABLE (MOXA + 60) -#define MOXA_HighSpeedOn (MOXA + 61) -#define MOXA_GET_MAJOR (MOXA + 63) -#define MOXA_GETMSTATUS (MOXA + 65) -#define MOXA_SET_OP_MODE (MOXA + 66) -#define MOXA_GET_OP_MODE (MOXA + 67) - -#define RS232_MODE 0 -#define RS485_2WIRE_MODE 1 -#define RS422_MODE 2 -#define RS485_4WIRE_MODE 3 -#define OP_MODE_MASK 3 - -#define MOXA_SDS_RSTICOUNTER (MOXA + 69) -#define MOXA_ASPP_OQUEUE (MOXA + 70) -#define MOXA_ASPP_MON (MOXA + 73) -#define MOXA_ASPP_LSTATUS (MOXA + 74) -#define MOXA_ASPP_MON_EXT (MOXA + 75) -#define MOXA_SET_BAUD_METHOD (MOXA + 76) - -/* --------------------------------------------------- */ - -#define NPPI_NOTIFY_PARITY 0x01 -#define NPPI_NOTIFY_FRAMING 0x02 -#define NPPI_NOTIFY_HW_OVERRUN 0x04 -#define NPPI_NOTIFY_SW_OVERRUN 0x08 -#define NPPI_NOTIFY_BREAK 0x10 - -#define NPPI_NOTIFY_CTSHOLD 0x01 /* Tx hold by CTS low */ -#define NPPI_NOTIFY_DSRHOLD 0x02 /* Tx hold by DSR low */ -#define NPPI_NOTIFY_XOFFHOLD 0x08 /* Tx hold by Xoff received */ -#define NPPI_NOTIFY_XOFFXENT 0x10 /* Xoff Sent */ - -/* follow just for Moxa Must chip define. */ -/* */ -/* when LCR register (offset 0x03) write following value, */ -/* the Must chip will enter enchance mode. And write value */ -/* on EFR (offset 0x02) bit 6,7 to change bank. */ -#define MOXA_MUST_ENTER_ENCHANCE 0xBF - -/* when enhance mode enable, access on general bank register */ -#define MOXA_MUST_GDL_REGISTER 0x07 -#define MOXA_MUST_GDL_MASK 0x7F -#define MOXA_MUST_GDL_HAS_BAD_DATA 0x80 - -#define MOXA_MUST_LSR_RERR 0x80 /* error in receive FIFO */ -/* enchance register bank select and enchance mode setting register */ -/* when LCR register equal to 0xBF */ -#define MOXA_MUST_EFR_REGISTER 0x02 -/* enchance mode enable */ -#define MOXA_MUST_EFR_EFRB_ENABLE 0x10 -/* enchance reister bank set 0, 1, 2 */ -#define MOXA_MUST_EFR_BANK0 0x00 -#define MOXA_MUST_EFR_BANK1 0x40 -#define MOXA_MUST_EFR_BANK2 0x80 -#define MOXA_MUST_EFR_BANK3 0xC0 -#define MOXA_MUST_EFR_BANK_MASK 0xC0 - -/* set XON1 value register, when LCR=0xBF and change to bank0 */ -#define MOXA_MUST_XON1_REGISTER 0x04 - -/* set XON2 value register, when LCR=0xBF and change to bank0 */ -#define MOXA_MUST_XON2_REGISTER 0x05 - -/* set XOFF1 value register, when LCR=0xBF and change to bank0 */ -#define MOXA_MUST_XOFF1_REGISTER 0x06 - -/* set XOFF2 value register, when LCR=0xBF and change to bank0 */ -#define MOXA_MUST_XOFF2_REGISTER 0x07 - -#define MOXA_MUST_RBRTL_REGISTER 0x04 -#define MOXA_MUST_RBRTH_REGISTER 0x05 -#define MOXA_MUST_RBRTI_REGISTER 0x06 -#define MOXA_MUST_THRTL_REGISTER 0x07 -#define MOXA_MUST_ENUM_REGISTER 0x04 -#define MOXA_MUST_HWID_REGISTER 0x05 -#define MOXA_MUST_ECR_REGISTER 0x06 -#define MOXA_MUST_CSR_REGISTER 0x07 - -/* good data mode enable */ -#define MOXA_MUST_FCR_GDA_MODE_ENABLE 0x20 -/* only good data put into RxFIFO */ -#define MOXA_MUST_FCR_GDA_ONLY_ENABLE 0x10 - -/* enable CTS interrupt */ -#define MOXA_MUST_IER_ECTSI 0x80 -/* enable RTS interrupt */ -#define MOXA_MUST_IER_ERTSI 0x40 -/* enable Xon/Xoff interrupt */ -#define MOXA_MUST_IER_XINT 0x20 -/* enable GDA interrupt */ -#define MOXA_MUST_IER_EGDAI 0x10 - -#define MOXA_MUST_RECV_ISR (UART_IER_RDI | MOXA_MUST_IER_EGDAI) - -/* GDA interrupt pending */ -#define MOXA_MUST_IIR_GDA 0x1C -#define MOXA_MUST_IIR_RDA 0x04 -#define MOXA_MUST_IIR_RTO 0x0C -#define MOXA_MUST_IIR_LSR 0x06 - -/* received Xon/Xoff or specical interrupt pending */ -#define MOXA_MUST_IIR_XSC 0x10 - -/* RTS/CTS change state interrupt pending */ -#define MOXA_MUST_IIR_RTSCTS 0x20 -#define MOXA_MUST_IIR_MASK 0x3E - -#define MOXA_MUST_MCR_XON_FLAG 0x40 -#define MOXA_MUST_MCR_XON_ANY 0x80 -#define MOXA_MUST_MCR_TX_XON 0x08 - -/* software flow control on chip mask value */ -#define MOXA_MUST_EFR_SF_MASK 0x0F -/* send Xon1/Xoff1 */ -#define MOXA_MUST_EFR_SF_TX1 0x08 -/* send Xon2/Xoff2 */ -#define MOXA_MUST_EFR_SF_TX2 0x04 -/* send Xon1,Xon2/Xoff1,Xoff2 */ -#define MOXA_MUST_EFR_SF_TX12 0x0C -/* don't send Xon/Xoff */ -#define MOXA_MUST_EFR_SF_TX_NO 0x00 -/* Tx software flow control mask */ -#define MOXA_MUST_EFR_SF_TX_MASK 0x0C -/* don't receive Xon/Xoff */ -#define MOXA_MUST_EFR_SF_RX_NO 0x00 -/* receive Xon1/Xoff1 */ -#define MOXA_MUST_EFR_SF_RX1 0x02 -/* receive Xon2/Xoff2 */ -#define MOXA_MUST_EFR_SF_RX2 0x01 -/* receive Xon1,Xon2/Xoff1,Xoff2 */ -#define MOXA_MUST_EFR_SF_RX12 0x03 -/* Rx software flow control mask */ -#define MOXA_MUST_EFR_SF_RX_MASK 0x03 - -#endif From patchwork Fri Jun 18 06:14:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 463501 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B309C49EA2 for ; Fri, 18 Jun 2021 06:15:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7E18861154 for ; Fri, 18 Jun 2021 06:15:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232970AbhFRGRk (ORCPT ); Fri, 18 Jun 2021 02:17:40 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:46122 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232850AbhFRGR2 (ORCPT ); Fri, 18 Jun 2021 02:17:28 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 352651FDF9; Fri, 18 Jun 2021 06:15:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996918; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rlzE/tA9A15bP1cWf8FYAk8DbHjAkzpq3AYHbd5gsZU=; b=thmBdbrpC58fo7iZ/NFXjdGX+q+5Z6cWWqWAFVAFjTpHbvzg22EXui42j0wOD3hcoe8zKH xZ4Hh5ZMaQgo/YKDZBzPgvh8VmrGhcNvE1FHIRYDC+FTvL+p01TOW9R2hWtA2/3CEIyAOz EXjD8n+rRhfHacteXC52bsYfYN0KuoY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996918; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rlzE/tA9A15bP1cWf8FYAk8DbHjAkzpq3AYHbd5gsZU=; b=8fa06ir51Tc2gcZM0wcy828rw3Rd0Zfqub7lMcZWrvFrli45wel4t2S91VqwAsVJnsSTfv 9TvuQp1zRTbu1hCQ== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 0E89AA3B99; Fri, 18 Jun 2021 06:15:18 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 05/70] mxser: cleanup Gpci_uart_info struct Date: Fri, 18 Jun 2021 08:14:11 +0200 Message-Id: <20210618061516.662-6-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org The Gpci_uart_info structure contains up to tripled information and chose weird types for the members. Deduplicate the members and choose proper types for the data -- everything can be u8 except baud rate. There, we use speed_t, which is used in this context. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 42 ++++++++++++++++++------------------------ 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 0c779559f978..3b3f0da9ea64 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -200,18 +200,15 @@ #define MXSER_HIGHBAUD 1 static const struct { - int type; - int tx_fifo; - int rx_fifo; - int xmit_fifo_size; - int rx_high_water; - int rx_trigger; - int rx_low_water; - long max_baud; + u8 type; + u8 fifo_size; + u8 rx_high_water; + u8 rx_low_water; + speed_t max_baud; } Gpci_uart_info[] = { - {MOXA_OTHER_UART, 16, 16, 16, 14, 14, 1, 921600L}, - {MOXA_MUST_MU150_HWID, 64, 64, 64, 48, 48, 16, 230400L}, - {MOXA_MUST_MU860_HWID, 128, 128, 128, 96, 96, 32, 921600L} + { MOXA_OTHER_UART, 16, 14, 1, 921600 }, + { MOXA_MUST_MU150_HWID, 64, 48, 16, 230400 }, + { MOXA_MUST_MU860_HWID, 128, 96, 32, 921600 } }; #define UART_INFO_NUM ARRAY_SIZE(Gpci_uart_info) @@ -331,11 +328,10 @@ struct mxser_port { unsigned long ioaddr; unsigned long opmode_ioaddr; - int max_baud; + speed_t max_baud; - int rx_high_water; - int rx_trigger; /* Rx fifo trigger level */ - int rx_low_water; + u8 rx_high_water; + u8 rx_low_water; int baud_base; /* max. speed */ int type; /* UART type */ @@ -354,7 +350,7 @@ struct mxser_port { int read_status_mask; int ignore_status_mask; - unsigned int xmit_fifo_size; + u8 xmit_fifo_size; int xmit_head; int xmit_tail; int xmit_cnt; @@ -470,9 +466,9 @@ static void mxser_set_must_fifo_value(struct mxser_port *info) efr |= MOXA_MUST_EFR_BANK1; outb(efr, info->ioaddr + MOXA_MUST_EFR_REGISTER); - outb((u8)info->rx_high_water, info->ioaddr + MOXA_MUST_RBRTH_REGISTER); - outb((u8)info->rx_trigger, info->ioaddr + MOXA_MUST_RBRTI_REGISTER); - outb((u8)info->rx_low_water, info->ioaddr + MOXA_MUST_RBRTL_REGISTER); + outb(info->rx_high_water, info->ioaddr + MOXA_MUST_RBRTH_REGISTER); + outb(info->rx_high_water, info->ioaddr + MOXA_MUST_RBRTI_REGISTER); + outb(info->rx_low_water, info->ioaddr + MOXA_MUST_RBRTL_REGISTER); outb(oldlcr, info->ioaddr + UART_LCR); } @@ -615,17 +611,15 @@ static void process_txrx_fifo(struct mxser_port *info) int i; if ((info->type == PORT_16450) || (info->type == PORT_8250)) { - info->rx_trigger = 1; info->rx_high_water = 1; info->rx_low_water = 1; info->xmit_fifo_size = 1; } else for (i = 0; i < UART_INFO_NUM; i++) if (info->board->chip_flag == Gpci_uart_info[i].type) { - info->rx_trigger = Gpci_uart_info[i].rx_trigger; info->rx_low_water = Gpci_uart_info[i].rx_low_water; info->rx_high_water = Gpci_uart_info[i].rx_high_water; - info->xmit_fifo_size = Gpci_uart_info[i].xmit_fifo_size; + info->xmit_fifo_size = Gpci_uart_info[i].fifo_size; break; } } @@ -667,7 +661,7 @@ static void mxser_dtr_rts(struct tty_port *port, int on) spin_unlock_irqrestore(&mp->slock, flags); } -static int mxser_set_baud(struct tty_struct *tty, long newspd) +static int mxser_set_baud(struct tty_struct *tty, speed_t newspd) { struct mxser_port *info = tty->driver_data; unsigned int quot = 0, baud; @@ -793,7 +787,7 @@ static void mxser_change_speed(struct tty_struct *tty) fcr |= MOXA_MUST_FCR_GDA_MODE_ENABLE; mxser_set_must_fifo_value(info); } else { - switch (info->rx_trigger) { + switch (info->rx_high_water) { case 1: fcr |= UART_FCR_TRIGGER_1; break; From patchwork Fri Jun 18 06:14:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 464162 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 037C4C49EA5 for ; Fri, 18 Jun 2021 06:15:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DB48A611CD for ; Fri, 18 Jun 2021 06:15:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233005AbhFRGRm (ORCPT ); Fri, 18 Jun 2021 02:17:42 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:46158 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232853AbhFRGR2 (ORCPT ); Fri, 18 Jun 2021 02:17:28 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 6A83B1FDFE; Fri, 18 Jun 2021 06:15:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996918; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JapVV+Ep14EY9iMIxDFMI3xj74/EpUEBsvVrve3HFy0=; b=FHeNiwqAu2gO7W3qeDRdSdJyMsKbLzAwfaon6zi4vFfFTIUI07LQJaOhRdsoTHxqpLuc3X ziHdf7Z21vwJqbYPmu2Nw3kEjNYurR4mVWP857oK8WIuCp0UOmMSTcd/Ux4yueKDRG7JJY CmsyNNXKJpSvXt3iNknTHh5Bmcv+aaI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996918; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JapVV+Ep14EY9iMIxDFMI3xj74/EpUEBsvVrve3HFy0=; b=bujUTYGMM5WhdDFFHlF0euSKe6rkfjhkDHV8TMKLeJxrTZZczda/98g26dImCnL5pIF8l4 EtAI0HjfghCTU6BA== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 45566A3B99; Fri, 18 Jun 2021 06:15:18 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 06/70] mxser: rename CheckIsMoxaMust to mxser_get_must_hwid Date: Fri, 18 Jun 2021 08:14:12 +0200 Message-Id: <20210618061516.662-7-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org CheckIsMoxaMust actually finds out what the card is. So rename it to mxser_must_get_hwid, so that the name conforms to the semantics of the function. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 3b3f0da9ea64..72e1aeabdee7 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -583,7 +583,7 @@ static void mxser_disable_must_rx_software_flow_control(unsigned long baseio) outb(oldlcr, baseio + UART_LCR); } -static int CheckIsMoxaMust(unsigned long io) +static int mxser_must_get_hwid(unsigned long io) { u8 oldmcr, hwid; int i; @@ -2452,7 +2452,7 @@ static int mxser_probe(struct pci_dev *pdev, /* irq */ brd->irq = pdev->irq; - brd->chip_flag = CheckIsMoxaMust(brd->ports[0].ioaddr); + brd->chip_flag = mxser_must_get_hwid(brd->ports[0].ioaddr); brd->uart_type = PORT_16550A; brd->vector_mask = 0; From patchwork Fri Jun 18 06:14:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 463500 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3CA45C49EA3 for ; Fri, 18 Jun 2021 06:15:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2422961154 for ; Fri, 18 Jun 2021 06:15:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232990AbhFRGRl (ORCPT ); Fri, 18 Jun 2021 02:17:41 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:58952 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232862AbhFRGR2 (ORCPT ); Fri, 18 Jun 2021 02:17:28 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id B405821B4D; Fri, 18 Jun 2021 06:15:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996918; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/BStP6RpxFDwuUTjL7UXZHaSYbkwvTAEWBd7rzHAhSk=; b=j3fO9gS0j4DuQ7GWwEC4fajCtWN0poji6ZlJxXsIlvcm1GxTMCped9sTfAiuUSz+iVgsQe w8vePjnNpvtR4IOwdaBm2VSc/At0X3LrmMKTNuSIW30ra3mNQvnwCEMa08h2sQ4meAX8VM oiWDv/oSTrA4W6ghA5tLLcXXJH2firc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996918; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/BStP6RpxFDwuUTjL7UXZHaSYbkwvTAEWBd7rzHAhSk=; b=T7Kk7+Ub9PGwY4YvOw5HdwfXILJlkMAA7wi0PrCcXrTFLicxW6l3PTGwoCBb/QHokFmg1P 48s21Hru1xBQPxDw== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 7EEA8A3B99; Fri, 18 Jun 2021 06:15:18 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 07/70] mxser: rename mxser_board::chip_flag to must_hwid Date: Fri, 18 Jun 2021 08:14:13 +0200 Message-Id: <20210618061516.662-8-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org It is named IsMoxaMustChipFlag in the original Moxa's driver. Over the time, it was reduced to chip_flag which doesn't make much sense. So dub it again by what it is: must_hwid (mxser_must_get_hwid assigns to it). Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 70 ++++++++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 72e1aeabdee7..1865f965334a 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -370,7 +370,7 @@ struct mxser_board { unsigned long vector; unsigned long vector_mask; - int chip_flag; + int must_hwid; int uart_type; struct mxser_port ports[MXSER_PORTS_PER_BOARD]; @@ -616,7 +616,7 @@ static void process_txrx_fifo(struct mxser_port *info) info->xmit_fifo_size = 1; } else for (i = 0; i < UART_INFO_NUM; i++) - if (info->board->chip_flag == Gpci_uart_info[i].type) { + if (info->board->must_hwid == Gpci_uart_info[i].type) { info->rx_low_water = Gpci_uart_info[i].rx_low_water; info->rx_high_water = Gpci_uart_info[i].rx_high_water; info->xmit_fifo_size = Gpci_uart_info[i].fifo_size; @@ -775,7 +775,7 @@ static void mxser_change_speed(struct tty_struct *tty) cval |= UART_LCR_SPAR; if ((info->type == PORT_8250) || (info->type == PORT_16450)) { - if (info->board->chip_flag) { + if (info->board->must_hwid) { fcr = UART_FCR_ENABLE_FIFO; fcr |= MOXA_MUST_FCR_GDA_MODE_ENABLE; mxser_set_must_fifo_value(info); @@ -783,7 +783,7 @@ static void mxser_change_speed(struct tty_struct *tty) fcr = 0; } else { fcr = UART_FCR_ENABLE_FIFO; - if (info->board->chip_flag) { + if (info->board->must_hwid) { fcr |= MOXA_MUST_FCR_GDA_MODE_ENABLE; mxser_set_must_fifo_value(info); } else { @@ -810,7 +810,7 @@ static void mxser_change_speed(struct tty_struct *tty) tty_port_set_cts_flow(&info->port, cflag & CRTSCTS); if (cflag & CRTSCTS) { info->IER |= UART_IER_MSI; - if ((info->type == PORT_16550A) || (info->board->chip_flag)) { + if ((info->type == PORT_16550A) || (info->board->must_hwid)) { info->MCR |= UART_MCR_AFE; } else { status = inb(info->ioaddr + UART_MSR); @@ -818,7 +818,7 @@ static void mxser_change_speed(struct tty_struct *tty) if (status & UART_MSR_CTS) { tty->hw_stopped = 0; if (info->type != PORT_16550A && - !info->board->chip_flag) { + !info->board->must_hwid) { outb(info->IER & ~UART_IER_THRI, info->ioaddr + UART_IER); @@ -832,7 +832,7 @@ static void mxser_change_speed(struct tty_struct *tty) if (!(status & UART_MSR_CTS)) { tty->hw_stopped = 1; if ((info->type != PORT_16550A) && - (!info->board->chip_flag)) { + (!info->board->must_hwid)) { info->IER &= ~UART_IER_THRI; outb(info->IER, info->ioaddr + UART_IER); @@ -876,7 +876,7 @@ static void mxser_change_speed(struct tty_struct *tty) UART_LSR_FE; } } - if (info->board->chip_flag) { + if (info->board->must_hwid) { mxser_set_must_xon1_value(info->ioaddr, START_CHAR(tty)); mxser_set_must_xoff1_value(info->ioaddr, STOP_CHAR(tty)); if (I_IXON(tty)) { @@ -926,7 +926,7 @@ static void mxser_check_modem_status(struct tty_struct *tty, tty->hw_stopped = 0; if ((port->type != PORT_16550A) && - (!port->board->chip_flag)) { + (!port->board->must_hwid)) { outb(port->IER & ~UART_IER_THRI, port->ioaddr + UART_IER); port->IER |= UART_IER_THRI; @@ -939,7 +939,7 @@ static void mxser_check_modem_status(struct tty_struct *tty, if (!(status & UART_MSR_CTS)) { tty->hw_stopped = 1; if (port->type != PORT_16550A && - !port->board->chip_flag) { + !port->board->must_hwid) { port->IER &= ~UART_IER_THRI; outb(port->IER, port->ioaddr + UART_IER); @@ -973,7 +973,7 @@ static int mxser_activate(struct tty_port *port, struct tty_struct *tty) * Clear the FIFO buffers and disable them * (they will be reenabled in mxser_change_speed()) */ - if (info->board->chip_flag) + if (info->board->must_hwid) outb((UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT | MOXA_MUST_FCR_GDA_MODE_ENABLE), info->ioaddr + UART_FCR); @@ -1015,7 +1015,7 @@ static int mxser_activate(struct tty_port *port, struct tty_struct *tty) */ info->IER = UART_IER_MSI | UART_IER_RLSI | UART_IER_RDI; - if (info->board->chip_flag) + if (info->board->must_hwid) info->IER |= MOXA_MUST_IER_EGDAI; outb(info->IER, info->ioaddr + UART_IER); /* enable interrupts */ @@ -1067,7 +1067,7 @@ static void mxser_shutdown_port(struct tty_port *port) outb(0x00, info->ioaddr + UART_IER); /* clear Rx/Tx FIFO's */ - if (info->board->chip_flag) + if (info->board->must_hwid) outb(UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT | MOXA_MUST_FCR_GDA_MODE_ENABLE, info->ioaddr + UART_FCR); @@ -1079,7 +1079,7 @@ static void mxser_shutdown_port(struct tty_port *port) (void) inb(info->ioaddr + UART_RX); - if (info->board->chip_flag) + if (info->board->must_hwid) SET_MOXA_MUST_NO_SOFTWARE_FLOW_CONTROL(info->ioaddr); spin_unlock_irqrestore(&info->slock, flags); @@ -1139,7 +1139,7 @@ static void mxser_close_port(struct tty_port *port) * line status register. */ info->IER &= ~UART_IER_RLSI; - if (info->board->chip_flag) + if (info->board->must_hwid) info->IER &= ~MOXA_MUST_RECV_ISR; outb(info->IER, info->ioaddr + UART_IER); @@ -1217,7 +1217,7 @@ static int mxser_write(struct tty_struct *tty, const unsigned char *buf, int cou if (info->xmit_cnt && !tty->flow.stopped) { if (!tty->hw_stopped || (info->type == PORT_16550A) || - (info->board->chip_flag)) { + (info->board->must_hwid)) { spin_lock_irqsave(&info->slock, flags); outb(info->IER & ~UART_IER_THRI, info->ioaddr + UART_IER); @@ -1248,7 +1248,7 @@ static int mxser_put_char(struct tty_struct *tty, unsigned char ch) if (!tty->flow.stopped) { if (!tty->hw_stopped || (info->type == PORT_16550A) || - info->board->chip_flag) { + info->board->must_hwid) { spin_lock_irqsave(&info->slock, flags); outb(info->IER & ~UART_IER_THRI, info->ioaddr + UART_IER); info->IER |= UART_IER_THRI; @@ -1267,7 +1267,7 @@ static void mxser_flush_chars(struct tty_struct *tty) if (info->xmit_cnt <= 0 || tty->flow.stopped || !info->port.xmit_buf || (tty->hw_stopped && info->type != PORT_16550A && - !info->board->chip_flag)) + !info->board->must_hwid)) return; spin_lock_irqsave(&info->slock, flags); @@ -1631,7 +1631,7 @@ static int mxser_ioctl_special(unsigned int cmd, void __user *argp) if (ip->type == PORT_16550A) me->fifo[p] = 1; - if (ip->board->chip_flag == MOXA_MUST_MU860_HWID) { + if (ip->board->must_hwid == MOXA_MUST_MU860_HWID) { opmode = inb(ip->opmode_ioaddr)>>((p % 4) * 2); opmode &= OP_MODE_MASK; } else { @@ -1691,7 +1691,7 @@ static int mxser_ioctl(struct tty_struct *tty, int shiftbit; unsigned char val, mask; - if (info->board->chip_flag != MOXA_MUST_MU860_HWID) + if (info->board->must_hwid != MOXA_MUST_MU860_HWID) return -EFAULT; p = tty->index % 4; @@ -1853,7 +1853,7 @@ static void mxser_stoprx(struct tty_struct *tty) info->ldisc_stop_rx = 1; if (I_IXOFF(tty)) { - if (info->board->chip_flag) { + if (info->board->must_hwid) { info->IER &= ~MOXA_MUST_RECV_ISR; outb(info->IER, info->ioaddr + UART_IER); } else { @@ -1889,7 +1889,7 @@ static void mxser_unthrottle(struct tty_struct *tty) if (info->x_char) info->x_char = 0; else { - if (info->board->chip_flag) { + if (info->board->must_hwid) { info->IER |= MOXA_MUST_RECV_ISR; outb(info->IER, info->ioaddr + UART_IER); } else { @@ -1958,7 +1958,7 @@ static void mxser_set_termios(struct tty_struct *tty, struct ktermios *old_termi if ((old_termios->c_iflag & IXON) && !I_IXON(tty)) { tty->flow.stopped = 0; - if (info->board->chip_flag) { + if (info->board->must_hwid) { spin_lock_irqsave(&info->slock, flags); mxser_disable_must_rx_software_flow_control( info->ioaddr); @@ -2068,11 +2068,11 @@ static void mxser_receive_chars(struct tty_struct *tty, recv_room = tty->receive_room; if (recv_room == 0 && !port->ldisc_stop_rx) mxser_stoprx(tty); - if (port->board->chip_flag != MOXA_OTHER_UART) { + if (port->board->must_hwid != MOXA_OTHER_UART) { if (*status & UART_LSR_SPECIAL) goto intr_old; - if (port->board->chip_flag == MOXA_MUST_MU860_HWID && + if (port->board->must_hwid == MOXA_MUST_MU860_HWID && (*status & MOXA_MUST_LSR_RERR)) goto intr_old; if (*status & MOXA_MUST_LSR_RERR) @@ -2080,7 +2080,7 @@ static void mxser_receive_chars(struct tty_struct *tty, gdl = inb(port->ioaddr + MOXA_MUST_GDL_REGISTER); - if (port->board->chip_flag == MOXA_MUST_MU150_HWID) + if (port->board->must_hwid == MOXA_MUST_MU150_HWID) gdl &= MOXA_MUST_GDL_MASK; if (gdl >= recv_room) { if (!port->ldisc_stop_rx) @@ -2100,7 +2100,7 @@ static void mxser_receive_chars(struct tty_struct *tty, break; ch = inb(port->ioaddr + UART_RX); - if (port->board->chip_flag && (*status & UART_LSR_OE)) + if (port->board->must_hwid && (*status & UART_LSR_OE)) outb(0x23, port->ioaddr + UART_FCR); *status &= port->read_status_mask; if (*status & port->ignore_status_mask) { @@ -2137,7 +2137,7 @@ static void mxser_receive_chars(struct tty_struct *tty, } - if (port->board->chip_flag) + if (port->board->must_hwid) break; *status = inb(port->ioaddr + UART_LSR); @@ -2171,7 +2171,7 @@ static void mxser_transmit_chars(struct tty_struct *tty, struct mxser_port *port if (port->xmit_cnt <= 0 || tty->flow.stopped || (tty->hw_stopped && (port->type != PORT_16550A) && - (!port->board->chip_flag))) { + (!port->board->must_hwid))) { port->IER &= ~UART_IER_THRI; outb(port->IER, port->ioaddr + UART_IER); return; @@ -2267,7 +2267,7 @@ static irqreturn_t mxser_interrupt(int irq, void *dev_id) if (status & UART_LSR_BI) port->err_shadow |= NPPI_NOTIFY_BREAK; - if (port->board->chip_flag) { + if (port->board->must_hwid) { if (iir == MOXA_MUST_IIR_GDA || iir == MOXA_MUST_IIR_RDA || iir == MOXA_MUST_IIR_RTO || @@ -2285,7 +2285,7 @@ static irqreturn_t mxser_interrupt(int irq, void *dev_id) if (msr & UART_MSR_ANY_DELTA) mxser_check_modem_status(tty, port, msr); - if (port->board->chip_flag) { + if (port->board->must_hwid) { if (iir == 0x02 && (status & UART_LSR_THRE)) mxser_transmit_chars(tty, port); @@ -2357,7 +2357,7 @@ static int mxser_initbrd(struct mxser_board *brd) info->ldisc_stop_rx = 0; /* Enhance mode enabled here */ - if (brd->chip_flag != MOXA_OTHER_UART) + if (brd->must_hwid != MOXA_OTHER_UART) mxser_enable_must_enchance_mode(info->ioaddr); info->type = brd->uart_type; @@ -2452,13 +2452,13 @@ static int mxser_probe(struct pci_dev *pdev, /* irq */ brd->irq = pdev->irq; - brd->chip_flag = mxser_must_get_hwid(brd->ports[0].ioaddr); + brd->must_hwid = mxser_must_get_hwid(brd->ports[0].ioaddr); brd->uart_type = PORT_16550A; brd->vector_mask = 0; for (i = 0; i < brd->info->nports; i++) { for (j = 0; j < UART_INFO_NUM; j++) { - if (Gpci_uart_info[j].type == brd->chip_flag) { + if (Gpci_uart_info[j].type == brd->must_hwid) { brd->ports[i].max_baud = Gpci_uart_info[j].max_baud; @@ -2470,7 +2470,7 @@ static int mxser_probe(struct pci_dev *pdev, } } - if (brd->chip_flag == MOXA_MUST_MU860_HWID) { + if (brd->must_hwid == MOXA_MUST_MU860_HWID) { for (i = 0; i < brd->info->nports; i++) { if (i < 4) brd->ports[i].opmode_ioaddr = ioaddress + 4; From patchwork Fri Jun 18 06:14:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 464161 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD670C48BE8 for ; Fri, 18 Jun 2021 06:15:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9403861154 for ; Fri, 18 Jun 2021 06:15:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233008AbhFRGRn (ORCPT ); Fri, 18 Jun 2021 02:17:43 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:58960 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232867AbhFRGR2 (ORCPT ); Fri, 18 Jun 2021 02:17:28 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id E0CAC21B50; Fri, 18 Jun 2021 06:15:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996918; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kvBWf2dKB23474z2mNWAGt+hhqaxZDHEgEl6Syx745Y=; b=MqZGJm3XcjT6owPhcwcO67vnTrkpgX0qgx8x0aoPh1Op1ytv3wU2A001SGWZI/+14Mfyyo VsA5mxwavHNVIDttbsG87G85v4w7yWqQS/KZvj0zvzO8o1qhstfcj0XyOG+7E6k96VAH/l O11ZaXrQ0NOxrNaS6/YzBl+jB7DYxMA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996918; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kvBWf2dKB23474z2mNWAGt+hhqaxZDHEgEl6Syx745Y=; b=J7wLScobwEDB/+fWpyVtmWabwoKiC87bWYrT9dNtQD0yrHJVWpfFstPVWqCK+Px6c3dWVA IlI9oquJ2iY2m+Cg== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id B8699A3BC5; Fri, 18 Jun 2021 06:15:18 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 08/70] mxser: introduce enum mxser_must_hwid Date: Fri, 18 Jun 2021 08:14:14 +0200 Message-Id: <20210618061516.662-9-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Provided the MUST HW ID is an enumeration, define one (enum mxser_must_hwid) and use it in the code. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 1865f965334a..558bd4140ee1 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -178,11 +178,6 @@ #define MXSER_PORTS (MXSER_BOARDS * MXSER_PORTS_PER_BOARD) #define MXSER_ISR_PASS_LIMIT 100 -/*CheckIsMoxaMust return value*/ -#define MOXA_OTHER_UART 0x00 -#define MOXA_MUST_MU150_HWID 0x01 -#define MOXA_MUST_MU860_HWID 0x02 - #define WAKEUP_CHARS 256 #define UART_MCR_AFE 0x20 @@ -199,6 +194,12 @@ #define MXSER_HIGHBAUD 1 +enum mxser_must_hwid { + MOXA_OTHER_UART = 0x00, + MOXA_MUST_MU150_HWID = 0x01, + MOXA_MUST_MU860_HWID = 0x02, +}; + static const struct { u8 type; u8 fifo_size; @@ -370,7 +371,7 @@ struct mxser_board { unsigned long vector; unsigned long vector_mask; - int must_hwid; + enum mxser_must_hwid must_hwid; int uart_type; struct mxser_port ports[MXSER_PORTS_PER_BOARD]; @@ -583,7 +584,7 @@ static void mxser_disable_must_rx_software_flow_control(unsigned long baseio) outb(oldlcr, baseio + UART_LCR); } -static int mxser_must_get_hwid(unsigned long io) +static enum mxser_must_hwid mxser_must_get_hwid(unsigned long io) { u8 oldmcr, hwid; int i; @@ -599,10 +600,10 @@ static int mxser_must_get_hwid(unsigned long io) } mxser_get_must_hardware_id(io, &hwid); - for (i = 1; i < UART_INFO_NUM; i++) { /* 0 = OTHER_UART */ + for (i = 1; i < UART_INFO_NUM; i++) /* 0 = OTHER_UART */ if (hwid == Gpci_uart_info[i].type) - return (int)hwid; - } + return hwid; + return MOXA_OTHER_UART; } From patchwork Fri Jun 18 06:14:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 464163 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63D5DC49EA4 for ; Fri, 18 Jun 2021 06:15:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4C82A61154 for ; Fri, 18 Jun 2021 06:15:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232996AbhFRGRm (ORCPT ); Fri, 18 Jun 2021 02:17:42 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:58982 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232871AbhFRGR2 (ORCPT ); Fri, 18 Jun 2021 02:17:28 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 2330C21B52; Fri, 18 Jun 2021 06:15:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996919; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LxosIp5dp9pyQOqp1juxUY2HNSyClmwSRVJeLU3fHhE=; b=QbxTDRwajfAt03H9pg6X5iYRGk3kBZygAVycKrw1A+x0XLWzmc6bUad4iCvG2cekfzGo96 uD9VMVyBvTzPCMoWUa1T4pVnkF/V0xksOKy0s4D6J/XSbzA910GNGHwD/4tKIknE8hhlhd JksQwLHZs4txLRHThfDy3WBfVH89OOY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996919; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LxosIp5dp9pyQOqp1juxUY2HNSyClmwSRVJeLU3fHhE=; b=O8AuCyrn7RKguj5bZC0erzy94tQjbTKMUnRUrzxXwbF3iGG0kF/idzj6Pg1PUhYw96WArw Zl579dLJYpqyjbBA== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id F2516A3B99; Fri, 18 Jun 2021 06:15:18 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 09/70] mxser: drop constant board::uart_type Date: Fri, 18 Jun 2021 08:14:15 +0200 Message-Id: <20210618061516.662-10-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org board::uart_type is always set to PORT_16550A. So, use this constant in the code instead. And drop the mxser_board member. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 558bd4140ee1..a6121fea7a55 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -372,7 +372,6 @@ struct mxser_board { unsigned long vector_mask; enum mxser_must_hwid must_hwid; - int uart_type; struct mxser_port ports[MXSER_PORTS_PER_BOARD]; }; @@ -2361,7 +2360,7 @@ static int mxser_initbrd(struct mxser_board *brd) if (brd->must_hwid != MOXA_OTHER_UART) mxser_enable_must_enchance_mode(info->ioaddr); - info->type = brd->uart_type; + info->type = PORT_16550A; process_txrx_fifo(info); @@ -2454,7 +2453,6 @@ static int mxser_probe(struct pci_dev *pdev, brd->irq = pdev->irq; brd->must_hwid = mxser_must_get_hwid(brd->ports[0].ioaddr); - brd->uart_type = PORT_16550A; brd->vector_mask = 0; for (i = 0; i < brd->info->nports; i++) { From patchwork Fri Jun 18 06:14:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 463499 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1107CC49EA7 for ; Fri, 18 Jun 2021 06:15:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EA2146120A for ; Fri, 18 Jun 2021 06:15:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233015AbhFRGRo (ORCPT ); Fri, 18 Jun 2021 02:17:44 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:46196 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232876AbhFRGR3 (ORCPT ); Fri, 18 Jun 2021 02:17:29 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 59B221FDF6; Fri, 18 Jun 2021 06:15:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996919; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IQ2mcSDmaW4gVGU3JtmSCsP7pBY+lolL3WjN/NhU3ag=; b=Wl25uRgWqB4205P+UO3IdyWaa56YCd+00dy/FKyoY3DnISnEeSZSHzdihZp0OUm8FiH7Um S7RDKgetsBTYaUAjRngE0P132aK6zrYl+wLlMpIzjjCKb2eciurq9t1+khNimMEPq3moi1 /VhMEViee36FYZYKm1qr6eyfD56npu0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996919; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IQ2mcSDmaW4gVGU3JtmSCsP7pBY+lolL3WjN/NhU3ag=; b=NsleWod2HFFeKbucegV1fij0lDJFhuI03cafHh/yl9cCTvIJ0NFo+JppFHNGmdfNT5ORDP ntxdLUOHNfpCEjBw== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 335A0A3B99; Fri, 18 Jun 2021 06:15:19 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 10/70] mxser: move max_baud from port to board Date: Fri, 18 Jun 2021 08:14:16 +0200 Message-Id: <20210618061516.662-11-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org mxser_port::max_baud is actually a board property, not port's. So move it to mxser_board. While at it, drop the printk informing about max baud rate during probe. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index a6121fea7a55..db594a64ff00 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -329,7 +329,6 @@ struct mxser_port { unsigned long ioaddr; unsigned long opmode_ioaddr; - speed_t max_baud; u8 rx_high_water; u8 rx_low_water; @@ -372,6 +371,7 @@ struct mxser_board { unsigned long vector_mask; enum mxser_must_hwid must_hwid; + speed_t max_baud; struct mxser_port ports[MXSER_PORTS_PER_BOARD]; }; @@ -671,7 +671,7 @@ static int mxser_set_baud(struct tty_struct *tty, speed_t newspd) if (!info->ioaddr) return -1; - if (newspd > info->max_baud) + if (newspd > info->board->max_baud) return -1; if (newspd == 134) { @@ -2345,9 +2345,6 @@ static int mxser_initbrd(struct mxser_board *brd) unsigned int i; int retval; - printk(KERN_INFO "mxser: max. baud rate = %d bps\n", - brd->ports[0].max_baud); - for (i = 0; i < brd->info->nports; i++) { info = &brd->ports[i]; tty_port_init(&info->port); @@ -2455,17 +2452,14 @@ static int mxser_probe(struct pci_dev *pdev, brd->must_hwid = mxser_must_get_hwid(brd->ports[0].ioaddr); brd->vector_mask = 0; - for (i = 0; i < brd->info->nports; i++) { - for (j = 0; j < UART_INFO_NUM; j++) { - if (Gpci_uart_info[j].type == brd->must_hwid) { - brd->ports[i].max_baud = - Gpci_uart_info[j].max_baud; - - /* exception....CP-102 */ - if (brd->info->flags & MXSER_HIGHBAUD) - brd->ports[i].max_baud = 921600; - break; - } + for (j = 0; j < UART_INFO_NUM; j++) { + if (Gpci_uart_info[j].type == brd->must_hwid) { + brd->max_baud = Gpci_uart_info[j].max_baud; + + /* exception....CP-102 */ + if (brd->info->flags & MXSER_HIGHBAUD) + brd->max_baud = 921600; + break; } } From patchwork Fri Jun 18 06:14:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 464160 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F40DDC48BE8 for ; Fri, 18 Jun 2021 06:15:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DB22E611CE for ; Fri, 18 Jun 2021 06:15:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232893AbhFRGRp (ORCPT ); Fri, 18 Jun 2021 02:17:45 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:58992 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232877AbhFRGR3 (ORCPT ); Fri, 18 Jun 2021 02:17:29 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 8846B21B42; Fri, 18 Jun 2021 06:15:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996919; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=leLTXwajvlyeJKw41T/Godr6c8XcW1aFlkn/bziTvjU=; b=lvh1VVLSagblL2ZPwb3bDO0wCkdTuYOgYY/kCkE3jnfBsr9l7gtYxPYWJonkVBRKcVZu+B 10OgHrKAdkww4iG0HxctCxAwX05ASLTrgxIPH6ShL68BY7znQaQ+wirTO/huuwjzaSKXIG 10b3E/4vPt+xxZ0gCXaEBNRD27ZWJAM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996919; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=leLTXwajvlyeJKw41T/Godr6c8XcW1aFlkn/bziTvjU=; b=kN4iEFd4JNZUPIcgCrOHrS2kWSaPJf+ubPNylzc+H2MzAJptmBO/KEiHo6Nfqsci6GSnLg RbrgVpJ5Jyfca9Aw== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 61292A3BC8; Fri, 18 Jun 2021 06:15:19 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 11/70] mxser: remove nonsense from ISR Date: Fri, 18 Jun 2021 08:14:17 +0200 Message-Id: <20210618061516.662-12-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org request_irq was passed a board. There is no need to check dev_id and/or find the appropriate board in the ISR. Neither check if board is NULL. Remove this nonsense. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index db594a64ff00..6602b2741271 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -2207,23 +2207,13 @@ static void mxser_transmit_chars(struct tty_struct *tty, struct mxser_port *port static irqreturn_t mxser_interrupt(int irq, void *dev_id) { int status, iir, i; - struct mxser_board *brd = NULL; + struct mxser_board *brd = dev_id; struct mxser_port *port; int max, irqbits, bits, msr; unsigned int int_cnt, pass_counter = 0; int handled = IRQ_NONE; struct tty_struct *tty; - for (i = 0; i < MXSER_BOARDS; i++) - if (dev_id == &mxser_boards[i]) { - brd = dev_id; - break; - } - - if (i == MXSER_BOARDS) - goto irq_stop; - if (brd == NULL) - goto irq_stop; max = brd->info->nports; while (pass_counter++ < MXSER_ISR_PASS_LIMIT) { irqbits = inb(brd->vector) & brd->vector_mask; @@ -2299,7 +2289,6 @@ static irqreturn_t mxser_interrupt(int irq, void *dev_id) } } -irq_stop: return handled; } From patchwork Fri Jun 18 06:14:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 463498 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99946C49361 for ; Fri, 18 Jun 2021 06:15:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 843EA61154 for ; Fri, 18 Jun 2021 06:15:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233044AbhFRGRq (ORCPT ); Fri, 18 Jun 2021 02:17:46 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:46210 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232881AbhFRGR3 (ORCPT ); Fri, 18 Jun 2021 02:17:29 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id B5A091FDF2; Fri, 18 Jun 2021 06:15:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996919; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MLbdN2mwhZ8591LPEEpdqZp7i95lCMmmdxy9Xlgwj4k=; b=yJvW9qFMGrVc7fAWA3xPMFooOlrrxJO4BYfvbOAjll2ImbNZGavsAH2y7+pbSl3pGPr3VP pj6WVl1FumySsm9aGn/RHqy4NgTSZqzDDZ3EXhLfvXrG/tqKGdKSyImpCX8HdOu37iFGuB qwIQhILuvITG3O177UC7oVAYCADqJu4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996919; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MLbdN2mwhZ8591LPEEpdqZp7i95lCMmmdxy9Xlgwj4k=; b=tWRt1pNsQH68063NspH0xv3Di+vjF/HuVpJYux5vpJ2iTdHvOq4StRf+ggk6kDwNAVNY0v FVY7vxDQlV2IB2DA== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 90C22A3BCA; Fri, 18 Jun 2021 06:15:19 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 12/70] mxser: cleanup LSR handling in mxser_receive_chars Date: Fri, 18 Jun 2021 08:14:18 +0200 Message-Id: <20210618061516.662-13-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org mxser_interrupt is a bit confusing as it passes a pointer to LSR variable ("status") to mxser_receive_chars. That function can indeed update the LCR variable. Make this clear by not passing a variable by reference, instead, return updated status. And change its type accordingly -- to u8. Note that the next patches will rework ISR so that even the definition of status will be u8 soon too. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 6602b2741271..9ba3af4626c6 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -2056,8 +2056,8 @@ static int mxser_rs_break(struct tty_struct *tty, int break_state) return 0; } -static void mxser_receive_chars(struct tty_struct *tty, - struct mxser_port *port, int *status) +static u8 mxser_receive_chars(struct tty_struct *tty, + struct mxser_port *port, u8 status) { unsigned char ch, gdl; int ignored = 0; @@ -2070,12 +2070,12 @@ static void mxser_receive_chars(struct tty_struct *tty, mxser_stoprx(tty); if (port->board->must_hwid != MOXA_OTHER_UART) { - if (*status & UART_LSR_SPECIAL) + if (status & UART_LSR_SPECIAL) goto intr_old; if (port->board->must_hwid == MOXA_MUST_MU860_HWID && - (*status & MOXA_MUST_LSR_RERR)) + (status & MOXA_MUST_LSR_RERR)) goto intr_old; - if (*status & MOXA_MUST_LSR_RERR) + if (status & MOXA_MUST_LSR_RERR) goto intr_old; gdl = inb(port->ioaddr + MOXA_MUST_GDL_REGISTER); @@ -2100,28 +2100,28 @@ static void mxser_receive_chars(struct tty_struct *tty, break; ch = inb(port->ioaddr + UART_RX); - if (port->board->must_hwid && (*status & UART_LSR_OE)) + if (port->board->must_hwid && (status & UART_LSR_OE)) outb(0x23, port->ioaddr + UART_FCR); - *status &= port->read_status_mask; - if (*status & port->ignore_status_mask) { + status &= port->read_status_mask; + if (status & port->ignore_status_mask) { if (++ignored > 100) break; } else { char flag = 0; - if (*status & UART_LSR_SPECIAL) { - if (*status & UART_LSR_BI) { + if (status & UART_LSR_SPECIAL) { + if (status & UART_LSR_BI) { flag = TTY_BREAK; port->icount.brk++; if (port->port.flags & ASYNC_SAK) do_SAK(tty); - } else if (*status & UART_LSR_PE) { + } else if (status & UART_LSR_PE) { flag = TTY_PARITY; port->icount.parity++; - } else if (*status & UART_LSR_FE) { + } else if (status & UART_LSR_FE) { flag = TTY_FRAME; port->icount.frame++; - } else if (*status & UART_LSR_OE) { + } else if (status & UART_LSR_OE) { flag = TTY_OVERRUN; port->icount.overrun++; } else @@ -2140,8 +2140,8 @@ static void mxser_receive_chars(struct tty_struct *tty, if (port->board->must_hwid) break; - *status = inb(port->ioaddr + UART_LSR); - } while (*status & UART_LSR_DR); + status = inb(port->ioaddr + UART_LSR); + } while (status & UART_LSR_DR); end_intr: mxvar_log.rxcnt[tty->index] += cnt; @@ -2149,6 +2149,8 @@ static void mxser_receive_chars(struct tty_struct *tty, port->mon_data.up_rxcnt += cnt; tty_flip_buffer_push(&port->port); + + return status; } static void mxser_transmit_chars(struct tty_struct *tty, struct mxser_port *port) @@ -2262,14 +2264,14 @@ static irqreturn_t mxser_interrupt(int irq, void *dev_id) iir == MOXA_MUST_IIR_RDA || iir == MOXA_MUST_IIR_RTO || iir == MOXA_MUST_IIR_LSR) - mxser_receive_chars(tty, port, - &status); + status = mxser_receive_chars(tty, + port, status); } else { status &= port->read_status_mask; if (status & UART_LSR_DR) - mxser_receive_chars(tty, port, - &status); + status = mxser_receive_chars(tty, + port, status); } msr = inb(port->ioaddr + UART_MSR); if (msr & UART_MSR_ANY_DELTA) From patchwork Fri Jun 18 06:14:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 464159 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34D62C48BDF for ; Fri, 18 Jun 2021 06:15:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1B8B461154 for ; Fri, 18 Jun 2021 06:15:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233062AbhFRGRr (ORCPT ); Fri, 18 Jun 2021 02:17:47 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:59016 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232882AbhFRGRa (ORCPT ); Fri, 18 Jun 2021 02:17:30 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id E702321AB2; Fri, 18 Jun 2021 06:15:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996919; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hf0c8AA+WJx652FcNRZ4b2mKiWtF7sdoLMBJ0Alo48k=; b=vfPrh/+SIYqPT1W9SCU55eZGuuBwY1HQ+VaNtgVlRpq98rZQIVGN6NPo5P//b1j1+nFCeY 8eWfmBhz27/HWAP44t2An8s+eLAU872goGmkUzK5jVwPzJuP3UDVujUqw4LrIakBq0vamM dehYB5FnMgBzxZiQ0bT6WXEvVkENfJ4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996919; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hf0c8AA+WJx652FcNRZ4b2mKiWtF7sdoLMBJ0Alo48k=; b=4erSWj+frJATVHr3KJqItVXsaINsB3zHTPijFc9j60AyadtFMjCIL3XuvgXXIipxfUocQL DLyAoygLtBO6GDAQ== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id C01F2A3BCB; Fri, 18 Jun 2021 06:15:19 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 13/70] mxser: extract port ISR Date: Fri, 18 Jun 2021 08:14:19 +0200 Message-Id: <20210618061516.662-14-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org The ISR is terrible mix of letters. Let's extract the proper per-port handling to a separate function called mxser_port_isr. This way, we can actually see what both mxser_interrupt and mxser_port_isr do now. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 119 ++++++++++++++++++++++++-------------------- 1 file changed, 64 insertions(+), 55 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 9ba3af4626c6..555b9b37b52f 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -2203,18 +2203,78 @@ static void mxser_transmit_chars(struct tty_struct *tty, struct mxser_port *port } } +static bool mxser_port_isr(struct mxser_port *port) +{ + struct tty_struct *tty; + u8 iir, msr, status; + bool error = false; + + iir = inb(port->ioaddr + UART_IIR); + if (iir & UART_IIR_NO_INT) + return true; + + iir &= MOXA_MUST_IIR_MASK; + tty = tty_port_tty_get(&port->port); + if (!tty || port->closing || !tty_port_initialized(&port->port)) { + status = inb(port->ioaddr + UART_LSR); + outb(0x27, port->ioaddr + UART_FCR); + inb(port->ioaddr + UART_MSR); + + error = true; + goto put_tty; + } + + status = inb(port->ioaddr + UART_LSR); + + if (status & UART_LSR_PE) + port->err_shadow |= NPPI_NOTIFY_PARITY; + if (status & UART_LSR_FE) + port->err_shadow |= NPPI_NOTIFY_FRAMING; + if (status & UART_LSR_OE) + port->err_shadow |= NPPI_NOTIFY_HW_OVERRUN; + if (status & UART_LSR_BI) + port->err_shadow |= NPPI_NOTIFY_BREAK; + + if (port->board->must_hwid) { + if (iir == MOXA_MUST_IIR_GDA || + iir == MOXA_MUST_IIR_RDA || + iir == MOXA_MUST_IIR_RTO || + iir == MOXA_MUST_IIR_LSR) + status = mxser_receive_chars(tty, port, status); + } else { + status &= port->read_status_mask; + if (status & UART_LSR_DR) + status = mxser_receive_chars(tty, port, status); + } + + msr = inb(port->ioaddr + UART_MSR); + if (msr & UART_MSR_ANY_DELTA) + mxser_check_modem_status(tty, port, msr); + + if (port->board->must_hwid) { + if (iir == 0x02 && (status & UART_LSR_THRE)) + mxser_transmit_chars(tty, port); + } else { + if (status & UART_LSR_THRE) + mxser_transmit_chars(tty, port); + } + +put_tty: + tty_kref_put(tty); + + return error; +} + /* * This is the serial driver's generic interrupt routine */ static irqreturn_t mxser_interrupt(int irq, void *dev_id) { - int status, iir, i; struct mxser_board *brd = dev_id; struct mxser_port *port; - int max, irqbits, bits, msr; unsigned int int_cnt, pass_counter = 0; + int max, irqbits, bits, i; int handled = IRQ_NONE; - struct tty_struct *tty; max = brd->info->nports; while (pass_counter++ < MXSER_ISR_PASS_LIMIT) { @@ -2233,59 +2293,8 @@ static irqreturn_t mxser_interrupt(int irq, void *dev_id) int_cnt = 0; spin_lock(&port->slock); do { - iir = inb(port->ioaddr + UART_IIR); - if (iir & UART_IIR_NO_INT) - break; - iir &= MOXA_MUST_IIR_MASK; - tty = tty_port_tty_get(&port->port); - if (!tty || port->closing || - !tty_port_initialized(&port->port)) { - status = inb(port->ioaddr + UART_LSR); - outb(0x27, port->ioaddr + UART_FCR); - inb(port->ioaddr + UART_MSR); - tty_kref_put(tty); + if (mxser_port_isr(port)) break; - } - - status = inb(port->ioaddr + UART_LSR); - - if (status & UART_LSR_PE) - port->err_shadow |= NPPI_NOTIFY_PARITY; - if (status & UART_LSR_FE) - port->err_shadow |= NPPI_NOTIFY_FRAMING; - if (status & UART_LSR_OE) - port->err_shadow |= - NPPI_NOTIFY_HW_OVERRUN; - if (status & UART_LSR_BI) - port->err_shadow |= NPPI_NOTIFY_BREAK; - - if (port->board->must_hwid) { - if (iir == MOXA_MUST_IIR_GDA || - iir == MOXA_MUST_IIR_RDA || - iir == MOXA_MUST_IIR_RTO || - iir == MOXA_MUST_IIR_LSR) - status = mxser_receive_chars(tty, - port, status); - - } else { - status &= port->read_status_mask; - if (status & UART_LSR_DR) - status = mxser_receive_chars(tty, - port, status); - } - msr = inb(port->ioaddr + UART_MSR); - if (msr & UART_MSR_ANY_DELTA) - mxser_check_modem_status(tty, port, msr); - - if (port->board->must_hwid) { - if (iir == 0x02 && (status & - UART_LSR_THRE)) - mxser_transmit_chars(tty, port); - } else { - if (status & UART_LSR_THRE) - mxser_transmit_chars(tty, port); - } - tty_kref_put(tty); } while (int_cnt++ < MXSER_ISR_PASS_LIMIT); spin_unlock(&port->slock); } From patchwork Fri Jun 18 06:14:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 464158 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96818C48BE8 for ; Fri, 18 Jun 2021 06:15:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 81A986120A for ; Fri, 18 Jun 2021 06:15:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233076AbhFRGRs (ORCPT ); Fri, 18 Jun 2021 02:17:48 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:59036 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232883AbhFRGRa (ORCPT ); Fri, 18 Jun 2021 02:17:30 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 216AA21B51; Fri, 18 Jun 2021 06:15:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996920; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1slZ3qSkLzaics74bWzedOlvybCAvig1qgHYjIlKIGo=; b=aUxqVovw+TrQNa4tDWZpC4KUwyaR8x15tBVt5o7LP7NvyuaJLvD8Irg8PWmFfYhebEeZKS WmDOiPkVqVZ1tOQfWedeB1KKKayteSKlJZzxI5S2a4tpHNAH5j3+rVWkwvgHQ8k8Svl98P ifaQenKaHGODPC6vTZ81IrOI1ZbjdL8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996920; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1slZ3qSkLzaics74bWzedOlvybCAvig1qgHYjIlKIGo=; b=isrEqdEyx9AiExP6wC070BB1GdQkfNe+f0VlsT9sJAQs2g/Ez1SJ0nDLYbb+rP0ZsO9T7O 6Yxi5XdL9pVLesBg== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id EE4E1A3BBA; Fri, 18 Jun 2021 06:15:19 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 14/70] mxser: simplify mxser_interrupt and drop mxser_board::vector_mask Date: Fri, 18 Jun 2021 08:14:20 +0200 Message-Id: <20210618061516.662-15-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org mxser_board::vector_mask is just a bitfield with bits set for all available ports. We can obtain this value simply by "BIT(brd->info->nports) - 1" directly in the ISR. So remove vector_mask and simplify the code a bit. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 555b9b37b52f..df59ca88acab 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -368,7 +368,6 @@ struct mxser_board { int irq; const struct mxser_cardinfo *info; unsigned long vector; - unsigned long vector_mask; enum mxser_must_hwid must_hwid; speed_t max_baud; @@ -2273,18 +2272,18 @@ static irqreturn_t mxser_interrupt(int irq, void *dev_id) struct mxser_board *brd = dev_id; struct mxser_port *port; unsigned int int_cnt, pass_counter = 0; - int max, irqbits, bits, i; + unsigned int i, max = brd->info->nports; int handled = IRQ_NONE; + u8 irqbits, bits, mask = BIT(max) - 1; - max = brd->info->nports; while (pass_counter++ < MXSER_ISR_PASS_LIMIT) { - irqbits = inb(brd->vector) & brd->vector_mask; - if (irqbits == brd->vector_mask) + irqbits = inb(brd->vector) & mask; + if (irqbits == mask) break; handled = IRQ_HANDLED; for (i = 0, bits = 1; i < max; i++, irqbits |= bits, bits <<= 1) { - if (irqbits == brd->vector_mask) + if (irqbits == mask) break; if (bits & irqbits) continue; @@ -2450,7 +2449,6 @@ static int mxser_probe(struct pci_dev *pdev, brd->irq = pdev->irq; brd->must_hwid = mxser_must_get_hwid(brd->ports[0].ioaddr); - brd->vector_mask = 0; for (j = 0; j < UART_INFO_NUM; j++) { if (Gpci_uart_info[j].type == brd->must_hwid) { @@ -2475,7 +2473,6 @@ static int mxser_probe(struct pci_dev *pdev, } for (i = 0; i < brd->info->nports; i++) { - brd->vector_mask |= (1 << i); brd->ports[i].baud_base = 921600; } From patchwork Fri Jun 18 06:14:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 463496 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 68C90C49EA4 for ; Fri, 18 Jun 2021 06:15:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 54909611CE for ; Fri, 18 Jun 2021 06:15:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233084AbhFRGRt (ORCPT ); Fri, 18 Jun 2021 02:17:49 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:59054 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232885AbhFRGRa (ORCPT ); Fri, 18 Jun 2021 02:17:30 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 4B17321B58; Fri, 18 Jun 2021 06:15:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996920; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NGhI4h+9UkpEWdcFqpCM9ilg01EZuzFHbZ8KsYHILQ0=; b=GOGw5O+Sb1wOT27GYD+gGvcFZa0/j9tLNiFHsRRNym7sz+DuJgAbfWAujDZsYe8TsAvOBY 4jorbwcXGvvxZKPg8RNI99Uh51OxYPGCGPC4WBRJPwn3GEF+9oO2f7iH5pK8MiWbSoRHcD gyY+5Ok7Jc+mnWRAWRXaEd1OknEBDQo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996920; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NGhI4h+9UkpEWdcFqpCM9ilg01EZuzFHbZ8KsYHILQ0=; b=gw66omFvBB85BJBIhFCb9vPx7TNCZ89BheJ6zNfyRF06IW4GfeFtxHVZlm/hgBti0s11kJ wlZF0ydpz7Q1mnCQ== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 2AA8BA3BCB; Fri, 18 Jun 2021 06:15:20 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 15/70] mxser: extract mxser_receive_chars_new Date: Fri, 18 Jun 2021 08:14:21 +0200 Message-Id: <20210618061516.662-16-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Extract the new handling of receive chars (using the MUST chip enhancements) into a separate function. This eliminates the need for the intr_old label and makes the code of mxser_receive_chars more compact. In the next step, we will extract the old handling too. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 60 +++++++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 26 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index df59ca88acab..a321aba24d58 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -2055,10 +2055,41 @@ static int mxser_rs_break(struct tty_struct *tty, int break_state) return 0; } +static bool mxser_receive_chars_new(struct tty_struct *tty, + struct mxser_port *port, u8 status, int *cnt) +{ + enum mxser_must_hwid hwid = port->board->must_hwid; + u8 gdl; + + if (hwid == MOXA_OTHER_UART) + return false; + if (status & UART_LSR_SPECIAL) + return false; + if (hwid == MOXA_MUST_MU860_HWID && (status & MOXA_MUST_LSR_RERR)) + return false; + if (status & MOXA_MUST_LSR_RERR) + return false; + + gdl = inb(port->ioaddr + MOXA_MUST_GDL_REGISTER); + if (hwid == MOXA_MUST_MU150_HWID) + gdl &= MOXA_MUST_GDL_MASK; + + if (gdl >= tty->receive_room && !port->ldisc_stop_rx) + mxser_stoprx(tty); + + while (gdl--) { + u8 ch = inb(port->ioaddr + UART_RX); + tty_insert_flip_char(&port->port, ch, 0); + (*cnt)++; + } + + return true; +} + static u8 mxser_receive_chars(struct tty_struct *tty, struct mxser_port *port, u8 status) { - unsigned char ch, gdl; + unsigned char ch; int ignored = 0; int cnt = 0; int recv_room; @@ -2067,32 +2098,9 @@ static u8 mxser_receive_chars(struct tty_struct *tty, recv_room = tty->receive_room; if (recv_room == 0 && !port->ldisc_stop_rx) mxser_stoprx(tty); - if (port->board->must_hwid != MOXA_OTHER_UART) { - - if (status & UART_LSR_SPECIAL) - goto intr_old; - if (port->board->must_hwid == MOXA_MUST_MU860_HWID && - (status & MOXA_MUST_LSR_RERR)) - goto intr_old; - if (status & MOXA_MUST_LSR_RERR) - goto intr_old; - - gdl = inb(port->ioaddr + MOXA_MUST_GDL_REGISTER); - - if (port->board->must_hwid == MOXA_MUST_MU150_HWID) - gdl &= MOXA_MUST_GDL_MASK; - if (gdl >= recv_room) { - if (!port->ldisc_stop_rx) - mxser_stoprx(tty); - } - while (gdl--) { - ch = inb(port->ioaddr + UART_RX); - tty_insert_flip_char(&port->port, ch, 0); - cnt++; - } + + if (mxser_receive_chars_new(tty, port, status, &cnt)) goto end_intr; - } -intr_old: do { if (max-- < 0) From patchwork Fri Jun 18 06:14:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 464157 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BFAC0C49361 for ; Fri, 18 Jun 2021 06:15:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AA923611CE for ; Fri, 18 Jun 2021 06:15:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233086AbhFRGRu (ORCPT ); Fri, 18 Jun 2021 02:17:50 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:59074 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232889AbhFRGRa (ORCPT ); Fri, 18 Jun 2021 02:17:30 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 822BB21B5A; Fri, 18 Jun 2021 06:15:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996920; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CaN6R/IGB7HxBmyiOa/qSdAOPItu271CaB0Oj6+8+Mw=; b=KS19NaNplPYGKeIRGc1ik9PVXBGSwj3k95MsqTR5IKtM8Af41r2P9MK4pQBIG4y/oClWBg cGzN+hH87tqiZRr9OzGtXttNY4+cdq+z12JcHLwNlg24XDcNj4qXvxF9qiA5VkFTyg7a/E xJlamcD47N8DYixbQdh6Wr3KpA7BLdY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996920; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CaN6R/IGB7HxBmyiOa/qSdAOPItu271CaB0Oj6+8+Mw=; b=m0YvQApTQTn4NyEOox+hIoN8z/pF4cat+okRIVKkFTlm5+8nSZlsQiVKflBFI1zboTVxCz 1saWzwRwqewI1XBA== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 58EB0A3BBA; Fri, 18 Jun 2021 06:15:20 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 16/70] mxser: extract mxser_receive_chars_old Date: Fri, 18 Jun 2021 08:14:22 +0200 Message-Id: <20210618061516.662-17-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index a321aba24d58..6b8f2b0e0726 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -2086,28 +2086,21 @@ static bool mxser_receive_chars_new(struct tty_struct *tty, return true; } -static u8 mxser_receive_chars(struct tty_struct *tty, - struct mxser_port *port, u8 status) +static u8 mxser_receive_chars_old(struct tty_struct *tty, + struct mxser_port *port, u8 status, int *cnt) { - unsigned char ch; + enum mxser_must_hwid hwid = port->board->must_hwid; + int recv_room = tty->receive_room; int ignored = 0; - int cnt = 0; - int recv_room; int max = 256; - - recv_room = tty->receive_room; - if (recv_room == 0 && !port->ldisc_stop_rx) - mxser_stoprx(tty); - - if (mxser_receive_chars_new(tty, port, status, &cnt)) - goto end_intr; + u8 ch; do { if (max-- < 0) break; ch = inb(port->ioaddr + UART_RX); - if (port->board->must_hwid && (status & UART_LSR_OE)) + if (hwid && (status & UART_LSR_OE)) outb(0x23, port->ioaddr + UART_FCR); status &= port->read_status_mask; if (status & port->ignore_status_mask) { @@ -2135,8 +2128,8 @@ static u8 mxser_receive_chars(struct tty_struct *tty, flag = TTY_BREAK; } tty_insert_flip_char(&port->port, ch, flag); - cnt++; - if (cnt >= recv_room) { + (*cnt)++; + if (*cnt >= recv_room) { if (!port->ldisc_stop_rx) mxser_stoprx(tty); break; @@ -2144,13 +2137,26 @@ static u8 mxser_receive_chars(struct tty_struct *tty, } - if (port->board->must_hwid) + if (hwid) break; status = inb(port->ioaddr + UART_LSR); } while (status & UART_LSR_DR); -end_intr: + return status; +} + +static u8 mxser_receive_chars(struct tty_struct *tty, + struct mxser_port *port, u8 status) +{ + int cnt = 0; + + if (tty->receive_room == 0 && !port->ldisc_stop_rx) + mxser_stoprx(tty); + + if (!mxser_receive_chars_new(tty, port, status, &cnt)) + status = mxser_receive_chars_old(tty, port, status, &cnt); + mxvar_log.rxcnt[tty->index] += cnt; port->mon_data.rxcnt += cnt; port->mon_data.up_rxcnt += cnt; From patchwork Fri Jun 18 06:14:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 463497 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1CA72C49EA3 for ; Fri, 18 Jun 2021 06:15:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 076DC61154 for ; Fri, 18 Jun 2021 06:15:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233068AbhFRGRs (ORCPT ); Fri, 18 Jun 2021 02:17:48 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:46246 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232888AbhFRGRa (ORCPT ); Fri, 18 Jun 2021 02:17:30 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id AFAED1FDF1; Fri, 18 Jun 2021 06:15:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996920; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eAxFk5BUNdVrHksKGizhyIj//K73Z70eGUSV+FbEDP0=; b=OK1uaBQx3iJxVZahHVvMvuQwDKGe/A2MshY3ZCj+kqUvLAdGTAXFoh2POX3/xTvPuEg1wt iu1tUIgf3qhVNTUUaMxS4vgbi8IdojmG+ZepIYlAJoZssawObLxXCOmwvndBxKr+4SPIya hIcWgraoazAbWu5fFOycmeUyGWJ8HCc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996920; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eAxFk5BUNdVrHksKGizhyIj//K73Z70eGUSV+FbEDP0=; b=r7d7xOpUeTftkOUhFZ/WD3W+0JQTNriVilZcCR8aSCv8ORhGDKPBBpCJmv37MQxZSap5F9 wWShaIo1yjrMiYAA== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 88EB2A3BCB; Fri, 18 Jun 2021 06:15:20 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 17/70] mxser: remove else from LSR bits checks Date: Fri, 18 Jun 2021 08:14:23 +0200 Message-Id: <20210618061516.662-18-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org UART_LSR_SPECIAL is composed of UART_LSR_BI, UART_LSR_PE, UART_LSR_FE, UART_LSR_OE. So status cannot be anything else. Remove the unused else branch. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 6b8f2b0e0726..1b8032c9351e 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -2124,8 +2124,7 @@ static u8 mxser_receive_chars_old(struct tty_struct *tty, } else if (status & UART_LSR_OE) { flag = TTY_OVERRUN; port->icount.overrun++; - } else - flag = TTY_BREAK; + } } tty_insert_flip_char(&port->port, ch, flag); (*cnt)++; From patchwork Fri Jun 18 06:14:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 463493 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 102AAC48BDF for ; Fri, 18 Jun 2021 06:15:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EE4BB611CE for ; Fri, 18 Jun 2021 06:15:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233147AbhFRGR5 (ORCPT ); Fri, 18 Jun 2021 02:17:57 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:59680 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232950AbhFRGRl (ORCPT ); Fri, 18 Jun 2021 02:17:41 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id E91E221B4F; Fri, 18 Jun 2021 06:15:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996920; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=373VsUjCdmrfx4JVH30Rel8N/AJ7vp7LefOEwnhMQ0A=; b=y2SaWuxqUH3mLiNKv4u9OnhRdjPkLOava9ogh9yqkqwDGDfj8IVW97nRFA5dRIQf+OoINP tGK5hTs8+rOz9/to/dDThdDbWVFdPhiy729X4E+i16++QYQzoY6VFqhOKhTuV9AhX/6FKs 7bcGJV+gsipgq53GvhPu+hNANN944bM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996920; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=373VsUjCdmrfx4JVH30Rel8N/AJ7vp7LefOEwnhMQ0A=; b=ozsQncD//q2uYxqlFihpuUcr36BYAtusWbfvQssAU9I3pefx7G6nzEnVgDoAsiRqyiVTJe TlJpIv36x6VDS/CA== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id C303BA3BBA; Fri, 18 Jun 2021 06:15:20 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 18/70] mxser: correct types for uart variables Date: Fri, 18 Jun 2021 08:14:24 +0200 Message-Id: <20210618061516.662-19-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org In struct mxser_port, all the UART registers and masks, and the xon/xoff character are stored into int. Let's re-type all these as UART registers are 8bit (u8) and xon/xoff character is an unsigned char (cc_t in ktermios). This save some bytes in memory, but more importantly the change makes it what it really is. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 1b8032c9351e..45f36d92c5ea 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -335,9 +335,9 @@ struct mxser_port { int baud_base; /* max. speed */ int type; /* UART type */ - int x_char; /* xon/xoff character */ - int IER; /* Interrupt Enable Register */ - int MCR; /* Modem control register */ + unsigned char x_char; /* xon/xoff character */ + u8 IER; /* Interrupt Enable Register */ + u8 MCR; /* Modem control register */ unsigned char stop_rx; unsigned char ldisc_stop_rx; @@ -348,8 +348,8 @@ struct mxser_port { struct async_icount icount; /* kernel counters for 4 input interrupts */ unsigned int timeout; - int read_status_mask; - int ignore_status_mask; + u8 read_status_mask; + u8 ignore_status_mask; u8 xmit_fifo_size; int xmit_head; int xmit_tail; From patchwork Fri Jun 18 06:14:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 464155 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8132EC48BDF for ; Fri, 18 Jun 2021 06:15:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6D67C6120A for ; Fri, 18 Jun 2021 06:15:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233135AbhFRGR4 (ORCPT ); Fri, 18 Jun 2021 02:17:56 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:46728 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232964AbhFRGRl (ORCPT ); Fri, 18 Jun 2021 02:17:41 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 31D851FDFC; Fri, 18 Jun 2021 06:15:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996921; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=F5/FmGrKE5ZFei42H0MztKDKgh/V6X8PtUx5LYCmr7s=; b=Vqm5iFk6Qq6iq3cIm1gz8jFI0zOB60Km+3XWaCkhZR5bWV3K9EW/NFmljf0E2LAW7SPEGg 04h+sUL83p3f7lLimDjZYvZKSC0eaLnfPId1g22gF9BqnrPGWkFHpeAWGnLJTUbslj7Kz6 nU3/3c/zundT6gLW6skDH6kINrBuxBo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996921; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=F5/FmGrKE5ZFei42H0MztKDKgh/V6X8PtUx5LYCmr7s=; b=3D6fjC/4WBynAMzenbdUjmnwqqe0tTvWbwEokIokb4y2kT9h/DU8NNpE6dH/0aI2gev59V 1f9WJui9P/gP70DA== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 062C7A3BBA; Fri, 18 Jun 2021 06:15:21 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 19/70] mxser: make xmit ring buffer variables unsigned Date: Fri, 18 Jun 2021 08:14:25 +0200 Message-Id: <20210618061516.662-20-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Make the xmit ring buffer pointers and counter (xmit_head, xmit_tail, xmit_cnt) unsigned. Now, the assumptions for the compiler are clear -- they cannot be negative. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 45f36d92c5ea..53136a7d92b1 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -351,9 +351,9 @@ struct mxser_port { u8 read_status_mask; u8 ignore_status_mask; u8 xmit_fifo_size; - int xmit_head; - int xmit_tail; - int xmit_cnt; + unsigned int xmit_head; + unsigned int xmit_tail; + unsigned int xmit_cnt; int closing; struct ktermios normal_termios; From patchwork Fri Jun 18 06:14:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 464156 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 472B1C48BDF for ; Fri, 18 Jun 2021 06:15:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2FD0161154 for ; Fri, 18 Jun 2021 06:15:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232944AbhFRGRz (ORCPT ); Fri, 18 Jun 2021 02:17:55 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:59682 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232951AbhFRGRl (ORCPT ); Fri, 18 Jun 2021 02:17:41 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 6F6E821B53; Fri, 18 Jun 2021 06:15:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996921; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IW0m4vxKEyvIv3zdEh/UnHi6Ya53RIfjQkPGMTKdkuE=; b=MSCadmFMaPY4cHFBSPtiQZJWrYEpjHaZFPUDg+bWWKCuVfaz6KVW6u1+ZXsU5T2YRY5SVJ 6Hr3DIPtUzwrPDgak1F/VBc+hR+eMEG9rvRALYQ8YLyhKb5hQBqhnTAECUNZX6XbI0tzh1 lio8rQtzHjvfF0pG9qOXrTsxUkerDOE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996921; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IW0m4vxKEyvIv3zdEh/UnHi6Ya53RIfjQkPGMTKdkuE=; b=xjEcWJi3ADY7OrCF2NBB8r64Ab4svENOalTUQE59fupXJwkFVZ9flSZt39mPHKgnw9b87a F28oluefxClJj1DA== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 42F61A3BBA; Fri, 18 Jun 2021 06:15:21 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 20/70] mxser: drop UART_MCR_AFE and UART_LSR_SPECIAL defines Date: Fri, 18 Jun 2021 08:14:26 +0200 Message-Id: <20210618061516.662-21-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org * UART_MCR_AFE is a redefinition of serial_reg.h's one. * UART_LSR_SPECIAL is a redefinition of serial_reg.h's UART_LSR_BRK_ERROR_BITS. So remove both and replace the latter uses by already defined UART_LSR_BRK_ERROR_BITS. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 53136a7d92b1..79d7cecb7765 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -180,9 +180,6 @@ #define WAKEUP_CHARS 256 -#define UART_MCR_AFE 0x20 -#define UART_LSR_SPECIAL 0x1E - #define PCI_DEVICE_ID_POS104UL 0x1044 #define PCI_DEVICE_ID_CB108 0x1080 #define PCI_DEVICE_ID_CP102UF 0x1023 @@ -2063,7 +2060,7 @@ static bool mxser_receive_chars_new(struct tty_struct *tty, if (hwid == MOXA_OTHER_UART) return false; - if (status & UART_LSR_SPECIAL) + if (status & UART_LSR_BRK_ERROR_BITS) return false; if (hwid == MOXA_MUST_MU860_HWID && (status & MOXA_MUST_LSR_RERR)) return false; @@ -2108,7 +2105,7 @@ static u8 mxser_receive_chars_old(struct tty_struct *tty, break; } else { char flag = 0; - if (status & UART_LSR_SPECIAL) { + if (status & UART_LSR_BRK_ERROR_BITS) { if (status & UART_LSR_BI) { flag = TTY_BREAK; port->icount.brk++; From patchwork Fri Jun 18 06:14:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 463490 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A888C49EA5 for ; Fri, 18 Jun 2021 06:15:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 26D516120A for ; Fri, 18 Jun 2021 06:15:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232994AbhFRGSG (ORCPT ); Fri, 18 Jun 2021 02:18:06 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:59712 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232984AbhFRGRl (ORCPT ); Fri, 18 Jun 2021 02:17:41 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 9C9B321B59; Fri, 18 Jun 2021 06:15:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996921; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/SpERyA+zkcmagUm1oEhXZEouTm6Uehd8gHw+VSJQNA=; b=zc5XQMFey/7ylS0roJbl4AxnY7tMUO6Tm7mOdCFx7ztYU4l10Ncs8pvChJJbQX86BFMv5M xElYoW86eRKbjAqJupJX6X71GvyZEaBZV8FGkwoH6p9HwMiF3YqOUTu9WSTCdC9eRky5Tw ZWmgNfqCaqBbadJzG3+ieHouIFi2SxQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996921; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/SpERyA+zkcmagUm1oEhXZEouTm6Uehd8gHw+VSJQNA=; b=7oGAfchxAeN1Ne+nVx2rIIOpiSDngiNtisrn1Hp8siQIRcVD/pOwmkiXUrZs7Ezd8+mPJi DmBUgChE3Pxy3iAQ== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 75B64A3BCF; Fri, 18 Jun 2021 06:15:21 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 21/70] mxser: drop unused MOXA_DIAGNOSE macro Date: Fri, 18 Jun 2021 08:14:27 +0200 Message-Id: <20210618061516.662-22-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org It's unused. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 79d7cecb7765..a830a4359ea1 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -51,7 +51,6 @@ #define MOXA 0x400 #define MOXA_GETDATACOUNT (MOXA + 23) -#define MOXA_DIAGNOSE (MOXA + 50) #define MOXA_CHKPORTENABLE (MOXA + 60) #define MOXA_HighSpeedOn (MOXA + 61) #define MOXA_GET_MAJOR (MOXA + 63) From patchwork Fri Jun 18 06:14:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 464154 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50A37C48BE8 for ; Fri, 18 Jun 2021 06:15:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3908F611CE for ; Fri, 18 Jun 2021 06:15:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233160AbhFRGSA (ORCPT ); Fri, 18 Jun 2021 02:18:00 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:58952 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232957AbhFRGRl (ORCPT ); Fri, 18 Jun 2021 02:17:41 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id DA3AA21B5B; Fri, 18 Jun 2021 06:15:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996921; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QicgmRLI5sis+DIc/je8KKnUPtR6F6ZKidUylbbEFPU=; b=ZC0SGGyOpkyXdORCLr9hC25cjCxSTJ8keOlc2NLyp/FIwHx7hVG1YVCcNGoBYBk80p+IbR qS8CYe7CRpc40xWVwCVck6nm9AfqSV3Oze86ZzyNPLzlbIQo1QgbTzzNXqJFm9PBKMxdSr IO6OEAR8QFLvzUDIRnjpZA1KX8QZXg8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996921; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QicgmRLI5sis+DIc/je8KKnUPtR6F6ZKidUylbbEFPU=; b=wvPoB/oipGun8dYOMAlFM+sASIkAPf2EFGDKl7XNt4R4WTduPEJ4XiL06jGXCa1BbO9hdK FwjuQzUi3ILTacCg== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id AFE89A3BBA; Fri, 18 Jun 2021 06:15:21 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 22/70] mxser: remove MOXA_GET_MAJOR deprecated ioctl Date: Fri, 18 Jun 2021 08:14:28 +0200 Message-Id: <20210618061516.662-23-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org MOXA_GET_MAJOR was deprecated in commit 41aee9a121fd (Char: mxser, ioctl cleanup) in 2008. Remove this ioctl finally. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index a830a4359ea1..a55b20f98cb3 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -53,7 +53,6 @@ #define MOXA_GETDATACOUNT (MOXA + 23) #define MOXA_CHKPORTENABLE (MOXA + 60) #define MOXA_HighSpeedOn (MOXA + 61) -#define MOXA_GET_MAJOR (MOXA + 63) #define MOXA_GETMSTATUS (MOXA + 65) #define MOXA_SET_OP_MODE (MOXA + 66) #define MOXA_GET_OP_MODE (MOXA + 67) @@ -1499,12 +1498,6 @@ static int mxser_ioctl_special(unsigned int cmd, void __user *argp) int ret = 0; switch (cmd) { - case MOXA_GET_MAJOR: - printk_ratelimited(KERN_WARNING "mxser: '%s' uses deprecated ioctl " - "%x (GET_MAJOR), fix your userspace\n", - current->comm, cmd); - return put_user(ttymajor, (int __user *)argp); - case MOXA_CHKPORTENABLE: result = 0; for (i = 0; i < MXSER_BOARDS; i++) From patchwork Fri Jun 18 06:14:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 463494 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F3ABC49361 for ; Fri, 18 Jun 2021 06:15:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0C970611CE for ; Fri, 18 Jun 2021 06:15:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233130AbhFRGR4 (ORCPT ); Fri, 18 Jun 2021 02:17:56 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:58982 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232967AbhFRGRl (ORCPT ); Fri, 18 Jun 2021 02:17:41 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 1C00721B5F; Fri, 18 Jun 2021 06:15:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996922; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6Ykax/pYw7bUj0ENSPbb5NBsEbkcLkScyR9oddj30dc=; b=BDxZgjYUqESFCIfxJ94XxdKcIdjDEwDaZieHE9en8MYC3880rvn1UHuFVwCo5pqODeNJ+A cJomuLimQL2zgqOW5GVQnKpLYnpHZLTC5Q194MmGgN7OqSLBVydT+r74un1D5IFJe6lx88 786EQrxyVLkIKyo+ystAcAKIuUvNAoU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996922; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6Ykax/pYw7bUj0ENSPbb5NBsEbkcLkScyR9oddj30dc=; b=D8S5aMoF7LqEFAbejKqZ4L62hM3SRc+Rjpf2Pf9rFfGlqlj0JpYqNskdiWtV7ZI9vnbp8n CKB5SewwTAno3CDg== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id EA3D7A3BBA; Fri, 18 Jun 2021 06:15:21 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 23/70] mxser: remove MOXA_SET_BAUD_METHOD ioctl Date: Fri, 18 Jun 2021 08:14:29 +0200 Message-Id: <20210618061516.662-24-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org 1) The semantics are defined exactly nowhere. 2) The ioctl definition was never exposed to userspace, so noone should actually be reliably using this. 3) It's not even mentioned in any of the mxser utilities. Provided the above, remove this mxser-special ioctl. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index a55b20f98cb3..cf3b8f9f7e1e 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -68,7 +68,6 @@ #define MOXA_ASPP_MON (MOXA + 73) #define MOXA_ASPP_LSTATUS (MOXA + 74) #define MOXA_ASPP_MON_EXT (MOXA + 75) -#define MOXA_SET_BAUD_METHOD (MOXA + 76) /* --------------------------------------------------- */ @@ -381,7 +380,6 @@ struct mxser_mstatus { static struct mxser_board mxser_boards[MXSER_BOARDS]; static struct tty_driver *mxvar_sdriver; static struct mxser_log mxvar_log; -static int mxser_set_baud_method[MXSER_PORTS + 1]; static void mxser_enable_must_enchance_mode(unsigned long baseio) { @@ -738,8 +736,7 @@ static void mxser_change_speed(struct tty_struct *tty) if (!info->ioaddr) return; - if (mxser_set_baud_method[tty->index] == 0) - mxser_set_baud(tty, tty_get_baud_rate(tty)); + mxser_set_baud(tty, tty_get_baud_rate(tty)); /* byte size and parity */ switch (cflag & CSIZE) { @@ -1788,14 +1785,6 @@ static int mxser_ioctl(struct tty_struct *tty, info->err_shadow = 0; return 0; } - case MOXA_SET_BAUD_METHOD: { - int method; - - if (get_user(method, (int __user *)argp)) - return -EFAULT; - mxser_set_baud_method[tty->index] = method; - return put_user(method, (int __user *)argp); - } default: return -ENOIOCTLCMD; } From patchwork Fri Jun 18 06:14:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 463495 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7218C48BE8 for ; Fri, 18 Jun 2021 06:15:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A1806611CE for ; Fri, 18 Jun 2021 06:15:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233127AbhFRGRy (ORCPT ); Fri, 18 Jun 2021 02:17:54 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:46730 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232959AbhFRGRl (ORCPT ); Fri, 18 Jun 2021 02:17:41 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 4B5181FDFF; Fri, 18 Jun 2021 06:15:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996922; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HVNftH2elFpyV4ZFJ0ppe+gUsXfPcwSN+vuhKzxbcNg=; b=vacjIbXq6NajWAl9FyZNIhZcvCLbvKGLhZ+FBlFB/0PjFdglJfJJksFpAYb/9iX+OIocM6 g2Q2IgLPtHfsFPo/cGStVa17gw10HymoMcV0gqVnPnPI+1HfJAUOUuRQR8MTKJz7ZzUHS+ SKZ3RPRcaKR9QPLem/zV9I0Wf9hde0U= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996922; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HVNftH2elFpyV4ZFJ0ppe+gUsXfPcwSN+vuhKzxbcNg=; b=hBB0Q23ptgX+iMII4IhZsukCCWrSAUkarHN02OtAdop0EJMc+HvlWaiYUjD1h1de+nHo+v XFOvYbh7NTsrVnAA== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 25C68A3BA2; Fri, 18 Jun 2021 06:15:22 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 24/70] mxser: remove MOXA_ASPP_MON and friends Date: Fri, 18 Jun 2021 08:14:30 +0200 Message-Id: <20210618061516.662-25-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org 1) MOXA_ASPP_MON_EXT is broken at least since commit ecbbfd44a08f (TTY: move tty buffers to tty_port) in 2012. 2) The ioctl definitions were never exposed to userspace, so noone should actually be reliably using them. 3) They're not even mentioned in any of the mxser utilities. So remove all these mxser-special ioctls: MOXA_ASPP_MON, MOXA_ASPP_MON_EXT, and MOXA_SDS_RSTICOUNTER. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 184 -------------------------------------------- 1 file changed, 184 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index cf3b8f9f7e1e..68c2f2346dcf 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -63,11 +63,8 @@ #define RS485_4WIRE_MODE 3 #define OP_MODE_MASK 3 -#define MOXA_SDS_RSTICOUNTER (MOXA + 69) #define MOXA_ASPP_OQUEUE (MOXA + 70) -#define MOXA_ASPP_MON (MOXA + 73) #define MOXA_ASPP_LSTATUS (MOXA + 74) -#define MOXA_ASPP_MON_EXT (MOXA + 75) /* --------------------------------------------------- */ @@ -77,11 +74,6 @@ #define NPPI_NOTIFY_SW_OVERRUN 0x08 #define NPPI_NOTIFY_BREAK 0x10 -#define NPPI_NOTIFY_CTSHOLD 0x01 /* Tx hold by CTS low */ -#define NPPI_NOTIFY_DSRHOLD 0x02 /* Tx hold by DSR low */ -#define NPPI_NOTIFY_XOFFHOLD 0x08 /* Tx hold by Xoff received */ -#define NPPI_NOTIFY_XOFFXENT 0x10 /* Xoff Sent */ - /* * Follow just what Moxa Must chip defines. * @@ -290,31 +282,6 @@ struct mxser_log { unsigned long txcnt[MXSER_PORTS]; }; -struct mxser_mon { - unsigned long rxcnt; - unsigned long txcnt; - unsigned long up_rxcnt; - unsigned long up_txcnt; - int modem_status; - unsigned char hold_reason; -}; - -struct mxser_mon_ext { - unsigned long rx_cnt[32]; - unsigned long tx_cnt[32]; - unsigned long up_rxcnt[32]; - unsigned long up_txcnt[32]; - int modem_status[32]; - - long baudrate[32]; - int databits[32]; - int stopbits[32]; - int parity[32]; - int flowctrl[32]; - int fifo[32]; - int iftype[32]; -}; - struct mxser_board; struct mxser_port { @@ -352,8 +319,6 @@ struct mxser_port { struct ktermios normal_termios; - struct mxser_mon mon_data; - spinlock_t slock; }; @@ -616,22 +581,6 @@ static void process_txrx_fifo(struct mxser_port *info) } } -static unsigned char mxser_get_msr(int baseaddr, int mode, int port) -{ - static unsigned char mxser_msr[MXSER_PORTS + 1]; - unsigned char status = 0; - - status = inb(baseaddr + UART_MSR); - - mxser_msr[port] &= 0x0F; - mxser_msr[port] |= status; - status = mxser_msr[port]; - if (mode) - mxser_msr[port] = 0; - - return status; -} - static int mxser_carrier_raised(struct tty_port *port) { struct mxser_port *mp = container_of(port, struct mxser_port, port); @@ -903,7 +852,6 @@ static void mxser_check_modem_status(struct tty_struct *tty, port->icount.dcd++; if (status & UART_MSR_DCTS) port->icount.cts++; - port->mon_data.modem_status = status; wake_up_interruptible(&port->port.delta_msr_wait); if (tty_port_check_carrier(&port->port) && (status & UART_MSR_DDCD)) { @@ -1544,93 +1492,6 @@ static int mxser_ioctl_special(unsigned int cmd, void __user *argp) } return 0; } - case MOXA_ASPP_MON_EXT: { - struct mxser_mon_ext *me; /* it's 2k, stack unfriendly */ - unsigned int cflag, iflag, p; - u8 opmode; - - me = kzalloc(sizeof(*me), GFP_KERNEL); - if (!me) - return -ENOMEM; - - for (i = 0, p = 0; i < MXSER_BOARDS; i++) { - for (j = 0; j < MXSER_PORTS_PER_BOARD; j++, p++) { - if (p >= ARRAY_SIZE(me->rx_cnt)) { - i = MXSER_BOARDS; - break; - } - ip = &mxser_boards[i].ports[j]; - port = &ip->port; - - mutex_lock(&port->mutex); - if (!ip->ioaddr) { - mutex_unlock(&port->mutex); - continue; - } - - spin_lock_irq(&ip->slock); - status = mxser_get_msr(ip->ioaddr, 0, p); - - if (status & UART_MSR_TERI) - ip->icount.rng++; - if (status & UART_MSR_DDSR) - ip->icount.dsr++; - if (status & UART_MSR_DDCD) - ip->icount.dcd++; - if (status & UART_MSR_DCTS) - ip->icount.cts++; - - ip->mon_data.modem_status = status; - me->rx_cnt[p] = ip->mon_data.rxcnt; - me->tx_cnt[p] = ip->mon_data.txcnt; - me->up_rxcnt[p] = ip->mon_data.up_rxcnt; - me->up_txcnt[p] = ip->mon_data.up_txcnt; - me->modem_status[p] = - ip->mon_data.modem_status; - spin_unlock_irq(&ip->slock); - - tty = tty_port_tty_get(&ip->port); - - if (!tty) { - cflag = ip->normal_termios.c_cflag; - iflag = ip->normal_termios.c_iflag; - me->baudrate[p] = tty_termios_baud_rate(&ip->normal_termios); - } else { - cflag = tty->termios.c_cflag; - iflag = tty->termios.c_iflag; - me->baudrate[p] = tty_get_baud_rate(tty); - } - tty_kref_put(tty); - - me->databits[p] = cflag & CSIZE; - me->stopbits[p] = cflag & CSTOPB; - me->parity[p] = cflag & (PARENB | PARODD | - CMSPAR); - - if (cflag & CRTSCTS) - me->flowctrl[p] |= 0x03; - - if (iflag & (IXON | IXOFF)) - me->flowctrl[p] |= 0x0C; - - if (ip->type == PORT_16550A) - me->fifo[p] = 1; - - if (ip->board->must_hwid == MOXA_MUST_MU860_HWID) { - opmode = inb(ip->opmode_ioaddr)>>((p % 4) * 2); - opmode &= OP_MODE_MASK; - } else { - opmode = RS232_MODE; - } - me->iftype[p] = opmode; - mutex_unlock(&port->mutex); - } - } - if (copy_to_user(argp, me, sizeof(*me))) - ret = -EFAULT; - kfree(me); - return ret; - } default: return -ENOIOCTLCMD; } @@ -1729,13 +1590,6 @@ static int mxser_ioctl(struct tty_struct *tty, mxser_cflags_changed(info, arg, &cnow)); case MOXA_HighSpeedOn: return put_user(info->baud_base != 115200 ? 1 : 0, (int __user *)argp); - case MOXA_SDS_RSTICOUNTER: - spin_lock_irq(&info->slock); - info->mon_data.rxcnt = 0; - info->mon_data.txcnt = 0; - spin_unlock_irq(&info->slock); - return 0; - case MOXA_ASPP_OQUEUE:{ int len, lsr; @@ -1747,37 +1601,6 @@ static int mxser_ioctl(struct tty_struct *tty, return put_user(len, (int __user *)argp); } - case MOXA_ASPP_MON: { - int mcr, status; - - spin_lock_irq(&info->slock); - status = mxser_get_msr(info->ioaddr, 1, tty->index); - mxser_check_modem_status(tty, info, status); - - mcr = inb(info->ioaddr + UART_MCR); - spin_unlock_irq(&info->slock); - - if (mcr & MOXA_MUST_MCR_XON_FLAG) - info->mon_data.hold_reason &= ~NPPI_NOTIFY_XOFFHOLD; - else - info->mon_data.hold_reason |= NPPI_NOTIFY_XOFFHOLD; - - if (mcr & MOXA_MUST_MCR_TX_XON) - info->mon_data.hold_reason &= ~NPPI_NOTIFY_XOFFXENT; - else - info->mon_data.hold_reason |= NPPI_NOTIFY_XOFFXENT; - - if (tty->hw_stopped) - info->mon_data.hold_reason |= NPPI_NOTIFY_CTSHOLD; - else - info->mon_data.hold_reason &= ~NPPI_NOTIFY_CTSHOLD; - - if (copy_to_user(argp, &info->mon_data, - sizeof(struct mxser_mon))) - return -EFAULT; - - return 0; - } case MOXA_ASPP_LSTATUS: { if (put_user(info->err_shadow, (unsigned char __user *)argp)) return -EFAULT; @@ -2135,8 +1958,6 @@ static u8 mxser_receive_chars(struct tty_struct *tty, status = mxser_receive_chars_old(tty, port, status, &cnt); mxvar_log.rxcnt[tty->index] += cnt; - port->mon_data.rxcnt += cnt; - port->mon_data.up_rxcnt += cnt; tty_flip_buffer_push(&port->port); @@ -2151,8 +1972,6 @@ static void mxser_transmit_chars(struct tty_struct *tty, struct mxser_port *port outb(port->x_char, port->ioaddr + UART_TX); port->x_char = 0; mxvar_log.txcnt[tty->index]++; - port->mon_data.txcnt++; - port->mon_data.up_txcnt++; port->icount.tx++; return; } @@ -2180,8 +1999,6 @@ static void mxser_transmit_chars(struct tty_struct *tty, struct mxser_port *port } while (--count > 0); mxvar_log.txcnt[tty->index] += (cnt - port->xmit_cnt); - port->mon_data.txcnt += (cnt - port->xmit_cnt); - port->mon_data.up_txcnt += (cnt - port->xmit_cnt); port->icount.tx += (cnt - port->xmit_cnt); if (port->xmit_cnt < WAKEUP_CHARS) @@ -2355,7 +2172,6 @@ static int mxser_initbrd(struct mxser_board *brd) info->port.close_delay = 5 * HZ / 10; info->port.closing_wait = 30 * HZ; info->normal_termios = mxvar_sdriver->init_termios; - memset(&info->mon_data, 0, sizeof(struct mxser_mon)); info->err_shadow = 0; spin_lock_init(&info->slock); From patchwork Fri Jun 18 06:14:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 463492 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A019C48BDF for ; Fri, 18 Jun 2021 06:15:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 42B776120A for ; Fri, 18 Jun 2021 06:15:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232740AbhFRGSB (ORCPT ); Fri, 18 Jun 2021 02:18:01 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:58960 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232968AbhFRGRl (ORCPT ); Fri, 18 Jun 2021 02:17:41 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 8814721B55; Fri, 18 Jun 2021 06:15:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996922; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MHjKP+37ZNlHo7geWY/DFBJLZgfC6j9WGmGs7MNQfoo=; b=aVa33LxlYYiknMOlmvgtv77TZyaBk2uSh31ze1Dkewa/gw5k0OH9DWTojEl6ScKRd9bR1h ykv8LO4JK1xiNu5xNF0N1eWjfxqrrLHTN9OwaulB3kw9ht/I6KTKhe+C09/KTBzdtolNS2 acfnnKWZWivpI0UshYH0PXqwZ8dFkJI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996922; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MHjKP+37ZNlHo7geWY/DFBJLZgfC6j9WGmGs7MNQfoo=; b=WhQXtuYoASh10LzdIA493fueD0MVfhNUITyuirKInW7x8zyQshjHntHb8YK4k6RbrCnOWV SbFPLH9/P7uo8LBg== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 5EE6FA3BA2; Fri, 18 Jun 2021 06:15:22 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 25/70] mxser: remove MOXA_ASPP_LSTATUS ioctl Date: Fri, 18 Jun 2021 08:14:31 +0200 Message-Id: <20210618061516.662-26-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org 1) The semantics are defined exactly nowhere. 2) The ioctl definition was never exposed to userspace, so noone should actually be reliably using this. 3) It's not even mentioned in any of the mxser utilities. Provided the above, remove this mxser-special ioctl. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 68c2f2346dcf..38e12ff17529 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -64,16 +64,9 @@ #define OP_MODE_MASK 3 #define MOXA_ASPP_OQUEUE (MOXA + 70) -#define MOXA_ASPP_LSTATUS (MOXA + 74) /* --------------------------------------------------- */ -#define NPPI_NOTIFY_PARITY 0x01 -#define NPPI_NOTIFY_FRAMING 0x02 -#define NPPI_NOTIFY_HW_OVERRUN 0x04 -#define NPPI_NOTIFY_SW_OVERRUN 0x08 -#define NPPI_NOTIFY_BREAK 0x10 - /* * Follow just what Moxa Must chip defines. * @@ -304,7 +297,6 @@ struct mxser_port { unsigned char ldisc_stop_rx; int custom_divisor; - unsigned char err_shadow; struct async_icount icount; /* kernel counters for 4 input interrupts */ unsigned int timeout; @@ -1601,13 +1593,6 @@ static int mxser_ioctl(struct tty_struct *tty, return put_user(len, (int __user *)argp); } - case MOXA_ASPP_LSTATUS: { - if (put_user(info->err_shadow, (unsigned char __user *)argp)) - return -EFAULT; - - info->err_shadow = 0; - return 0; - } default: return -ENOIOCTLCMD; } @@ -2033,15 +2018,6 @@ static bool mxser_port_isr(struct mxser_port *port) status = inb(port->ioaddr + UART_LSR); - if (status & UART_LSR_PE) - port->err_shadow |= NPPI_NOTIFY_PARITY; - if (status & UART_LSR_FE) - port->err_shadow |= NPPI_NOTIFY_FRAMING; - if (status & UART_LSR_OE) - port->err_shadow |= NPPI_NOTIFY_HW_OVERRUN; - if (status & UART_LSR_BI) - port->err_shadow |= NPPI_NOTIFY_BREAK; - if (port->board->must_hwid) { if (iir == MOXA_MUST_IIR_GDA || iir == MOXA_MUST_IIR_RDA || @@ -2172,7 +2148,6 @@ static int mxser_initbrd(struct mxser_board *brd) info->port.close_delay = 5 * HZ / 10; info->port.closing_wait = 30 * HZ; info->normal_termios = mxvar_sdriver->init_termios; - info->err_shadow = 0; spin_lock_init(&info->slock); /* before set INT ISR, disable all int */ From patchwork Fri Jun 18 06:14:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 464152 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51D18C48BE8 for ; Fri, 18 Jun 2021 06:15:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 40A22611CD for ; Fri, 18 Jun 2021 06:15:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233162AbhFRGSF (ORCPT ); Fri, 18 Jun 2021 02:18:05 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:59716 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232981AbhFRGRl (ORCPT ); Fri, 18 Jun 2021 02:17:41 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id B86D721B5E; Fri, 18 Jun 2021 06:15:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996922; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DYd3N3c0Aw6LBISi1oYuZ2lsGo9Y+aGBzcnY+yVesZs=; b=rFtrd/0VFTjGwJxaH0LkrQWHdgy1rWCOzKKZhXIhdhvQQIHT0ccw/1bcyZB0+X4uIGtO51 DlWfwfqryhADJrpy5/8xz7PX8VG5toM5s6BYRg7r6ygHnXSQKvIpJx8ROfdkuDOlt7C3eY 3RF/Z3XK4Pz8JpPSX6HFeR4Ymea0bXY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996922; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DYd3N3c0Aw6LBISi1oYuZ2lsGo9Y+aGBzcnY+yVesZs=; b=ap5IW0VkrkJgSQAREDwHCSh72fYx/TLfmgXl1dPDqMQN1m/4zfVdYaz7Mim0c1oSVscfYV R1V7I75BbxahvcAg== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 90161A3BBA; Fri, 18 Jun 2021 06:15:22 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 26/70] mxser: remove MOXA_CHKPORTENABLE ioctl Date: Fri, 18 Jun 2021 08:14:32 +0200 Message-Id: <20210618061516.662-27-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org 1) MOXA_CHKPORTENABLE is broken at least since commit ecbbfd44a08f (TTY: move tty buffers to tty_port) in 2012. 2) The ioctl definition was never exposed to userspace, so noone should actually be reliably using this. 3) It's not even mentioned in any of the mxser utilities. Provided the above, remove this mxser-special ioctl. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 38e12ff17529..ebe657426636 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -51,7 +51,6 @@ #define MOXA 0x400 #define MOXA_GETDATACOUNT (MOXA + 23) -#define MOXA_CHKPORTENABLE (MOXA + 60) #define MOXA_HighSpeedOn (MOXA + 61) #define MOXA_GETMSTATUS (MOXA + 65) #define MOXA_SET_OP_MODE (MOXA + 66) @@ -1430,18 +1429,11 @@ static int mxser_ioctl_special(unsigned int cmd, void __user *argp) struct mxser_port *ip; struct tty_port *port; struct tty_struct *tty; - int result, status; + int status; unsigned int i, j; int ret = 0; switch (cmd) { - case MOXA_CHKPORTENABLE: - result = 0; - for (i = 0; i < MXSER_BOARDS; i++) - for (j = 0; j < MXSER_PORTS_PER_BOARD; j++) - if (mxser_boards[i].ports[j].ioaddr) - result |= (1 << i); - return put_user(result, (unsigned long __user *)argp); case MOXA_GETDATACOUNT: /* The receive side is locked by port->slock but it isn't clear that an exact snapshot is worth copying here */ From patchwork Fri Jun 18 06:14:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 464153 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B60ABC49361 for ; Fri, 18 Jun 2021 06:15:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A39E96120A for ; Fri, 18 Jun 2021 06:15:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233175AbhFRGSE (ORCPT ); Fri, 18 Jun 2021 02:18:04 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:46744 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232972AbhFRGRl (ORCPT ); Fri, 18 Jun 2021 02:17:41 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id E0D1D1FDE7; Fri, 18 Jun 2021 06:15:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996922; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=knifx1Wyo/CwkTtpPLHWcfMdFsNclZb01S3JsAqoMRY=; b=PvagUU4+kjDESkKGmXsVd3t7+jp/HhMpyqJ2vfMsrwjYSl2ogTsQXjwHUPrbWZ1dDndNyZ NT8Vy7YuiLUUezRvdt6TUVWKbimPsDXbF17mi+waqgGgvF5DNFRFrL91K9oJTtSnYhnpyG 7ObRH1Csvut2YLW5jxqn4/ypYGyoDWA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996922; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=knifx1Wyo/CwkTtpPLHWcfMdFsNclZb01S3JsAqoMRY=; b=XL4bsrBtOaOIl3EJVk4/pPR0aiPpxDRGUX+h2vWoqBFdAOq1LLVh4QiW04wJintTTCAr1R NtT50Q43jxONdNBw== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id C0CF4A3B9E; Fri, 18 Jun 2021 06:15:22 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 27/70] mxser: remove MOXA_GETDATACOUNT ioctl Date: Fri, 18 Jun 2021 08:14:33 +0200 Message-Id: <20210618061516.662-28-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org 1) MOXA_GETDATACOUNT is broken at least since commit ecbbfd44a08f (TTY: move tty buffers to tty_port) in 2012. Even though it's mentioned in the mon_p moxa utility, obviously noone ever tried that in that timeframe. 2) The ioctl definition was never exposed to userspace, so noone should actually be reliably using this. Provided the above, remove this mxser-special ioctl. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index ebe657426636..9e241f8bd814 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -50,7 +50,6 @@ */ #define MOXA 0x400 -#define MOXA_GETDATACOUNT (MOXA + 23) #define MOXA_HighSpeedOn (MOXA + 61) #define MOXA_GETMSTATUS (MOXA + 65) #define MOXA_SET_OP_MODE (MOXA + 66) @@ -268,12 +267,6 @@ MODULE_DESCRIPTION("MOXA Smartio/Industio Family Multiport Board Device Driver") module_param(ttymajor, int, 0); MODULE_LICENSE("GPL"); -struct mxser_log { - int tick; - unsigned long rxcnt[MXSER_PORTS]; - unsigned long txcnt[MXSER_PORTS]; -}; - struct mxser_board; struct mxser_port { @@ -335,7 +328,6 @@ struct mxser_mstatus { static struct mxser_board mxser_boards[MXSER_BOARDS]; static struct tty_driver *mxvar_sdriver; -static struct mxser_log mxvar_log; static void mxser_enable_must_enchance_mode(unsigned long baseio) { @@ -1431,15 +1423,8 @@ static int mxser_ioctl_special(unsigned int cmd, void __user *argp) struct tty_struct *tty; int status; unsigned int i, j; - int ret = 0; switch (cmd) { - case MOXA_GETDATACOUNT: - /* The receive side is locked by port->slock but it isn't - clear that an exact snapshot is worth copying here */ - if (copy_to_user(argp, &mxvar_log, sizeof(mxvar_log))) - ret = -EFAULT; - return ret; case MOXA_GETMSTATUS: { struct mxser_mstatus ms, __user *msu = argp; for (i = 0; i < MXSER_BOARDS; i++) @@ -1934,8 +1919,6 @@ static u8 mxser_receive_chars(struct tty_struct *tty, if (!mxser_receive_chars_new(tty, port, status, &cnt)) status = mxser_receive_chars_old(tty, port, status, &cnt); - mxvar_log.rxcnt[tty->index] += cnt; - tty_flip_buffer_push(&port->port); return status; @@ -1948,7 +1931,6 @@ static void mxser_transmit_chars(struct tty_struct *tty, struct mxser_port *port if (port->x_char) { outb(port->x_char, port->ioaddr + UART_TX); port->x_char = 0; - mxvar_log.txcnt[tty->index]++; port->icount.tx++; return; } @@ -1974,7 +1956,6 @@ static void mxser_transmit_chars(struct tty_struct *tty, struct mxser_port *port if (--port->xmit_cnt <= 0) break; } while (--count > 0); - mxvar_log.txcnt[tty->index] += (cnt - port->xmit_cnt); port->icount.tx += (cnt - port->xmit_cnt); From patchwork Fri Jun 18 06:14:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 463491 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 355E9C49EA2 for ; Fri, 18 Jun 2021 06:15:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 20824611CD for ; Fri, 18 Jun 2021 06:15:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233184AbhFRGSE (ORCPT ); Fri, 18 Jun 2021 02:18:04 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:46746 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232971AbhFRGRl (ORCPT ); Fri, 18 Jun 2021 02:17:41 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 227DD1FE02; Fri, 18 Jun 2021 06:15:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996923; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GLTnXZ4QUq2WNtmjZk7+V0DJY7p/Dd8KBWBUwF3DW2E=; b=GCh9mPPhaT4PfeQscADxFeC70Ja7BMXkkmetzwe7cKuu3xIDzbRQTLOCCKi5j6PzQDlep3 qCIOv/DDKltpuu3tJMLAdy6GLa13A3Bth7aVDDfzhn6OyEuUqM8bh+JJkiL8MNB+nwIZ80 6c+BYy7oOfrJ22EKayz+9B5lj2wsCeg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996923; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GLTnXZ4QUq2WNtmjZk7+V0DJY7p/Dd8KBWBUwF3DW2E=; b=9DecCV8TBK6/tVI3lFR0deUT0Kgs93k6EQ62RkZQwAcAYYudmMhNjxO1tAOg+XGsH37pX+ X20wkY8RvtpGL5BA== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id EFDC5A3B9E; Fri, 18 Jun 2021 06:15:22 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 28/70] mxser: remove MOXA_GETMSTATUS ioctl Date: Fri, 18 Jun 2021 08:14:34 +0200 Message-Id: <20210618061516.662-29-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org 1) MOXA_GETMSTATUS is broken at least since commit ecbbfd44a08f (TTY: move tty buffers to tty_port) in 2012. Even though it's mentioned in the mon_pa moxa utility, obviously noone ever tried that in that timeframe. 2) The ioctl definition was never exposed to userspace, so noone should actually be reliably using this. Provided the above, remove this mxser-special ioctl. And remove the whole concept of mxser_ioctl_special as this was the last ioctl in there. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 62 +-------------------------------------------- 1 file changed, 1 insertion(+), 61 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 9e241f8bd814..1eb48141d6ca 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -51,7 +51,6 @@ #define MOXA 0x400 #define MOXA_HighSpeedOn (MOXA + 61) -#define MOXA_GETMSTATUS (MOXA + 65) #define MOXA_SET_OP_MODE (MOXA + 66) #define MOXA_GET_OP_MODE (MOXA + 67) @@ -318,14 +317,6 @@ struct mxser_board { struct mxser_port ports[MXSER_PORTS_PER_BOARD]; }; -struct mxser_mstatus { - tcflag_t cflag; - int cts; - int dsr; - int ri; - int dcd; -}; - static struct mxser_board mxser_boards[MXSER_BOARDS]; static struct tty_driver *mxvar_sdriver; @@ -1416,57 +1407,6 @@ static int mxser_tiocmset(struct tty_struct *tty, return 0; } -static int mxser_ioctl_special(unsigned int cmd, void __user *argp) -{ - struct mxser_port *ip; - struct tty_port *port; - struct tty_struct *tty; - int status; - unsigned int i, j; - - switch (cmd) { - case MOXA_GETMSTATUS: { - struct mxser_mstatus ms, __user *msu = argp; - for (i = 0; i < MXSER_BOARDS; i++) - for (j = 0; j < MXSER_PORTS_PER_BOARD; j++) { - ip = &mxser_boards[i].ports[j]; - port = &ip->port; - memset(&ms, 0, sizeof(ms)); - - mutex_lock(&port->mutex); - if (!ip->ioaddr) - goto copy; - - tty = tty_port_tty_get(port); - - if (!tty) - ms.cflag = ip->normal_termios.c_cflag; - else - ms.cflag = tty->termios.c_cflag; - tty_kref_put(tty); - spin_lock_irq(&ip->slock); - status = inb(ip->ioaddr + UART_MSR); - spin_unlock_irq(&ip->slock); - if (status & UART_MSR_DCD) - ms.dcd = 1; - if (status & UART_MSR_DSR) - ms.dsr = 1; - if (status & UART_MSR_CTS) - ms.cts = 1; - copy: - mutex_unlock(&port->mutex); - if (copy_to_user(msu, &ms, sizeof(ms))) - return -EFAULT; - msu++; - } - return 0; - } - default: - return -ENOIOCTLCMD; - } - return 0; -} - static int mxser_cflags_changed(struct mxser_port *info, unsigned long arg, struct async_icount *cprev) { @@ -1497,7 +1437,7 @@ static int mxser_ioctl(struct tty_struct *tty, void __user *argp = (void __user *)arg; if (tty->index == MXSER_PORTS) - return mxser_ioctl_special(cmd, argp); + return -ENOTTY; if (cmd == MOXA_SET_OP_MODE || cmd == MOXA_GET_OP_MODE) { int p; From patchwork Fri Jun 18 06:14:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 463489 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97BDCC49EA4 for ; Fri, 18 Jun 2021 06:15:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 81FAC61396 for ; Fri, 18 Jun 2021 06:15:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233197AbhFRGSH (ORCPT ); Fri, 18 Jun 2021 02:18:07 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:46780 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232997AbhFRGRn (ORCPT ); Fri, 18 Jun 2021 02:17:43 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 48FFD1FE04; Fri, 18 Jun 2021 06:15:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996923; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gXYV3WoE6otUox1ZIh+NXdHRLbvXNs6Ix+bq974Czl8=; b=yGy7ptEiKurqWueVq9tpPftbQOr6gKfoM2UZj8odKMxN8Vvoj9uP8DZ4uxvARaWE8aLUEy q2xp151PxK0FoXp3N/Jb4jBpLzJ/hGZyK9tEg92HsTU+GhcfcUENG1KDgVA1+ip0UO6tYb B9HbgnKfi3qBFOKRd01I+lnBHkmgpbQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996923; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gXYV3WoE6otUox1ZIh+NXdHRLbvXNs6Ix+bq974Czl8=; b=ZFDXGMhtbB4pycwXbsmjBvWsp6eTz1awNbossJOdqcQFIzJOz+Ph3tGDaeRbOscwf5DK1o bwrLNcJm2jHZmJCA== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 24BA0A3BC2; Fri, 18 Jun 2021 06:15:23 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 29/70] mxser: remove MOXA_ASPP_OQUEUE ioctl Date: Fri, 18 Jun 2021 08:14:35 +0200 Message-Id: <20210618061516.662-30-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org 1) The semantics are defined exactly nowhere. 2) The ioctl definition was never exposed to userspace, so noone should actually be reliably using this. 3) It's not even mentioned in any of the mxser utilities. Provided the above, remove this mxser-special ioctl. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 1eb48141d6ca..ca417d9a03cf 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -60,8 +60,6 @@ #define RS485_4WIRE_MODE 3 #define OP_MODE_MASK 3 -#define MOXA_ASPP_OQUEUE (MOXA + 70) - /* --------------------------------------------------- */ /* @@ -1499,17 +1497,6 @@ static int mxser_ioctl(struct tty_struct *tty, mxser_cflags_changed(info, arg, &cnow)); case MOXA_HighSpeedOn: return put_user(info->baud_base != 115200 ? 1 : 0, (int __user *)argp); - case MOXA_ASPP_OQUEUE:{ - int len, lsr; - - len = mxser_chars_in_buffer(tty); - spin_lock_irq(&info->slock); - lsr = inb(info->ioaddr + UART_LSR) & UART_LSR_THRE; - spin_unlock_irq(&info->slock); - len += (lsr ? 0 : 1); - - return put_user(len, (int __user *)argp); - } default: return -ENOIOCTLCMD; } From patchwork Fri Jun 18 06:14:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 464151 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B26FAC49EA3 for ; Fri, 18 Jun 2021 06:15:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A0B59613E1 for ; Fri, 18 Jun 2021 06:15:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232781AbhFRGSF (ORCPT ); Fri, 18 Jun 2021 02:18:05 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:59718 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232974AbhFRGRl (ORCPT ); Fri, 18 Jun 2021 02:17:41 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 80D4F21B6E; Fri, 18 Jun 2021 06:15:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996923; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CXiwtDda8WUvQ1B1TfIDLBye0GpMNWCf5AFEisaaqjY=; b=ll2w8VCWVACIvmIhuJeCn3pTYPYKDaXKZJy+9Nx/wdQhLHkgWNAEdYGlHEn1KcLuZcSXHc YL93IEfsSE5wDZTNvevoqgb+olpgsEJrc4DXDnKaW06YT+pwbYYRRyB7cuLQ0hP/bWhEKk iN8Kd9fdweovljq9/ASqjzSrokOgdxg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996923; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CXiwtDda8WUvQ1B1TfIDLBye0GpMNWCf5AFEisaaqjY=; b=1kQRBSuEXnSwzs1zYs8kKuZXbbXAkAdhrERNMdHhvi0xbC6EapVIcU/a7IttVkmfYiB3TN 84cySdkMiCD+25BQ== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 5AA6BA3BC2; Fri, 18 Jun 2021 06:15:23 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 30/70] mxser: remove MOXA_HighSpeedOn ioctl Date: Fri, 18 Jun 2021 08:14:36 +0200 Message-Id: <20210618061516.662-31-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org 1) The semantics are defined exactly nowhere. 2) The ioctl definition was never exposed to userspace, so noone should actually be reliably using this. 3) It's not even mentioned in any of the mxser utilities. Provided the above, remove this mxser-special ioctl. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index ca417d9a03cf..586fa3575673 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -50,7 +50,6 @@ */ #define MOXA 0x400 -#define MOXA_HighSpeedOn (MOXA + 61) #define MOXA_SET_OP_MODE (MOXA + 66) #define MOXA_GET_OP_MODE (MOXA + 67) @@ -1495,8 +1494,6 @@ static int mxser_ioctl(struct tty_struct *tty, return wait_event_interruptible(info->port.delta_msr_wait, mxser_cflags_changed(info, arg, &cnow)); - case MOXA_HighSpeedOn: - return put_user(info->baud_base != 115200 ? 1 : 0, (int __user *)argp); default: return -ENOIOCTLCMD; } From patchwork Fri Jun 18 06:14:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 463488 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F8C2C48BDF for ; Fri, 18 Jun 2021 06:16:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EEDFE6120A for ; Fri, 18 Jun 2021 06:16:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233235AbhFRGSO (ORCPT ); Fri, 18 Jun 2021 02:18:14 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:58992 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233024AbhFRGRp (ORCPT ); Fri, 18 Jun 2021 02:17:45 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id B80D521B70; Fri, 18 Jun 2021 06:15:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996923; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2JyG/W9XCxU1xTrSTE7jAFbgVcFxPfOrOkYTmv9owc4=; b=CLeMMGfOPe9xQDDy5r3frnti0QwvHz9ALlwzRHrpDt2/FOeRb3LKzhROSVs6QsWKa3LjBV FeLNsvF+KWHFu5i4sTPiPWPNzOf6Wh8HMC0jlIYrsKbdzwDKAmlpnSSLVDH4AosQwqig7W yIQJRF3N7WHCYyaJpbWyAo226Dp8ebQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996923; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2JyG/W9XCxU1xTrSTE7jAFbgVcFxPfOrOkYTmv9owc4=; b=qsQbni0DoG/SQA3m9CUIWNyajTM1oFVwPHVkoIRAC5I7B/6UyDA4JhXNjPZGKp17etiYiW nKiHksMSwu+C3hBw== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 901B1A3B9E; Fri, 18 Jun 2021 06:15:23 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 31/70] mxser: remove cnt from mxser_receive_chars Date: Fri, 18 Jun 2021 08:14:37 +0200 Message-Id: <20210618061516.662-32-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org After the previous ioctls removal, cnt is needed only in mxser_receive_chars_old now. So remove it from mxser_receive_chars and mxser_receive_chars_new and account only in mxser_receive_chars_old. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 586fa3575673..d354c80083fd 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -1743,7 +1743,7 @@ static int mxser_rs_break(struct tty_struct *tty, int break_state) } static bool mxser_receive_chars_new(struct tty_struct *tty, - struct mxser_port *port, u8 status, int *cnt) + struct mxser_port *port, u8 status) { enum mxser_must_hwid hwid = port->board->must_hwid; u8 gdl; @@ -1767,19 +1767,19 @@ static bool mxser_receive_chars_new(struct tty_struct *tty, while (gdl--) { u8 ch = inb(port->ioaddr + UART_RX); tty_insert_flip_char(&port->port, ch, 0); - (*cnt)++; } return true; } static u8 mxser_receive_chars_old(struct tty_struct *tty, - struct mxser_port *port, u8 status, int *cnt) + struct mxser_port *port, u8 status) { enum mxser_must_hwid hwid = port->board->must_hwid; int recv_room = tty->receive_room; int ignored = 0; int max = 256; + int cnt = 0; u8 ch; do { @@ -1814,8 +1814,8 @@ static u8 mxser_receive_chars_old(struct tty_struct *tty, } } tty_insert_flip_char(&port->port, ch, flag); - (*cnt)++; - if (*cnt >= recv_room) { + cnt++; + if (cnt >= recv_room) { if (!port->ldisc_stop_rx) mxser_stoprx(tty); break; @@ -1835,13 +1835,11 @@ static u8 mxser_receive_chars_old(struct tty_struct *tty, static u8 mxser_receive_chars(struct tty_struct *tty, struct mxser_port *port, u8 status) { - int cnt = 0; - if (tty->receive_room == 0 && !port->ldisc_stop_rx) mxser_stoprx(tty); - if (!mxser_receive_chars_new(tty, port, status, &cnt)) - status = mxser_receive_chars_old(tty, port, status, &cnt); + if (!mxser_receive_chars_new(tty, port, status)) + status = mxser_receive_chars_old(tty, port, status); tty_flip_buffer_push(&port->port); From patchwork Fri Jun 18 06:14:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 464150 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97059C49361 for ; Fri, 18 Jun 2021 06:16:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7E9F2613E1 for ; Fri, 18 Jun 2021 06:16:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233214AbhFRGSK (ORCPT ); Fri, 18 Jun 2021 02:18:10 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:46778 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233000AbhFRGRn (ORCPT ); Fri, 18 Jun 2021 02:17:43 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id EECD01FD8F; Fri, 18 Jun 2021 06:15:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996923; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ulMBa5/CPcYovSlxzGo2WYNtkunB+m2puMZs6xaGagU=; b=ndjwHJ59JYZSJArs0ohCI2qoBcULpz57wu2ur/Pbssl8xKXmtOJWAg1YMAqNkuC6vvy6r4 WREWHldZHr+AABVSJ8a0lni4r/Vza6R6oPHAwBPU6jySlFRxOQ8fA+HbWSf4f98UulZ58+ wZxqkJQoIcc6gexJJ96IAB5B0lS7yTo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996923; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ulMBa5/CPcYovSlxzGo2WYNtkunB+m2puMZs6xaGagU=; b=B4buZe94Lq/VYxmZ1G5IvR2H8YqBRdpmmoEJySlpgQkqrn3/TQbOrPi1YssGHzkuJl0EDT LMd20oALhtBROLDQ== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id C690CA3B9E; Fri, 18 Jun 2021 06:15:23 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 32/70] mxser: don't allocate MXSER_PORTS + 1 Date: Fri, 18 Jun 2021 08:14:38 +0200 Message-Id: <20210618061516.662-33-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org The MXSER_PORTS's tty_device is never registered and neither its tty_port instance exists. Hence, it's quite pointless to allocate it. It used to be used for global information fetches via ioctls. We have just removed these as non-existent tty_device+tty_port was exactly the reason to remove the ioctls. It would be peculiar to add this "virtual" port as we require a backing tty_port since commit ecbbfd44a08f (TTY: move tty buffers to tty_port) in 2012. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index d354c80083fd..007137c3b5c9 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -1004,11 +1004,8 @@ static void mxser_shutdown_port(struct tty_port *port) static int mxser_open(struct tty_struct *tty, struct file *filp) { struct mxser_port *info; - int line; + int line = tty->index; - line = tty->index; - if (line == MXSER_PORTS) - return 0; info = &mxser_boards[line / MXSER_PORTS_PER_BOARD].ports[line % MXSER_PORTS_PER_BOARD]; if (!info->ioaddr) return -ENODEV; @@ -1077,7 +1074,7 @@ static void mxser_close(struct tty_struct *tty, struct file *filp) struct mxser_port *info = tty->driver_data; struct tty_port *port = &info->port; - if (tty->index == MXSER_PORTS || info == NULL) + if (info == NULL) return; if (tty_port_close_start(port, tty, filp) == 0) return; @@ -1216,9 +1213,6 @@ static int mxser_get_serial_info(struct tty_struct *tty, struct tty_port *port = &info->port; unsigned int closing_wait, close_delay; - if (tty->index == MXSER_PORTS) - return -ENOTTY; - mutex_lock(&port->mutex); close_delay = jiffies_to_msecs(info->port.close_delay) / 10; @@ -1249,8 +1243,6 @@ static int mxser_set_serial_info(struct tty_struct *tty, unsigned int flags, close_delay, closing_wait; int retval = 0; - if (tty->index == MXSER_PORTS) - return -ENOTTY; if (tty_io_error(tty)) return -EIO; @@ -1354,9 +1346,6 @@ static int mxser_tiocmget(struct tty_struct *tty) unsigned char control, status; unsigned long flags; - - if (tty->index == MXSER_PORTS) - return -ENOIOCTLCMD; if (tty_io_error(tty)) return -EIO; @@ -1381,9 +1370,6 @@ static int mxser_tiocmset(struct tty_struct *tty, struct mxser_port *info = tty->driver_data; unsigned long flags; - - if (tty->index == MXSER_PORTS) - return -ENOIOCTLCMD; if (tty_io_error(tty)) return -EIO; @@ -1433,9 +1419,6 @@ static int mxser_ioctl(struct tty_struct *tty, unsigned long flags; void __user *argp = (void __user *)arg; - if (tty->index == MXSER_PORTS) - return -ENOTTY; - if (cmd == MOXA_SET_OP_MODE || cmd == MOXA_GET_OP_MODE) { int p; unsigned long opmode; @@ -2211,7 +2194,7 @@ static int __init mxser_module_init(void) { int retval; - mxvar_sdriver = alloc_tty_driver(MXSER_PORTS + 1); + mxvar_sdriver = alloc_tty_driver(MXSER_PORTS); if (!mxvar_sdriver) return -ENOMEM; From patchwork Fri Jun 18 06:14:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 464148 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53BCDC49EA2 for ; Fri, 18 Jun 2021 06:16:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3973061154 for ; Fri, 18 Jun 2021 06:16:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233303AbhFRGSY (ORCPT ); Fri, 18 Jun 2021 02:18:24 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:46896 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233032AbhFRGRq (ORCPT ); Fri, 18 Jun 2021 02:17:46 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 26C531FDF8; Fri, 18 Jun 2021 06:15:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996924; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BZTgWQKTNyBlxvsC+cKlY4x8M0AJWY8bYkfXrysDjhk=; b=ysEFrNm94GX71AAKKD60/nhf9nesNbfzAW5sHCUJwnmD0aWoY1LrkAiYxcCOqRB/bkof+v bip660GKN3fczRNlvnqruHZOS4fX4Dmc0rEGrJp/hITcvBGsfxFSrCf5HhMShhrxdizLrs VLizPXwRxSgAixOhF+kcLwb9tyAccSE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996924; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BZTgWQKTNyBlxvsC+cKlY4x8M0AJWY8bYkfXrysDjhk=; b=95QTXCVeT0+DY4aPN7KFw1yMhCTldC8lBVZ4GZVSuEtd3h8rcZgYj9AR3S1iwJ9hEjOw5P 5Nt8AT3V/y3uzzDw== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 0285AA3BA3; Fri, 18 Jun 2021 06:15:23 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 33/70] mxser: drop unused mxser_port::normal_termios Date: Fri, 18 Jun 2021 08:14:39 +0200 Message-Id: <20210618061516.662-34-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org After the previous patches, mxser_port::normal_termios is unused, so time to wave bye-bye. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 007137c3b5c9..e10fbe7270c9 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -297,8 +297,6 @@ struct mxser_port { unsigned int xmit_cnt; int closing; - struct ktermios normal_termios; - spinlock_t slock; }; @@ -2025,7 +2023,6 @@ static int mxser_initbrd(struct mxser_board *brd) info->custom_divisor = info->baud_base * 16; info->port.close_delay = 5 * HZ / 10; info->port.closing_wait = 30 * HZ; - info->normal_termios = mxvar_sdriver->init_termios; spin_lock_init(&info->slock); /* before set INT ISR, disable all int */ From patchwork Fri Jun 18 06:14:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 463487 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7E1DC49361 for ; Fri, 18 Jun 2021 06:16:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AD55A61209 for ; Fri, 18 Jun 2021 06:16:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233242AbhFRGSQ (ORCPT ); Fri, 18 Jun 2021 02:18:16 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:46898 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233033AbhFRGRq (ORCPT ); Fri, 18 Jun 2021 02:17:46 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 615BD1FDFD; Fri, 18 Jun 2021 06:15:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996924; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9vFxXMMvn/v5hxITo4hlF/D6aJyBEU9IXn2dLjh/Lcs=; b=rsUZalgG8gvuQg0L15daU43RUZ2z0CqQKIInpVT/yLe8tC/fOWLgvTXJyv4C6T7xP84S1F TnT7AY+GCDVdMIqygdySEs6mWCSjlY7vhq/4h3Tlz0JjGlz/GGDU26zk6/Kam0VTTdEBii L95sq5oDdBz/JvehewXqqS/Ye/p9AJo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996924; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9vFxXMMvn/v5hxITo4hlF/D6aJyBEU9IXn2dLjh/Lcs=; b=fi4jjY/f5TkyaOsdiq4HS66ZWZRRkwK8dC4D95Wv0I5777Mx6qnCDORj2UyOgDUBDzDQ3T r4GO4VJ5Rnrra5Bw== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 3A710A3B9E; Fri, 18 Jun 2021 06:15:24 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 34/70] mxser: remove unused mxser_port::stop_rx Date: Fri, 18 Jun 2021 08:14:40 +0200 Message-Id: <20210618061516.662-35-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org It's been a long time since mxser_port::stop_rx was abandoned. Remove it. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index e10fbe7270c9..b47b17ec1f12 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -281,7 +281,6 @@ struct mxser_port { u8 IER; /* Interrupt Enable Register */ u8 MCR; /* Modem control register */ - unsigned char stop_rx; unsigned char ldisc_stop_rx; int custom_divisor; @@ -2009,7 +2008,6 @@ static int mxser_initbrd(struct mxser_board *brd) tty_port_init(&info->port); info->port.ops = &mxser_port_ops; info->board = brd; - info->stop_rx = 0; info->ldisc_stop_rx = 0; /* Enhance mode enabled here */ From patchwork Fri Jun 18 06:14:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 464149 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 732E8C48BDF for ; Fri, 18 Jun 2021 06:16:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 617EA61260 for ; Fri, 18 Jun 2021 06:16:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233240AbhFRGSP (ORCPT ); Fri, 18 Jun 2021 02:18:15 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:59874 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233027AbhFRGRq (ORCPT ); Fri, 18 Jun 2021 02:17:46 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 9206221B5C; Fri, 18 Jun 2021 06:15:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996924; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NT3diBbYcYFtW5DOa7+5OM7X7wD11otVgCQ/9tJnmsw=; b=hDutgZwhOJyDeKGgGMpqDd8O1bkJuiT1SePJATJOtLKQuA4yiNvnLJ9IbHf46LCO+xvAPa Kj2SLP/3P3B8IGRhXo06fKWbZC8m/fL0eC71SYLwWr9lVSTOU+cLwPKvnR1yY1FVcSo9Hh 5E+1nwuinnAQUCquc4uVhs2qglGEMGo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996924; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NT3diBbYcYFtW5DOa7+5OM7X7wD11otVgCQ/9tJnmsw=; b=anxs/sGDxO+61xFHguFS+u3tJPvKlQpQSaOZ5fLge/GHRHU9Mq8Wl5VlhinoJvODmZpk78 s7S0WWrkBuQSGIDg== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 72693A3B9E; Fri, 18 Jun 2021 06:15:24 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 35/70] mxser: drop mxser_port::baud_base Date: Fri, 18 Jun 2021 08:14:41 +0200 Message-Id: <20210618061516.662-36-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org It's an once-set constant, so define a macro for the constant (MXSER_BAUD_BASE) and use it in the code instead. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index b47b17ec1f12..204b71c4d1ae 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -156,6 +156,8 @@ #define WAKEUP_CHARS 256 +#define MXSER_BAUD_BASE 921600 + #define PCI_DEVICE_ID_POS104UL 0x1044 #define PCI_DEVICE_ID_CB108 0x1080 #define PCI_DEVICE_ID_CP102UF 0x1023 @@ -274,7 +276,6 @@ struct mxser_port { u8 rx_high_water; u8 rx_low_water; - int baud_base; /* max. speed */ int type; /* UART type */ unsigned char x_char; /* xon/xoff character */ @@ -584,13 +585,13 @@ static int mxser_set_baud(struct tty_struct *tty, speed_t newspd) return -1; if (newspd == 134) { - quot = 2 * info->baud_base / 269; + quot = 2 * MXSER_BAUD_BASE / 269; tty_encode_baud_rate(tty, 134, 134); } else if (newspd) { - quot = info->baud_base / newspd; + quot = MXSER_BAUD_BASE / newspd; if (quot == 0) quot = 1; - baud = info->baud_base/quot; + baud = MXSER_BAUD_BASE / quot; tty_encode_baud_rate(tty, baud, baud); } else { quot = 0; @@ -601,7 +602,7 @@ static int mxser_set_baud(struct tty_struct *tty, speed_t newspd) * u64 domain */ timeout = (u64)info->xmit_fifo_size * HZ * 10 * quot; - do_div(timeout, info->baud_base); + do_div(timeout, MXSER_BAUD_BASE); info->timeout = timeout + HZ / 50; /* Add .02 seconds of slop */ if (quot) { @@ -623,7 +624,7 @@ static int mxser_set_baud(struct tty_struct *tty, speed_t newspd) #ifdef BOTHER if (C_BAUD(tty) == BOTHER) { - quot = info->baud_base % newspd; + quot = MXSER_BAUD_BASE % newspd; quot *= 8; if (quot % newspd > newspd / 2) { quot /= newspd; @@ -1222,7 +1223,7 @@ static int mxser_get_serial_info(struct tty_struct *tty, ss->port = info->ioaddr, ss->irq = info->board->irq, ss->flags = info->port.flags, - ss->baud_base = info->baud_base, + ss->baud_base = MXSER_BAUD_BASE, ss->close_delay = close_delay; ss->closing_wait = closing_wait; ss->custom_divisor = info->custom_divisor, @@ -1263,7 +1264,7 @@ static int mxser_set_serial_info(struct tty_struct *tty, closing_wait = msecs_to_jiffies(closing_wait * 10); if (!capable(CAP_SYS_ADMIN)) { - if ((ss->baud_base != info->baud_base) || + if ((ss->baud_base != MXSER_BAUD_BASE) || (close_delay != info->port.close_delay) || (closing_wait != info->port.closing_wait) || ((ss->flags & ~ASYNC_USR_MASK) != (info->port.flags & ~ASYNC_USR_MASK))) { @@ -1282,7 +1283,7 @@ static int mxser_set_serial_info(struct tty_struct *tty, port->close_delay = close_delay; port->closing_wait = closing_wait; if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST && - (ss->baud_base != info->baud_base || + (ss->baud_base != MXSER_BAUD_BASE || ss->custom_divisor != info->custom_divisor)) { if (ss->custom_divisor == 0) { @@ -2018,7 +2019,7 @@ static int mxser_initbrd(struct mxser_board *brd) process_txrx_fifo(info); - info->custom_divisor = info->baud_base * 16; + info->custom_divisor = MXSER_BAUD_BASE * 16; info->port.close_delay = 5 * HZ / 10; info->port.closing_wait = 30 * HZ; spin_lock_init(&info->slock); @@ -2127,10 +2128,6 @@ static int mxser_probe(struct pci_dev *pdev, outb(0, ioaddress + 0x0c); /* default set to RS232 mode */ } - for (i = 0; i < brd->info->nports; i++) { - brd->ports[i].baud_base = 921600; - } - /* mxser_initbrd will hook ISR. */ retval = mxser_initbrd(brd); if (retval) From patchwork Fri Jun 18 06:14:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 463486 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81CA5C49EA5 for ; Fri, 18 Jun 2021 06:16:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6A72061369 for ; Fri, 18 Jun 2021 06:16:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233319AbhFRGSZ (ORCPT ); Fri, 18 Jun 2021 02:18:25 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:59930 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233036AbhFRGRr (ORCPT ); Fri, 18 Jun 2021 02:17:47 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id CC8B421B63; Fri, 18 Jun 2021 06:15:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996924; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VdHJiYFLEsbDOMQIptWXqcPojbfcv3AmVx69LGNxAPQ=; b=wPO4iVOOpi5QjgLE93oQzht05KVVo/1wbH5aXv+R4ukDAgBjNfVthlcrKaHbYejJetmKaw XRxrVaJgCuV9sd9CbZ9bjfoDluy8GVDoHYwwUgeoH7tqKiufxIdurrnCMN2pagykrNAshe 3PlYoBFJaEVRdlHa/gfKLHBhJJjQRPA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996924; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VdHJiYFLEsbDOMQIptWXqcPojbfcv3AmVx69LGNxAPQ=; b=E2oD3KC8if9ESGFvG93tb1GOImwGPLZNoOA8sN5R9KEEdxnXopnPt74Qy10w4l0r/1bvfs M23mipdXvzYnr4Ag== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id A3F39A3B9E; Fri, 18 Jun 2021 06:15:24 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 36/70] mxser: drop mxser_port::custom_divisor Date: Fri, 18 Jun 2021 08:14:42 +0200 Message-Id: <20210618061516.662-37-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org It's an once-set constant, so define a macro for the constant (MXSER_CUSTOM_DIVISOR) and use it in the code instead. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 204b71c4d1ae..c4ee5cb6952e 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -157,6 +157,7 @@ #define WAKEUP_CHARS 256 #define MXSER_BAUD_BASE 921600 +#define MXSER_CUSTOM_DIVISOR (MXSER_BAUD_BASE * 16) #define PCI_DEVICE_ID_POS104UL 0x1044 #define PCI_DEVICE_ID_CB108 0x1080 @@ -284,8 +285,6 @@ struct mxser_port { unsigned char ldisc_stop_rx; - int custom_divisor; - struct async_icount icount; /* kernel counters for 4 input interrupts */ unsigned int timeout; @@ -1226,7 +1225,7 @@ static int mxser_get_serial_info(struct tty_struct *tty, ss->baud_base = MXSER_BAUD_BASE, ss->close_delay = close_delay; ss->closing_wait = closing_wait; - ss->custom_divisor = info->custom_divisor, + ss->custom_divisor = MXSER_CUSTOM_DIVISOR, mutex_unlock(&port->mutex); return 0; } @@ -1285,7 +1284,7 @@ static int mxser_set_serial_info(struct tty_struct *tty, if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST && (ss->baud_base != MXSER_BAUD_BASE || ss->custom_divisor != - info->custom_divisor)) { + MXSER_CUSTOM_DIVISOR)) { if (ss->custom_divisor == 0) { mutex_unlock(&port->mutex); return -EINVAL; @@ -2019,7 +2018,6 @@ static int mxser_initbrd(struct mxser_board *brd) process_txrx_fifo(info); - info->custom_divisor = MXSER_BAUD_BASE * 16; info->port.close_delay = 5 * HZ / 10; info->port.closing_wait = 30 * HZ; spin_lock_init(&info->slock); From patchwork Fri Jun 18 06:14:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 464145 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8EA9EC49EA2 for ; Fri, 18 Jun 2021 06:16:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7796361260 for ; Fri, 18 Jun 2021 06:16:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233380AbhFRGSf (ORCPT ); Fri, 18 Jun 2021 02:18:35 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:46938 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233056AbhFRGRr (ORCPT ); Fri, 18 Jun 2021 02:17:47 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 077FE1FDFA; Fri, 18 Jun 2021 06:15:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996925; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ARHILmTdoR9Ny5uAo9t9Abt9U5Ou2+Fs0cR+3waViTA=; b=haqDy7N61o79ABvcOep2LDPDJiFlDNMb8OvybahFQCPBXgu13nFBoVdIHKe7d2TdSzURIg CUrMJoaZ8Zxtp/U3rirRxe8d/tEm73rGAmQYIzN65GYnOuwmG5dGG5ZdH3ZNn7PCPv6Duh aGmI6VpcuafMzKkwRZPKG/FNLqTm43g= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996925; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ARHILmTdoR9Ny5uAo9t9Abt9U5Ou2+Fs0cR+3waViTA=; b=IqzyjOTUHhAJxH2lX8p7ele82BFDFfBiFkV7DqMc9O96NzTbGfACvCMGC7fUQcXjFTzB+m vMgYJLs0CpXWqaDQ== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id D49D1A3BA3; Fri, 18 Jun 2021 06:15:24 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 37/70] mxser: cleanup mxser_change_speed Date: Fri, 18 Jun 2021 08:14:43 +0200 Message-Id: <20210618061516.662-38-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org * use UART macros instead of magic constants * let the default case reuse already existing code (CS5 case) Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index c4ee5cb6952e..2a8bbce790f3 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -657,24 +657,23 @@ static void mxser_change_speed(struct tty_struct *tty) /* byte size and parity */ switch (cflag & CSIZE) { + default: case CS5: - cval = 0x00; + cval = UART_LCR_WLEN5; break; case CS6: - cval = 0x01; + cval = UART_LCR_WLEN6; break; case CS7: - cval = 0x02; + cval = UART_LCR_WLEN7; break; case CS8: - cval = 0x03; + cval = UART_LCR_WLEN8; break; - default: - cval = 0x00; - break; /* too keep GCC shut... */ } + if (cflag & CSTOPB) - cval |= 0x04; + cval |= UART_LCR_STOP; if (cflag & PARENB) cval |= UART_LCR_PARITY; if (!(cflag & PARODD)) From patchwork Fri Jun 18 06:14:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 463484 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6DE20C48BDF for ; Fri, 18 Jun 2021 06:16:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 59E9C61154 for ; Fri, 18 Jun 2021 06:16:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233374AbhFRGSe (ORCPT ); Fri, 18 Jun 2021 02:18:34 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:46936 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233057AbhFRGRr (ORCPT ); Fri, 18 Jun 2021 02:17:47 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 42C521FE03; Fri, 18 Jun 2021 06:15:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996925; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/38fEl8txuzOsFqhCfY5k/ViYG1VHu/lJH5AUM9cEJI=; b=ktBvDYAg7rQKKi1XWXmouxAfT8gilnfpqpNDSilD/ysLSW7H2E54HA/IvQ+l0oy4Mz/SkS IEnKoT9w/6+hb47bmoyujWKrGdUAOgZq3a06JsXgJ/AfYbRrcm0jHpaTQS5/o80Lwn1qcc 8L2xQOxgQ08FCduV+1iriEg4cy13nvc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996925; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/38fEl8txuzOsFqhCfY5k/ViYG1VHu/lJH5AUM9cEJI=; b=c0nG0RcWkILrf33sVaLQOSvoXwjefiap6a2FqTMnz6KRfogrXIpCsWIn1NqaFwwjmVRL4m ze6ngA1zR/vUIkAw== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 197E6A3B9E; Fri, 18 Jun 2021 06:15:25 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 38/70] mxser: extract mxser_ioctl_op_mode Date: Fri, 18 Jun 2021 08:14:44 +0200 Message-Id: <20210618061516.662-39-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org This ioctl code sets RS232, RS422 or RS485 mode. Move the code to a separate function (mxser_ioctl_op_mode) with a note that these mxser-special ioctls should be likely replaced eventually by TIOCGRS485 and TIOCSRS485. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 83 ++++++++++++++++++++++++--------------------- 1 file changed, 45 insertions(+), 38 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 2a8bbce790f3..4a584db09494 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -1407,6 +1407,48 @@ static int mxser_cflags_changed(struct mxser_port *info, unsigned long arg, return ret; } +/* We should likely switch to TIOCGRS485/TIOCSRS485. */ +static int mxser_ioctl_op_mode(struct mxser_port *port, int index, bool set, + int __user *u_opmode) +{ + static const unsigned char ModeMask[] = { 0xfc, 0xf3, 0xcf, 0x3f }; + int opmode, p = index % 4; + int shiftbit = p * 2; + unsigned char val, mask; + + if (port->board->must_hwid != MOXA_MUST_MU860_HWID) + return -EFAULT; + + if (set) { + if (get_user(opmode, u_opmode)) + return -EFAULT; + + if (opmode != RS232_MODE && opmode != RS485_2WIRE_MODE && + opmode != RS422_MODE && + opmode != RS485_4WIRE_MODE) + return -EFAULT; + + mask = ModeMask[p]; + + spin_lock_irq(&port->slock); + val = inb(port->opmode_ioaddr); + val &= mask; + val |= (opmode << shiftbit); + outb(val, port->opmode_ioaddr); + spin_unlock_irq(&port->slock); + } else { + spin_lock_irq(&port->slock); + opmode = inb(port->opmode_ioaddr) >> shiftbit; + spin_unlock_irq(&port->slock); + + opmode &= OP_MODE_MASK; + if (put_user(opmode, u_opmode)) + return -EFAULT; + } + + return 0; +} + static int mxser_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { @@ -1415,44 +1457,9 @@ static int mxser_ioctl(struct tty_struct *tty, unsigned long flags; void __user *argp = (void __user *)arg; - if (cmd == MOXA_SET_OP_MODE || cmd == MOXA_GET_OP_MODE) { - int p; - unsigned long opmode; - static unsigned char ModeMask[] = { 0xfc, 0xf3, 0xcf, 0x3f }; - int shiftbit; - unsigned char val, mask; - - if (info->board->must_hwid != MOXA_MUST_MU860_HWID) - return -EFAULT; - - p = tty->index % 4; - if (cmd == MOXA_SET_OP_MODE) { - if (get_user(opmode, (int __user *) argp)) - return -EFAULT; - if (opmode != RS232_MODE && - opmode != RS485_2WIRE_MODE && - opmode != RS422_MODE && - opmode != RS485_4WIRE_MODE) - return -EFAULT; - mask = ModeMask[p]; - shiftbit = p * 2; - spin_lock_irq(&info->slock); - val = inb(info->opmode_ioaddr); - val &= mask; - val |= (opmode << shiftbit); - outb(val, info->opmode_ioaddr); - spin_unlock_irq(&info->slock); - } else { - shiftbit = p * 2; - spin_lock_irq(&info->slock); - opmode = inb(info->opmode_ioaddr) >> shiftbit; - spin_unlock_irq(&info->slock); - opmode &= OP_MODE_MASK; - if (put_user(opmode, (int __user *)argp)) - return -EFAULT; - } - return 0; - } + if (cmd == MOXA_SET_OP_MODE || cmd == MOXA_GET_OP_MODE) + return mxser_ioctl_op_mode(info, tty->index, + cmd == MOXA_SET_OP_MODE, argp); if (cmd != TIOCMIWAIT && tty_io_error(tty)) return -EIO; From patchwork Fri Jun 18 06:14:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 464141 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D948C48BE8 for ; Fri, 18 Jun 2021 06:16:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 465E460FE6 for ; Fri, 18 Jun 2021 06:16:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232841AbhFRGSw (ORCPT ); Fri, 18 Jun 2021 02:18:52 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:46730 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233118AbhFRGRz (ORCPT ); Fri, 18 Jun 2021 02:17:55 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 7986E1FE00; Fri, 18 Jun 2021 06:15:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996925; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rfkwiMcfVfUg3JuOVlfnbb/dw2b1Z6NVGhmaE+vMfEk=; b=bx3pi6UpkFLccnGnEPE1VSut3DpBwEr6IIvNLmzyKO6bJJxjyzP+QptnG0KlHne5ebQyJ5 O0+d182PP9JptG9dVeYwj90CGNDwFjG9UjtyLM847q0NY5NVwDSE7uDXJOIke1qeAj72M4 WIr/C6bLXG/rJeHIKLKdXHfu4gsCIhw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996925; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rfkwiMcfVfUg3JuOVlfnbb/dw2b1Z6NVGhmaE+vMfEk=; b=oTDMWreCzPtjO+kO3POvfCaV8qqntyPr0LiObDv84hPMUG9gzSxJtwMeRZF4n0l+DWp6Do GHNx86tGTJnz1DDQ== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 5181EA3B99; Fri, 18 Jun 2021 06:15:25 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 39/70] mxser: simplify mxser_ioctl_op_mode Date: Fri, 18 Jun 2021 08:14:45 +0200 Message-Id: <20210618061516.662-40-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org * ModeMask local array is just inverted OP_MODE_MASK shifted by shiftbit. Drop this array and use the value directly. * return from the if's true branch and drop 'else' branch by moving the code completely outside the if. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 4a584db09494..e082ae055c39 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -1411,10 +1411,9 @@ static int mxser_cflags_changed(struct mxser_port *info, unsigned long arg, static int mxser_ioctl_op_mode(struct mxser_port *port, int index, bool set, int __user *u_opmode) { - static const unsigned char ModeMask[] = { 0xfc, 0xf3, 0xcf, 0x3f }; int opmode, p = index % 4; int shiftbit = p * 2; - unsigned char val, mask; + u8 val; if (port->board->must_hwid != MOXA_MUST_MU860_HWID) return -EFAULT; @@ -1423,30 +1422,24 @@ static int mxser_ioctl_op_mode(struct mxser_port *port, int index, bool set, if (get_user(opmode, u_opmode)) return -EFAULT; - if (opmode != RS232_MODE && opmode != RS485_2WIRE_MODE && - opmode != RS422_MODE && - opmode != RS485_4WIRE_MODE) - return -EFAULT; - - mask = ModeMask[p]; + if (opmode & ~OP_MODE_MASK) + return -EINVAL; spin_lock_irq(&port->slock); val = inb(port->opmode_ioaddr); - val &= mask; + val &= ~(OP_MODE_MASK << shiftbit); val |= (opmode << shiftbit); outb(val, port->opmode_ioaddr); spin_unlock_irq(&port->slock); - } else { - spin_lock_irq(&port->slock); - opmode = inb(port->opmode_ioaddr) >> shiftbit; - spin_unlock_irq(&port->slock); - opmode &= OP_MODE_MASK; - if (put_user(opmode, u_opmode)) - return -EFAULT; + return 0; } - return 0; + spin_lock_irq(&port->slock); + opmode = inb(port->opmode_ioaddr) >> shiftbit; + spin_unlock_irq(&port->slock); + + return put_user(opmode & OP_MODE_MASK, u_opmode); } static int mxser_ioctl(struct tty_struct *tty, From patchwork Fri Jun 18 06:14:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 464147 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5F63C49EA6 for ; Fri, 18 Jun 2021 06:16:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BFC056120A for ; Fri, 18 Jun 2021 06:16:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232882AbhFRGSZ (ORCPT ); Fri, 18 Jun 2021 02:18:25 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:59016 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233035AbhFRGRq (ORCPT ); Fri, 18 Jun 2021 02:17:46 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id B45B121B5D; Fri, 18 Jun 2021 06:15:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996925; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OSErs93vjO9M14a4sDa8H3yI+ArnDl4hXOYzKvTJMWc=; b=y1qRsJk0A+/lCFs7tPs56/BekIXIH9DsPMumRjBGwd1+kYAYNG655P7DIJhttXH1eiID/e v9RFEpNBdxQc5VljkqBJweyAZmAXD82q1cSuc+tWdghhCQiKGP//mH0+AP8Tq4FECiHMHR YTwJRbWXzvcYLqNsiuhaQijA6GAy1jI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996925; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OSErs93vjO9M14a4sDa8H3yI+ArnDl4hXOYzKvTJMWc=; b=TQiYyY9R+6DcqkL7jYV8xESxHYAVxiLwrVIWiQGaS0JoXLtL1PJ9aK86FhMcVkdjvMv9Ul SrREl7ZmGvgaisBg== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 8C34CA3B99; Fri, 18 Jun 2021 06:15:25 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 40/70] mxser: dedup mxser_must_set_enhance_mode Date: Fri, 18 Jun 2021 08:14:46 +0200 Message-Id: <20210618061516.662-41-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org There are multiple copies of setting the EFR register. Separate it to a new universal function called __mxser_must_set_EFR. And use it in the code by introducing mxser_must_set_enhance_mode instead of mxser_disable_must_enchance_mode and mxser_enable_must_enchance_mode. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index e082ae055c39..7caf369571f1 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -314,34 +314,24 @@ struct mxser_board { static struct mxser_board mxser_boards[MXSER_BOARDS]; static struct tty_driver *mxvar_sdriver; -static void mxser_enable_must_enchance_mode(unsigned long baseio) +static u8 __mxser_must_set_EFR(unsigned long baseio, u8 clear, u8 set, + bool restore_LCR) { - u8 oldlcr; - u8 efr; + u8 oldlcr, efr; oldlcr = inb(baseio + UART_LCR); outb(MOXA_MUST_ENTER_ENCHANCE, baseio + UART_LCR); efr = inb(baseio + MOXA_MUST_EFR_REGISTER); - efr |= MOXA_MUST_EFR_EFRB_ENABLE; + efr &= ~clear; + efr |= set; outb(efr, baseio + MOXA_MUST_EFR_REGISTER); - outb(oldlcr, baseio + UART_LCR); -} - -static void mxser_disable_must_enchance_mode(unsigned long baseio) -{ - u8 oldlcr; - u8 efr; - - oldlcr = inb(baseio + UART_LCR); - outb(MOXA_MUST_ENTER_ENCHANCE, baseio + UART_LCR); - efr = inb(baseio + MOXA_MUST_EFR_REGISTER); - efr &= ~MOXA_MUST_EFR_EFRB_ENABLE; + if (restore_LCR) + outb(oldlcr, baseio + UART_LCR); - outb(efr, baseio + MOXA_MUST_EFR_REGISTER); - outb(oldlcr, baseio + UART_LCR); + return oldlcr; } static void mxser_set_must_xon1_value(unsigned long baseio, u8 value) @@ -431,6 +421,18 @@ static void mxser_get_must_hardware_id(unsigned long baseio, u8 *pId) outb(oldlcr, baseio + UART_LCR); } +static void mxser_must_set_EFR(unsigned long baseio, u8 clear, u8 set) +{ + __mxser_must_set_EFR(baseio, clear, set, true); +} + +static void mxser_must_set_enhance_mode(unsigned long baseio, bool enable) +{ + mxser_must_set_EFR(baseio, + enable ? 0 : MOXA_MUST_EFR_EFRB_ENABLE, + enable ? MOXA_MUST_EFR_EFRB_ENABLE : 0); +} + static void SET_MOXA_MUST_NO_SOFTWARE_FLOW_CONTROL(unsigned long baseio) { u8 oldlcr; @@ -514,7 +516,7 @@ static enum mxser_must_hwid mxser_must_get_hwid(unsigned long io) int i; outb(0, io + UART_LCR); - mxser_disable_must_enchance_mode(io); + mxser_must_set_enhance_mode(io, false); oldmcr = inb(io + UART_MCR); outb(0, io + UART_MCR); mxser_set_must_xon1_value(io, 0x11); @@ -2011,7 +2013,7 @@ static int mxser_initbrd(struct mxser_board *brd) /* Enhance mode enabled here */ if (brd->must_hwid != MOXA_OTHER_UART) - mxser_enable_must_enchance_mode(info->ioaddr); + mxser_must_set_enhance_mode(info->ioaddr, true); info->type = PORT_16550A; From patchwork Fri Jun 18 06:14:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 463485 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50B0CC49361 for ; Fri, 18 Jun 2021 06:16:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3D0B161260 for ; Fri, 18 Jun 2021 06:16:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233364AbhFRGSa (ORCPT ); Fri, 18 Jun 2021 02:18:30 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:59036 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233045AbhFRGRr (ORCPT ); Fri, 18 Jun 2021 02:17:47 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 0457521B62; Fri, 18 Jun 2021 06:15:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996926; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WunEcyMTZztXC8FBdz/qLCvbhxVKGm10rvI3aZg8xgc=; b=IKD9NjDXZG8hh2IhonUKapY1Yb4k2zOwhLougIhLgWFV508BMhDb+CNBxu/mMWo7QowoZe lp5m1GawWPTkSn6zxMuOgitgImfUIb2MD5qXsXJyKxXB3vEOBfZwco3OrVEwMLdzYjlWy9 49ey0ZT3MhVTJiuHphfWUwtujEBYS2U= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996926; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WunEcyMTZztXC8FBdz/qLCvbhxVKGm10rvI3aZg8xgc=; b=phVwfOnheKJ8ILcn0sqy3LE/9n4JYFoZeoSay9Kzxwmdc4s8BQECj/Xx3EZprmFDh71wlf MJOJX3Dh1WUOISCw== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id C7005A3B99; Fri, 18 Jun 2021 06:15:25 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 41/70] mxser: introduce mxser_must_select_bank and use it Date: Fri, 18 Jun 2021 08:14:47 +0200 Message-Id: <20210618061516.662-42-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Again, selecting a bank in the EFR register is duplicated many times. Extract it to a separate function (mxser_must_select_bank) and use it on all the places. This cleans up most of the helpers. And mxser_get_must_hardware_id now returns the HW ID directly, not via a by-reference parameter. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 74 ++++++++++----------------------------------- 1 file changed, 16 insertions(+), 58 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 7caf369571f1..392aee47c803 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -334,53 +334,29 @@ static u8 __mxser_must_set_EFR(unsigned long baseio, u8 clear, u8 set, return oldlcr; } -static void mxser_set_must_xon1_value(unsigned long baseio, u8 value) +static u8 mxser_must_select_bank(unsigned long baseio, u8 bank) { - u8 oldlcr; - u8 efr; - - oldlcr = inb(baseio + UART_LCR); - outb(MOXA_MUST_ENTER_ENCHANCE, baseio + UART_LCR); - - efr = inb(baseio + MOXA_MUST_EFR_REGISTER); - efr &= ~MOXA_MUST_EFR_BANK_MASK; - efr |= MOXA_MUST_EFR_BANK0; + return __mxser_must_set_EFR(baseio, MOXA_MUST_EFR_BANK_MASK, bank, + false); +} - outb(efr, baseio + MOXA_MUST_EFR_REGISTER); +static void mxser_set_must_xon1_value(unsigned long baseio, u8 value) +{ + u8 oldlcr = mxser_must_select_bank(baseio, MOXA_MUST_EFR_BANK0); outb(value, baseio + MOXA_MUST_XON1_REGISTER); outb(oldlcr, baseio + UART_LCR); } static void mxser_set_must_xoff1_value(unsigned long baseio, u8 value) { - u8 oldlcr; - u8 efr; - - oldlcr = inb(baseio + UART_LCR); - outb(MOXA_MUST_ENTER_ENCHANCE, baseio + UART_LCR); - - efr = inb(baseio + MOXA_MUST_EFR_REGISTER); - efr &= ~MOXA_MUST_EFR_BANK_MASK; - efr |= MOXA_MUST_EFR_BANK0; - - outb(efr, baseio + MOXA_MUST_EFR_REGISTER); + u8 oldlcr = mxser_must_select_bank(baseio, MOXA_MUST_EFR_BANK0); outb(value, baseio + MOXA_MUST_XOFF1_REGISTER); outb(oldlcr, baseio + UART_LCR); } static void mxser_set_must_fifo_value(struct mxser_port *info) { - u8 oldlcr; - u8 efr; - - oldlcr = inb(info->ioaddr + UART_LCR); - outb(MOXA_MUST_ENTER_ENCHANCE, info->ioaddr + UART_LCR); - - efr = inb(info->ioaddr + MOXA_MUST_EFR_REGISTER); - efr &= ~MOXA_MUST_EFR_BANK_MASK; - efr |= MOXA_MUST_EFR_BANK1; - - outb(efr, info->ioaddr + MOXA_MUST_EFR_REGISTER); + u8 oldlcr = mxser_must_select_bank(info->ioaddr, MOXA_MUST_EFR_BANK1); outb(info->rx_high_water, info->ioaddr + MOXA_MUST_RBRTH_REGISTER); outb(info->rx_high_water, info->ioaddr + MOXA_MUST_RBRTI_REGISTER); outb(info->rx_low_water, info->ioaddr + MOXA_MUST_RBRTL_REGISTER); @@ -389,36 +365,18 @@ static void mxser_set_must_fifo_value(struct mxser_port *info) static void mxser_set_must_enum_value(unsigned long baseio, u8 value) { - u8 oldlcr; - u8 efr; - - oldlcr = inb(baseio + UART_LCR); - outb(MOXA_MUST_ENTER_ENCHANCE, baseio + UART_LCR); - - efr = inb(baseio + MOXA_MUST_EFR_REGISTER); - efr &= ~MOXA_MUST_EFR_BANK_MASK; - efr |= MOXA_MUST_EFR_BANK2; - - outb(efr, baseio + MOXA_MUST_EFR_REGISTER); + u8 oldlcr = mxser_must_select_bank(baseio, MOXA_MUST_EFR_BANK2); outb(value, baseio + MOXA_MUST_ENUM_REGISTER); outb(oldlcr, baseio + UART_LCR); } -static void mxser_get_must_hardware_id(unsigned long baseio, u8 *pId) +static u8 mxser_get_must_hardware_id(unsigned long baseio) { - u8 oldlcr; - u8 efr; - - oldlcr = inb(baseio + UART_LCR); - outb(MOXA_MUST_ENTER_ENCHANCE, baseio + UART_LCR); - - efr = inb(baseio + MOXA_MUST_EFR_REGISTER); - efr &= ~MOXA_MUST_EFR_BANK_MASK; - efr |= MOXA_MUST_EFR_BANK2; - - outb(efr, baseio + MOXA_MUST_EFR_REGISTER); - *pId = inb(baseio + MOXA_MUST_HWID_REGISTER); + u8 oldlcr = mxser_must_select_bank(baseio, MOXA_MUST_EFR_BANK2); + u8 id = inb(baseio + MOXA_MUST_HWID_REGISTER); outb(oldlcr, baseio + UART_LCR); + + return id; } static void mxser_must_set_EFR(unsigned long baseio, u8 clear, u8 set) @@ -525,7 +483,7 @@ static enum mxser_must_hwid mxser_must_get_hwid(unsigned long io) return MOXA_OTHER_UART; } - mxser_get_must_hardware_id(io, &hwid); + hwid = mxser_get_must_hardware_id(io); for (i = 1; i < UART_INFO_NUM; i++) /* 0 = OTHER_UART */ if (hwid == Gpci_uart_info[i].type) return hwid; From patchwork Fri Jun 18 06:14:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 464146 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6F74C49EA2 for ; Fri, 18 Jun 2021 06:16:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CFE4D613AA for ; Fri, 18 Jun 2021 06:16:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233279AbhFRGSc (ORCPT ); Fri, 18 Jun 2021 02:18:32 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:59974 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233054AbhFRGRr (ORCPT ); Fri, 18 Jun 2021 02:17:47 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 3C0E421B64; Fri, 18 Jun 2021 06:15:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996926; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mN4HxNMJTR2MUbn+I3zPnmQsF2Yg/Zns1X63Wa0iWdE=; b=geDS57rImcbSmyNRvGAOfVTrPAcp981/kOJj5kI5sJM7Pbhef7MEdKwQ5NkjyX0jBgSUGM euS2+YiPODDT15p83gzW1i1N5wgSagg5PRFC1cwf6khjpCtDHUBjV25nWMI0/RfC9evMf4 WH+4jZdcWpM+7d/Trssbf6mSbL3T95A= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996926; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mN4HxNMJTR2MUbn+I3zPnmQsF2Yg/Zns1X63Wa0iWdE=; b=3/Bc0XPF9cP9nlsLpzT4GaK+PTvTJ5JqBpy2o/qE7VqiAupZFMKyqzjIaDcsTKOQHplRwR dzfvgRbyMciGdpCQ== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 0D58DA3B9E; Fri, 18 Jun 2021 06:15:26 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 42/70] mxser: clean up the rest of MUST helpers Date: Fri, 18 Jun 2021 08:14:48 +0200 Message-Id: <20210618061516.662-43-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Clean up the rest of MUST helpers. They all can use the newly added mxser_must_set_EFR. And passing a bool instead of having two functions (_enable+_disable) simplifies the code a lot too. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 97 ++++++--------------------------------------- 1 file changed, 12 insertions(+), 85 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 392aee47c803..ff85a6e15d9d 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -391,81 +391,21 @@ static void mxser_must_set_enhance_mode(unsigned long baseio, bool enable) enable ? MOXA_MUST_EFR_EFRB_ENABLE : 0); } -static void SET_MOXA_MUST_NO_SOFTWARE_FLOW_CONTROL(unsigned long baseio) +static void mxser_must_no_sw_flow_control(unsigned long baseio) { - u8 oldlcr; - u8 efr; - - oldlcr = inb(baseio + UART_LCR); - outb(MOXA_MUST_ENTER_ENCHANCE, baseio + UART_LCR); - - efr = inb(baseio + MOXA_MUST_EFR_REGISTER); - efr &= ~MOXA_MUST_EFR_SF_MASK; - - outb(efr, baseio + MOXA_MUST_EFR_REGISTER); - outb(oldlcr, baseio + UART_LCR); -} - -static void mxser_enable_must_tx_software_flow_control(unsigned long baseio) -{ - u8 oldlcr; - u8 efr; - - oldlcr = inb(baseio + UART_LCR); - outb(MOXA_MUST_ENTER_ENCHANCE, baseio + UART_LCR); - - efr = inb(baseio + MOXA_MUST_EFR_REGISTER); - efr &= ~MOXA_MUST_EFR_SF_TX_MASK; - efr |= MOXA_MUST_EFR_SF_TX1; - - outb(efr, baseio + MOXA_MUST_EFR_REGISTER); - outb(oldlcr, baseio + UART_LCR); -} - -static void mxser_disable_must_tx_software_flow_control(unsigned long baseio) -{ - u8 oldlcr; - u8 efr; - - oldlcr = inb(baseio + UART_LCR); - outb(MOXA_MUST_ENTER_ENCHANCE, baseio + UART_LCR); - - efr = inb(baseio + MOXA_MUST_EFR_REGISTER); - efr &= ~MOXA_MUST_EFR_SF_TX_MASK; - - outb(efr, baseio + MOXA_MUST_EFR_REGISTER); - outb(oldlcr, baseio + UART_LCR); + mxser_must_set_EFR(baseio, MOXA_MUST_EFR_SF_MASK, 0); } -static void mxser_enable_must_rx_software_flow_control(unsigned long baseio) +static void mxser_must_set_tx_sw_flow_control(unsigned long baseio, bool enable) { - u8 oldlcr; - u8 efr; - - oldlcr = inb(baseio + UART_LCR); - outb(MOXA_MUST_ENTER_ENCHANCE, baseio + UART_LCR); - - efr = inb(baseio + MOXA_MUST_EFR_REGISTER); - efr &= ~MOXA_MUST_EFR_SF_RX_MASK; - efr |= MOXA_MUST_EFR_SF_RX1; - - outb(efr, baseio + MOXA_MUST_EFR_REGISTER); - outb(oldlcr, baseio + UART_LCR); + mxser_must_set_EFR(baseio, MOXA_MUST_EFR_SF_TX_MASK, + enable ? MOXA_MUST_EFR_SF_TX1 : 0); } -static void mxser_disable_must_rx_software_flow_control(unsigned long baseio) +static void mxser_must_set_rx_sw_flow_control(unsigned long baseio, bool enable) { - u8 oldlcr; - u8 efr; - - oldlcr = inb(baseio + UART_LCR); - outb(MOXA_MUST_ENTER_ENCHANCE, baseio + UART_LCR); - - efr = inb(baseio + MOXA_MUST_EFR_REGISTER); - efr &= ~MOXA_MUST_EFR_SF_RX_MASK; - - outb(efr, baseio + MOXA_MUST_EFR_REGISTER); - outb(oldlcr, baseio + UART_LCR); + mxser_must_set_EFR(baseio, MOXA_MUST_EFR_SF_RX_MASK, + enable ? MOXA_MUST_EFR_SF_RX1 : 0); } static enum mxser_must_hwid mxser_must_get_hwid(unsigned long io) @@ -746,20 +686,8 @@ static void mxser_change_speed(struct tty_struct *tty) if (info->board->must_hwid) { mxser_set_must_xon1_value(info->ioaddr, START_CHAR(tty)); mxser_set_must_xoff1_value(info->ioaddr, STOP_CHAR(tty)); - if (I_IXON(tty)) { - mxser_enable_must_rx_software_flow_control( - info->ioaddr); - } else { - mxser_disable_must_rx_software_flow_control( - info->ioaddr); - } - if (I_IXOFF(tty)) { - mxser_enable_must_tx_software_flow_control( - info->ioaddr); - } else { - mxser_disable_must_tx_software_flow_control( - info->ioaddr); - } + mxser_must_set_rx_sw_flow_control(info->ioaddr, I_IXON(tty)); + mxser_must_set_tx_sw_flow_control(info->ioaddr, I_IXOFF(tty)); } @@ -946,7 +874,7 @@ static void mxser_shutdown_port(struct tty_port *port) if (info->board->must_hwid) - SET_MOXA_MUST_NO_SOFTWARE_FLOW_CONTROL(info->ioaddr); + mxser_must_no_sw_flow_control(info->ioaddr); spin_unlock_irqrestore(&info->slock, flags); } @@ -1585,8 +1513,7 @@ static void mxser_set_termios(struct tty_struct *tty, struct ktermios *old_termi if (info->board->must_hwid) { spin_lock_irqsave(&info->slock, flags); - mxser_disable_must_rx_software_flow_control( - info->ioaddr); + mxser_must_set_rx_sw_flow_control(info->ioaddr, false); spin_unlock_irqrestore(&info->slock, flags); } From patchwork Fri Jun 18 06:14:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 463483 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96037C48BDF for ; Fri, 18 Jun 2021 06:16:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 81F1A6120A for ; Fri, 18 Jun 2021 06:16:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233390AbhFRGSg (ORCPT ); Fri, 18 Jun 2021 02:18:36 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:59054 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233066AbhFRGRs (ORCPT ); Fri, 18 Jun 2021 02:17:48 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 6258C21B65; Fri, 18 Jun 2021 06:15:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996926; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yA6rnJDBroYZw48I68eobmgJUVc2kvZtUvzdSgX9j4Q=; b=Kmjg4V5bc87TBpFNd1/QTbVvVQoEsLIRWGF2NpD/vMr4wgW8VPWn2+huZxoUPtG3XaUOvi qIEg2ANJHEi/RR+IdAkiyABPgrMjkh2C4iM6myDJbN7QlRDFwr//BkbEzRyvQF+j9yiDsh LD2r6+V1onAAHsQ5qj8QdGB/lJuhvVs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996926; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yA6rnJDBroYZw48I68eobmgJUVc2kvZtUvzdSgX9j4Q=; b=aDo4TKobZ+VBmM5PZZ+HZB8i9RfQSak7K1cQgyp3VLYRO7Ffhpkq6+NBc2uxI0lmBiwBqe k8uGfWw2Vxl7FPAA== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 42E77A3BB2; Fri, 18 Jun 2021 06:15:26 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 43/70] mxser: move board init into mxser_initbrd Date: Fri, 18 Jun 2021 08:14:49 +0200 Message-Id: <20210618061516.662-44-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org What's done in ->probe for board is actually its initialization. So move it to mxser_initbrd where it belongs. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 53 ++++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index ff85a6e15d9d..3b20eb96d788 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -1888,9 +1888,36 @@ static int mxser_initbrd(struct mxser_board *brd) struct mxser_port *info; unsigned int i; int retval; + bool is_mu860; + + brd->must_hwid = mxser_must_get_hwid(brd->ports[0].ioaddr); + is_mu860 = brd->must_hwid == MOXA_MUST_MU860_HWID; + + for (i = 0; i < UART_INFO_NUM; i++) { + if (Gpci_uart_info[i].type == brd->must_hwid) { + brd->max_baud = Gpci_uart_info[i].max_baud; + + /* exception....CP-102 */ + if (brd->info->flags & MXSER_HIGHBAUD) + brd->max_baud = 921600; + break; + } + } + + if (is_mu860) { + /* set to RS232 mode by default */ + outb(0, brd->vector + 4); + outb(0, brd->vector + 0x0c); + } for (i = 0; i < brd->info->nports; i++) { info = &brd->ports[i]; + if (is_mu860) { + if (i < 4) + info->opmode_ioaddr = brd->vector + 4; + else + info->opmode_ioaddr = brd->vector + 0x0c; + } tty_port_init(&info->port); info->port.ops = &mxser_port_ops; info->board = brd; @@ -1941,7 +1968,7 @@ static int mxser_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { struct mxser_board *brd; - unsigned int i, j; + unsigned int i; unsigned long ioaddress; struct device *tty_dev; int retval = -EINVAL; @@ -1988,30 +2015,6 @@ static int mxser_probe(struct pci_dev *pdev, /* irq */ brd->irq = pdev->irq; - brd->must_hwid = mxser_must_get_hwid(brd->ports[0].ioaddr); - - for (j = 0; j < UART_INFO_NUM; j++) { - if (Gpci_uart_info[j].type == brd->must_hwid) { - brd->max_baud = Gpci_uart_info[j].max_baud; - - /* exception....CP-102 */ - if (brd->info->flags & MXSER_HIGHBAUD) - brd->max_baud = 921600; - break; - } - } - - if (brd->must_hwid == MOXA_MUST_MU860_HWID) { - for (i = 0; i < brd->info->nports; i++) { - if (i < 4) - brd->ports[i].opmode_ioaddr = ioaddress + 4; - else - brd->ports[i].opmode_ioaddr = ioaddress + 0x0c; - } - outb(0, ioaddress + 4); /* default set to RS232 mode */ - outb(0, ioaddress + 0x0c); /* default set to RS232 mode */ - } - /* mxser_initbrd will hook ISR. */ retval = mxser_initbrd(brd); if (retval) From patchwork Fri Jun 18 06:14:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 464138 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 402EAC49EA5 for ; Fri, 18 Jun 2021 06:16:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 22353611CD for ; Fri, 18 Jun 2021 06:16:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233573AbhFRGS4 (ORCPT ); Fri, 18 Jun 2021 02:18:56 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:47228 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233122AbhFRGRz (ORCPT ); Fri, 18 Jun 2021 02:17:55 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 982EE1FE0B; Fri, 18 Jun 2021 06:15:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996926; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Y4iMzWqsiH2FEa13Mieof0vval3USLIYyoGx4LCtHrA=; b=NeXs5VxDqCIxfk/qB2d1xcio2WzFHwu9hNXl3Ag9uVVM3p6iV8n/5HC4h6iHh1HKa5tURH kdyQbKYNjsodGF/T13DQuhHUnfY0TMgOuwLDD9m9TeCxdpnmJdW2oFqEKRUyrAAvvuFM/+ +6GAbYky5XPvu+jEKDGbybyE+wySIxI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996926; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Y4iMzWqsiH2FEa13Mieof0vval3USLIYyoGx4LCtHrA=; b=SNC3G7LG9PpOG1Xk37sfQ7xvMThuRKf1jB5XOirmDrk5eGbxGxNK2NOJEywgfpxdWrDqJY xn1fIoyKdBzA3yCQ== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 6FEE5A3BB2; Fri, 18 Jun 2021 06:15:26 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 44/70] mxser: inline mxser_board_remove into mxser_remove Date: Fri, 18 Jun 2021 08:14:50 +0200 Message-Id: <20210618061516.662-45-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org The only user of mxser_board_remove is mxser_remove. Move there those few lines. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 3b20eb96d788..196750676400 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -1953,17 +1953,6 @@ static int mxser_initbrd(struct mxser_board *brd) return retval; } -static void mxser_board_remove(struct mxser_board *brd) -{ - unsigned int i; - - for (i = 0; i < brd->info->nports; i++) { - tty_unregister_device(mxvar_sdriver, brd->idx + i); - tty_port_destroy(&brd->ports[i].port); - } - free_irq(brd->irq, brd); -} - static int mxser_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { @@ -2053,8 +2042,14 @@ static int mxser_probe(struct pci_dev *pdev, static void mxser_remove(struct pci_dev *pdev) { struct mxser_board *brd = pci_get_drvdata(pdev); + unsigned int i; + + for (i = 0; i < brd->info->nports; i++) { + tty_unregister_device(mxvar_sdriver, brd->idx + i); + tty_port_destroy(&brd->ports[i].port); + } - mxser_board_remove(brd); + free_irq(brd->irq, brd); pci_release_region(pdev, 2); pci_release_region(pdev, 3); From patchwork Fri Jun 18 06:14:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 464139 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2839C49EA4 for ; Fri, 18 Jun 2021 06:16:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C89E06112D for ; Fri, 18 Jun 2021 06:16:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233564AbhFRGSz (ORCPT ); Fri, 18 Jun 2021 02:18:55 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:47242 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233129AbhFRGRz (ORCPT ); Fri, 18 Jun 2021 02:17:55 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id BE6541FDF4; Fri, 18 Jun 2021 06:15:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996926; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=69VkPmomv6jEhRvNGak5sOcsu55PwvFOz0PO27Q7kMM=; b=nWEn5nWD/exF1e7gVvIYwi4GnvkXfwFvEVittcxcAnPVh2uOSYtRlbJDOYFSa/gBsdE9C4 ntRnNTz18zAGhoaZsUlbPv+a9ZivJ4dqusrq+0KGfa3ywpGPrC8TcupqHebC0ty0MC4oAM 5ta5KLkFVx1JeKDt3xlvWTUommq6wPA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996926; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=69VkPmomv6jEhRvNGak5sOcsu55PwvFOz0PO27Q7kMM=; b=KMgAtb1xCMMfrsnJLx4GDT0YMS1VODpi2GAI2N31QlgiDPA+n8GBb8hgGTpf/B88SsR2vY /nnwRys/MCxgGbDg== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id A12C8A3B9D; Fri, 18 Jun 2021 06:15:26 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 45/70] mxser: pci, switch to managed resources Date: Fri, 18 Jun 2021 08:14:51 +0200 Message-Id: <20210618061516.662-46-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Switch to managed resources for PCI using pcim_enable_device. Regions and device disabling is now taken care of by the core and we need not unwind. Neither in ->probe, nor in ->remove. That simplifies the code. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 196750676400..be58ee025180 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -1978,7 +1978,7 @@ static int mxser_probe(struct pci_dev *pdev, mxser_cards[ent->driver_data].name, pdev->bus->number, PCI_SLOT(pdev->devfn)); - retval = pci_enable_device(pdev); + retval = pcim_enable_device(pdev); if (retval) { dev_err(&pdev->dev, "PCI enable failed\n"); goto err; @@ -1988,7 +1988,7 @@ static int mxser_probe(struct pci_dev *pdev, ioaddress = pci_resource_start(pdev, 2); retval = pci_request_region(pdev, 2, "mxser(IO)"); if (retval) - goto err_dis; + goto err; brd->info = &mxser_cards[ent->driver_data]; for (i = 0; i < brd->info->nports; i++) @@ -2007,7 +2007,7 @@ static int mxser_probe(struct pci_dev *pdev, /* mxser_initbrd will hook ISR. */ retval = mxser_initbrd(brd); if (retval) - goto err_rel3; + goto err_zero; for (i = 0; i < brd->info->nports; i++) { tty_dev = tty_port_register_device(&brd->ports[i].port, @@ -2028,13 +2028,8 @@ static int mxser_probe(struct pci_dev *pdev, for (i = 0; i < brd->info->nports; i++) tty_port_destroy(&brd->ports[i].port); free_irq(brd->irq, brd); -err_rel3: - pci_release_region(pdev, 3); err_zero: brd->info = NULL; - pci_release_region(pdev, 2); -err_dis: - pci_disable_device(pdev); err: return retval; } @@ -2051,9 +2046,6 @@ static void mxser_remove(struct pci_dev *pdev) free_irq(brd->irq, brd); - pci_release_region(pdev, 2); - pci_release_region(pdev, 3); - pci_disable_device(pdev); brd->info = NULL; } From patchwork Fri Jun 18 06:14:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 463482 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31431C48BDF for ; Fri, 18 Jun 2021 06:16:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 180E260FDC for ; Fri, 18 Jun 2021 06:16:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233469AbhFRGSi (ORCPT ); Fri, 18 Jun 2021 02:18:38 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:60014 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233069AbhFRGRt (ORCPT ); Fri, 18 Jun 2021 02:17:49 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 02A2E21B67; Fri, 18 Jun 2021 06:15:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996927; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mGMD3H2lAY5hTmQAamXpl3LCnLNkoyWme0TfBd7R0J8=; b=FXnIuhCMO9YC1uFqGae2hetjH0P1x8WFAbj9OgrYUw/9w4Sk1eXBx09EwxrmvQs9/6lLEL vnsZ1FapK/Vc4j2c23IAIK7Iyqus+n0W1vCeue/k+xOt/I2mELxAKKbU95PehxRbCtJPWE wU6hvtw2tyjCkdh/ZvTF5XtuJWZoyzo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996927; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mGMD3H2lAY5hTmQAamXpl3LCnLNkoyWme0TfBd7R0J8=; b=FgfLzAnPMFLkx70Uu3gGPCPmjmSb4klQGyrbea6apUQerXKwHk1dkAVMeH7/ZQ0l7p9hJ0 YbpI9Ig2RXJAGAAw== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id CFB3EA3B9D; Fri, 18 Jun 2021 06:15:26 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 46/70] mxser: move request irq to probe and switch to managed Date: Fri, 18 Jun 2021 08:14:52 +0200 Message-Id: <20210618061516.662-47-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Move request_irq from mxser_initbrd to mxser_probe so that we can switch it to managed request. It simplifies the cleanup code. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index be58ee025180..83c795acdb19 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -1883,11 +1883,10 @@ static const struct tty_port_operations mxser_port_ops = { * The MOXA Smartio/Industio serial driver boot-time initialization code! */ -static int mxser_initbrd(struct mxser_board *brd) +static void mxser_initbrd(struct mxser_board *brd) { struct mxser_port *info; unsigned int i; - int retval; bool is_mu860; brd->must_hwid = mxser_must_get_hwid(brd->ports[0].ioaddr); @@ -1939,18 +1938,6 @@ static int mxser_initbrd(struct mxser_board *brd) outb(inb(info->ioaddr + UART_IER) & 0xf0, info->ioaddr + UART_IER); } - - retval = request_irq(brd->irq, mxser_interrupt, IRQF_SHARED, "mxser", - brd); - if (retval) { - for (i = 0; i < brd->info->nports; i++) - tty_port_destroy(&brd->ports[i].port); - printk(KERN_ERR "Board %s: Request irq failed, IRQ (%d) may " - "conflict with another device.\n", - brd->info->name, brd->irq); - } - - return retval; } static int mxser_probe(struct pci_dev *pdev, @@ -2004,10 +1991,14 @@ static int mxser_probe(struct pci_dev *pdev, /* irq */ brd->irq = pdev->irq; - /* mxser_initbrd will hook ISR. */ - retval = mxser_initbrd(brd); - if (retval) - goto err_zero; + mxser_initbrd(brd); + + retval = devm_request_irq(&pdev->dev, brd->irq, mxser_interrupt, + IRQF_SHARED, "mxser", brd); + if (retval) { + dev_err(&pdev->dev, "request irq failed"); + goto err_relbrd; + } for (i = 0; i < brd->info->nports; i++) { tty_dev = tty_port_register_device(&brd->ports[i].port, @@ -2027,7 +2018,6 @@ static int mxser_probe(struct pci_dev *pdev, err_relbrd: for (i = 0; i < brd->info->nports; i++) tty_port_destroy(&brd->ports[i].port); - free_irq(brd->irq, brd); err_zero: brd->info = NULL; err: @@ -2044,8 +2034,6 @@ static void mxser_remove(struct pci_dev *pdev) tty_port_destroy(&brd->ports[i].port); } - free_irq(brd->irq, brd); - brd->info = NULL; } From patchwork Fri Jun 18 06:14:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 464143 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D99AC48BE8 for ; Fri, 18 Jun 2021 06:16:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E4B5661154 for ; Fri, 18 Jun 2021 06:16:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233098AbhFRGSj (ORCPT ); Fri, 18 Jun 2021 02:18:39 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:60022 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233072AbhFRGRt (ORCPT ); Fri, 18 Jun 2021 02:17:49 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 34B9921B68; Fri, 18 Jun 2021 06:15:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996927; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7Fy+e40HDa05bl2nXX0rRImWiTqxnJ4Lz3oLdTWrgt8=; b=A+USDCEK9OQDlD5MmyAIuXWmam2smwh/xIwL28b5iz95dfqSiOvEZJQDiriKf3CfyJgf5w 3I3oAub/LK1GUSpOqsCW0NgCA03Zhy/A3/6iv9q0V4znbAX7tI9P8mdI5NSzN8VEdoLaxD GLC/zFcaNOpumP5RCgdVfT0uVUZR+ds= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996927; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7Fy+e40HDa05bl2nXX0rRImWiTqxnJ4Lz3oLdTWrgt8=; b=upbi8hC0a/tQ2SnY804gJTKhavGqYy86FKjF99R/v33yTR80xCWU1VjpiTDrIUiqFCA/Sd RKFSsu5F9atbe6AQ== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 0CF67A3B9D; Fri, 18 Jun 2021 06:15:27 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 47/70] mxser: remove info message from probe Date: Fri, 18 Jun 2021 08:14:53 +0200 Message-Id: <20210618061516.662-48-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org There is a dev_info in ->probe which prints device's name, bus and slot numbers. All these can be fetched from the lspci output. So remove this useless print. This eliminates the whole mxser_cardinfo::name field. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 56 +++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 30 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 83c795acdb19..04a39c1f13bb 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -190,38 +190,37 @@ static const struct { #define UART_INFO_NUM ARRAY_SIZE(Gpci_uart_info) struct mxser_cardinfo { - char *name; unsigned int nports; unsigned int flags; }; static const struct mxser_cardinfo mxser_cards[] = { -/* 0*/ { "C168H/PCI series", 8, }, - { "C104H/PCI series", 4, }, - { "CP-132 series", 2, }, - { "CP-114 series", 4, }, - { "CT-114 series", 4, }, -/* 5*/ { "CP-102 series", 2, MXSER_HIGHBAUD }, - { "CP-104U series", 4, }, - { "CP-168U series", 8, }, - { "CP-132U series", 2, }, - { "CP-134U series", 4, }, -/*10*/ { "CP-104JU series", 4, }, - { "Moxa UC7000 Serial", 8, }, /* RC7000 */ - { "CP-118U series", 8, }, - { "CP-102UL series", 2, }, - { "CP-102U series", 2, }, -/*15*/ { "CP-118EL series", 8, }, - { "CP-168EL series", 8, }, - { "CP-104EL series", 4, }, - { "CB-108 series", 8, }, - { "CB-114 series", 4, }, -/*20*/ { "CB-134I series", 4, }, - { "CP-138U series", 8, }, - { "POS-104UL series", 4, }, - { "CP-114UL series", 4, }, - { "CP-102UF series", 2, }, -/*25*/ { "CP-112UL series", 2, }, +/* 0*/ { 8, }, + { 4, }, + { 2, }, + { 4, }, + { 4, }, +/* 5*/ { 2, MXSER_HIGHBAUD }, + { 4, }, + { 8, }, + { 2, }, + { 4, }, +/*10*/ { 4, }, + { 8, }, /* RC7000 */ + { 8, }, + { 2, }, + { 2, }, +/*15*/ { 8, }, + { 8, }, + { 4, }, + { 8, }, + { 4, }, +/*20*/ { 4, }, + { 8, }, + { 4, }, + { 4, }, + { 2, }, +/*25*/ { 2, }, }; /* driver_data correspond to the lines in the structure above @@ -1961,9 +1960,6 @@ static int mxser_probe(struct pci_dev *pdev, brd = &mxser_boards[i]; brd->idx = i * MXSER_PORTS_PER_BOARD; - dev_info(&pdev->dev, "found MOXA %s board (BusNo=%d, DevNo=%d)\n", - mxser_cards[ent->driver_data].name, - pdev->bus->number, PCI_SLOT(pdev->devfn)); retval = pcim_enable_device(pdev); if (retval) { From patchwork Fri Jun 18 06:14:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 463479 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, UNWANTED_LANGUAGE_BODY,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BAB21C48BDF for ; Fri, 18 Jun 2021 06:16:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A8E1A611CD for ; Fri, 18 Jun 2021 06:16:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232967AbhFRGSx (ORCPT ); Fri, 18 Jun 2021 02:18:53 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:46728 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232935AbhFRGRz (ORCPT ); Fri, 18 Jun 2021 02:17:55 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 5DDDD1FE07; Fri, 18 Jun 2021 06:15:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996927; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=q3y0/IFp2CiRPkh2A4x+A3iEwUH8AU+BFHPdO+95c54=; b=PVWIk455NY9c8iMLWnVA0om8MhYw7UnmLxRDW2uLpL26KNAR3QvEL40htnn29IOedQvWYy ADJ+0Tn/7PjVrY/Gu4ucUNqQZqMUdBrK0QUPLgSRP1l+ZPYLBOO0jGl1prXgM37gePFMvt e1I/osQpnsBUKs2K2w1eWRVDrBnq+2M= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996927; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=q3y0/IFp2CiRPkh2A4x+A3iEwUH8AU+BFHPdO+95c54=; b=bnLUN/ON+agpnPyYnvwpzXbn2G+mCWVcQECbUyZ4fjOmAC/+T5RkgeIRkUJWScvEeCDSS/ h7neUHA1KxRvZDBw== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 41013A3B9D; Fri, 18 Jun 2021 06:15:27 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 48/70] mxser: remove mxser_cardinfo Date: Fri, 18 Jun 2021 08:14:54 +0200 Message-Id: <20210618061516.662-49-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Now that mxser_cards array (of struct mxser_cardinfo) contains only port count and a quirk, we can encode these two directly into pci_device_id::driver_data. And we can remove this struct completely. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 113 ++++++++++++++++---------------------------- 1 file changed, 41 insertions(+), 72 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 04a39c1f13bb..bb4110d466cb 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -168,7 +168,8 @@ #define PCI_DEVICE_ID_CB134I 0x1341 #define PCI_DEVICE_ID_CP138U 0x1380 -#define MXSER_HIGHBAUD 1 +#define MXSER_NPORTS(ddata) ((ddata) & 0xffU) +#define MXSER_HIGHBAUD 0x0100 enum mxser_must_hwid { MOXA_OTHER_UART = 0x00, @@ -189,69 +190,36 @@ static const struct { }; #define UART_INFO_NUM ARRAY_SIZE(Gpci_uart_info) -struct mxser_cardinfo { - unsigned int nports; - unsigned int flags; -}; - -static const struct mxser_cardinfo mxser_cards[] = { -/* 0*/ { 8, }, - { 4, }, - { 2, }, - { 4, }, - { 4, }, -/* 5*/ { 2, MXSER_HIGHBAUD }, - { 4, }, - { 8, }, - { 2, }, - { 4, }, -/*10*/ { 4, }, - { 8, }, /* RC7000 */ - { 8, }, - { 2, }, - { 2, }, -/*15*/ { 8, }, - { 8, }, - { 4, }, - { 8, }, - { 4, }, -/*20*/ { 4, }, - { 8, }, - { 4, }, - { 4, }, - { 2, }, -/*25*/ { 2, }, -}; /* driver_data correspond to the lines in the structure above see also ISA probe function before you change something */ static const struct pci_device_id mxser_pcibrds[] = { - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_C168), .driver_data = 0 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_C104), .driver_data = 1 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_C168), .driver_data = 8 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_C104), .driver_data = 4 }, { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP132), .driver_data = 2 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP114), .driver_data = 3 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP114), .driver_data = 4 }, { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CT114), .driver_data = 4 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP102), .driver_data = 5 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP104U), .driver_data = 6 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP168U), .driver_data = 7 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP132U), .driver_data = 8 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP134U), .driver_data = 9 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP104JU),.driver_data = 10 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_RC7000), .driver_data = 11 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP118U), .driver_data = 12 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP102UL),.driver_data = 13 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP102U), .driver_data = 14 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP118EL),.driver_data = 15 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP168EL),.driver_data = 16 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP104EL),.driver_data = 17 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CB108), .driver_data = 18 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CB114), .driver_data = 19 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CB134I), .driver_data = 20 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CP138U), .driver_data = 21 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_POS104UL), .driver_data = 22 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CP114UL), .driver_data = 23 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CP102UF), .driver_data = 24 }, - { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CP112UL), .driver_data = 25 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP102), .driver_data = 2 | MXSER_HIGHBAUD }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP104U), .driver_data = 4 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP168U), .driver_data = 8 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP132U), .driver_data = 2 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP134U), .driver_data = 4 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP104JU),.driver_data = 4 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_RC7000), .driver_data = 8 }, /* RC7000 */ + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP118U), .driver_data = 8 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP102UL),.driver_data = 2 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP102U), .driver_data = 2 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP118EL),.driver_data = 8 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP168EL),.driver_data = 8 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP104EL),.driver_data = 4 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CB108), .driver_data = 8 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CB114), .driver_data = 4 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CB134I), .driver_data = 4 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CP138U), .driver_data = 8 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_POS104UL), .driver_data = 4 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CP114UL), .driver_data = 4 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CP102UF), .driver_data = 2 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CP112UL), .driver_data = 2 }, { } }; MODULE_DEVICE_TABLE(pci, mxser_pcibrds); @@ -300,8 +268,8 @@ struct mxser_port { struct mxser_board { unsigned int idx; + unsigned short nports; int irq; - const struct mxser_cardinfo *info; unsigned long vector; enum mxser_must_hwid must_hwid; @@ -1816,7 +1784,7 @@ static irqreturn_t mxser_interrupt(int irq, void *dev_id) struct mxser_board *brd = dev_id; struct mxser_port *port; unsigned int int_cnt, pass_counter = 0; - unsigned int i, max = brd->info->nports; + unsigned int i, max = brd->nports; int handled = IRQ_NONE; u8 irqbits, bits, mask = BIT(max) - 1; @@ -1882,7 +1850,7 @@ static const struct tty_port_operations mxser_port_ops = { * The MOXA Smartio/Industio serial driver boot-time initialization code! */ -static void mxser_initbrd(struct mxser_board *brd) +static void mxser_initbrd(struct mxser_board *brd, bool high_baud) { struct mxser_port *info; unsigned int i; @@ -1896,7 +1864,7 @@ static void mxser_initbrd(struct mxser_board *brd) brd->max_baud = Gpci_uart_info[i].max_baud; /* exception....CP-102 */ - if (brd->info->flags & MXSER_HIGHBAUD) + if (high_baud) brd->max_baud = 921600; break; } @@ -1908,7 +1876,7 @@ static void mxser_initbrd(struct mxser_board *brd) outb(0, brd->vector + 0x0c); } - for (i = 0; i < brd->info->nports; i++) { + for (i = 0; i < brd->nports; i++) { info = &brd->ports[i]; if (is_mu860) { if (i < 4) @@ -1945,11 +1913,12 @@ static int mxser_probe(struct pci_dev *pdev, struct mxser_board *brd; unsigned int i; unsigned long ioaddress; + unsigned short nports = MXSER_NPORTS(ent->driver_data); struct device *tty_dev; int retval = -EINVAL; for (i = 0; i < MXSER_BOARDS; i++) - if (mxser_boards[i].info == NULL) + if (mxser_boards[i].nports == 0) break; if (i >= MXSER_BOARDS) { @@ -1973,8 +1942,8 @@ static int mxser_probe(struct pci_dev *pdev, if (retval) goto err; - brd->info = &mxser_cards[ent->driver_data]; - for (i = 0; i < brd->info->nports; i++) + brd->nports = nports; + for (i = 0; i < nports; i++) brd->ports[i].ioaddr = ioaddress + 8 * i; /* vector */ @@ -1987,7 +1956,7 @@ static int mxser_probe(struct pci_dev *pdev, /* irq */ brd->irq = pdev->irq; - mxser_initbrd(brd); + mxser_initbrd(brd, ent->driver_data & MXSER_HIGHBAUD); retval = devm_request_irq(&pdev->dev, brd->irq, mxser_interrupt, IRQF_SHARED, "mxser", brd); @@ -1996,7 +1965,7 @@ static int mxser_probe(struct pci_dev *pdev, goto err_relbrd; } - for (i = 0; i < brd->info->nports; i++) { + for (i = 0; i < nports; i++) { tty_dev = tty_port_register_device(&brd->ports[i].port, mxvar_sdriver, brd->idx + i, &pdev->dev); if (IS_ERR(tty_dev)) { @@ -2012,10 +1981,10 @@ static int mxser_probe(struct pci_dev *pdev, return 0; err_relbrd: - for (i = 0; i < brd->info->nports; i++) + for (i = 0; i < nports; i++) tty_port_destroy(&brd->ports[i].port); err_zero: - brd->info = NULL; + brd->nports = 0; err: return retval; } @@ -2025,12 +1994,12 @@ static void mxser_remove(struct pci_dev *pdev) struct mxser_board *brd = pci_get_drvdata(pdev); unsigned int i; - for (i = 0; i < brd->info->nports; i++) { + for (i = 0; i < brd->nports; i++) { tty_unregister_device(mxvar_sdriver, brd->idx + i); tty_port_destroy(&brd->ports[i].port); } - brd->info = NULL; + brd->nports = 0; } static struct pci_driver mxser_driver = { From patchwork Fri Jun 18 06:14:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 464144 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6CBEC49EA2 for ; Fri, 18 Jun 2021 06:16:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BDE6D6120A for ; Fri, 18 Jun 2021 06:16:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233089AbhFRGSh (ORCPT ); Fri, 18 Jun 2021 02:18:37 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:59074 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232846AbhFRGRs (ORCPT ); Fri, 18 Jun 2021 02:17:48 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 935B321B6A; Fri, 18 Jun 2021 06:15:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996927; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6+EellicTsqi+obK/4cr/ZZtT3Qc7mWagnt2gFZfGkg=; b=y/XpAbF5eS34fnY2R3wGtmn3D+WZ1w1qnzUK3tH5rMyW7znjkeYmSbcD/K4T74OGWBiTB2 BQCdMHE0f/hlyFrDOJpjmNCR3JOWKhp76f3Xe/GDUFHwy36HwQpNvNuj2Z3IKlRrqpRoNN /Wvcit1Uh4L/6CYtN9ErCd3UiW0UQXE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996927; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6+EellicTsqi+obK/4cr/ZZtT3Qc7mWagnt2gFZfGkg=; b=Z8qkJrGQisnRe4HvL05ZE14smd8QPMt4B6sXqZyHPfU/axV/FPyABu0WH7/I0A8wnTEPwZ J9cwpYOE5ho0NEBA== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 6E54CA3B9D; Fri, 18 Jun 2021 06:15:27 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 49/70] mxser: cleanup mxser_process_txrx_fifo Date: Fri, 18 Jun 2021 08:14:55 +0200 Message-Id: <20210618061516.662-50-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Rename process_txrx_fifo to mxser_process_txrx_fifo and: * remove useless parentheses * return from the 'if's true branch and process the rest in normal code flow (shift the code one level left) All this to make the code more readable. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index bb4110d466cb..1e54e94a7ca6 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -398,22 +398,24 @@ static enum mxser_must_hwid mxser_must_get_hwid(unsigned long io) return MOXA_OTHER_UART; } -static void process_txrx_fifo(struct mxser_port *info) +static void mxser_process_txrx_fifo(struct mxser_port *info) { - int i; + unsigned int i; - if ((info->type == PORT_16450) || (info->type == PORT_8250)) { + if (info->type == PORT_16450 || info->type == PORT_8250) { info->rx_high_water = 1; info->rx_low_water = 1; info->xmit_fifo_size = 1; - } else - for (i = 0; i < UART_INFO_NUM; i++) - if (info->board->must_hwid == Gpci_uart_info[i].type) { - info->rx_low_water = Gpci_uart_info[i].rx_low_water; - info->rx_high_water = Gpci_uart_info[i].rx_high_water; - info->xmit_fifo_size = Gpci_uart_info[i].fifo_size; - break; - } + return; + } + + for (i = 0; i < UART_INFO_NUM; i++) + if (info->board->must_hwid == Gpci_uart_info[i].type) { + info->rx_low_water = Gpci_uart_info[i].rx_low_water; + info->rx_high_water = Gpci_uart_info[i].rx_high_water; + info->xmit_fifo_size = Gpci_uart_info[i].fifo_size; + break; + } } static int mxser_carrier_raised(struct tty_port *port) @@ -1149,7 +1151,7 @@ static int mxser_set_serial_info(struct tty_struct *tty, info->type = ss->type; - process_txrx_fifo(info); + mxser_process_txrx_fifo(info); } if (tty_port_initialized(port)) { @@ -1895,7 +1897,7 @@ static void mxser_initbrd(struct mxser_board *brd, bool high_baud) info->type = PORT_16550A; - process_txrx_fifo(info); + mxser_process_txrx_fifo(info); info->port.close_delay = 5 * HZ / 10; info->port.closing_wait = 30 * HZ; From patchwork Fri Jun 18 06:14:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 463477 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D491CC49EA3 for ; Fri, 18 Jun 2021 06:16:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A8DFE60FE6 for ; Fri, 18 Jun 2021 06:16:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233567AbhFRGS4 (ORCPT ); Fri, 18 Jun 2021 02:18:56 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:60222 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233125AbhFRGRz (ORCPT ); Fri, 18 Jun 2021 02:17:55 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id C48B821B4E; Fri, 18 Jun 2021 06:15:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996927; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=P5Gnrezmz3Bzu2npHjqRoddFJXVH2LBHHWxf0qe4Ju4=; b=RylYCkc9puEfh1exMaZFI6glnRtKULADzmRFkq0iGpZpNmQZvuGNGLTmvFf/EGd/Q0YIoJ nxrR1DN77zE2EBuCz206wiUIpKpTlfRLcK5+80+DcTEV4mO/j7OwWO/rm5QXKNNMcGI+OB yNyCQAc0xndWI3+6H4h5GxUUDsdNm2g= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996927; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=P5Gnrezmz3Bzu2npHjqRoddFJXVH2LBHHWxf0qe4Ju4=; b=h9b4d4yxIm49r0w4XFapImghrEs6Rk1BdQjVi3VqI8zhB9JWBN1TgxsnvragtzGsHCdMjc GArxBHDAq5m0aqDA== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 9C173A3BCA; Fri, 18 Jun 2021 06:15:27 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 50/70] mxser: rework and simplify mxser_open Date: Fri, 18 Jun 2021 08:14:56 +0200 Message-Id: <20210618061516.662-51-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org In mxser_open, tty->port is already set thanks to tty_port_register_device in ->probe. So we can simply use container_of to deduce the struct mxser_port's pointer. Thus avoiding divisions and complex computations. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 1e54e94a7ca6..ea5e61a5a173 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -856,15 +856,12 @@ static void mxser_shutdown_port(struct tty_port *port) */ static int mxser_open(struct tty_struct *tty, struct file *filp) { - struct mxser_port *info; - int line = tty->index; + struct tty_port *tport = tty->port; + struct mxser_port *port = container_of(tport, struct mxser_port, port); - info = &mxser_boards[line / MXSER_PORTS_PER_BOARD].ports[line % MXSER_PORTS_PER_BOARD]; - if (!info->ioaddr) - return -ENODEV; + tty->driver_data = port; - tty->driver_data = info; - return tty_port_open(&info->port, tty, filp); + return tty_port_open(tport, tty, filp); } static void mxser_flush_buffer(struct tty_struct *tty) From patchwork Fri Jun 18 06:14:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 464137 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 410F0C48BE8 for ; Fri, 18 Jun 2021 06:16:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 217BA60FE6 for ; Fri, 18 Jun 2021 06:16:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233614AbhFRGTC (ORCPT ); Fri, 18 Jun 2021 02:19:02 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:46744 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233139AbhFRGR5 (ORCPT ); Fri, 18 Jun 2021 02:17:57 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 0B3B91FE0C; Fri, 18 Jun 2021 06:15:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996928; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=90hIoEOiclMDq4Rix7TBaSibL8uUQATRthtyaIL6SWQ=; b=0obMtDWlQZXfV9ZjwD9pgl5+CZOvMprzUESC+XFzhNZvoolnClhN9mqvAkmVz3gkrmwEh6 5/AkhWS8UJbDL8ix52VDZmILNRj4yRBF48dFPYgDug9sNwtw3F3EtY0LIe4cyLwiX7+3UD ru0UGulyPok1cB1yFSIAZP90QedqSKM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996928; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=90hIoEOiclMDq4Rix7TBaSibL8uUQATRthtyaIL6SWQ=; b=2Cxxgg0oLxfXmuSpve+BJy+jVYuoL9tDXtUde9uYAIKQJjE2bymV8a/3T7WyXnta2wvHE8 YGFF8uZKle5Y1RCg== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id D718BA3BC8; Fri, 18 Jun 2021 06:15:27 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 51/70] mxser: make mxser_board::idx really an index Date: Fri, 18 Jun 2021 08:14:57 +0200 Message-Id: <20210618061516.662-52-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org mxser_board::idx is named as index, but actually contain a base. So assign index there. And for base, introduce a local variable. This is needed for the next patch (use index as a bit index). Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index ea5e61a5a173..30b3a5ab6bea 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -1910,7 +1910,7 @@ static int mxser_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { struct mxser_board *brd; - unsigned int i; + unsigned int i, base; unsigned long ioaddress; unsigned short nports = MXSER_NPORTS(ent->driver_data); struct device *tty_dev; @@ -1927,7 +1927,8 @@ static int mxser_probe(struct pci_dev *pdev, } brd = &mxser_boards[i]; - brd->idx = i * MXSER_PORTS_PER_BOARD; + brd->idx = i; + base = i * MXSER_PORTS_PER_BOARD; retval = pcim_enable_device(pdev); if (retval) { @@ -1966,12 +1967,12 @@ static int mxser_probe(struct pci_dev *pdev, for (i = 0; i < nports; i++) { tty_dev = tty_port_register_device(&brd->ports[i].port, - mxvar_sdriver, brd->idx + i, &pdev->dev); + mxvar_sdriver, base + i, &pdev->dev); if (IS_ERR(tty_dev)) { retval = PTR_ERR(tty_dev); for (; i > 0; i--) tty_unregister_device(mxvar_sdriver, - brd->idx + i - 1); + base + i - 1); goto err_relbrd; } } @@ -1991,10 +1992,10 @@ static int mxser_probe(struct pci_dev *pdev, static void mxser_remove(struct pci_dev *pdev) { struct mxser_board *brd = pci_get_drvdata(pdev); - unsigned int i; + unsigned int i, base = brd->idx * MXSER_PORTS_PER_BOARD; for (i = 0; i < brd->nports; i++) { - tty_unregister_device(mxvar_sdriver, brd->idx + i); + tty_unregister_device(mxvar_sdriver, base + i); tty_port_destroy(&brd->ports[i].port); } From patchwork Fri Jun 18 06:14:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 464142 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CBC36C48BDF for ; Fri, 18 Jun 2021 06:16:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B20016112D for ; Fri, 18 Jun 2021 06:16:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233518AbhFRGSu (ORCPT ); Fri, 18 Jun 2021 02:18:50 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:59682 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233114AbhFRGRz (ORCPT ); Fri, 18 Jun 2021 02:17:55 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 423F221B60; Fri, 18 Jun 2021 06:15:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996928; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4EqNNoy5B0+kzzFl6xKjMTy0sA1jN2I6miCofIcPPE0=; b=eKadvXaVxpM7H2Uu7SvDEFzJ4toF2x8Ssw3d265EZ4u1CsGg5NAQ+jOKTSVjsDI3ZpfJba tro1R0HcxMP9g5iYQK6G56LOrkVmIOVgTdCSbsd11hccnF/9SDXO90cMyN32S5OZrLVhwV HDLrHtrIrYDwAPmtHMQJhG4oNKOm8Gk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996928; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4EqNNoy5B0+kzzFl6xKjMTy0sA1jN2I6miCofIcPPE0=; b=f9nTa/lwGDDDLnhr+4J5A/TuUZf/vFkoH2yrt5FqFXY+talWljfnbk44bpfG+CSbRwpZ4T WkV+PslwmBwD5xDQ== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 1A749A3B9F; Fri, 18 Jun 2021 06:15:28 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 52/70] mxser: alloc struct mxser_board dynamically Date: Fri, 18 Jun 2021 08:14:58 +0200 Message-Id: <20210618061516.662-53-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org There is no need to preallocate an array of four struct mxser_board's. In most cases a single board or two will be present in a machine. So allocate struct mxser_board as needed in ->probe. This makes mxser_boards a bit array. There we store which indexes are free (unallocated). Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 30b3a5ab6bea..0e99225e260f 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -278,7 +278,7 @@ struct mxser_board { struct mxser_port ports[MXSER_PORTS_PER_BOARD]; }; -static struct mxser_board mxser_boards[MXSER_BOARDS]; +static DECLARE_BITMAP(mxser_boards, MXSER_BOARDS); static struct tty_driver *mxvar_sdriver; static u8 __mxser_must_set_EFR(unsigned long baseio, u8 clear, u8 set, @@ -1916,31 +1916,32 @@ static int mxser_probe(struct pci_dev *pdev, struct device *tty_dev; int retval = -EINVAL; - for (i = 0; i < MXSER_BOARDS; i++) - if (mxser_boards[i].nports == 0) - break; - + i = find_first_zero_bit(mxser_boards, MXSER_BOARDS); if (i >= MXSER_BOARDS) { dev_err(&pdev->dev, "too many boards found (maximum %d), board " "not configured\n", MXSER_BOARDS); goto err; } - brd = &mxser_boards[i]; + brd = devm_kzalloc(&pdev->dev, sizeof(*brd), GFP_KERNEL); + if (!brd) + goto err; + brd->idx = i; + __set_bit(brd->idx, mxser_boards); base = i * MXSER_PORTS_PER_BOARD; retval = pcim_enable_device(pdev); if (retval) { dev_err(&pdev->dev, "PCI enable failed\n"); - goto err; + goto err_zero; } /* io address */ ioaddress = pci_resource_start(pdev, 2); retval = pci_request_region(pdev, 2, "mxser(IO)"); if (retval) - goto err; + goto err_zero; brd->nports = nports; for (i = 0; i < nports; i++) @@ -1984,7 +1985,7 @@ static int mxser_probe(struct pci_dev *pdev, for (i = 0; i < nports; i++) tty_port_destroy(&brd->ports[i].port); err_zero: - brd->nports = 0; + __clear_bit(brd->idx, mxser_boards); err: return retval; } @@ -1999,7 +2000,7 @@ static void mxser_remove(struct pci_dev *pdev) tty_port_destroy(&brd->ports[i].port); } - brd->nports = 0; + __clear_bit(brd->idx, mxser_boards); } static struct pci_driver mxser_driver = { From patchwork Fri Jun 18 06:14:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 463474 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21B35C49EA2 for ; Fri, 18 Jun 2021 06:17:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0905C6120A for ; Fri, 18 Jun 2021 06:17:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233726AbhFRGTO (ORCPT ); Fri, 18 Jun 2021 02:19:14 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:47304 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233143AbhFRGR5 (ORCPT ); Fri, 18 Jun 2021 02:17:57 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 6B5971FE01; Fri, 18 Jun 2021 06:15:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996928; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tyqk0DCGDyTr9Xsn3kqVsodTh5mdxcBNmSaiXNNpM1c=; b=TVEVfu31MNdEODJCqggzAoro6UEnL7RelE53/jsGuESQ4irL3YvFOTGrWjFZkAsBQoAStc NOKkyeDf6GPGXteHZ2W5OMK6/3BUUeuWDqxWi0I3xRzoTFStSf+r2qvgBNqM9h1lByJpFq hyTfmciHTLvvkcH0UOIQ6JFjMWXPspI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996928; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tyqk0DCGDyTr9Xsn3kqVsodTh5mdxcBNmSaiXNNpM1c=; b=VzcEBp9w9HaDzF9KIYAKDXG+bouNsjF79HLT/MfVSAHTtiQI/j/d63Tc6N/yDiqOMWxhHQ bZJeoa7QfGiiqKAA== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 4697CA3BA2; Fri, 18 Jun 2021 06:15:28 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 53/70] mxser: alloc only needed # of ports Date: Fri, 18 Jun 2021 08:14:59 +0200 Message-Id: <20210618061516.662-54-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Many boards have only 2 ports. But we always allocate 8 ports (struct mxser_port) in each struct mxser_board. Switch this to an empty/variable sized array ([]) and allocate the needed number of ports using struct_size helper in ->probe. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 0e99225e260f..81e2b72fca3f 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -275,7 +275,7 @@ struct mxser_board { enum mxser_must_hwid must_hwid; speed_t max_baud; - struct mxser_port ports[MXSER_PORTS_PER_BOARD]; + struct mxser_port ports[]; }; static DECLARE_BITMAP(mxser_boards, MXSER_BOARDS); @@ -1923,7 +1923,8 @@ static int mxser_probe(struct pci_dev *pdev, goto err; } - brd = devm_kzalloc(&pdev->dev, sizeof(*brd), GFP_KERNEL); + brd = devm_kzalloc(&pdev->dev, struct_size(brd, ports, nports), + GFP_KERNEL); if (!brd) goto err; From patchwork Fri Jun 18 06:15:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 464140 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2BD68C49361 for ; Fri, 18 Jun 2021 06:16:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 16D4161154 for ; Fri, 18 Jun 2021 06:16:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233550AbhFRGSy (ORCPT ); Fri, 18 Jun 2021 02:18:54 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:60224 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233126AbhFRGRz (ORCPT ); Fri, 18 Jun 2021 02:17:55 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id A493721B61; Fri, 18 Jun 2021 06:15:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996928; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vXQIKufr277A9Hb8SIwvq0VOLlbbqdJ0NwvdvrU0O/o=; b=gZVrbBY5L7G9+njWUqFcvPX1FRcUisz9LmeuuMkg8I/93IcJEkh9KifoeslQdn++gZFSOC ysIpuXugS4shdACVQqmwk8iHG50boO0WAY1+oKDva4gu/LnMpsWj0AY0KQuuD5dKJqGQ3M 2b2+bSwwT0XRVzKP0Zd5ElbxSaOAtLA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996928; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vXQIKufr277A9Hb8SIwvq0VOLlbbqdJ0NwvdvrU0O/o=; b=e+ofj4F7urEPjxi7PJVfI/e3sjZA0lWdR2LhlhaeMAft5HB8f/0GJV/im7CXhsa3mfjPbI PZVMghUB4oYfbKBQ== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 7BE2CA3B9F; Fri, 18 Jun 2021 06:15:28 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 54/70] mxser: remove pointless ioaddr checks Date: Fri, 18 Jun 2021 08:15:00 +0200 Message-Id: <20210618061516.662-55-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org struct mxser_port::ioaddr can never be NULL once set in ->probe. Hence the checks for it are pointless. Remove them. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 81e2b72fca3f..e5f8d08de8fd 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -446,9 +446,6 @@ static int mxser_set_baud(struct tty_struct *tty, speed_t newspd) unsigned char cval; u64 timeout; - if (!info->ioaddr) - return -1; - if (newspd > info->board->max_baud) return -1; @@ -519,8 +516,6 @@ static void mxser_change_speed(struct tty_struct *tty) unsigned char status; cflag = tty->termios.c_cflag; - if (!info->ioaddr) - return; mxser_set_baud(tty, tty_get_baud_rate(tty)); @@ -724,7 +719,7 @@ static int mxser_activate(struct tty_port *port, struct tty_struct *tty) spin_lock_irqsave(&info->slock, flags); - if (!info->ioaddr || !info->type) { + if (!info->type) { set_bit(TTY_IO_ERROR, &tty->flags); free_page(page); spin_unlock_irqrestore(&info->slock, flags); @@ -1097,10 +1092,6 @@ static int mxser_set_serial_info(struct tty_struct *tty, return -EIO; mutex_lock(&port->mutex); - if (!info->ioaddr) { - mutex_unlock(&port->mutex); - return -ENODEV; - } if (ss->irq != info->board->irq || ss->port != info->ioaddr) { From patchwork Fri Jun 18 06:15:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 464136 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 134C7C48BDF for ; Fri, 18 Jun 2021 06:16:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F257F611CD for ; Fri, 18 Jun 2021 06:16:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233621AbhFRGTC (ORCPT ); Fri, 18 Jun 2021 02:19:02 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:46746 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233141AbhFRGR5 (ORCPT ); Fri, 18 Jun 2021 02:17:57 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id D60BD1FE06; Fri, 18 Jun 2021 06:15:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996928; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gSEl8JeZsPc4N7k8UmKtUhJ1wPYAFzh/UljyKTXN5ng=; b=dnE3rGQgusC6UzsIbk0sBJVuuhepWX5CEILww3uB23yLVdmxrmWmlmcjuPXk95ZSVkl22k ItetLvkgb5NfMv3oFefWGvuNF8YUOcQECJJgZNqJSIdpCoWJho8rz+jFmEdSlzFzX7+j+p /7RdaPS440OKEBuH9eqMVF0ewYieA8c= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996928; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gSEl8JeZsPc4N7k8UmKtUhJ1wPYAFzh/UljyKTXN5ng=; b=uVi0OmdSjNNCmH8xQRg+OFFsXDd2sISEuWQ5IFKrYL9qoT1LjUfe8Jr0SaTUyx4PPoRdzv DRcUe9qsvJ5dXfBA== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id ABD5BA3BA6; Fri, 18 Jun 2021 06:15:28 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 55/70] mxser: cleanup mxser_rs_break Date: Fri, 18 Jun 2021 08:15:01 +0200 Message-Id: <20210618061516.662-56-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org mxser_rs_break now does all inb, outb, & or | in a single statement. The code is hard to follow, so make it more readable by doing one-line = one-statement. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index e5f8d08de8fd..5789c4343f10 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -1553,15 +1553,17 @@ static int mxser_rs_break(struct tty_struct *tty, int break_state) { struct mxser_port *info = tty->driver_data; unsigned long flags; + u8 lcr; spin_lock_irqsave(&info->slock, flags); + lcr = inb(info->ioaddr + UART_LCR); if (break_state == -1) - outb(inb(info->ioaddr + UART_LCR) | UART_LCR_SBC, - info->ioaddr + UART_LCR); + lcr |= UART_LCR_SBC; else - outb(inb(info->ioaddr + UART_LCR) & ~UART_LCR_SBC, - info->ioaddr + UART_LCR); + lcr &= ~UART_LCR_SBC; + outb(lcr, info->ioaddr + UART_LCR); spin_unlock_irqrestore(&info->slock, flags); + return 0; } From patchwork Fri Jun 18 06:15:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 463481 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A0CBC49361 for ; Fri, 18 Jun 2021 06:16:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4584B611CD for ; Fri, 18 Jun 2021 06:16:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233511AbhFRGSu (ORCPT ); Fri, 18 Jun 2021 02:18:50 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:58982 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233119AbhFRGRz (ORCPT ); Fri, 18 Jun 2021 02:17:55 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 14BBE21B71; Fri, 18 Jun 2021 06:15:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996929; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+K4baIdwzbGwVzO2UC58euL9O9XT1UtzNqp38qQmGWE=; b=f8PcGgXu/M1QtU56SE9vDXjiJKfKOdHf4rIzDX/xKE74lh2HGVPZ2eSd2EmSN3d9lFKvHp 9LOPMJRgPV5E6dVCzWJmeGB0TC1w10pU42EtbMN71XIxlGOQA/JPCWQTFkIgxWj6M4TWvt MOKwXqkhTx3DCcYn3jK5LhaeEFoWPTI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996929; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+K4baIdwzbGwVzO2UC58euL9O9XT1UtzNqp38qQmGWE=; b=Khp9RyvMi6nLpmTORDCGRQ53KR15fkjPYKOcvMhmjf+rVZWhxaw7bC51BIHH9YNINaasFs T6Tk6nAnWxgELTBw== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id E36F5A3B9F; Fri, 18 Jun 2021 06:15:28 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 56/70] mxser: cleanup mxser_dtr_rts Date: Fri, 18 Jun 2021 08:15:02 +0200 Message-Id: <20210618061516.662-57-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org mxser_dtr_rts now does all inb, outb, & or | in a single statement. The code is hard to follow, so make it more readable by doing one-line = one-statement. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 5789c4343f10..daf820c086f4 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -428,14 +428,15 @@ static void mxser_dtr_rts(struct tty_port *port, int on) { struct mxser_port *mp = container_of(port, struct mxser_port, port); unsigned long flags; + u8 mcr; spin_lock_irqsave(&mp->slock, flags); + mcr = inb(mp->ioaddr + UART_MCR); if (on) - outb(inb(mp->ioaddr + UART_MCR) | - UART_MCR_DTR | UART_MCR_RTS, mp->ioaddr + UART_MCR); + mcr |= UART_MCR_DTR | UART_MCR_RTS; else - outb(inb(mp->ioaddr + UART_MCR)&~(UART_MCR_DTR | UART_MCR_RTS), - mp->ioaddr + UART_MCR); + mcr &= ~(UART_MCR_DTR | UART_MCR_RTS); + outb(mcr, mp->ioaddr + UART_MCR); spin_unlock_irqrestore(&mp->slock, flags); } From patchwork Fri Jun 18 06:15:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 463480 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56926C49EA2 for ; Fri, 18 Jun 2021 06:16:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4154B611CD for ; Fri, 18 Jun 2021 06:16:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233524AbhFRGSu (ORCPT ); Fri, 18 Jun 2021 02:18:50 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:59680 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233120AbhFRGRz (ORCPT ); Fri, 18 Jun 2021 02:17:55 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 4B99A21B56; Fri, 18 Jun 2021 06:15:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996929; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=j+qJzeN0GB4Du+0oC8C7gQGWeXvYtyew0tyei0BR1Ls=; b=JnSyqgqmcpRCObZRJCUwuTHSEotw+MQWu8z6YmJeOBUNP8eWAG7IhLvC5lRE0bianUZmkX 0KBNALhpeEWnxnhmPbGK/n409SJn3doTqOfz/qCObiBugJwS3TmNKem5wD9CTmkyaHaAWl ChTyGj3eZe0AjjCRPAK71A8vCWXdgsI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996929; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=j+qJzeN0GB4Du+0oC8C7gQGWeXvYtyew0tyei0BR1Ls=; b=1hKXhLumKuSZ2FYcHNTbq4H4526MU2O/p2Yu5JjEH1U/T3Qy/fTYXVuMVFVYWamBL7d1CW soetHcmfRybmtCBQ== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 2555AA3BA2; Fri, 18 Jun 2021 06:15:29 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 57/70] mxser: don't start TX from tty_operations::put_char Date: Fri, 18 Jun 2021 08:15:03 +0200 Message-Id: <20210618061516.662-58-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org TX is not supposed to be started from tty_operations::put_char. Line disciplines ought to call tty_operations::put_char several times and then do a single tty_operations::flush_chars to start TX. Fix this in mxser by removing TX startup from mxser_put_char. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index daf820c086f4..52dbdd4282b2 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -998,17 +998,7 @@ static int mxser_put_char(struct tty_struct *tty, unsigned char ch) info->xmit_head &= SERIAL_XMIT_SIZE - 1; info->xmit_cnt++; spin_unlock_irqrestore(&info->slock, flags); - if (!tty->flow.stopped) { - if (!tty->hw_stopped || - (info->type == PORT_16550A) || - info->board->must_hwid) { - spin_lock_irqsave(&info->slock, flags); - outb(info->IER & ~UART_IER_THRI, info->ioaddr + UART_IER); - info->IER |= UART_IER_THRI; - outb(info->IER, info->ioaddr + UART_IER); - spin_unlock_irqrestore(&info->slock, flags); - } - } + return 1; } From patchwork Fri Jun 18 06:15:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 463478 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7CC5AC49EA2 for ; Fri, 18 Jun 2021 06:16:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6B1F560FE6 for ; Fri, 18 Jun 2021 06:16:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233560AbhFRGSy (ORCPT ); Fri, 18 Jun 2021 02:18:54 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:58952 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232917AbhFRGRz (ORCPT ); Fri, 18 Jun 2021 02:17:55 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 7C67A21B6C; Fri, 18 Jun 2021 06:15:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996929; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GA4kF6z/rEgVCINRiWV6Ypf4/rhj630gX4Kxies8A/c=; b=NY/TTQL1vOUGePF/QNCiZ7vsIF13PHSXuvnzPs+QvuJqe0sp5jtSZesJ2oNXuZm0zl17K5 IO0XLK2R8nNoojuyzhupIXFnINyxO0eM8n3JhA+0but5qKF0e7hNY9ORjiwH6YnZ/GKIZd v/yRzQ8veCSg6+CadKkZtTXJqjSr904= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996929; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GA4kF6z/rEgVCINRiWV6Ypf4/rhj630gX4Kxies8A/c=; b=ptUUVNaS5XtOb6Qy/ows4n1E0bLW6ScNIfm31lmXeWRizyLtbmkZ3nGG5jjpGUsXKgmpbO 1CCs+DeF4Wj3rtDQ== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 61292A3B9F; Fri, 18 Jun 2021 06:15:29 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 58/70] mxser: extract and dedup CTS handling Date: Fri, 18 Jun 2021 08:15:04 +0200 Message-Id: <20210618061516.662-59-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org CTS is handled on two locations in mxser. Extract the code into separation function mxser_handle_cts. And call it from the two locations. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 87 +++++++++++++++++---------------------------- 1 file changed, 33 insertions(+), 54 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 52dbdd4282b2..00363d98277e 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -506,6 +506,35 @@ static int mxser_set_baud(struct tty_struct *tty, speed_t newspd) return 0; } +static void mxser_handle_cts(struct tty_struct *tty, struct mxser_port *info, + u8 msr) +{ + bool cts = msr & UART_MSR_CTS; + + if (tty->hw_stopped) { + if (cts) { + tty->hw_stopped = 0; + + if (info->type != PORT_16550A && + !info->board->must_hwid) { + outb(info->IER & ~UART_IER_THRI, + info->ioaddr + UART_IER); + info->IER |= UART_IER_THRI; + outb(info->IER, info->ioaddr + UART_IER); + } + tty_wakeup(tty); + } + return; + } else if (cts) + return; + + tty->hw_stopped = 1; + if (info->type != PORT_16550A && !info->board->must_hwid) { + info->IER &= ~UART_IER_THRI; + outb(info->IER, info->ioaddr + UART_IER); + } +} + /* * This routine is called to set the UART divisor registers to match * the specified baud rate for a serial port. @@ -514,7 +543,6 @@ static void mxser_change_speed(struct tty_struct *tty) { struct mxser_port *info = tty->driver_data; unsigned cflag, cval, fcr; - unsigned char status; cflag = tty->termios.c_cflag; @@ -585,32 +613,8 @@ static void mxser_change_speed(struct tty_struct *tty) if ((info->type == PORT_16550A) || (info->board->must_hwid)) { info->MCR |= UART_MCR_AFE; } else { - status = inb(info->ioaddr + UART_MSR); - if (tty->hw_stopped) { - if (status & UART_MSR_CTS) { - tty->hw_stopped = 0; - if (info->type != PORT_16550A && - !info->board->must_hwid) { - outb(info->IER & ~UART_IER_THRI, - info->ioaddr + - UART_IER); - info->IER |= UART_IER_THRI; - outb(info->IER, info->ioaddr + - UART_IER); - } - tty_wakeup(tty); - } - } else { - if (!(status & UART_MSR_CTS)) { - tty->hw_stopped = 1; - if ((info->type != PORT_16550A) && - (!info->board->must_hwid)) { - info->IER &= ~UART_IER_THRI; - outb(info->IER, info->ioaddr + - UART_IER); - } - } - } + mxser_handle_cts(tty, info, + inb(info->ioaddr + UART_MSR)); } } outb(info->MCR, info->ioaddr + UART_MCR); @@ -679,33 +683,8 @@ static void mxser_check_modem_status(struct tty_struct *tty, wake_up_interruptible(&port->port.open_wait); } - if (tty_port_cts_enabled(&port->port)) { - if (tty->hw_stopped) { - if (status & UART_MSR_CTS) { - tty->hw_stopped = 0; - - if ((port->type != PORT_16550A) && - (!port->board->must_hwid)) { - outb(port->IER & ~UART_IER_THRI, - port->ioaddr + UART_IER); - port->IER |= UART_IER_THRI; - outb(port->IER, port->ioaddr + - UART_IER); - } - tty_wakeup(tty); - } - } else { - if (!(status & UART_MSR_CTS)) { - tty->hw_stopped = 1; - if (port->type != PORT_16550A && - !port->board->must_hwid) { - port->IER &= ~UART_IER_THRI; - outb(port->IER, port->ioaddr + - UART_IER); - } - } - } - } + if (tty_port_cts_enabled(&port->port)) + mxser_handle_cts(tty, port, status); } static int mxser_activate(struct tty_port *port, struct tty_struct *tty) From patchwork Fri Jun 18 06:15:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 463476 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9606CC48BDF for ; Fri, 18 Jun 2021 06:16:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6CE8B611CD for ; Fri, 18 Jun 2021 06:16:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233581AbhFRGS5 (ORCPT ); Fri, 18 Jun 2021 02:18:57 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:58960 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233131AbhFRGR4 (ORCPT ); Fri, 18 Jun 2021 02:17:56 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id B0FC321AC6; Fri, 18 Jun 2021 06:15:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996929; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EzoRpp5oKpyTVhgKESNf8IQ9VyNnVjv8sjeTYvfaoIc=; b=TdAVhe8ezkc8W5GR4dT3aFaMNq5M0G3eugQtR46weXzxA0GdC2+sOgFUJL4Dxjdv2+/wyG GUncEkvQuNImp+G2WzTQpq/leOT4CXIK94JNeXeeK+UlsfSNDYCaH1WIqtfLcyf56vTgti jDvYsiYKCsHzm8asEH/453Qe4wb9mTU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996929; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EzoRpp5oKpyTVhgKESNf8IQ9VyNnVjv8sjeTYvfaoIc=; b=BPdpzOnO72b5wO4K6w+jEbhwaHtxMwVBFzo9grBn9xiqVprLUeIqZy39xMa8rF1c8TZMjx oYw/Y5RLzCrGUjAw== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 8E0C6A3B9F; Fri, 18 Jun 2021 06:15:29 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 59/70] mxser: introduce and use start/stop_tx helpers Date: Fri, 18 Jun 2021 08:15:05 +0200 Message-Id: <20210618061516.662-60-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Starting and stopping TX is performed on many places in the driver. It is repeated outb and info->IER modification. Create few helpers (__mxser_start_tx, mxser_start_tx, __mxser_stop_tx) and use them in the code instead of open coding. This should be a base for an uart driver for this device in the future. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 80 +++++++++++++++++++++------------------------ 1 file changed, 37 insertions(+), 43 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 00363d98277e..e46974e9421a 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -418,6 +418,28 @@ static void mxser_process_txrx_fifo(struct mxser_port *info) } } +static void __mxser_start_tx(struct mxser_port *info) +{ + outb(info->IER & ~UART_IER_THRI, info->ioaddr + UART_IER); + info->IER |= UART_IER_THRI; + outb(info->IER, info->ioaddr + UART_IER); +} + +static void mxser_start_tx(struct mxser_port *info) +{ + unsigned long flags; + + spin_lock_irqsave(&info->slock, flags); + __mxser_start_tx(info); + spin_unlock_irqrestore(&info->slock, flags); +} + +static void __mxser_stop_tx(struct mxser_port *info) +{ + info->IER &= ~UART_IER_THRI; + outb(info->IER, info->ioaddr + UART_IER); +} + static int mxser_carrier_raised(struct tty_port *port) { struct mxser_port *mp = container_of(port, struct mxser_port, port); @@ -516,12 +538,8 @@ static void mxser_handle_cts(struct tty_struct *tty, struct mxser_port *info, tty->hw_stopped = 0; if (info->type != PORT_16550A && - !info->board->must_hwid) { - outb(info->IER & ~UART_IER_THRI, - info->ioaddr + UART_IER); - info->IER |= UART_IER_THRI; - outb(info->IER, info->ioaddr + UART_IER); - } + !info->board->must_hwid) + __mxser_start_tx(info); tty_wakeup(tty); } return; @@ -529,10 +547,8 @@ static void mxser_handle_cts(struct tty_struct *tty, struct mxser_port *info, return; tty->hw_stopped = 1; - if (info->type != PORT_16550A && !info->board->must_hwid) { - info->IER &= ~UART_IER_THRI; - outb(info->IER, info->ioaddr + UART_IER); - } + if (info->type != PORT_16550A && !info->board->must_hwid) + __mxser_stop_tx(info); } /* @@ -947,16 +963,9 @@ static int mxser_write(struct tty_struct *tty, const unsigned char *buf, int cou } if (info->xmit_cnt && !tty->flow.stopped) { - if (!tty->hw_stopped || - (info->type == PORT_16550A) || - (info->board->must_hwid)) { - spin_lock_irqsave(&info->slock, flags); - outb(info->IER & ~UART_IER_THRI, info->ioaddr + - UART_IER); - info->IER |= UART_IER_THRI; - outb(info->IER, info->ioaddr + UART_IER); - spin_unlock_irqrestore(&info->slock, flags); - } + if (!tty->hw_stopped || info->type == PORT_16550A || + info->board->must_hwid) + mxser_start_tx(info); } return total; } @@ -985,20 +994,13 @@ static int mxser_put_char(struct tty_struct *tty, unsigned char ch) static void mxser_flush_chars(struct tty_struct *tty) { struct mxser_port *info = tty->driver_data; - unsigned long flags; if (info->xmit_cnt <= 0 || tty->flow.stopped || !info->port.xmit_buf || (tty->hw_stopped && info->type != PORT_16550A && !info->board->must_hwid)) return; - spin_lock_irqsave(&info->slock, flags); - - outb(info->IER & ~UART_IER_THRI, info->ioaddr + UART_IER); - info->IER |= UART_IER_THRI; - outb(info->IER, info->ioaddr + UART_IER); - - spin_unlock_irqrestore(&info->slock, flags); + mxser_start_tx(info); } static unsigned int mxser_write_room(struct tty_struct *tty) @@ -1399,10 +1401,8 @@ static void mxser_stop(struct tty_struct *tty) unsigned long flags; spin_lock_irqsave(&info->slock, flags); - if (info->IER & UART_IER_THRI) { - info->IER &= ~UART_IER_THRI; - outb(info->IER, info->ioaddr + UART_IER); - } + if (info->IER & UART_IER_THRI) + __mxser_stop_tx(info); spin_unlock_irqrestore(&info->slock, flags); } @@ -1412,11 +1412,8 @@ static void mxser_start(struct tty_struct *tty) unsigned long flags; spin_lock_irqsave(&info->slock, flags); - if (info->xmit_cnt && info->port.xmit_buf) { - outb(info->IER & ~UART_IER_THRI, info->ioaddr + UART_IER); - info->IER |= UART_IER_THRI; - outb(info->IER, info->ioaddr + UART_IER); - } + if (info->xmit_cnt && info->port.xmit_buf) + __mxser_start_tx(info); spin_unlock_irqrestore(&info->slock, flags); } @@ -1659,8 +1656,7 @@ static void mxser_transmit_chars(struct tty_struct *tty, struct mxser_port *port (tty->hw_stopped && (port->type != PORT_16550A) && (!port->board->must_hwid))) { - port->IER &= ~UART_IER_THRI; - outb(port->IER, port->ioaddr + UART_IER); + __mxser_stop_tx(port); return; } @@ -1679,10 +1675,8 @@ static void mxser_transmit_chars(struct tty_struct *tty, struct mxser_port *port if (port->xmit_cnt < WAKEUP_CHARS) tty_wakeup(tty); - if (port->xmit_cnt <= 0) { - port->IER &= ~UART_IER_THRI; - outb(port->IER, port->ioaddr + UART_IER); - } + if (port->xmit_cnt <= 0) + __mxser_stop_tx(port); } static bool mxser_port_isr(struct mxser_port *port) From patchwork Fri Jun 18 06:15:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 463475 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7F6BC49EA3 for ; Fri, 18 Jun 2021 06:16:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 957916112D for ; Fri, 18 Jun 2021 06:16:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232968AbhFRGTC (ORCPT ); Fri, 18 Jun 2021 02:19:02 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:59718 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233144AbhFRGR6 (ORCPT ); Fri, 18 Jun 2021 02:17:58 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id E64BA21B54; Fri, 18 Jun 2021 06:15:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996929; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=baw5roJpOwqfmTLddGrLxyNGNpRq+vYnG/7O8sjdo7U=; b=IoUFE5MfSGs3p1/j3wZJOOh8vdxw66YzsnmGiVlNAlq9wtAhTD4Pzx40hkLaz8iv5V/aqp obLimFJodK8Q/VnCNz9zjXsTone+R5zh81gBXKkaFKfTw1TGJwuyyqSUlBQwZGCs8Crsv8 bxYfByQi9KRwJOMpCg8jnZaTXSP2FF8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996929; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=baw5roJpOwqfmTLddGrLxyNGNpRq+vYnG/7O8sjdo7U=; b=ZMZtdTflz1XBd/Yl2H8JSwl9wfinJl6Jj6aIxTTOtdkz7t5GmkNJIqZgrCWBplm+8VWCpV 7vF58FQh4rrOhBDA== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id BEC7CA3B9F; Fri, 18 Jun 2021 06:15:29 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 60/70] mxser: remove xmit_cnt < 0 tests Date: Fri, 18 Jun 2021 08:15:06 +0200 Message-Id: <20210618061516.662-61-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org mxser_port::xmit_cnt is unsigned, it cannot be negative. Therefore remove all the xmit_cnt < 0 tests. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index e46974e9421a..1a8698e58b1c 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -995,7 +995,7 @@ static void mxser_flush_chars(struct tty_struct *tty) { struct mxser_port *info = tty->driver_data; - if (info->xmit_cnt <= 0 || tty->flow.stopped || !info->port.xmit_buf || + if (!info->xmit_cnt || tty->flow.stopped || !info->port.xmit_buf || (tty->hw_stopped && info->type != PORT_16550A && !info->board->must_hwid)) return; @@ -1652,7 +1652,7 @@ static void mxser_transmit_chars(struct tty_struct *tty, struct mxser_port *port if (port->port.xmit_buf == NULL) return; - if (port->xmit_cnt <= 0 || tty->flow.stopped || + if (!port->xmit_cnt || tty->flow.stopped || (tty->hw_stopped && (port->type != PORT_16550A) && (!port->board->must_hwid))) { @@ -1666,7 +1666,7 @@ static void mxser_transmit_chars(struct tty_struct *tty, struct mxser_port *port outb(port->port.xmit_buf[port->xmit_tail++], port->ioaddr + UART_TX); port->xmit_tail = port->xmit_tail & (SERIAL_XMIT_SIZE - 1); - if (--port->xmit_cnt <= 0) + if (!--port->xmit_cnt) break; } while (--count > 0); @@ -1675,7 +1675,7 @@ static void mxser_transmit_chars(struct tty_struct *tty, struct mxser_port *port if (port->xmit_cnt < WAKEUP_CHARS) tty_wakeup(tty); - if (port->xmit_cnt <= 0) + if (!port->xmit_cnt) __mxser_stop_tx(port); } From patchwork Fri Jun 18 06:15:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 463472 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5AA5C48BE8 for ; Fri, 18 Jun 2021 06:17:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A1FEB61209 for ; Fri, 18 Jun 2021 06:17:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233218AbhFRGTT (ORCPT ); Fri, 18 Jun 2021 02:19:19 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:59716 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233146AbhFRGR6 (ORCPT ); Fri, 18 Jun 2021 02:17:58 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 2202D21B6D; Fri, 18 Jun 2021 06:15:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996930; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=X6dbF/oprEWZa6shDksahK+hYcvu3XoBqYTwdnzgUz8=; b=Y5Gtm6Uiz+4FybSTaiqsr2uP+vX8LUdj6CCapOkDN7VASp7YjF0WEndLI0MBMzkHV0Gf4K SMUBZEKH7xIUwwfdYfY5dmTaA7bIlGM7gsD/7dyWlBNfdhGWop+qN27sAXfi1wm9Eka/X/ eJSQ4gHWvNtkFzaPONfDb1DZVVKwZpM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996930; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=X6dbF/oprEWZa6shDksahK+hYcvu3XoBqYTwdnzgUz8=; b=e8pRHiVLR9Iikgz5AbvSPoW1BLODkbPT7LMmQBhxzH1X+8ZbpdFFx22YrPoXuDg4IyUXbh 8E3Pet89Sq9BFkDA== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id F1229A3B9F; Fri, 18 Jun 2021 06:15:29 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 61/70] mxser: decrypt FCR values Date: Fri, 18 Jun 2021 08:15:07 +0200 Message-Id: <20210618061516.662-62-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Currently, some of the values written to FCR are magic constants. But they are composed of well-defined bits. Use these named macros in place of the constants. No changes in objdump -d. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 1a8698e58b1c..c8ba062d8824 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -1580,7 +1580,9 @@ static u8 mxser_receive_chars_old(struct tty_struct *tty, ch = inb(port->ioaddr + UART_RX); if (hwid && (status & UART_LSR_OE)) - outb(0x23, port->ioaddr + UART_FCR); + outb(UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR | + MOXA_MUST_FCR_GDA_MODE_ENABLE, + port->ioaddr + UART_FCR); status &= port->read_status_mask; if (status & port->ignore_status_mask) { if (++ignored > 100) @@ -1693,7 +1695,9 @@ static bool mxser_port_isr(struct mxser_port *port) tty = tty_port_tty_get(&port->port); if (!tty || port->closing || !tty_port_initialized(&port->port)) { status = inb(port->ioaddr + UART_LSR); - outb(0x27, port->ioaddr + UART_FCR); + outb(MOXA_MUST_FCR_GDA_MODE_ENABLE | UART_FCR_ENABLE_FIFO | + UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT, + port->ioaddr + UART_FCR); inb(port->ioaddr + UART_MSR); error = true; From patchwork Fri Jun 18 06:15:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 464135 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 79EE9C48BDF for ; Fri, 18 Jun 2021 06:17:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 62EF2613AA for ; Fri, 18 Jun 2021 06:17:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231766AbhFRGTR (ORCPT ); Fri, 18 Jun 2021 02:19:17 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:59712 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233148AbhFRGR6 (ORCPT ); Fri, 18 Jun 2021 02:17:58 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 5AEB721B69; Fri, 18 Jun 2021 06:15:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996930; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CK9asDX+0HN+MlTN5oiFj4ZLf6QXVNvLkxkc/oS6vnE=; b=fTBrdwVKJqnnsxn9np4b6XWwjX582JTHvkRxWZBDQOTmWScCXarOp1AZhmTx0rU0AqPCD8 fEBx0zOXCa/gJQKIV2xOT+Dzgstpd21tLrNTPWLjFX5cI17sEI/Dc+Aq7nJnhSZzzBpGo8 f0RROkapSjrSSMIBheua9fMJOqU6I2Q= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996930; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CK9asDX+0HN+MlTN5oiFj4ZLf6QXVNvLkxkc/oS6vnE=; b=DQnBimBg4nvgrOXRiAzfDD++xUOUweHVw2rFHeR824vXbPkDCyLHLY42PH/ry/N6jAjZHd 20R4pDPoiL7FVEBA== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 33D9AA3B9F; Fri, 18 Jun 2021 06:15:30 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 62/70] mxser: fix typos around enhanced mode Date: Fri, 18 Jun 2021 08:15:08 +0200 Message-Id: <20210618061516.662-63-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Fix spelling of "enhanced" in macros and comments around them. While "enchance" comes from the original Moxa's driver, I don't think it was meant to be that. From the context, they obviously mean "enhanced". Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index c8ba062d8824..54b9a9c7c9e9 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -64,23 +64,23 @@ /* * Follow just what Moxa Must chip defines. * - * When LCR register (offset 0x03) writes the following value, the Must chip - * will enter enchance mode. And write value on EFR (offset 0x02) bit 6,7 to + * When LCR register (offset 0x03) is written the following value, the Must chip + * will enter enhanced mode. And a write to EFR (offset 0x02) bit 6,7 will * change bank. */ -#define MOXA_MUST_ENTER_ENCHANCE 0xBF +#define MOXA_MUST_ENTER_ENHANCED 0xBF -/* when enhance mode enabled, access on general bank register */ +/* when enhanced mode is enabled, access to general bank register */ #define MOXA_MUST_GDL_REGISTER 0x07 #define MOXA_MUST_GDL_MASK 0x7F #define MOXA_MUST_GDL_HAS_BAD_DATA 0x80 #define MOXA_MUST_LSR_RERR 0x80 /* error in receive FIFO */ -/* enchance register bank select and enchance mode setting register */ -/* when LCR register equals to 0xBF */ +/* enhanced register bank select and enhanced mode setting register */ +/* This works only when LCR register equals to 0xBF */ #define MOXA_MUST_EFR_REGISTER 0x02 -#define MOXA_MUST_EFR_EFRB_ENABLE 0x10 /* enchance mode enable */ -/* enchance register bank set 0, 1, 2 */ +#define MOXA_MUST_EFR_EFRB_ENABLE 0x10 /* enhanced mode enable */ +/* enhanced register bank set 0, 1, 2 */ #define MOXA_MUST_EFR_BANK0 0x00 #define MOXA_MUST_EFR_BANK1 0x40 #define MOXA_MUST_EFR_BANK2 0x80 @@ -287,7 +287,7 @@ static u8 __mxser_must_set_EFR(unsigned long baseio, u8 clear, u8 set, u8 oldlcr, efr; oldlcr = inb(baseio + UART_LCR); - outb(MOXA_MUST_ENTER_ENCHANCE, baseio + UART_LCR); + outb(MOXA_MUST_ENTER_ENHANCED, baseio + UART_LCR); efr = inb(baseio + MOXA_MUST_EFR_REGISTER); efr &= ~clear; From patchwork Fri Jun 18 06:15:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 464134 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 525B0C49EA4 for ; Fri, 18 Jun 2021 06:17:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3C6AF611CD for ; Fri, 18 Jun 2021 06:17:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233092AbhFRGTT (ORCPT ); Fri, 18 Jun 2021 02:19:19 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:58992 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233234AbhFRGSP (ORCPT ); Fri, 18 Jun 2021 02:18:15 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 96E8621B66; Fri, 18 Jun 2021 06:15:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996930; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yksK7LzDOGP61ARBRrE+5NpcXJ2ZmxHs03eLeRZb+zM=; b=QrkM0mG3fFrKQ7wGURVxqZmEFam2FhCoSB5GARcZJaQ6vKFDF8MTGZezp2QRvpx0HP7qJl et+Sr59tBvNNdWFu03faPMKLLFh/5cyldUs4fyYooBEtTjplIUrh154qmIUfad7w7yxJi1 ZdUIOeA6ezN+V9PH3IBxF3cbmWDCWQo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996930; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yksK7LzDOGP61ARBRrE+5NpcXJ2ZmxHs03eLeRZb+zM=; b=rzY7t2gLiuvP+45F6ZFTICK6D8qAYY7cDVAwS9s+T4yZrhDzmidBkjXaBDQ4yz8mVBCOHp RIu/srm3VhC9iRBg== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 64D7BA3BC3; Fri, 18 Jun 2021 06:15:30 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 63/70] mxser: access info->MCR under info->slock Date: Fri, 18 Jun 2021 08:15:09 +0200 Message-Id: <20210618061516.662-64-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org info->MCR is protected by info->slock all over the code. Extend the lock in mxser_tiocmget around the info->MCR fetch too. It likely doesn't change anything, but it's always good to be consistent. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 54b9a9c7c9e9..5dd121450813 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -1162,13 +1162,13 @@ static int mxser_tiocmget(struct tty_struct *tty) if (tty_io_error(tty)) return -EIO; - control = info->MCR; - spin_lock_irqsave(&info->slock, flags); + control = info->MCR; status = inb(info->ioaddr + UART_MSR); if (status & UART_MSR_ANY_DELTA) mxser_check_modem_status(tty, info, status); spin_unlock_irqrestore(&info->slock, flags); + return ((control & UART_MCR_RTS) ? TIOCM_RTS : 0) | ((control & UART_MCR_DTR) ? TIOCM_DTR : 0) | ((status & UART_MSR_DCD) ? TIOCM_CAR : 0) | From patchwork Fri Jun 18 06:15:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 464133 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ADDD5C49EA5 for ; Fri, 18 Jun 2021 06:17:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9745E6120A for ; Fri, 18 Jun 2021 06:17:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232984AbhFRGTU (ORCPT ); Fri, 18 Jun 2021 02:19:20 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:59874 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233029AbhFRGSQ (ORCPT ); Fri, 18 Jun 2021 02:18:16 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id D34BA21B74; Fri, 18 Jun 2021 06:15:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996930; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IoskkITiw49w3uZEefKbBo96jqnzZoI9tXr0fMMFiLQ=; b=wWPTurKxxnrz4+iEHARlmL56iWTviiV30kmhhy4ZbyGqaBgiCQzM8R+nA5AMmJZPMmcQXx Gy4CcQSWdCXCNhsCGSXhKqadpA+BUohvj1IrUkMWlmcdMSTN18X8ZBqbx2TIXflR3nS2lH jpRaTmJ44fFdREmCpCsPJjM8sUCw2Zc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996930; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IoskkITiw49w3uZEefKbBo96jqnzZoI9tXr0fMMFiLQ=; b=YonQeFepMZPVSZCzTKvcj8QMuwirRZLOwZ8djjgBviTlwgNpT/vBBcOb/PEtQ26Ol0EAmX NB5arb2MfT1sR1BA== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 9F50FA3BA3; Fri, 18 Jun 2021 06:15:30 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 64/70] mxser: use port variable in mxser_set_serial_info Date: Fri, 18 Jun 2021 08:15:10 +0200 Message-Id: <20210618061516.662-65-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org mxser_set_serial_info already defined a local 'port' of type struct tty_port. So use it in the code everywhere. This eliminates some text from the code there. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 5dd121450813..2f724b4d3f43 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -1080,14 +1080,14 @@ static int mxser_set_serial_info(struct tty_struct *tty, if (!capable(CAP_SYS_ADMIN)) { if ((ss->baud_base != MXSER_BAUD_BASE) || - (close_delay != info->port.close_delay) || - (closing_wait != info->port.closing_wait) || - ((ss->flags & ~ASYNC_USR_MASK) != (info->port.flags & ~ASYNC_USR_MASK))) { + (close_delay != port->close_delay) || + (closing_wait != port->closing_wait) || + ((ss->flags & ~ASYNC_USR_MASK) != (port->flags & ~ASYNC_USR_MASK))) { mutex_unlock(&port->mutex); return -EPERM; } - info->port.flags = ((info->port.flags & ~ASYNC_USR_MASK) | - (ss->flags & ASYNC_USR_MASK)); + port->flags = (port->flags & ~ASYNC_USR_MASK) | + (ss->flags & ASYNC_USR_MASK); } else { /* * OK, past this point, all the error checking has been done. From patchwork Fri Jun 18 06:15:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 463471 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 38507C49EA2 for ; Fri, 18 Jun 2021 06:17:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 26CB1611CE for ; Fri, 18 Jun 2021 06:17:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233722AbhFRGT2 (ORCPT ); Fri, 18 Jun 2021 02:19:28 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:59016 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233305AbhFRGSZ (ORCPT ); Fri, 18 Jun 2021 02:18:25 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 0C1F121B76; Fri, 18 Jun 2021 06:15:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996931; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iwTedBNKcRnucuoBg0xtuBYFokFV3kZJEyrOb6NMuq0=; b=KQN+3DPCqLXZWUp6hdkWmykRKBIPrPF5pOfYy3YuKcF/3lViOrmcCwxS3kuC0dMvL7MShH Hx+GCukPKvYze8nEAKDkY57yqX6zrJCXDWzxCCByJFzhxuqPmZgM6sI0XxjCyjDGZGyInw spw8o8cfpe/Jo34vdMpGS8ElBw7gEzc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996931; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iwTedBNKcRnucuoBg0xtuBYFokFV3kZJEyrOb6NMuq0=; b=jDLMBpnN7CelL/MN672ZKPSdHa1uaawMCjnzxNgcWG6r9lReA5zxV6+k0O5M0z7BjaM9Jf GgTKJX0LAQ+nkHDA== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id D9253A3BC3; Fri, 18 Jun 2021 06:15:30 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 65/70] mxser: rename flags to old_speed in mxser_set_serial_info Date: Fri, 18 Jun 2021 08:15:11 +0200 Message-Id: <20210618061516.662-66-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Local 'flags' are used to store speed in mxser_set_serial_info, not actual flags (by doing & ASYNC_SPD_MASK). So rename 'flags' to 'old_speed' (after what it is). Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 2f724b4d3f43..f238d17d6fdf 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -1057,7 +1057,7 @@ static int mxser_set_serial_info(struct tty_struct *tty, struct tty_port *port = &info->port; speed_t baud; unsigned long sl_flags; - unsigned int flags, close_delay, closing_wait; + unsigned int old_speed, close_delay, closing_wait; int retval = 0; if (tty_io_error(tty)) @@ -1071,7 +1071,7 @@ static int mxser_set_serial_info(struct tty_struct *tty, return -EINVAL; } - flags = port->flags & ASYNC_SPD_MASK; + old_speed = port->flags & ASYNC_SPD_MASK; close_delay = msecs_to_jiffies(ss->close_delay * 10); closing_wait = ss->closing_wait; @@ -1115,7 +1115,7 @@ static int mxser_set_serial_info(struct tty_struct *tty, } if (tty_port_initialized(port)) { - if (flags != (port->flags & ASYNC_SPD_MASK)) { + if (old_speed != (port->flags & ASYNC_SPD_MASK)) { spin_lock_irqsave(&info->slock, sl_flags); mxser_change_speed(tty); spin_unlock_irqrestore(&info->slock, sl_flags); From patchwork Fri Jun 18 06:15:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 464132 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8A71C48BDF for ; Fri, 18 Jun 2021 06:17:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 859646112D for ; Fri, 18 Jun 2021 06:17:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233730AbhFRGT3 (ORCPT ); Fri, 18 Jun 2021 02:19:29 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:59930 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233309AbhFRGSZ (ORCPT ); Fri, 18 Jun 2021 02:18:25 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 3D2FC21B78; Fri, 18 Jun 2021 06:15:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996931; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GFSZYeDrwRYRWTUYjDH02bF7eRx8Ylf2/6cryqmW8hI=; b=vf/6BUaDWoGsbBwpGCqNoZRebAnlqtAxZaRNxl6X8GC263QWW0TEEX9VfUgi2r/sbpmRzb 1qcSXCIxRbYvYzDgu8OvZCIpxzbpfg6CxERmb+/YREluGt2U+O0KAVuauPqMyjuxGaeT45 QHtkgE2mv75/3HJWHveAxTCg69/Qajo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996931; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GFSZYeDrwRYRWTUYjDH02bF7eRx8Ylf2/6cryqmW8hI=; b=39CBZUQmhzGrX0jEbKtQglOvrMgpwyl7WSMa9F8xLBcs4vc844JjYQ6EOkSDb67M9ThdPO 7Jaicelc4UoPyeAA== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 1D869A3BA7; Fri, 18 Jun 2021 06:15:31 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 66/70] mxser: introduce mxser_16550A_or_MUST helper Date: Fri, 18 Jun 2021 08:15:12 +0200 Message-Id: <20210618061516.662-67-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org This check is used in the code on many places. Either in positive or negative form. So introduce a helper called mxser_16550A_or_MUST for this purpose. And replace all the occurrences. This simplifies many ifs in there. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index f238d17d6fdf..900ccb2ca166 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -398,6 +398,11 @@ static enum mxser_must_hwid mxser_must_get_hwid(unsigned long io) return MOXA_OTHER_UART; } +static bool mxser_16550A_or_MUST(struct mxser_port *info) +{ + return info->type == PORT_16550A || info->board->must_hwid; +} + static void mxser_process_txrx_fifo(struct mxser_port *info) { unsigned int i; @@ -537,8 +542,7 @@ static void mxser_handle_cts(struct tty_struct *tty, struct mxser_port *info, if (cts) { tty->hw_stopped = 0; - if (info->type != PORT_16550A && - !info->board->must_hwid) + if (!mxser_16550A_or_MUST(info)) __mxser_start_tx(info); tty_wakeup(tty); } @@ -547,7 +551,7 @@ static void mxser_handle_cts(struct tty_struct *tty, struct mxser_port *info, return; tty->hw_stopped = 1; - if (info->type != PORT_16550A && !info->board->must_hwid) + if (!mxser_16550A_or_MUST(info)) __mxser_stop_tx(info); } @@ -626,7 +630,7 @@ static void mxser_change_speed(struct tty_struct *tty) tty_port_set_cts_flow(&info->port, cflag & CRTSCTS); if (cflag & CRTSCTS) { info->IER |= UART_IER_MSI; - if ((info->type == PORT_16550A) || (info->board->must_hwid)) { + if (mxser_16550A_or_MUST(info)) { info->MCR |= UART_MCR_AFE; } else { mxser_handle_cts(tty, info, @@ -962,11 +966,10 @@ static int mxser_write(struct tty_struct *tty, const unsigned char *buf, int cou total += c; } - if (info->xmit_cnt && !tty->flow.stopped) { - if (!tty->hw_stopped || info->type == PORT_16550A || - info->board->must_hwid) + if (info->xmit_cnt && !tty->flow.stopped) + if (!tty->hw_stopped || mxser_16550A_or_MUST(info)) mxser_start_tx(info); - } + return total; } @@ -996,8 +999,7 @@ static void mxser_flush_chars(struct tty_struct *tty) struct mxser_port *info = tty->driver_data; if (!info->xmit_cnt || tty->flow.stopped || !info->port.xmit_buf || - (tty->hw_stopped && info->type != PORT_16550A && - !info->board->must_hwid)) + (tty->hw_stopped && !mxser_16550A_or_MUST(info))) return; mxser_start_tx(info); @@ -1655,9 +1657,7 @@ static void mxser_transmit_chars(struct tty_struct *tty, struct mxser_port *port return; if (!port->xmit_cnt || tty->flow.stopped || - (tty->hw_stopped && - (port->type != PORT_16550A) && - (!port->board->must_hwid))) { + (tty->hw_stopped && !mxser_16550A_or_MUST(port))) { __mxser_stop_tx(port); return; } From patchwork Fri Jun 18 06:15:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 463473 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42D32C49361 for ; Fri, 18 Jun 2021 06:17:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2CB4F61209 for ; Fri, 18 Jun 2021 06:17:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233149AbhFRGTS (ORCPT ); Fri, 18 Jun 2021 02:19:18 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:47306 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233145AbhFRGR6 (ORCPT ); Fri, 18 Jun 2021 02:17:58 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 78BAF1FE08; Fri, 18 Jun 2021 06:15:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996931; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9vkQegQCDa6RbYkbdZNTRf/A5yYN3NJAvIBIZzX/CoY=; b=1QAWiFZqLeDkBeVGlMYr5Z7RWJJ9JiKw7BYs0yJwIokUOoe6LfPSDUu0PykSVPeerF4UT4 MPtSz8zSjRm6QQGOA+Vf9v/WXgCgYbdImgAf7b2Y3QCkhAO3b2hiw12BSeu0a3L/nVuYk7 wvzFMWEFPCEgLavPBY6l9O5p/Jni9lw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996931; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9vkQegQCDa6RbYkbdZNTRf/A5yYN3NJAvIBIZzX/CoY=; b=/YvzfCHrf7xKdhuRUXUCyDNYRCZXoWm1ESjbsT++4vv2xvUKrAcEp1Yd7T87a4dg3lAGan LppuDkeaBky920Bg== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 4F926A3BA3; Fri, 18 Jun 2021 06:15:31 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 67/70] mxser: Documentation, remove traces of callout device Date: Fri, 18 Jun 2021 08:15:13 +0200 Message-Id: <20210618061516.662-68-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Callout devices are ancient history, so remove its traces from mxser's documentation. Signed-off-by: Jiri Slaby --- .../driver-api/serial/moxa-smartio.rst | 46 +++++-------------- 1 file changed, 12 insertions(+), 34 deletions(-) diff --git a/Documentation/driver-api/serial/moxa-smartio.rst b/Documentation/driver-api/serial/moxa-smartio.rst index aedda2546242..3a0a8b502898 100644 --- a/Documentation/driver-api/serial/moxa-smartio.rst +++ b/Documentation/driver-api/serial/moxa-smartio.rst @@ -147,13 +147,7 @@ or:: run the driver. If you prefer module driver, please refer to 3.4. If static driver is required, please refer to 3.5. -Dialin and callout port ------------------------ - - This driver remains traditional serial device properties. There are - two special file name for each serial port. One is dial-in port - which is named "ttyMxx". For callout port, the naming convention - is "cumxx". + The device node is named "ttyMxx". Device naming when more than 2 boards installed ----------------------------------------------- @@ -161,18 +155,13 @@ Device naming when more than 2 boards installed Naming convention for each Smartio/Industio multiport board is pre-defined as below. - ============ =============== ============== - Board Num. Dial-in Port Callout port - 1st board ttyM0 - ttyM7 cum0 - cum7 - 2nd board ttyM8 - ttyM15 cum8 - cum15 - 3rd board ttyM16 - ttyM23 cum16 - cum23 - 4th board ttyM24 - ttym31 cum24 - cum31 - ============ =============== ============== - -.. note:: - - Under Kernel 2.6 and upper, the cum Device is Obsolete. So use ttyM* - device instead. + ============ =============== + Board Num. Device node + 1st board ttyM0 - ttyM7 + 2nd board ttyM8 - ttyM15 + 3rd board ttyM16 - ttyM23 + 4th board ttyM24 - ttyM31 + ============ =============== 3.4 Module driver configuration =============================== @@ -204,13 +193,10 @@ Device naming when more than 2 boards installed # cd /moxa/mxser/driver # ./msmknod - This shell script will require the major number for dial-in - device and callout device to create tty device. You also need - to specify the total installed MOXA board number. Default major - numbers for dial-in device and callout device are 30, 35. If - you need to change to other number, please refer section "3.7" - for more detailed procedure. - Msmknod will delete any special files occupying the same device + This shell script will require the major number for the device. You also + need to specify the total installed MOXA board number. If you need to + change to other number, please refer section "3.7" for more detailed + procedure. Msmknod will delete any special files occupying the same device naming. 3.4.2 Build the MOXA driver and utilities @@ -516,11 +502,3 @@ msterm - Terminal Emulation Load Moxa driver fail, the major number may conflict with other devices. Please refer to previous section 3.7 to change a free major number for Moxa driver. - - Error msg: - Couldn't install MOXA Smartio/Industio family callout driver! - - Solution: - Load Moxa callout driver fail, the callout device major number may - conflict with other devices. Please refer to previous section 3.7 to - change a free callout device major number for Moxa driver. From patchwork Fri Jun 18 06:15:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 463469 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0580C49361 for ; Fri, 18 Jun 2021 06:18:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C7433611CE for ; Fri, 18 Jun 2021 06:18:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231282AbhFRGUq (ORCPT ); Fri, 18 Jun 2021 02:20:46 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:46780 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233176AbhFRGSF (ORCPT ); Fri, 18 Jun 2021 02:18:05 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id AE4041FDF9; Fri, 18 Jun 2021 06:15:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996931; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vcLmznICkzCP1tnpjE7llznqce1TDBfGeFKnxfywsZY=; b=XyOK1dKWTUYBOqgcu6BEefz1+MgDAFah4yoqGaXNgkNcaQSEwuh/vm4PdjkIL8zuh+suvO mITyUDV+i8cmw2W+o1MP5zgw/HBol2zqKg4HNPKLfTHxwsIxN7zTm0zR+y/q65kXohBFiO EBk1e/EtULQUQwkBo5S/46lxyN4nWwE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996931; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vcLmznICkzCP1tnpjE7llznqce1TDBfGeFKnxfywsZY=; b=PsNRSRApJYzSIe4vWPwjImFp0oeC322cXUmLPAB6QQdGTMNiz8F+KZgIYGofDsi4Qon6xn 7XpaWhoMtE6/VoCg== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 82929A3BCB; Fri, 18 Jun 2021 06:15:31 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 68/70] mxser: Documentation, make the docs up-to-date Date: Fri, 18 Jun 2021 08:15:14 +0200 Message-Id: <20210618061516.662-69-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Remove all the obsolete information from the documentation of mxser driver. Either it was about the out-of-tree driver, or it was superseded by udev et al. Signed-off-by: Jiri Slaby --- .../driver-api/serial/moxa-smartio.rst | 325 +----------------- 1 file changed, 9 insertions(+), 316 deletions(-) diff --git a/Documentation/driver-api/serial/moxa-smartio.rst b/Documentation/driver-api/serial/moxa-smartio.rst index 3a0a8b502898..838888f81b6d 100644 --- a/Documentation/driver-api/serial/moxa-smartio.rst +++ b/Documentation/driver-api/serial/moxa-smartio.rst @@ -2,14 +2,8 @@ MOXA Smartio/Industio Family Device Driver Installation Guide ============================================================= -.. note:: - - This file is outdated. It needs some care in order to make it - updated to Kernel 5.0 and upper - Copyright (C) 2008, Moxa Inc. - -Date: 01/21/2008 +Copyright (C) 2021, Jiri Slaby .. Content @@ -17,12 +11,7 @@ Date: 01/21/2008 2. System Requirement 3. Installation 3.1 Hardware installation - 3.2 Driver files - 3.3 Device naming convention - 3.4 Module driver configuration - 3.5 Static driver configuration for Linux kernel 2.4.x and 2.6.x. - 3.6 Custom configuration - 3.7 Verify driver installation + 3.2 Device naming convention 4. Utilities 5. Setserial 6. Troubleshooting @@ -56,11 +45,8 @@ Date: 01/21/2008 C168H/PCI, CB-108 - This driver and installation procedure have been developed upon Linux Kernel - 2.4.x and 2.6.x. This driver supports Intel x86 hardware platform. In order - to maintain compatibility, this version has also been properly tested with - RedHat, Mandrake, Fedora and S.u.S.E Linux. However, if compatibility problem - occurs, please contact Moxa at support@moxa.com.tw. + If a compatibility problem occurs, please contact Moxa at + support@moxa.com.tw. In addition to device driver, useful utilities are also provided in this version. They are: @@ -77,14 +63,14 @@ Date: 01/21/2008 GNU General Public License in this version. Please refer to GNU General Public License announcement in each source code file for more detail. - In Moxa's Web sites, you may always find latest driver at http://www.moxa.com/. + In Moxa's Web sites, you may always find latest driver at + https://www.moxa.com/. This version of driver can be installed as Loadable Module (Module driver) - or built-in into kernel (Static driver). You may refer to following - installation procedure for suitable one. Before you install the driver, + or built-in into kernel (Static driver). Before you install the driver, please refer to hardware installation procedure in the User's Manual. - We assume the user should be familiar with following documents. + We assume the user should be familiar with following documents: - Serial-HOWTO - Kernel-HOWTO @@ -92,9 +78,6 @@ Date: 01/21/2008 2. System Requirement ^^^^^^^^^^^^^^^^^^^^^ - - Hardware platform: Intel x86 machine - - Kernel version: 2.4.x or 2.6.x - - gcc version 2.72 or later - Maximum 4 boards can be installed in combination 3. Installation @@ -118,35 +101,10 @@ PCI IRQ Sharing together on one system and they can share the same IRQ. -3.2 Driver files -================ - - The driver file may be obtained from ftp, CD-ROM or floppy disk. The - first step, anyway, is to copy driver file "mxser.tgz" into specified - directory. e.g. /moxa. The execute commands as below:: - - # cd / - # mkdir moxa - # cd /moxa - # tar xvf /dev/fd0 - -or:: - - # cd / - # mkdir moxa - # cd /moxa - # cp /mnt/cdrom//mxser.tgz . - # tar xvfz mxser.tgz - -3.3 Device naming convention +3.2 Device naming convention ============================ - You may find all the driver and utilities files in /moxa/mxser. - Following installation procedure depends on the model you'd like to - run the driver. If you prefer module driver, please refer to 3.4. - If static driver is required, please refer to 3.5. - The device node is named "ttyMxx". Device naming when more than 2 boards installed @@ -163,245 +121,6 @@ Device naming when more than 2 boards installed 4th board ttyM24 - ttyM31 ============ =============== -3.4 Module driver configuration -=============================== - - Module driver is easiest way to install. If you prefer static driver - installation, please skip this paragraph. - - - ------------- Prepare to use the MOXA driver -------------------- - -3.4.1 Create tty device with correct major number -------------------------------------------------- - - Before using MOXA driver, your system must have the tty devices - which are created with driver's major number. We offer one shell - script "msmknod" to simplify the procedure. - This step is only needed to be executed once. But you still - need to do this procedure when: - - a. You change the driver's major number. Please refer the "3.7" - section. - b. Your total installed MOXA boards number is changed. Maybe you - add/delete one MOXA board. - c. You want to change the tty name. This needs to modify the - shell script "msmknod" - - The procedure is:: - - # cd /moxa/mxser/driver - # ./msmknod - - This shell script will require the major number for the device. You also - need to specify the total installed MOXA board number. If you need to - change to other number, please refer section "3.7" for more detailed - procedure. Msmknod will delete any special files occupying the same device - naming. - -3.4.2 Build the MOXA driver and utilities ------------------------------------------ - - Before using the MOXA driver and utilities, you need compile the - all the source code. This step is only need to be executed once. - But you still re-compile the source code if you modify the source - code. For example, if you change the driver's major number (see - "3.7" section), then you need to do this step again. - - Find "Makefile" in /moxa/mxser, then run - - # make clean; make install - - ..note:: - - For Red Hat 9, Red Hat Enterprise Linux AS3/ES3/WS3 & Fedora Core1: - # make clean; make installsp1 - - For Red Hat Enterprise Linux AS4/ES4/WS4: - # make clean; make installsp2 - - The driver files "mxser.o" and utilities will be properly compiled - and copied to system directories respectively. - -------------- Load MOXA driver-------------------- - -3.4.3 Load the MOXA driver --------------------------- - - :: - - # modprobe mxser - - will activate the module driver. You may run "lsmod" to check - if "mxser" is activated. - -------------- Load MOXA driver on boot -------------------- - -3.4.4 Load the mxser driver ---------------------------- - - - For the above description, you may manually execute - "modprobe mxser" to activate this driver and run - "rmmod mxser" to remove it. - - However, it's better to have a boot time configuration to - eliminate manual operation. Boot time configuration can be - achieved by rc file. We offer one "rc.mxser" file to simplify - the procedure under "moxa/mxser/driver". - - Run following command for setting rc files:: - - # cd /moxa/mxser/driver - # cp ./rc.mxser /etc/rc.d - # cd /etc/rc.d - - Check "rc.serial" is existed or not. If "rc.serial" doesn't exist, - create it by vi, run "chmod 755 rc.serial" to change the permission. - - Add "/etc/rc.d/rc.mxser" in last line. - - Reboot and check if moxa.o activated by "lsmod" command. - -3.5 Static driver configuration for Linux kernel 2.4.x and 2.6.x -================================================================ - - Note: - To use static driver, you must install the linux kernel - source package. - -3.5.1 Backup the built-in driver in the kernel ----------------------------------------------- - - :: - - # cd /usr/src/linux/drivers/char - # mv mxser.c mxser.c.old - - For Red Hat 7.x user, you need to create link: - # cd /usr/src - # ln -s linux-2.4 linux - -3.5.2 Create link ------------------ - :: - - # cd /usr/src/linux/drivers/char - # ln -s /moxa/mxser/driver/mxser.c mxser.c - -3.5.3 Setup kernel configuration --------------------------------- - - Configure the kernel:: - - # cd /usr/src/linux - # make menuconfig - - You will go into a menu-driven system. Please select [Character - devices][Non-standard serial port support], enable the [Moxa - SmartIO support] driver with "[*]" for built-in (not "[M]"), then - select [Exit] to exit this program. - -3.5.4 Rebuild kernel --------------------- - - The following are for Linux kernel rebuilding, for your - reference only. - - For appropriate details, please refer to the Linux document: - - a. Run the following commands:: - - cd /usr/src/linux - make clean # take a few minutes - make dep # take a few minutes - make bzImage # take probably 10-20 minutes - make install # copy boot image to correct position - - f. Please make sure the boot kernel (vmlinuz) is in the - correct position. - g. If you use 'lilo' utility, you should check /etc/lilo.conf - 'image' item specified the path which is the 'vmlinuz' path, - or you will load wrong (or old) boot kernel image (vmlinuz). - After checking /etc/lilo.conf, please run "lilo". - - Note that if the result of "make bzImage" is ERROR, then you have to - go back to Linux configuration Setup. Type "make menuconfig" in - directory /usr/src/linux. - - -3.5.5 Make tty device and special file --------------------------------------- - - :: - # cd /moxa/mxser/driver - # ./msmknod - -3.5.6 Make utility ------------------- - - :: - - # cd /moxa/mxser/utility - # make clean; make install - -3.5.7 Reboot ------------- - - - -3.6 Custom configuration -======================== - - Although this driver already provides you default configuration, you - still can change the device name and major number. The instruction to - change these parameters are shown as below. - -a. Change Device name - - If you'd like to use other device names instead of default naming - convention, all you have to do is to modify the internal code - within the shell script "msmknod". First, you have to open "msmknod" - by vi. Locate each line contains "ttyM" and "cum" and change them - to the device name you desired. "msmknod" creates the device names - you need next time executed. - -b. Change Major number - - If major number 30 and 35 had been occupied, you may have to select - 2 free major numbers for this driver. There are 3 steps to change - major numbers. - -3.6.1 Find free major numbers ------------------------------ - - In /proc/devices, you may find all the major numbers occupied - in the system. Please select 2 major numbers that are available. - e.g. 40, 45. - -3.6.2 Create special files --------------------------- - - Run /moxa/mxser/driver/msmknod to create special files with - specified major numbers. - -3.6.3 Modify driver with new major number ------------------------------------------ - - Run vi to open /moxa/mxser/driver/mxser.c. Locate the line - contains "MXSERMAJOR". Change the content as below:: - - #define MXSERMAJOR 40 - #define MXSERCUMAJOR 45 - - 3.6.4 Run "make clean; make install" in /moxa/mxser/driver. - -3.7 Verify driver installation -============================== - - You may refer to /var/log/messages to check the latest status - log reported by this driver whenever it's activated. - 4. Utilities ^^^^^^^^^^^^ @@ -409,9 +128,6 @@ b. Change Major number msterm. These 3 utilities are released in form of source code. They should be compiled into executable file and copied into /usr/bin. - Before using these utilities, please load driver (refer 3.4 & 3.5) and - make sure you had run the "msmknod" utility. - msdiag - Diagnostic =================== @@ -479,26 +195,3 @@ msterm - Terminal Emulation Solution: To avoid this problem, please unplug fifth and after board, because Moxa driver supports up to 4 boards. - - Error msg: - Request_irq fail, IRQ(?) may be conflict with another device. - - Solution: - Other PCI or ISA devices occupy the assigned IRQ. If you are not sure - which device causes the situation, please check /proc/interrupts to find - free IRQ and simply change another free IRQ for Moxa board. - - Error msg: - Board #: C1xx Series(CAP=xxx) interrupt number invalid. - - Solution: - Each port within the same multiport board shares the same IRQ. Please set - one IRQ (IRQ doesn't equal to zero) for one Moxa board. - - Error msg: - Couldn't install MOXA Smartio/Industio family driver! - - Solution: - Load Moxa driver fail, the major number may conflict with other devices. - Please refer to previous section 3.7 to change a free major number for - Moxa driver. From patchwork Fri Jun 18 06:15:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 463470 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1852C48BDF for ; Fri, 18 Jun 2021 06:17:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 985C361209 for ; Fri, 18 Jun 2021 06:17:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230390AbhFRGTk (ORCPT ); Fri, 18 Jun 2021 02:19:40 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:59036 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233357AbhFRGSa (ORCPT ); Fri, 18 Jun 2021 02:18:30 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id D5C9621B7B; Fri, 18 Jun 2021 06:15:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996931; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=S8GxyXPxzMGx7zlg6fd+xLgPxH3RcZPHEn9DJ8iIKxw=; b=b12GCBR3N1j2jj+Qq8hiqTTtFyHrUlygEjmlsDkkSDN4tke0IIr5QfIUFZ1bw5XIntjQc0 5IqZedYEaawzc1IixreTSQWn1TAUQOTTFV5zNwfjlJ6/QKHVINzuCX5QwdSPgEoJHvdJyK k8ne9ByxY1XAjEX231o1ksSzrGhiDUc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996931; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=S8GxyXPxzMGx7zlg6fd+xLgPxH3RcZPHEn9DJ8iIKxw=; b=/3In8MpJbJp0pDddJ9mkImnNBBAtTZBdjGuoH4y7fLSJmW5DnYHZsSKkNNjnfRWd5qH1Uj RDJDpYKqaUIjmABg== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id B5F49A3BCD; Fri, 18 Jun 2021 06:15:31 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 69/70] mxser: Documentation, fix typos Date: Fri, 18 Jun 2021 08:15:15 +0200 Message-Id: <20210618061516.662-70-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Fix some typos in the mxser's documentation. Signed-off-by: Jiri Slaby --- .../driver-api/serial/moxa-smartio.rst | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/Documentation/driver-api/serial/moxa-smartio.rst b/Documentation/driver-api/serial/moxa-smartio.rst index 838888f81b6d..af25bc5cc3e6 100644 --- a/Documentation/driver-api/serial/moxa-smartio.rst +++ b/Documentation/driver-api/serial/moxa-smartio.rst @@ -20,7 +20,7 @@ Copyright (C) 2021, Jiri Slaby ^^^^^^^^^^^^^^^ The Smartio/Industio/UPCI family Linux driver supports following multiport - boards. + boards: - 2 ports multiport board CP-102U, CP-102UL, CP-102UF @@ -63,10 +63,10 @@ Copyright (C) 2021, Jiri Slaby GNU General Public License in this version. Please refer to GNU General Public License announcement in each source code file for more detail. - In Moxa's Web sites, you may always find latest driver at + In Moxa's Web sites, you may always find the latest driver at https://www.moxa.com/. - This version of driver can be installed as Loadable Module (Module driver) + This version of driver can be installed as a Loadable Module (Module driver) or built-in into kernel (Static driver). Before you install the driver, please refer to hardware installation procedure in the User's Manual. @@ -89,9 +89,9 @@ Copyright (C) 2021, Jiri Slaby PCI/UPCI board -------------- - You may need to adjust IRQ usage in BIOS to avoid from IRQ conflict - with other ISA devices. Please refer to hardware installation - procedure in User's Manual in advance. + You may need to adjust IRQ usage in BIOS to avoid IRQ conflict with other + ISA devices. Please refer to hardware installation procedure in User's + Manual in advance. PCI IRQ Sharing --------------- @@ -132,7 +132,7 @@ msdiag - Diagnostic =================== This utility provides the function to display what Moxa Smartio/Industio - board found by driver in the system. + board was found by the driver in the system. msmon - Port Monitoring ======================= @@ -162,23 +162,23 @@ msterm - Terminal Emulation Supported Setserial parameters are listed as below. - ============== ========================================================= - uart set UART type(16450-->disable FIFO, 16550A-->enable FIFO) - close_delay set the amount of time(in 1/100 of a second) that DTR + ============== ============================================================= + uart set UART type(16450 --> disable FIFO, 16550A --> enable FIFO) + close_delay set the amount of time (in 1/100 of a second) that DTR should be kept low while being closed. - closing_wait set the amount of time(in 1/100 of a second) that the + closing_wait set the amount of time (in 1/100 of a second) that the serial port should wait for data to be drained while - being closed, before the receiver is disable. - spd_hi Use 57.6kb when the application requests 38.4kb. - spd_vhi Use 115.2kb when the application requests 38.4kb. - spd_shi Use 230.4kb when the application requests 38.4kb. - spd_warp Use 460.8kb when the application requests 38.4kb. - spd_normal Use 38.4kb when the application requests 38.4kb. - spd_cust Use the custom divisor to set the speed when the + being closed, before the receiver is disabled. + spd_hi Use 57.6kb when the application requests 38.4kb. + spd_vhi Use 115.2kb when the application requests 38.4kb. + spd_shi Use 230.4kb when the application requests 38.4kb. + spd_warp Use 460.8kb when the application requests 38.4kb. + spd_normal Use 38.4kb when the application requests 38.4kb. + spd_cust Use the custom divisor to set the speed when the application requests 38.4kb. - divisor This option set the custom division. - baud_base This option set the base baud rate. - ============== ========================================================= + divisor This option sets the custom division. + baud_base This option sets the base baud rate. + ============== ============================================================= 6. Troubleshooting ^^^^^^^^^^^^^^^^^^ From patchwork Fri Jun 18 06:15:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 464131 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6A7CC48BE8 for ; Fri, 18 Jun 2021 06:17:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BFE4961209 for ; Fri, 18 Jun 2021 06:17:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233597AbhFRGTs (ORCPT ); Fri, 18 Jun 2021 02:19:48 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:59974 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233048AbhFRGSc (ORCPT ); Fri, 18 Jun 2021 02:18:32 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 178A721B4D; Fri, 18 Jun 2021 06:15:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1623996932; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hhqhJJHGQgh1nSjIpUSQwyMaH6oNC00EvkhH+O8kSEw=; b=qFXAvluC5MMr4B6HeKKxDqKi6CyJXU7LjvUi1LOsS/5aKm+iw6T9CrPEn+Idn8KcHR6oe5 D/ZpOmakzVP/CKB4kf5iqKGaLtJLlUfTBw/smO7yC3/+kFBfEHBClb5ZqKWtooSr7olnGo 12X//FQ7QOf4xeanJ8cDLgzYbSKBUKY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1623996932; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hhqhJJHGQgh1nSjIpUSQwyMaH6oNC00EvkhH+O8kSEw=; b=C5+df4lJGtRSgQ4rb9NAedppvONpue8HmhMW0KZYFhfVC1ZPxrV3npbSTRs6G40vwR+mEo 45thYwE3CTNdCpBg== Received: from localhost.localdomain (unknown [10.100.208.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id E4D70A3B9E; Fri, 18 Jun 2021 06:15:31 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 70/70] MAINTAINERS: add me back as mxser maintainer Date: Fri, 18 Jun 2021 08:15:16 +0200 Message-Id: <20210618061516.662-71-jslaby@suse.cz> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210618061516.662-1-jslaby@suse.cz> References: <20210618061516.662-1-jslaby@suse.cz> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org I was given a few cards from MOXA (thanks a lot). Provided I can now test changes, I cleaned up the driver a bit and can continue maintaining it. Signed-off-by: Jiri Slaby --- MAINTAINERS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index cff342847673..314207ccc82a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -12498,7 +12498,8 @@ S: Maintained F: drivers/net/phy/motorcomm.c MOXA SMARTIO/INDUSTIO/INTELLIO SERIAL CARD -S: Orphan +M: Jiri Slaby +S: Maintained F: Documentation/driver-api/serial/moxa-smartio.rst F: drivers/tty/mxser.*