From patchwork Fri May 13 08:29:03 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: 12848477 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9410AC433F5 for ; Fri, 13 May 2022 08:31:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=727WXb8I9/O8WIptfAx7O3NC0voRfFTynYE1PUq2PLA=; b=m590ZlUseYXFGF La6JrJV7CQXTEdtWE3O5wPjNBtGizX0BDjPqUDzfhh1JRMAMJ4a39jZuGzKMfjyPtrasyizHUI/cK sofcMJOg+IykGw9RuF/kpiHIhmAo+gZtHR5Uc9ZOdJftujVarSWy52dxmxVPiRE9FHgf/OvwJniSM RPVuMEl0M8Bt0URVKHf3AQGETvxo94OUsNFTU5sHg8A/wQ56kTZFGue52eLUjK5gFSUz+qxYDpUVA 1biEiMfxopqzKdlyTAtuy6Bqd+xoqEp3fLqzVpW910o0M8anHXNJaF0EFQV6YOXlwdkVn/46tULgK rNuloeZEofV+2qyKS6UA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1npQg2-00F4P3-Jg; Fri, 13 May 2022 08:29:34 +0000 Received: from mga03.intel.com ([134.134.136.65]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1npQfy-00F4NO-8l for linux-arm-kernel@lists.infradead.org; Fri, 13 May 2022 08:29:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652430570; x=1683966570; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ZaGFZlPpCXiOg96Y9zRYreA0FK3dK9EZzaBA06o/Ag0=; b=WcyLnq6ulB3YO6LIJ54/8vppjHV5/BX4PjBkXSjwn/ULk1kn4d2ECvSX iqANnF8A255spvIHFa/vnlMbG876Tjkfyt8flm/V689xDb6gHZ5+tfAXA NcoYnONt6ZsveT/VXpCM90sxo5V1U/cfINcj5gJOwZ0va/TBhyO22Pr1U LmeZayLZC6imIpL3zl0M1VtnaVCF1vcgnTDzTA24GhovZ0hpyoyg2fFPs cYE8L2gcqK1G4wOyTFjzh9+Fbzmm2foEv7/s1A41LfHDoj8e7HWTh2P9J BkbztXJ+PPmDkl4enK8y1j6AcvlnkL/iQ3v3IcJDon9x+5YkKZlP3CbY6 A==; X-IronPort-AV: E=McAfee;i="6400,9594,10345"; a="270187196" X-IronPort-AV: E=Sophos;i="5.91,221,1647327600"; d="scan'208";a="270187196" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2022 01:29:28 -0700 X-IronPort-AV: E=Sophos;i="5.91,221,1647327600"; d="scan'208";a="567107480" 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:25 -0700 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: linux-serial@vger.kernel.org, Greg KH , Johan Hovold , Jiri Slaby , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH v2 2/5] tty: remove BOTHER ifdefs Date: Fri, 13 May 2022 11:29:03 +0300 Message-Id: <20220513082906.11096-3-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220513_012930_390108_7625FCC7 X-CRM114-Status: GOOD ( 13.97 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org BOTHER is defined by all architectures since commit d0ffb805b729 ("arch/alpha, termios: implement BOTHER, IBSHIFT and termios2"). Signed-off-by: Ilpo Järvinen --- drivers/tty/mxser.c | 5 ++--- drivers/tty/tty_baudrate.c | 20 +++++--------------- drivers/tty/tty_ioctl.c | 2 -- 3 files changed, 7 insertions(+), 20 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 6ebd3e4ed859..70b982b2c6b2 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -528,7 +528,6 @@ static int mxser_set_baud(struct tty_struct *tty, speed_t newspd) outb(quot >> 8, info->ioaddr + UART_DLM); /* MS of divisor */ outb(cval, info->ioaddr + UART_LCR); /* reset DLAB */ -#ifdef BOTHER if (C_BAUD(tty) == BOTHER) { quot = MXSER_BAUD_BASE % newspd; quot *= 8; @@ -539,9 +538,9 @@ static int mxser_set_baud(struct tty_struct *tty, speed_t newspd) quot /= newspd; mxser_set_must_enum_value(info->ioaddr, quot); - } else -#endif + } else { mxser_set_must_enum_value(info->ioaddr, 0); + } return 0; } diff --git a/drivers/tty/tty_baudrate.c b/drivers/tty/tty_baudrate.c index d903e111dbcb..07bbbfee5635 100644 --- a/drivers/tty/tty_baudrate.c +++ b/drivers/tty/tty_baudrate.c @@ -61,11 +61,10 @@ speed_t tty_termios_baud_rate(struct ktermios *termios) cbaud = termios->c_cflag & CBAUD; -#ifdef BOTHER /* Magic token for arbitrary speed via c_ispeed/c_ospeed */ if (cbaud == BOTHER) return termios->c_ospeed; -#endif + if (cbaud & CBAUDEX) { cbaud &= ~CBAUDEX; @@ -97,11 +96,11 @@ speed_t tty_termios_input_baud_rate(struct ktermios *termios) if (cbaud == B0) return tty_termios_baud_rate(termios); -#ifdef BOTHER + /* Magic token for arbitrary speed via c_ispeed*/ if (cbaud == BOTHER) return termios->c_ispeed; -#endif + if (cbaud & CBAUDEX) { cbaud &= ~CBAUDEX; @@ -157,7 +156,6 @@ void tty_termios_encode_baud_rate(struct ktermios *termios, if (((termios->c_cflag >> IBSHIFT) & CBAUD) != B0) ibinput = 1; /* An input speed was specified */ #endif -#ifdef BOTHER /* 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,7 +168,7 @@ void tty_termios_encode_baud_rate(struct ktermios *termios, } if (((termios->c_cflag >> IBSHIFT) & CBAUD) == BOTHER) iclose = 0; -#endif + termios->c_cflag &= ~CBAUD; #ifdef IBSHIFT termios->c_cflag &= ~(CBAUD << IBSHIFT); @@ -205,11 +203,7 @@ void tty_termios_encode_baud_rate(struct ktermios *termios, } } while (++i < n_baud_table); - /* - * If we found no match then use BOTHER if provided or warn - * the user their platform maintainer needs to wake up if not. - */ -#ifdef BOTHER + /* If we found no match then use BOTHER. */ if (ofound == -1) termios->c_cflag |= BOTHER; /* Set exact input bits only if the input and output differ or the @@ -217,10 +211,6 @@ void tty_termios_encode_baud_rate(struct ktermios *termios, */ if (ifound == -1 && (ibaud != obaud || ibinput)) termios->c_cflag |= (BOTHER << IBSHIFT); -#else - if (ifound == -1 || ofound == -1) - pr_warn_once("tty: Unable to return correct speed data as your architecture needs updating.\n"); -#endif } EXPORT_SYMBOL_GPL(tty_termios_encode_baud_rate); diff --git a/drivers/tty/tty_ioctl.c b/drivers/tty/tty_ioctl.c index 63181925ec1a..adae687f654b 100644 --- a/drivers/tty/tty_ioctl.c +++ b/drivers/tty/tty_ioctl.c @@ -562,10 +562,8 @@ static int set_sgttyb(struct tty_struct *tty, struct sgttyb __user *sgttyb) termios.c_cc[VKILL] = tmp.sg_kill; set_sgflags(&termios, tmp.sg_flags); /* Try and encode into Bfoo format */ -#ifdef BOTHER tty_termios_encode_baud_rate(&termios, termios.c_ispeed, termios.c_ospeed); -#endif up_write(&tty->termios_rwsem); tty_set_termios(tty, &termios); return 0;