From patchwork Thu Jan 5 12:47:44 2023 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: 39508 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp283497wrt; Thu, 5 Jan 2023 04:49:38 -0800 (PST) X-Google-Smtp-Source: AMrXdXtBlo/3ZZ4b8Pfb678IKqXtju+nh45CReOEkNarAOMIQZGcljjwqalrhc87yfIn/YHEEurw X-Received: by 2002:a17:906:915:b0:7c0:e98d:b27 with SMTP id i21-20020a170906091500b007c0e98d0b27mr44104108ejd.58.1672922978502; Thu, 05 Jan 2023 04:49:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672922978; cv=none; d=google.com; s=arc-20160816; b=JUl8gk9BWJla0LXmCY9iCBKY0s4zk4rgYjgoadtUgvKRzeQ/jjmG2t8lacRmb555jE WlQWjWkreuXfNvJih19bc/ao6qkcxt64bKnctgiGbNs0PU4WLPQa/wB1tBnUImI7Bn5E +8iYXnoUNyxOrW+tfohClHz/Toh8NCoxc9Bt4hORTtDSjU7mvqAFNJCkY0NTHaeviSLL qQhyxffphWp3ur0sypIQ/BsFyg62sJv0I5KKSVtJS9jliqgfhOvdlMIQitwUS49w4vVw Klyw/8JHfq/BDZsHUBe+Ss4S+wQg0mpl5+MIoyCgv33mgqSUcWg4sowgxc0AB/sfoaU2 T2sw== 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; bh=Q3dGBZiLrm3inYwN3WJK5C6Hv9u2G/3uDm9Qigj2Tkw=; b=xTNYkEnOV0uhzCjxy6bfWWI02kGtDuSZF5j10ylwWFTnkf1j56Zbwm4ywKv3WCYdei tjoaSQcGn1Nr/+Q3ydN6hQcmaWH5rFvltx9O4qXfcbOvmqMYSnCitAsscPKJj0CXu2jW 86scXbcFICKy9Bj/N2tc2VFcDZwGlCLx6r+Lkd+bbAR763ptPEuYT0/U6R6oGrUJ+Y6v 0CKYnE/zBUNqAuNdgmdBeQgfieBJUgs8LylqrR+VIYy8k/emOL9lW/a2S1jRYJiQdI9P 5MA8zIX+aVIukXtmXgxC+YwpkAqmRy5XFgP0YPhBSdHwN5BhXXBPoGJLU5S/ccHbASjU X9kQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=l9P96e6g; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gs43-20020a1709072d2b00b0084d119e0672si1190458ejc.932.2023.01.05.04.49.15; Thu, 05 Jan 2023 04:49:38 -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=@intel.com header.s=Intel header.b=l9P96e6g; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233314AbjAEMsU (ORCPT + 99 others); Thu, 5 Jan 2023 07:48:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233152AbjAEMsF (ORCPT ); Thu, 5 Jan 2023 07:48:05 -0500 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 216E14C72E; Thu, 5 Jan 2023 04:48:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1672922885; x=1704458885; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gBllpDNVCKeKdbc9yaBSuxUO7hrUZrjNNGgoCldFUrw=; b=l9P96e6gF93vZvgD5HcKqA0WXMAMQEW6IgGikPfTlkMKas4V8DtppbgN RAW3D+QuRWLuZ32SB059n3l53+norS5I4KKzhgS5mDts77JFre0xRm+2X bBxW5SKPfX+KTGOJ3rhO9qiC6IC7RccJ68qhA9oN/ifYxQR74kzy8jwWK VHR1+mAtPpZoNjy4ENqIlpHPFSD6Ob7ByTqYS+7RCMfg0WWWBoGtTFSor 5e8g5zhKRIAXimXPeMgXKZ5SD5gJSTRSCxuFguR+0CkcMNkW9lcn2k6jq u/SRKxiF6LAQGoNSKnKZnspOr/7Vo2gqS1477Jbm1cNNtRJUDTU+Cf4Ye w==; X-IronPort-AV: E=McAfee;i="6500,9779,10580"; a="301889842" X-IronPort-AV: E=Sophos;i="5.96,302,1665471600"; d="scan'208";a="301889842" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2023 04:48:04 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10580"; a="984287804" X-IronPort-AV: E=Sophos;i="5.96,302,1665471600"; d="scan'208";a="984287804" Received: from khaunx-mobl1.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.252.35.181]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2023 04:48:03 -0800 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: linux-serial@vger.kernel.org, Greg Kroah-Hartman , Jiri Slaby , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , linux-kernel@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH v2 3/3] serial: 8250_rt288x: Remove unnecessary UART_REG_UNMAPPED Date: Thu, 5 Jan 2023 14:47:44 +0200 Message-Id: <20230105124744.105950-4-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230105124744.105950-1-ilpo.jarvinen@linux.intel.com> References: <20230105124744.105950-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_PASS, SPF_NONE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754186885245922805?= X-GMAIL-MSGID: =?utf-8?q?1754186885245922805?= As unmapped registers are at the tail of the array, the ARRAY_SIZE() condition will catch them just fine. No need to define special value for them. Signed-off-by: Ilpo Järvinen --- drivers/tty/serial/8250/8250_rt288x.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/tty/serial/8250/8250_rt288x.c b/drivers/tty/serial/8250/8250_rt288x.c index 3015afb99722..7399fea6dfc1 100644 --- a/drivers/tty/serial/8250/8250_rt288x.c +++ b/drivers/tty/serial/8250/8250_rt288x.c @@ -14,10 +14,8 @@ #define RT288X_DL 0x28 -#define UART_REG_UNMAPPED -1 - /* Au1x00/RT288x UART hardware has a weird register layout */ -static const s8 au_io_in_map[8] = { +static const s8 au_io_in_map[7] = { [UART_RX] = 0, [UART_IER] = 2, [UART_IIR] = 3, @@ -25,18 +23,14 @@ static const s8 au_io_in_map[8] = { [UART_MCR] = 6, [UART_LSR] = 7, [UART_MSR] = 8, - [UART_SCR] = UART_REG_UNMAPPED, }; -static const s8 au_io_out_map[8] = { +static const s8 au_io_out_map[5] = { [UART_TX] = 1, [UART_IER] = 2, [UART_FCR] = 4, [UART_LCR] = 5, [UART_MCR] = 6, - [UART_LSR] = UART_REG_UNMAPPED, - [UART_MSR] = UART_REG_UNMAPPED, - [UART_SCR] = UART_REG_UNMAPPED, }; static unsigned int au_serial_in(struct uart_port *p, int offset) @@ -44,8 +38,7 @@ static unsigned int au_serial_in(struct uart_port *p, int offset) if (offset >= ARRAY_SIZE(au_io_in_map)) return UINT_MAX; offset = au_io_in_map[offset]; - if (offset == UART_REG_UNMAPPED) - return UINT_MAX; + return __raw_readl(p->membase + (offset << p->regshift)); } @@ -54,8 +47,7 @@ static void au_serial_out(struct uart_port *p, int offset, int value) if (offset >= ARRAY_SIZE(au_io_out_map)) return; offset = au_io_out_map[offset]; - if (offset == UART_REG_UNMAPPED) - return; + __raw_writel(value, p->membase + (offset << p->regshift)); }