From patchwork Fri May 13 08:29:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ilpo_J=C3=A4rvinen?= X-Patchwork-Id: 572771 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D9F7C433EF for ; Fri, 13 May 2022 08:29:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378215AbiEMI3Z (ORCPT ); Fri, 13 May 2022 04:29:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229593AbiEMI3Y (ORCPT ); Fri, 13 May 2022 04:29:24 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09393291CF5; Fri, 13 May 2022 01:29:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652430564; x=1683966564; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=R3lDYtnHrNPVHv2um+g488BAuAfzyGmmPeOLDwrFMDk=; b=NCv6jc9LDNSRY/w6LCgp3MAUHlaQSfyEAisz9kykzQhXyEQOdAZEygi8 OoXCn2OI+1xxJ418SzcgjwDS7KuI6rVDqAb9vGMiifM8YC9/I+3luSwl9 /kixXX7IOAZmgn628dpTp3HEb8I7BEkm+iLGCm0/GNVQgHokYDN1YwTf+ 0DZEnK23DM+KUkmBLEPcr2GCHuVQqejS7sBDMnCN4Zh7Cw9ct8KWyv+4k Ee5ira948eFQw34BT8ZowuoAogEdJlUr5x6WjxEejkJ8fzpxuwQVkep46 FOzhv1JTGSzK4xxtlIVClyEGZE3HwmsKpXid5Utl7DwsS7HN/IfH41BiF g==; X-IronPort-AV: E=McAfee;i="6400,9594,10345"; a="270385178" X-IronPort-AV: E=Sophos;i="5.91,221,1647327600"; d="scan'208";a="270385178" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2022 01:29:23 -0700 X-IronPort-AV: E=Sophos;i="5.91,221,1647327600"; d="scan'208";a="567107469" Received: from huberth-mobl.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.252.34.58]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2022 01:29:20 -0700 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: linux-serial@vger.kernel.org, Greg KH , Johan Hovold , Arnd Bergmann , Jiri Slaby , "David S. Miller" , Oliver Neukum , linux-kernel@vger.kernel.org, sparclinux@vger.kernel.org, linux-usb@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH v2 1/5] tty: remove CMSPAR ifdefs Date: Fri, 13 May 2022 11:29:02 +0300 Message-Id: <20220513082906.11096-2-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220513082906.11096-1-ilpo.jarvinen@linux.intel.com> References: <20220513082906.11096-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org CMSPAR is defined by all architectures since commit 6bf08cb246b5 ("[PATCH] Add CMSPAR to termbits.h for powerpc and alpha"). Reviewed-by: Johan Hovold Signed-off-by: Ilpo Järvinen --- drivers/char/pcmcia/synclink_cs.c | 2 -- drivers/tty/amiserial.c | 2 -- drivers/tty/serial/8250/8250_port.c | 2 -- drivers/tty/serial/jsm/jsm_cls.c | 6 ------ drivers/tty/serial/jsm/jsm_neo.c | 6 ------ drivers/tty/serial/sunsu.c | 2 -- drivers/usb/class/cdc-acm.h | 8 -------- drivers/usb/serial/ark3116.c | 3 +-- drivers/usb/serial/whiteheat.c | 4 ---- 9 files changed, 1 insertion(+), 34 deletions(-) diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index 78baba55a8b5..c20f2cb784e8 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c @@ -1432,10 +1432,8 @@ static void mgslpc_change_params(MGSLPC_INFO *info, struct tty_struct *tty) info->params.parity = ASYNC_PARITY_ODD; else info->params.parity = ASYNC_PARITY_EVEN; -#ifdef CMSPAR if (cflag & CMSPAR) info->params.parity = ASYNC_PARITY_SPACE; -#endif } /* calculate number of jiffies to transmit a full diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c index 533d02b38e02..afb2d373dd47 100644 --- a/drivers/tty/amiserial.c +++ b/drivers/tty/amiserial.c @@ -588,10 +588,8 @@ static void change_speed(struct tty_struct *tty, struct serial_state *info, } if (!(cflag & PARODD)) cval |= UART_LCR_EPAR; -#ifdef CMSPAR if (cflag & CMSPAR) cval |= UART_LCR_SPAR; -#endif /* Determine divisor based on baud rate */ baud = tty_get_baud_rate(tty); diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c index 5591f18f2ea9..78b6dedc43e6 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -2620,10 +2620,8 @@ static unsigned char serial8250_compute_lcr(struct uart_8250_port *up, } if (!(c_cflag & PARODD)) cval |= UART_LCR_EPAR; -#ifdef CMSPAR if (c_cflag & CMSPAR) cval |= UART_LCR_SPAR; -#endif return cval; } diff --git a/drivers/tty/serial/jsm/jsm_cls.c b/drivers/tty/serial/jsm/jsm_cls.c index 444f233ebd1f..046b624e5f71 100644 --- a/drivers/tty/serial/jsm/jsm_cls.c +++ b/drivers/tty/serial/jsm/jsm_cls.c @@ -723,14 +723,8 @@ static void cls_param(struct jsm_channel *ch) if (!(ch->ch_c_cflag & PARODD)) lcr |= UART_LCR_EPAR; - /* - * Not all platforms support mark/space parity, - * so this will hide behind an ifdef. - */ -#ifdef CMSPAR if (ch->ch_c_cflag & CMSPAR) lcr |= UART_LCR_SPAR; -#endif if (ch->ch_c_cflag & CSTOPB) lcr |= UART_LCR_STOP; diff --git a/drivers/tty/serial/jsm/jsm_neo.c b/drivers/tty/serial/jsm/jsm_neo.c index 110696cdaa1d..0cf586c10688 100644 --- a/drivers/tty/serial/jsm/jsm_neo.c +++ b/drivers/tty/serial/jsm/jsm_neo.c @@ -997,14 +997,8 @@ static void neo_param(struct jsm_channel *ch) if (!(ch->ch_c_cflag & PARODD)) lcr |= UART_LCR_EPAR; - /* - * Not all platforms support mark/space parity, - * so this will hide behind an ifdef. - */ -#ifdef CMSPAR if (ch->ch_c_cflag & CMSPAR) lcr |= UART_LCR_SPAR; -#endif if (ch->ch_c_cflag & CSTOPB) lcr |= UART_LCR_STOP; diff --git a/drivers/tty/serial/sunsu.c b/drivers/tty/serial/sunsu.c index c31389114b86..fff50b5b82eb 100644 --- a/drivers/tty/serial/sunsu.c +++ b/drivers/tty/serial/sunsu.c @@ -798,10 +798,8 @@ sunsu_change_speed(struct uart_port *port, unsigned int cflag, cval |= UART_LCR_PARITY; if (!(cflag & PARODD)) cval |= UART_LCR_EPAR; -#ifdef CMSPAR if (cflag & CMSPAR) cval |= UART_LCR_SPAR; -#endif /* * Work around a bug in the Oxford Semiconductor 952 rev B diff --git a/drivers/usb/class/cdc-acm.h b/drivers/usb/class/cdc-acm.h index 3aa7f0a3ad71..d26ecd15be60 100644 --- a/drivers/usb/class/cdc-acm.h +++ b/drivers/usb/class/cdc-acm.h @@ -7,14 +7,6 @@ * */ -/* - * CMSPAR, some architectures can't have space and mark parity. - */ - -#ifndef CMSPAR -#define CMSPAR 0 -#endif - /* * Major and minor numbers. */ diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c index c0e4df87ff22..39eaa7b97c40 100644 --- a/drivers/usb/serial/ark3116.c +++ b/drivers/usb/serial/ark3116.c @@ -208,10 +208,9 @@ static void ark3116_set_termios(struct tty_struct *tty, lcr |= UART_LCR_PARITY; if (!(cflag & PARODD)) lcr |= UART_LCR_EPAR; -#ifdef CMSPAR if (cflag & CMSPAR) lcr |= UART_LCR_SPAR; -#endif + /* handshake control */ hcr = (cflag & CRTSCTS) ? 0x03 : 0x00; diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c index 06aad0d727dd..332fb92ae575 100644 --- a/drivers/usb/serial/whiteheat.c +++ b/drivers/usb/serial/whiteheat.c @@ -30,10 +30,6 @@ #include #include "whiteheat.h" /* WhiteHEAT specific commands */ -#ifndef CMSPAR -#define CMSPAR 0 -#endif - /* * Version Information */ From patchwork Fri May 13 08:29:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ilpo_J=C3=A4rvinen?= X-Patchwork-Id: 572770 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B15D2C433FE for ; Fri, 13 May 2022 08:29:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378231AbiEMI3f (ORCPT ); Fri, 13 May 2022 04:29:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378233AbiEMI3e (ORCPT ); Fri, 13 May 2022 04:29:34 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FF242A7C3F; Fri, 13 May 2022 01:29:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652430573; x=1683966573; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3AZmPCQXD829z2NVQfnDiZr0z2oQIdav3zQqb/SAWNM=; b=Cv9AlMpQsrE4/vEhtgGop8WJETxUvU5ujTHbHSxJltQNas+tiwd7ywqu NSxbCanYG16cY4GivMDpxJUKMVZXqtMzt58Ba43fU8r31reSu68LkHe9h riKQlUwQTbzSqcMvLDY2jVhF1gUmgxL0qn++DI624z0ycd03l159+ElC6 MOSgTW74L8l6qmX+bwprocn8LbP+zloveViOk9q4bkkwdIDXaRCz83hBk NQJpCLwbs6uOI7ppIxDkHMflLRlPyfWFFtcv5DbONIzzBqprajMOa2Qrr I7QrS5rB1boZD4ofXm2p+ojylK3EAscNo906AfOX+9fW8q54LEFewNHSh w==; X-IronPort-AV: E=McAfee;i="6400,9594,10345"; a="270385189" X-IronPort-AV: E=Sophos;i="5.91,221,1647327600"; d="scan'208";a="270385189" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2022 01:29:32 -0700 X-IronPort-AV: E=Sophos;i="5.91,221,1647327600"; d="scan'208";a="567107492" Received: from huberth-mobl.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.252.34.58]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2022 01:29:29 -0700 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: linux-serial@vger.kernel.org, Greg KH , Johan Hovold , Jiri Slaby , linux-kernel@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH v2 3/5] tty: remove IBSHIFT ifdefs Date: Fri, 13 May 2022 11:29:04 +0300 Message-Id: <20220513082906.11096-4-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220513082906.11096-1-ilpo.jarvinen@linux.intel.com> References: <20220513082906.11096-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org IBSHIFT is defined by all architectures since commit d0ffb805b729 ("arch/alpha, termios: implement BOTHER, IBSHIFT and termios2"). Signed-off-by: Ilpo Järvinen --- drivers/tty/tty_baudrate.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/tty/tty_baudrate.c b/drivers/tty/tty_baudrate.c index 07bbbfee5635..3cd99ed7c710 100644 --- a/drivers/tty/tty_baudrate.c +++ b/drivers/tty/tty_baudrate.c @@ -91,7 +91,6 @@ EXPORT_SYMBOL(tty_termios_baud_rate); speed_t tty_termios_input_baud_rate(struct ktermios *termios) { -#ifdef IBSHIFT unsigned int cbaud = (termios->c_cflag >> IBSHIFT) & CBAUD; if (cbaud == B0) @@ -110,9 +109,6 @@ speed_t tty_termios_input_baud_rate(struct ktermios *termios) cbaud += 15; } return cbaud >= n_baud_table ? 0 : baud_table[cbaud]; -#else /* IBSHIFT */ - return tty_termios_baud_rate(termios); -#endif /* IBSHIFT */ } EXPORT_SYMBOL(tty_termios_input_baud_rate); @@ -152,10 +148,9 @@ void tty_termios_encode_baud_rate(struct ktermios *termios, termios->c_ispeed = ibaud; termios->c_ospeed = obaud; -#ifdef IBSHIFT if (((termios->c_cflag >> IBSHIFT) & CBAUD) != B0) ibinput = 1; /* An input speed was specified */ -#endif + /* If the user asked for a precise weird speed give a precise weird * answer. If they asked for a Bfoo speed they may have problems * digesting non-exact replies so fuzz a bit. @@ -170,9 +165,7 @@ void tty_termios_encode_baud_rate(struct ktermios *termios, iclose = 0; termios->c_cflag &= ~CBAUD; -#ifdef IBSHIFT termios->c_cflag &= ~(CBAUD << IBSHIFT); -#endif /* * Our goal is to find a close match to the standard baud rate @@ -192,14 +185,12 @@ void tty_termios_encode_baud_rate(struct ktermios *termios, /* For the case input == output don't set IBAUD bits * if the user didn't do so. */ - if (ofound == i && !ibinput) + if (ofound == i && !ibinput) { ifound = i; -#ifdef IBSHIFT - else { + } else { ifound = i; termios->c_cflag |= (baud_bits[i] << IBSHIFT); } -#endif } } while (++i < n_baud_table); From patchwork Fri May 13 08:29:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ilpo_J=C3=A4rvinen?= X-Patchwork-Id: 572769 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94874C433F5 for ; Fri, 13 May 2022 08:30:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378250AbiEMIaJ (ORCPT ); Fri, 13 May 2022 04:30:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378248AbiEMI3i (ORCPT ); Fri, 13 May 2022 04:29:38 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C225F2A8044; Fri, 13 May 2022 01:29:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652430577; x=1683966577; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=iOoN2Fve4JKCSLdO4MGCcXzCd2YW2wiUYn98empvuVE=; b=f+zoycT4/P4tlE5zJl3sYMqvGtIZVYr43YH2wPtgZYGG8V+81IKOBGJO uvG4ucmUHzGFu5dBO6iBFV37zivmDp8PNerrTZvn3ifav9j2o+iYiwlvC HeoFcRk0krJezWEJ2jtOsRymiU2XM1BkrjCnMOlYFz40emCb4OmhI5n+W tfpJG4s6lRCo9F5uvd1q1H6k1YnnPPJzYMctavohgXKaQSBgL44vN14l7 bH4oVHC85e3ixEakcy4DVUXf3pz2mt1S6xu4SLIbkn8hnuXo78t0v38Y6 t6POpXS/buEvy4HZN0AMIeUruIKVHxL7z0u2x2DhgcGlWh8h9cmZNpP+J A==; X-IronPort-AV: E=McAfee;i="6400,9594,10345"; a="270385208" X-IronPort-AV: E=Sophos;i="5.91,221,1647327600"; d="scan'208";a="270385208" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2022 01:29:37 -0700 X-IronPort-AV: E=Sophos;i="5.91,221,1647327600"; d="scan'208";a="567107510" Received: from huberth-mobl.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.252.34.58]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2022 01:29:35 -0700 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: linux-serial@vger.kernel.org, Greg KH , Johan Hovold , Jiri Slaby , linux-kernel@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH v2 5/5] serial: jsm: Use B0 instead of 0 Date: Fri, 13 May 2022 11:29:06 +0300 Message-Id: <20220513082906.11096-6-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220513082906.11096-1-ilpo.jarvinen@linux.intel.com> References: <20220513082906.11096-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Use B0 to check zero baudrate rather than literal 0. While at it, remove extra parenthesis around CBAUD. Signed-off-by: Ilpo Järvinen --- drivers/tty/serial/jsm/jsm_cls.c | 2 +- drivers/tty/serial/jsm/jsm_neo.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/jsm/jsm_cls.c b/drivers/tty/serial/jsm/jsm_cls.c index 046b624e5f71..3fd57ac3ad81 100644 --- a/drivers/tty/serial/jsm/jsm_cls.c +++ b/drivers/tty/serial/jsm/jsm_cls.c @@ -689,7 +689,7 @@ static void cls_param(struct jsm_channel *ch) /* * If baud rate is zero, flush queues, and set mval to drop DTR. */ - if ((ch->ch_c_cflag & (CBAUD)) == 0) { + if ((ch->ch_c_cflag & CBAUD) == B0) { ch->ch_r_head = 0; ch->ch_r_tail = 0; ch->ch_e_head = 0; diff --git a/drivers/tty/serial/jsm/jsm_neo.c b/drivers/tty/serial/jsm/jsm_neo.c index 0cf586c10688..0c78f66276cd 100644 --- a/drivers/tty/serial/jsm/jsm_neo.c +++ b/drivers/tty/serial/jsm/jsm_neo.c @@ -938,7 +938,7 @@ static void neo_param(struct jsm_channel *ch) /* * If baud rate is zero, flush queues, and set mval to drop DTR. */ - if ((ch->ch_c_cflag & (CBAUD)) == 0) { + if ((ch->ch_c_cflag & CBAUD) == B0) { ch->ch_r_head = ch->ch_r_tail = 0; ch->ch_e_head = ch->ch_e_tail = 0;