Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1860669rwb; Fri, 19 Aug 2022 10:35:28 -0700 (PDT) X-Google-Smtp-Source: AA6agR4O6gmHDCmyFnwV1Z93oM9BAfMbuw16d/wSUGlnTQIJrjV6mN9asd8a9ZaqnK1LpxQuBaYu X-Received: by 2002:a17:906:5a65:b0:73c:ba9b:70d0 with SMTP id my37-20020a1709065a6500b0073cba9b70d0mr3192535ejc.741.1660930528682; Fri, 19 Aug 2022 10:35:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660930528; cv=none; d=google.com; s=arc-20160816; b=QA3Nq9MvMf7RAGwmVy45lQ7PmzlMzbzfUgYnz8Y3xwY3yE6pDoeDTD23kZFCoNRVx2 aO3s3UloRJyWRX1eAlLE/S/wB1ceakMYNKbPDrWb5Y8MeGZwSFMWnSlO+Ty46mMVavYn /ov9poY2cu9GMvAMFRGyOY1NqLRps+jD4Ub+lKp9maH0XtgC5+mnXL3sSatninMoVESy gHlN5wH5mEze08Ic3kDkwL7Cewhi59VJ2FVUOF1wdbQh7vh1gCSMlpisa9hK9qc2qBrN 5Z0isFxFv53W0nrszniF55XBbayGV0hxi84J6pxgYW1JQlITptQlsiW/vekXj5ks8tzF T38Q== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vRYhrAmtsxnd6oFUeoVynrSONJyc9D68s+33GGR0pNg=; b=CmAsSIK5A/8StO1wQyl1lgK3mlWupSSeVRP/CZmHApODiDIf+K19/3FAH56+FHAtqO fNhmWQkinsasEjMfSUVImcn4q5jIfq5Gy0SA5uIhvOXrvuXm4BwFOr3B+7ZZwdYI68BE gCevkEaUiBOVsWbtpQ2JjUiUgzfYpACU+W4RDMe9LcjyFOJBH4nld25yfCmvSn9aiJRD 0va0Fx3ARGnxAdI6qMIWPK5Vhn7WQE94t/hN4UZWGvncuSCR85ERTjIRygZM/wKMSehw uzgQKBA2s+dLtwyGIzA3Ks3KNjnl/YgWim4Sh4mkXAUzLvalngtruDdflg1RTDahA9C8 H9YA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ppl4Q3ra; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x15-20020a056402414f00b00443720e5441si3245786eda.170.2022.08.19.10.35.02; Fri, 19 Aug 2022 10:35:28 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b=Ppl4Q3ra; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353481AbiHSQgC (ORCPT + 99 others); Fri, 19 Aug 2022 12:36:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352741AbiHSQ3B (ORCPT ); Fri, 19 Aug 2022 12:29:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D2CB11A2D8; Fri, 19 Aug 2022 09:04:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DBBFFB8281A; Fri, 19 Aug 2022 16:04:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4EA15C433D7; Fri, 19 Aug 2022 16:04:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660925059; bh=rMQujy9Rm3AKuwyWWpNKXcNcOHF3RqjwmCE5Oj/ybzs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ppl4Q3raaqYAZxW9F4Tv1/MS4gHMpZb3CHGayGpicf7e/skkpKDL0FDeIVQ0uyt91 RU4QAxHao+kBXveLgGLo123aOScFjgOjdvWnJ0nwyyG3r5KPOI/Lrc18uQ5wK2ky7b SmpTS02xwaRGKwchms8cfTRNINY/+ZpG5enGs9mE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Maciej W. Rozycki" , Andy Shevchenko , Sasha Levin Subject: [PATCH 5.10 370/545] serial: 8250: Export ICR access helpers for internal use Date: Fri, 19 Aug 2022 17:42:20 +0200 Message-Id: <20220819153845.971433258@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220819153829.135562864@linuxfoundation.org> References: <20220819153829.135562864@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 From: Maciej W. Rozycki [ Upstream commit cb5a40e3143bc64437858b337273fd63cc42e9c2 ] Make ICR access helpers available outside 8250_port.c, however retain them as ordinary static functions so as not to regress code generation. This is because `serial_icr_write' is currently automatically inlined by GCC, however `serial_icr_read' is not. Making them both static inline would grow code produced, e.g.: $ i386-linux-gnu-size --format=gnu 8250_port-{old,new}.o text data bss total filename 15065 3378 0 18443 8250_port-old.o 15289 3378 0 18667 8250_port-new.o and: $ riscv64-linux-gnu-size --format=gnu 8250_port-{old,new}.o text data bss total filename 16980 5306 0 22286 8250_port-old.o 17124 5306 0 22430 8250_port-new.o while making them external would needlessly add a new module interface and lose the benefit from `serial_icr_write' getting inlined outside 8250_port.o. Signed-off-by: Maciej W. Rozycki Reviewed-by: Andy Shevchenko Link: https://lore.kernel.org/r/alpine.DEB.2.21.2204181517500.9383@angie.orcam.me.uk Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/serial/8250/8250.h | 22 ++++++++++++++++++++++ drivers/tty/serial/8250/8250_port.c | 21 --------------------- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/drivers/tty/serial/8250/8250.h b/drivers/tty/serial/8250/8250.h index 34aa2714f3c9..b6dc9003b8c4 100644 --- a/drivers/tty/serial/8250/8250.h +++ b/drivers/tty/serial/8250/8250.h @@ -119,6 +119,28 @@ static inline void serial_out(struct uart_8250_port *up, int offset, int value) up->port.serial_out(&up->port, offset, value); } +/* + * For the 16C950 + */ +static void serial_icr_write(struct uart_8250_port *up, int offset, int value) +{ + serial_out(up, UART_SCR, offset); + serial_out(up, UART_ICR, value); +} + +static unsigned int __maybe_unused serial_icr_read(struct uart_8250_port *up, + int offset) +{ + unsigned int value; + + serial_icr_write(up, UART_ACR, up->acr | UART_ACR_ICRRD); + serial_out(up, UART_SCR, offset); + value = serial_in(up, UART_ICR); + serial_icr_write(up, UART_ACR, up->acr); + + return value; +} + void serial8250_clear_and_reinit_fifos(struct uart_8250_port *p); static inline int serial_dl_read(struct uart_8250_port *up) diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c index 43884e8b5161..9d60418e4adb 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -529,27 +529,6 @@ serial_port_out_sync(struct uart_port *p, int offset, int value) } } -/* - * For the 16C950 - */ -static void serial_icr_write(struct uart_8250_port *up, int offset, int value) -{ - serial_out(up, UART_SCR, offset); - serial_out(up, UART_ICR, value); -} - -static unsigned int serial_icr_read(struct uart_8250_port *up, int offset) -{ - unsigned int value; - - serial_icr_write(up, UART_ACR, up->acr | UART_ACR_ICRRD); - serial_out(up, UART_SCR, offset); - value = serial_in(up, UART_ICR); - serial_icr_write(up, UART_ACR, up->acr); - - return value; -} - /* * FIFO support. */ -- 2.35.1