Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp251258pxb; Wed, 22 Sep 2021 01:02:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxq/nh6SaaoLDEmr/fy+0l0qwDlhsMFolaT+cmYcWBlfdkt48pjjCn8b7zo/cluG9b6C103 X-Received: by 2002:a05:6402:202a:: with SMTP id ay10mr39013492edb.400.1632297777663; Wed, 22 Sep 2021 01:02:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632297777; cv=none; d=google.com; s=arc-20160816; b=dYPBfndBquLG89XITWk5vZW0HUWPMWUoKb8zELpbvpkWhnbQw3qRc5Rkgxo/acFOmy dC+c5fBzRprElRHpMX+cuLNgKZHKAdkN0i3WIhgJZ+PbsFAAOcKx96vhaDiqKPhIwgo1 2df4DKlRZf2SZg9x8L53gxX6vDDyMVaxs4+mHRabeAdXgFYFKiEv9WsX1wdsq1uNFouh QzwZXaU1Pfqt1j3MheoGWCYkSeqSPK6O4jq2u+zRjvznWnc20ADNkkfIDtRM4n0nyEIY PIEJBE34CLp5/eLzFLfV7101qz6x4mYzvFUm+BrSlIP0JHYh64a2nfWJZjwgB0ydxLZy lO6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=1eNhrsKLfHba5f7FTtrJ7Ml7fJtnV/kwE/HvvTUi05Y=; b=uWTi0ysWJpRZp1ElwXdNgoVS0DaBw/oP8kF41veecoed7N6ZwcLlkS+JGhpIDrPehE FV/CufkbqIUbXhTuBHG/yW2wJw5IYTfnI9BpW2Wj8sVGU4G0W46hHAYR/rBBnqnBV0rG t1Ts0qhPkWdqPxUX++kYFZdWawNm5CmiMT11SUe7hq5sdc1JqFmGnmdwHJfXHSqstVfR 9s31oJjbuphw9pkkiAWIMJ8w6z97Smf331o95swhqEDu8EOOf+Kx/GsjHn1ilFg7n4S1 apn8UrGB2gxA+Ncoh9pwO8hCAKrhi9ocs8hVET5l9vRzlDPoQoLLC2mzYvGmepobnwoA Sp2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=d5Wrma4f; dkim=neutral (no key) header.i=@suse.cz header.b=5T3IyPgy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m19si1742625ejd.372.2021.09.22.01.02.33; Wed, 22 Sep 2021 01:02:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=d5Wrma4f; dkim=neutral (no key) header.i=@suse.cz header.b=5T3IyPgy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233701AbhIVIBT (ORCPT + 99 others); Wed, 22 Sep 2021 04:01:19 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:34554 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233420AbhIVIBK (ORCPT ); Wed, 22 Sep 2021 04:01:10 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 6E13C201BF; Wed, 22 Sep 2021 07:59:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1632297579; 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=1eNhrsKLfHba5f7FTtrJ7Ml7fJtnV/kwE/HvvTUi05Y=; b=d5Wrma4fJbAZhYMY6GkjElUusGnQAl70oqhb/cJsih5xwVyJnQ6z5lrUGJQNIICk5ARDqf R/LvdX2B7RkUhW8TVc5vpA7AoreQQzL1EDFW+BnXeGfe5KyXn2ERpRL3185z95C4oqCwmG tCkEYAA0UzfF3BRLNBW7YBDawae9Y4Q= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1632297579; 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=1eNhrsKLfHba5f7FTtrJ7Ml7fJtnV/kwE/HvvTUi05Y=; b=5T3IyPgyz47gtw2Fk/Vu+nqlr5cr/tSzrqo1DoCSDilWWd1IA2HZj4Di1IPpzKV7+Cv2az +HpylQ5sKOqxqsCQ== 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 4F8CAA3B8D; Wed, 22 Sep 2021 07:59:39 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 4/7] mxser: simplify FCR computation in mxser_change_speed() Date: Wed, 22 Sep 2021 09:59:35 +0200 Message-Id: <20210922075938.31390-4-jslaby@suse.cz> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210922075938.31390-1-jslaby@suse.cz> References: <20210922075938.31390-1-jslaby@suse.cz> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Provided FIFO is always enabled for MUST chips, move its FCR setting out of PORT_8250/PORT_16450 special case in mxser_change_speed(). Now, we can pre-set fcr to zero and invert the condition of the 'if'. This makes the code more readable (no functional change intended). Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 47 +++++++++++++++++++-------------------------- 1 file changed, 20 insertions(+), 27 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 309acf3f1ec3..c194a96bb14e 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -600,33 +600,26 @@ static void mxser_change_speed(struct tty_struct *tty, struct ktermios *old_term if (cflag & CMSPAR) cval |= UART_LCR_SPAR; - if ((info->type == PORT_8250) || (info->type == PORT_16450)) { - if (info->board->must_hwid) { - fcr = UART_FCR_ENABLE_FIFO; - fcr |= MOXA_MUST_FCR_GDA_MODE_ENABLE; - mxser_set_must_fifo_value(info); - } else - fcr = 0; - } else { - fcr = UART_FCR_ENABLE_FIFO; - if (info->board->must_hwid) { - fcr |= MOXA_MUST_FCR_GDA_MODE_ENABLE; - mxser_set_must_fifo_value(info); - } else { - switch (info->rx_high_water) { - case 1: - fcr |= UART_FCR_TRIGGER_1; - break; - case 4: - fcr |= UART_FCR_TRIGGER_4; - break; - case 8: - fcr |= UART_FCR_TRIGGER_8; - break; - default: - fcr |= UART_FCR_TRIGGER_14; - break; - } + fcr = 0; + if (info->board->must_hwid) { + fcr |= UART_FCR_ENABLE_FIFO | + MOXA_MUST_FCR_GDA_MODE_ENABLE; + mxser_set_must_fifo_value(info); + } else if (info->type != PORT_8250 && info->type != PORT_16450) { + fcr |= UART_FCR_ENABLE_FIFO; + switch (info->rx_high_water) { + case 1: + fcr |= UART_FCR_TRIGGER_1; + break; + case 4: + fcr |= UART_FCR_TRIGGER_4; + break; + case 8: + fcr |= UART_FCR_TRIGGER_8; + break; + default: + fcr |= UART_FCR_TRIGGER_14; + break; } } -- 2.33.0