Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp2765653pxb; Mon, 18 Apr 2022 07:49:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOxWKRLTenxwo+jLN9tAf5Z7EKWuMx8CGHJrd+CDoHN64RUItWVaOQF63oSxw1nES/tL55 X-Received: by 2002:a17:907:6d23:b0:6d9:ac9d:222 with SMTP id sa35-20020a1709076d2300b006d9ac9d0222mr9614115ejc.595.1650293358422; Mon, 18 Apr 2022 07:49:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650293358; cv=none; d=google.com; s=arc-20160816; b=QH3i/GPmE31DKPYAqrxDM17SI/H21RiuyUGf2goRrxewYX6jXo3kU+eyYTyeOhVKd9 A+5VqePj1vR1HikDtOhe98Gr6RhoBYwvrfbYH3HTiJ7kJpxoCcYVJmrQVw9jr9bWaaCU adb5dW0sresAHkzagX1JfRx1kAkO07JO+r7HfCcDLle1GPH4O6308Hky1hbB5Ght/Je7 QE7vCrH14mvT4dke+KhRcKhFBOxv9y8vkw7nPnGP/W/H4bjYyFbVmcp2NC/NpKPCQbDx 7KutM9rfHgMLxBQZlk/GrjQFEu90ddYyFgbPvkAjzkknc7gtrMcNetDNOapahWJ+UOz/ nqEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=rBeq7r1LUr17BD3wzjfHgTsyokZ2FymR+3nXomEXu6g=; b=Yqz7Vu50c3+X5wOVC03HOUjp5ml4xG3SNJwZviYon35wUDz4YntIZbkxXoPNdBqrge Fk1daxF2QedG/adJOctCKqn1Mx7HBCfGFB6ySLJIuCxFrwUei6EuV4S2oKXidXnk1p8C Fkb4FQrLnzSm+DyM3vbDQo4WwHUWhDagZre7xvtEhze5Nah0faJsXQvV0g9XCmqkYxQd wJHyxOFLh+F7QFeedoKA/MXDjBeY5TTlv9nnTk/tpI70aeO2Lu7CLZyoJBry2Dp36IY6 pgujF5XmyGkJvTzi7T1fXHcoYELJwm58PcZ7IICgVcDvc1snVdiogTvIkFJB2g+3LfT/ YImQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Xx1vnBsJ; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ks18-20020a170906f85200b006df76385d90si6304513ejb.560.2022.04.18.07.48.54; Mon, 18 Apr 2022 07:49:18 -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=@gmail.com header.s=20210112 header.b=Xx1vnBsJ; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237885AbiDRMYM (ORCPT + 99 others); Mon, 18 Apr 2022 08:24:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238780AbiDRMWt (ORCPT ); Mon, 18 Apr 2022 08:22:49 -0400 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BCD71CB33; Mon, 18 Apr 2022 05:18:16 -0700 (PDT) Received: by mail-ej1-x62a.google.com with SMTP id y10so9116656ejw.8; Mon, 18 Apr 2022 05:18:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=rBeq7r1LUr17BD3wzjfHgTsyokZ2FymR+3nXomEXu6g=; b=Xx1vnBsJpTyBssMLec8mWL15r4vB/b1/DWYrrTDsZnx2crQM4QEDvWC1X35cKEKTw5 7FVXpOzPkGNXScfkmXRupkAvTHLeBqzzDsn6HcCjyRW7QI9+CmkoALZK8AYNZxWy1Vtf vYx5aG7d1KK2A6okFaDTud0BRjgIP9b+6mZyLgNkXsDWEII974cqla2ix6TR9p9HQ3Xu 5d+p4lAGna3lySSQ8/seWqb6pSTbfMBjtSZrSSkECgoy81rnwU5J1xlKf1Icv7aYoyQV 1JSwfjcmHfbMsGx2pcbuIfpx30qH+cx7UenAXVLXlG1SOEY15IjTJLYBHDh9cfpzvlfP gzUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=rBeq7r1LUr17BD3wzjfHgTsyokZ2FymR+3nXomEXu6g=; b=ZRUdqZVj8KkYi8QjYtlTzhx1+7Rs4QqAcJf3qLyKGx5eKZRPYDNTJTyfn+2JlWHDVY n64JPSzK7/RJGWC7Mq1INh0w3GpYnLGS4Dc8m1nwCxWUfkFMxyL+TiI1+N9Ad9WmB1Tp BgQCJQeQ8y3xqKkPz1GTtinwbaRguyYvMg8hxgsEHVKfVtz/s2F7La8XTfFSIfovjZUU IH7YjePYgM+8tZlbPZjVtCeYfB8iwB3bPj7qjHin3LwNZ5yLw7oUoTDaWiPbeJBJQgHW wuoRJoyfYcvPWmtTzYrDMXBDOhkpxKMsF4XgdYbX8oKAI1Qr5gljjApiqEpruaQ6iwtg w+6A== X-Gm-Message-State: AOAM533LDUpaamTixsN1iVbbr+svqg7VPc/OlzAkhbz8thqebTneu8ot hVJt1k7RRpyPIhaXLdXdZq4PmXKsomg4so3Fv2g= X-Received: by 2002:a17:907:8a14:b0:6e8:9691:62f7 with SMTP id sc20-20020a1709078a1400b006e8969162f7mr8964573ejc.497.1650284294799; Mon, 18 Apr 2022 05:18:14 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Andy Shevchenko Date: Mon, 18 Apr 2022 15:17:38 +0300 Message-ID: Subject: Re: [PATCH v4 3/5] serial: 8250: Export ICR access helpers for internal use To: "Maciej W. Rozycki" Cc: Greg Kroah-Hartman , Jiri Slaby , "open list:SERIAL DRIVERS" , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 On Mon, Apr 18, 2022 at 2:02 AM Maciej W. Rozycki wrote: > > 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. Reviewed-by: Andy Shevchenko See one nit-pick below. > Signed-off-by: Maciej W. Rozycki > --- > New change in v4, factored out from 5/5. > --- > drivers/tty/serial/8250/8250.h | 23 +++++++++++++++++++++++ > drivers/tty/serial/8250/8250_port.c | 21 --------------------- > 2 files changed, 23 insertions(+), 21 deletions(-) > > linux-serial-8250-icr-access.diff > Index: linux-macro/drivers/tty/serial/8250/8250.h > =================================================================== > --- linux-macro.orig/drivers/tty/serial/8250/8250.h > +++ linux-macro/drivers/tty/serial/8250/8250.h > @@ -120,6 +120,29 @@ static inline void serial_out(struct uar > up->port.serial_out(&up->port, offset, value); > } > > +/* > + * For the 16C950 > + */ > +static void __maybe_unused serial_icr_write(struct uart_8250_port *up, > + int offset, int value) I think you may drop __maybe_unused here, because it's always used by the code below. So it will be eliminated altogether when the below won't be used. > +{ > + 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) > Index: linux-macro/drivers/tty/serial/8250/8250_port.c > =================================================================== > --- linux-macro.orig/drivers/tty/serial/8250/8250_port.c > +++ linux-macro/drivers/tty/serial/8250/8250_port.c > @@ -538,27 +538,6 @@ serial_port_out_sync(struct uart_port *p > } > > /* > - * 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. > */ > static void serial8250_clear_fifos(struct uart_8250_port *p) -- With Best Regards, Andy Shevchenko