From patchwork Tue Nov 15 07:17:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 20221 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2566787wru; Mon, 14 Nov 2022 23:22:37 -0800 (PST) X-Google-Smtp-Source: AA0mqf6hGq3zTDvqBXYP491MhX1iQbobncaJUs6qLaHXbZP07Kaj+/xz2wAnyRdWNj2XynHlTBEi X-Received: by 2002:a17:906:d115:b0:79e:9aea:7b60 with SMTP id b21-20020a170906d11500b0079e9aea7b60mr13109533ejz.444.1668496957027; Mon, 14 Nov 2022 23:22:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668496957; cv=none; d=google.com; s=arc-20160816; b=zXLN75Dvp8KTnwzIuUbz3stgW1VrH/VshLaBWWorVCvSipfwVYUIXYqhrVGqDwvcAF DY9AaLiNMTwsOb3o6wGy5vl1n6pEYE7JJp3YaQrcOt+331UAUvhq2k1A6+Y7yCRT2ZwJ 6T1i2V3QxErTIf3OvrNR5Kf38ZXYtTq0eis8+XOykfaRLXSIRQHv/uACunqqVPpuRDkV 8B7weXOtbsuVo3kwdv2UwhEoym8eKF36S6PQvgm+QsFGFaCCXk387UVfi1AgCbERHKxx aBuNN8AbyCOfEwtewx8n4jtiD/Intk4mFlEBU7o7xKf7AAOFRAgsg2jct0B3M3k5Ts+v 7kig== 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=ZN0z6nPyQE6trmhcHuRv9hP7vFnpkl52nAkd0jyPeco=; b=cAQKcp9uF7CdjcXDZ9xyn10TfK+Q6M3/BqM5ChjH5XGIBMn2EzqD9lkDukH1KB+AsG 9dYEdwXdqOmAvkmOThwYmiYE0WJwkF3pMBr+flgpU1Q8v5uNXWfOOopRuQYyXUVyWtUV ZF+PX/2j4fX3nepQ/ih3JNq5HxdfJngnyHi6RnMOvhEmPUuJ8STGyfRu+rjD6bfWw+5P +5o2qOX7OUdHalDbV9ahUWMEHl7EV2N6rUHlEr1H/zdFwqw7KBpht+/Fruyn2LXohyGd /A72arZFX3ZcsAo+2r4DgTcH3piEZUPQB7jSXi57QyefDG0W0jz7pebHdO/KiaOIl4iN LWQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Wo3YGIGo; 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 dd11-20020a1709069b8b00b0077d562462f5si11353761ejc.381.2022.11.14.23.22.02; Mon, 14 Nov 2022 23:22:37 -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=Wo3YGIGo; 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 S229732AbiKOHRs (ORCPT + 99 others); Tue, 15 Nov 2022 02:17:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232197AbiKOHRf (ORCPT ); Tue, 15 Nov 2022 02:17:35 -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 1D36F1DF07; Mon, 14 Nov 2022 23:17:34 -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 C2ADAB816E3; Tue, 15 Nov 2022 07:17:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3516CC433D7; Tue, 15 Nov 2022 07:17:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668496651; bh=ySbf5OGqnLlT6+c5XgtGYdkxj8KjA4c0fKuJpbK+Xa8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wo3YGIGoImxD2R2QnuP0u57S+zV8/mH+JYkL1bRXG8eVtmO1Azn4BwldRFM43gzoI u7ooUUY0c+seV9RinkoH0WjKV+FNzA9r9kQomNUPhQpsb5svlkARiZA/Yox3XHgqgh y7U+LDT5npwH9jVY1taWmP7hf9sv1EFh/Zy9waYuemMDwLjlTrFPXsrZ9BkfQgvSWA FXdvbkyJdIKk37BKZBAkkb8agytP3uU8XUOY2YkTr9PsVeHyMrmT2Ufx9eC/Om8Dqf PjR56200TJ/9m5csISkbaxXg81klMus4xZywT6V+svYAd88ochkr1csH+cBXCP5mv4 REAMkaKw7chzQ== 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 3/4] tty: serial: altera_jtaguart: use uart_port::read_status_mask Date: Tue, 15 Nov 2022 08:17:23 +0100 Message-Id: <20221115071724.5185-3-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?1749545865289081163?= X-GMAIL-MSGID: =?utf-8?q?1749545865289081163?= Instead of self-defined struct altera_jtaguart::imr, use preexisting uart_port::read_status_mask. Note that imr was ulong. But there is no reason for that, its values are uints. And readl/writel's are used to read it/write to it. Cc: Tobias Klauser Signed-off-by: Jiri Slaby (SUSE) Reviewed-by: Tobias Klauser --- drivers/tty/serial/altera_jtaguart.c | 41 +++++++++++----------------- 1 file changed, 16 insertions(+), 25 deletions(-) diff --git a/drivers/tty/serial/altera_jtaguart.c b/drivers/tty/serial/altera_jtaguart.c index b83eade64b22..6808abd27785 100644 --- a/drivers/tty/serial/altera_jtaguart.c +++ b/drivers/tty/serial/altera_jtaguart.c @@ -55,7 +55,6 @@ */ struct altera_jtaguart { struct uart_port port; - unsigned long imr; /* Local IMR mirror */ }; static unsigned int altera_jtaguart_tx_space(struct uart_port *port, u32 *ctlp) @@ -84,29 +83,23 @@ static void altera_jtaguart_set_mctrl(struct uart_port *port, unsigned int sigs) static void altera_jtaguart_start_tx(struct uart_port *port) { - struct altera_jtaguart *pp = - container_of(port, struct altera_jtaguart, port); - - pp->imr |= ALTERA_JTAGUART_CONTROL_WE_MSK; - writel(pp->imr, port->membase + ALTERA_JTAGUART_CONTROL_REG); + port->read_status_mask |= ALTERA_JTAGUART_CONTROL_WE_MSK; + writel(port->read_status_mask, + port->membase + ALTERA_JTAGUART_CONTROL_REG); } static void altera_jtaguart_stop_tx(struct uart_port *port) { - struct altera_jtaguart *pp = - container_of(port, struct altera_jtaguart, port); - - pp->imr &= ~ALTERA_JTAGUART_CONTROL_WE_MSK; - writel(pp->imr, port->membase + ALTERA_JTAGUART_CONTROL_REG); + port->read_status_mask &= ~ALTERA_JTAGUART_CONTROL_WE_MSK; + writel(port->read_status_mask, + port->membase + ALTERA_JTAGUART_CONTROL_REG); } static void altera_jtaguart_stop_rx(struct uart_port *port) { - struct altera_jtaguart *pp = - container_of(port, struct altera_jtaguart, port); - - pp->imr &= ~ALTERA_JTAGUART_CONTROL_RE_MSK; - writel(pp->imr, port->membase + ALTERA_JTAGUART_CONTROL_REG); + port->read_status_mask &= ~ALTERA_JTAGUART_CONTROL_RE_MSK; + writel(port->read_status_mask, + port->membase + ALTERA_JTAGUART_CONTROL_REG); } static void altera_jtaguart_break_ctl(struct uart_port *port, int break_state) @@ -163,7 +156,7 @@ static irqreturn_t altera_jtaguart_interrupt(int irq, void *data) unsigned int isr; isr = (readl(port->membase + ALTERA_JTAGUART_CONTROL_REG) >> - ALTERA_JTAGUART_CONTROL_RI_OFF) & pp->imr; + ALTERA_JTAGUART_CONTROL_RI_OFF) & port->read_status_mask; spin_lock(&port->lock); @@ -187,8 +180,6 @@ static void altera_jtaguart_config_port(struct uart_port *port, int flags) static int altera_jtaguart_startup(struct uart_port *port) { - struct altera_jtaguart *pp = - container_of(port, struct altera_jtaguart, port); unsigned long flags; int ret; @@ -203,8 +194,9 @@ static int altera_jtaguart_startup(struct uart_port *port) spin_lock_irqsave(&port->lock, flags); /* Enable RX interrupts now */ - pp->imr = ALTERA_JTAGUART_CONTROL_RE_MSK; - writel(pp->imr, port->membase + ALTERA_JTAGUART_CONTROL_REG); + port->read_status_mask = ALTERA_JTAGUART_CONTROL_RE_MSK; + writel(port->read_status_mask, + port->membase + ALTERA_JTAGUART_CONTROL_REG); spin_unlock_irqrestore(&port->lock, flags); @@ -213,15 +205,14 @@ static int altera_jtaguart_startup(struct uart_port *port) static void altera_jtaguart_shutdown(struct uart_port *port) { - struct altera_jtaguart *pp = - container_of(port, struct altera_jtaguart, port); unsigned long flags; spin_lock_irqsave(&port->lock, flags); /* Disable all interrupts now */ - pp->imr = 0; - writel(pp->imr, port->membase + ALTERA_JTAGUART_CONTROL_REG); + port->read_status_mask = 0; + writel(port->read_status_mask, + port->membase + ALTERA_JTAGUART_CONTROL_REG); spin_unlock_irqrestore(&port->lock, flags);