From patchwork Tue Dec 6 11:57:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Schneider-Pargmann X-Patchwork-Id: 30253 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2774846wrr; Tue, 6 Dec 2022 03:59:37 -0800 (PST) X-Google-Smtp-Source: AA0mqf4A/UYKsNEVm4ex6ObMCGLXsymYjylJgWQAvZ9F+y8ljjsQSJMO7Y5+qhXrAnHlx/FsihfQ X-Received: by 2002:a17:902:d88d:b0:186:cb27:4e01 with SMTP id b13-20020a170902d88d00b00186cb274e01mr71263317plz.139.1670327977106; Tue, 06 Dec 2022 03:59:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670327977; cv=none; d=google.com; s=arc-20160816; b=vErn8+fQp1IeYs64ydE4nJFMpGP2zF8fW21YshgnzPx2+9jX6Rveh7BL/TtQCtDdIw 0VKAgIkjyzYarAbh/dcxCBleh+hCUDqRGpZKql8wNhgzBTXxkhDinddADeAYpobJf1TO Askx8yRmiSGmD0XF5M83qTxiM+rw1kpT7hOIPsHg4/N5cpikAFmEfG8QOVN+0a82C3B2 g5SnPEDByJthMmfpVpk5p8wi8cEehos805AMbvtaj5YGD+c/2cQwa4+64EBX95FpmgvD 4FlW67aXYLRDN+rpEp0WYMFGaRHpCG65M3jMDzPBUmCZHHXN0noYMtg472m4j1uuanI0 UK9Q== 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=6/SM3kRtE0QNFZxUupuZ+9fh0CsrCFYSaqu7nZYqZws=; b=D4V4EamYfQyBFsPn30dY13DziC/XF45mmZ+wkyKkEWB920KGFtxOqhfqc0M1H6OMnY ZN4okJ/5/1NAGEgVEo9bsHmAKS1pWZdIM4BA6AbWkJDzg32Pp4v3IhFyRniHVGHsikn8 UlWu8WgWCi/0SQXCZ9vYpqg+RhsfUZ7P8k/inWiCNvFYua4nbvu63/oJismxGOwZfFe+ MYzKjpOyg0I69W1RXUhjSIAMi8Cd9KzWm3EkuAXGLq5wW8w4IKRHNal4tKANE6dFMlgi zj5BBVGCCaY57NVIYVr+4mH2upoxBM8xqAFlyd2DecmLIqGEV4aEYAxfweHP/QxL6c6/ cIOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=0+4ZNoct; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q6-20020a170902a3c600b00186a076362csi794247plb.315.2022.12.06.03.59.24; Tue, 06 Dec 2022 03:59: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=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=0+4ZNoct; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235271AbiLFL6C (ORCPT + 99 others); Tue, 6 Dec 2022 06:58:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235139AbiLFL5n (ORCPT ); Tue, 6 Dec 2022 06:57:43 -0500 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC36C9580 for ; Tue, 6 Dec 2022 03:57:39 -0800 (PST) Received: by mail-ed1-x52f.google.com with SMTP id d14so14974062edj.11 for ; Tue, 06 Dec 2022 03:57:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6/SM3kRtE0QNFZxUupuZ+9fh0CsrCFYSaqu7nZYqZws=; b=0+4ZNoct0t37OCBI0Y3zYjJ0HnauWB5gfqosr2YiHb/KDkgUB0W0OrWp6Td60o/qh2 mj23yCSgRd5vUr7yuTKBqXK1rKj0Dhlne1ZTLoggSHVQcVUnynig5NLWmEpmVyZtjCR9 irNVKd5e/1zjgrEagyZdtsouWAoDH1YU6TEqfWDYe8sKqoV5xy6a8vH3wt1gX/C2iF05 D9RYNZvOzX9Iu3F07nBTc6L5AZpNP9kV7QGs67cWBAQAzMJTfsXEK36ablfRhBOVi8rt LtImRuyGjgccVT2bgzzGb5sl8iVYYFbWE+C+3BKu1JbqA6qOh3YMau4R9iC5+p7Ap9Uw 8DQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6/SM3kRtE0QNFZxUupuZ+9fh0CsrCFYSaqu7nZYqZws=; b=cFANtEZa8BexaNFGU1HZSgTozY4yzv1xdULfKRtNHuvcgY8U58A1TXfIkJe1DYb1qF w88j9JicDQca8evNUa9N8jMbNYrmBzc1gK8LdX56M0ILgu+fI/8LkzTDfas+0O2Zo+cW G0suxEwElBuDgguSwzrl4am4f+5aHz4w72ZvPoCP6HtNQBgIO4LhpoG7KXtvxZdHpJU5 04dljMdWaW3KFu5goAa40XVtk4UVNS+QnsP/c8gECACzeleEwYMgwQAV8fQTblQkNhBy 80alzuzTTHrooUM4T4aDCyFXdzD69GkEkjXhutd5iaCFcx9Be8WgF83yFkkKocR7cB86 46dg== X-Gm-Message-State: ANoB5plZjcKEwUMDVBgS6AKErwyznOkRvn3tPmGJaReXdHOqS08+L5+M elc4S+GuUOcNgvV9XTkA6czBeQ== X-Received: by 2002:a05:6402:2b91:b0:457:23cb:20ab with SMTP id fj17-20020a0564022b9100b0045723cb20abmr12075583edb.254.1670327858359; Tue, 06 Dec 2022 03:57:38 -0800 (PST) Received: from blmsp.fritz.box ([2001:4091:a245:805c:8713:84e4:2a9e:cbe8]) by smtp.gmail.com with ESMTPSA id ky20-20020a170907779400b007c0ac4e6b6esm6472076ejc.143.2022.12.06.03.57.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Dec 2022 03:57:38 -0800 (PST) From: Markus Schneider-Pargmann To: Chandrasekar Ramakrishnan , Marc Kleine-Budde , Wolfgang Grandegger Cc: linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Markus Schneider-Pargmann Subject: [PATCH v2 03/11] can: m_can: Read register PSR only on error Date: Tue, 6 Dec 2022 12:57:20 +0100 Message-Id: <20221206115728.1056014-4-msp@baylibre.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221206115728.1056014-1-msp@baylibre.com> References: <20221206115728.1056014-1-msp@baylibre.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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?1751465829156317783?= X-GMAIL-MSGID: =?utf-8?q?1751465829156317783?= Only read register PSR if there is an error indicated in irqstatus. Signed-off-by: Markus Schneider-Pargmann --- drivers/net/can/m_can/m_can.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c index d30afbb3503b..45c718413abf 100644 --- a/drivers/net/can/m_can/m_can.c +++ b/drivers/net/can/m_can/m_can.c @@ -900,7 +900,6 @@ static int m_can_rx_handler(struct net_device *dev, int quota, u32 irqstatus) struct m_can_classdev *cdev = netdev_priv(dev); int rx_work_or_err; int work_done = 0; - u32 psr; if (!irqstatus) goto end; @@ -926,13 +925,13 @@ static int m_can_rx_handler(struct net_device *dev, int quota, u32 irqstatus) } } - psr = m_can_read(cdev, M_CAN_PSR); - if (irqstatus & IR_ERR_STATE) - work_done += m_can_handle_state_errors(dev, psr); + work_done += m_can_handle_state_errors(dev, + m_can_read(cdev, M_CAN_PSR)); if (irqstatus & IR_ERR_BUS_30X) - work_done += m_can_handle_bus_errors(dev, irqstatus, psr); + work_done += m_can_handle_bus_errors(dev, irqstatus, + m_can_read(cdev, M_CAN_PSR)); if (irqstatus & IR_RF0N) { rx_work_or_err = m_can_do_rx_poll(dev, (quota - work_done));