Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1684878pxm; Thu, 24 Feb 2022 07:35:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJyqRVYljdmJej1TQMp6prLNc65aRpRU3IFKtbJyX3RZniS7M3bG8YLVO4pjnAngLQO54dnf X-Received: by 2002:a17:902:e743:b0:150:a12:bc5c with SMTP id p3-20020a170902e74300b001500a12bc5cmr3293595plf.123.1645716920400; Thu, 24 Feb 2022 07:35:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645716920; cv=none; d=google.com; s=arc-20160816; b=A2G4O4JGoHW7yj+w4tDttk6rcwXGrXdkC7VrSQ15iP5+b5XZ4ZzSAZKpusyZZBe5Zq IaYZHFs2qBqKDEfu/5DJOMJc9P+ljE+OTUrxvS/JmbCG9Rbwh4lEZmQ9YYHqWX0K4FNQ zFHM8lWk/0fUuyw/iWKpY6+oa2mcZz7wAPG20jlroC1jAoLF5E0yx3pLPvOyN+U7JzvU XQ+nIDgR3QW2YwO2iNQ9B8EozvGRqNVvinW+fxtBClG7iisooJdEnMsr/2ke+oL4O2LF adkbSM6S8UXIEnllMJUxB42uJTxNq2K9Ep1E3ecKcBE5dHxa08mjVc80+zn01ynvEMRO TgOA== 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=1yL3OrD93751tjdTWgqtYW3vZmFiVRVbclLaKF5e268=; b=GHrXi5FHyOvWBp9jYANBbCTEbdfvqAXATg//8UNXTQNIFCMKoI3I//IHLCDAZ5kM+9 1KS64eLrCSyeqPRZdvHhDaSdA0Nc1WBoALG+TUFVAcbFLkHPjcdYizU0M72NBVREkekB j3Pbgljwuy3S7av2n8xRKe05XOjjXp5FWllNDqEj/2uYfkpsqEde9JkVJCqkuTkFHSfl aMTvcwrzCEdDFKKrpdqvMN4C8w00RVHRcmbc0jIxiIUTiVvfAHugFEXqqDxscJ64o3sM KwqrXfryOYYtkpNNIyI1x2vgG1oDUP2oe0WOHexWUjQ5+xDp1TK8H1pnsl82dLkAmCVc Ceig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=dZPjGftc; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a15si2469776pll.350.2022.02.24.07.35.02; Thu, 24 Feb 2022 07:35:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=dZPjGftc; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233105AbiBXJ4k (ORCPT + 99 others); Thu, 24 Feb 2022 04:56:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233073AbiBXJ4b (ORCPT ); Thu, 24 Feb 2022 04:56:31 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCFFA285AA4; Thu, 24 Feb 2022 01:56:01 -0800 (PST) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 9B6EA1F44C; Thu, 24 Feb 2022 09:56:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1645696560; 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=1yL3OrD93751tjdTWgqtYW3vZmFiVRVbclLaKF5e268=; b=dZPjGftc8DmBWAbVxU6MpC9JWpuJADlKpUXhT3+VziYC1Sr/U5W+kBX0Oibr+0qrRIXnoC 70kmWIy7XgaYCZ3LMdLxd68VF5Owk+Z6xwYN5R3bBB0u4jr2pVhvc3CoTxdMMCsyy4Fn0H kwI+xy/RCq2z87BKgPEFyHUIoEkiXKg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1645696560; 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=1yL3OrD93751tjdTWgqtYW3vZmFiVRVbclLaKF5e268=; b=5eHk5bbCB/yNM/pwLcOCwRP1XGxtQaWU8YoAcTrSqhs8UnLlyxCMj/37N+Fs0vWtEVB+NO HpypL1XQYT0tgZDg== 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 729AFA3B97; Thu, 24 Feb 2022 09:56:00 +0000 (UTC) From: Jiri Slaby To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH 5/5] mxser: make use of UART_LCR_WLEN() + tty_get_char_size() Date: Thu, 24 Feb 2022 10:55:58 +0100 Message-Id: <20220224095558.30929-5-jslaby@suse.cz> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220224095558.30929-1-jslaby@suse.cz> References: <20220224095517.30872-1-jslaby@suse.cz> <20220224095558.30929-1-jslaby@suse.cz> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Having a generic UART_LCR_WLEN() macro and the tty_get_char_size() helper, we can remove all those repeated switch-cases in drivers. Signed-off-by: Jiri Slaby --- drivers/tty/mxser.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 836c9eca2946..6ebd3e4ed859 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c @@ -588,21 +588,7 @@ static void mxser_change_speed(struct tty_struct *tty, struct ktermios *old_term } /* byte size and parity */ - switch (cflag & CSIZE) { - default: - case CS5: - cval = UART_LCR_WLEN5; - break; - case CS6: - cval = UART_LCR_WLEN6; - break; - case CS7: - cval = UART_LCR_WLEN7; - break; - case CS8: - cval = UART_LCR_WLEN8; - break; - } + cval = UART_LCR_WLEN(tty_get_char_size(tty->termios.c_cflag)); if (cflag & CSTOPB) cval |= UART_LCR_STOP; -- 2.35.1