From patchwork Tue Nov 15 07:17:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 20217 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2566010wru; Mon, 14 Nov 2022 23:20:43 -0800 (PST) X-Google-Smtp-Source: AA0mqf6IybkoSQVBxgD4HrkSSAaJVJqOIz7srCOdonj0J9Kx0+994PwbzRJ0mgjohOByHSdooTwb X-Received: by 2002:a17:907:a046:b0:7ae:cbae:af1 with SMTP id gz6-20020a170907a04600b007aecbae0af1mr12187446ejc.31.1668496843211; Mon, 14 Nov 2022 23:20:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668496843; cv=none; d=google.com; s=arc-20160816; b=iqNTCgky5G2eOJqIQqbZQqaFyBlkcm9VhgvP/9UKNM+r+aTuTuMTl91XhLVPHshKVf iU/Wk55MG9ddyFjuJGzth+WL5pf2qwx6OirIaQvg6sBhnH+0E3qXq8UFUMxOGs4qfUim YwbjnDjTakaJtahdN8IQcBnIc0RIDm2lPJP99/rN64qGFRxSRP1R3s+2qV5XUvPH/2/o tC9OU+LgqfntSmnKEpLT/7h5ElFBkzYxWKhqd+8yhAePF2J/eSo5X0Iss/Y2UW4SWWn/ tc6Jnw4MXwEd1C5/3ugXCEy61Sr6EagmCcLtGKAZhH9g5fevJJaKxrDgY27Lci0bNv2G swpQ== 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=uHLOZAoBCxM2ggx3auBDP7ULS8olXYXAI1yNvmRSbX0=; b=TCTzvctMpzK+67Kz5BO/SVbIExYOqATFwtZ4G3T47EHLx7Wr2KPukdSeSPlfZ1bUMn HlsHzVtNXai2NLK1Oq5xCiUparTbbOGjdwtikm6k5OihHAH/NQU7xtpoSf7W0kPWwCKE M7ANdDXuI7WKf/zCt1LCfio1Ckdg5oOM4wyssyVCWeu9XTNAxilDKX44O/0kAY/LePTt 0ixqrq9GRjU7MG6ImK8y8d9FlTLCnYhoBRgwwnv2zv2sfbGM39rXicUFPCCEBGsuaV3J VQc8U17/Sp7tc/DE6xhgt887XE3QdoyvbWRgHo9fQMFyqFwqwtlyg/mO2vnS5Vo532kJ GH1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=K8Iu51xs; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o13-20020a170906974d00b0073d8e4e8c77si11107927ejy.1005.2022.11.14.23.20.18; Mon, 14 Nov 2022 23:20:43 -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=@kernel.org header.s=k20201202 header.b=K8Iu51xs; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232428AbiKOHRw (ORCPT + 99 others); Tue, 15 Nov 2022 02:17:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232253AbiKOHRh (ORCPT ); Tue, 15 Nov 2022 02:17:37 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C227D1DF05; Mon, 14 Nov 2022 23:17:35 -0800 (PST) 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 77BEDB816E1; Tue, 15 Nov 2022 07:17:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E19C2C433C1; Tue, 15 Nov 2022 07:17:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668496653; bh=H6ycuvdmMnn4fzX+ZhFbcKEoEHYAguQOKDxX4bdPxmU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K8Iu51xsk/uma9VXUC+KtCaKc2k728Hhu9iT9hakP+zjNbkf1Sm0z0curl0rL/35R PocaKKjpqrbp1nxraFy82R+x8FNWAmWrYRmzkDWtc1nijLQnzpjQnga5Er6HM1Zgqu UE0K+IhEiOpnSK2Ne/d9u/HKuE5mjx0j3/hW33KGErn967xK8DSF6p/WJHHierWd7k tQ0qy4XFdHSzoyYOiCAfd5j5sO7nu09fGYfA4X3yr7ZpLZvNOQ/Xg4aE1h53V1E+zU nWZUP4SxrvjrUrN11IqTyVScrhmx3braNGbRgsdCkbdpdK2Z6qxdNHizNUKJUVamPk 2KW6vf9csSJyA== From: "Jiri Slaby (SUSE)" To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, "Jiri Slaby (SUSE)" , Tobias Klauser Subject: [PATCH 4/4] tty: serial: altera_jtaguart: remove struct altera_jtaguart Date: Tue, 15 Nov 2022 08:17:24 +0100 Message-Id: <20221115071724.5185-4-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221115071724.5185-1-jirislaby@kernel.org> References: <20221115071724.5185-1-jirislaby@kernel.org> MIME-Version: 1.0 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 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?1749545745909848568?= X-GMAIL-MSGID: =?utf-8?q?1749545745909848568?= It contains only struct uart_port, so no need for another structure. Remove it and convert the rest to use struct uart_port directly. Cc: Tobias Klauser Signed-off-by: Jiri Slaby (SUSE) Reviewed-by: Tobias Klauser --- drivers/tty/serial/altera_jtaguart.c | 29 +++++++++------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/drivers/tty/serial/altera_jtaguart.c b/drivers/tty/serial/altera_jtaguart.c index 6808abd27785..9f843d1cee40 100644 --- a/drivers/tty/serial/altera_jtaguart.c +++ b/drivers/tty/serial/altera_jtaguart.c @@ -50,13 +50,6 @@ #define ALTERA_JTAGUART_CONTROL_AC_MSK 0x00000400 #define ALTERA_JTAGUART_CONTROL_WSPACE_MSK 0xFFFF0000 -/* - * Local per-uart structure. - */ -struct altera_jtaguart { - struct uart_port port; -}; - static unsigned int altera_jtaguart_tx_space(struct uart_port *port, u32 *ctlp) { u32 ctl = readl(port->membase + ALTERA_JTAGUART_CONTROL_REG); @@ -115,9 +108,8 @@ static void altera_jtaguart_set_termios(struct uart_port *port, tty_termios_copy_hw(termios, old); } -static void altera_jtaguart_rx_chars(struct altera_jtaguart *pp) +static void altera_jtaguart_rx_chars(struct uart_port *port) { - struct uart_port *port = &pp->port; unsigned char ch; unsigned long status; @@ -134,9 +126,8 @@ static void altera_jtaguart_rx_chars(struct altera_jtaguart *pp) tty_flip_buffer_push(&port->state->port); } -static void altera_jtaguart_tx_chars(struct altera_jtaguart *pp) +static void altera_jtaguart_tx_chars(struct uart_port *port) { - struct uart_port *port = &pp->port; unsigned int count; u8 ch; @@ -151,8 +142,6 @@ static void altera_jtaguart_tx_chars(struct altera_jtaguart *pp) static irqreturn_t altera_jtaguart_interrupt(int irq, void *data) { struct uart_port *port = data; - struct altera_jtaguart *pp = - container_of(port, struct altera_jtaguart, port); unsigned int isr; isr = (readl(port->membase + ALTERA_JTAGUART_CONTROL_REG) >> @@ -161,9 +150,9 @@ static irqreturn_t altera_jtaguart_interrupt(int irq, void *data) spin_lock(&port->lock); if (isr & ALTERA_JTAGUART_CONTROL_RE_MSK) - altera_jtaguart_rx_chars(pp); + altera_jtaguart_rx_chars(port); if (isr & ALTERA_JTAGUART_CONTROL_WE_MSK) - altera_jtaguart_tx_chars(pp); + altera_jtaguart_tx_chars(port); spin_unlock(&port->lock); @@ -265,7 +254,7 @@ static const struct uart_ops altera_jtaguart_ops = { }; #define ALTERA_JTAGUART_MAXPORTS 1 -static struct altera_jtaguart altera_jtaguart_ports[ALTERA_JTAGUART_MAXPORTS]; +static struct uart_port altera_jtaguart_ports[ALTERA_JTAGUART_MAXPORTS]; #if defined(CONFIG_SERIAL_ALTERA_JTAGUART_CONSOLE) @@ -308,7 +297,7 @@ static void altera_jtaguart_console_putc(struct uart_port *port, unsigned char c static void altera_jtaguart_console_write(struct console *co, const char *s, unsigned int count) { - struct uart_port *port = &(altera_jtaguart_ports + co->index)->port; + struct uart_port *port = &altera_jtaguart_ports[co->index]; uart_console_write(port, s, count, altera_jtaguart_console_putc); } @@ -320,7 +309,7 @@ static int __init altera_jtaguart_console_setup(struct console *co, if (co->index < 0 || co->index >= ALTERA_JTAGUART_MAXPORTS) return -EINVAL; - port = &altera_jtaguart_ports[co->index].port; + port = &altera_jtaguart_ports[co->index]; if (port->membase == NULL) return -ENODEV; return 0; @@ -400,7 +389,7 @@ static int altera_jtaguart_probe(struct platform_device *pdev) if (i >= ALTERA_JTAGUART_MAXPORTS) return -EINVAL; - port = &altera_jtaguart_ports[i].port; + port = &altera_jtaguart_ports[i]; res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (res_mem) @@ -444,7 +433,7 @@ static int altera_jtaguart_remove(struct platform_device *pdev) if (i == -1) i = 0; - port = &altera_jtaguart_ports[i].port; + port = &altera_jtaguart_ports[i]; uart_remove_one_port(&altera_jtaguart_driver, port); iounmap(port->membase);