From patchwork Wed Nov 16 20:53:00 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: 21263 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp57000wrr; Wed, 16 Nov 2022 12:55:41 -0800 (PST) X-Google-Smtp-Source: AA0mqf5UnXSmTcV7BeT9UumdHxrzJvlM9tz8zZyfnd0UpQTb0E4tLNByk4I8/R3qNhtuNc+qcB+y X-Received: by 2002:a17:902:f304:b0:188:547d:b142 with SMTP id c4-20020a170902f30400b00188547db142mr10770921ple.103.1668632140867; Wed, 16 Nov 2022 12:55:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668632140; cv=none; d=google.com; s=arc-20160816; b=Epqru3G6azrgDgS6VSFjmLCtOaNcKU2e7vXf5pKygBHrV1rvBMCN+zLkhvonaTi+sx PZ34e7U91GR7or6SaanWQgvvU2b0GZUWE5YU3jet8cRhnJTNEEqcJRn/oR2/cYSCjTmI lK/JVLUtRMSXjvCC2y6F3HpL41tuHI/30zJAbp2PkaI27XVU558lnkEnFxs5svomi00c ajatJOBNRscyheyVZvtDXth4iL8DR70zi+3D7K3Crn67heCU8U+2CgxVO6cJgJgnq8/x cOeh3NOX/uc1UbXrbW04Qk32xe8Q03zHEkv/Gah+/QtnYrUWDZwTighvAw5MR7VQx8yF BIvg== 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=qMp0tWmayQFDCuQozvTUDpU6JW1zD9b9gmw4AkF62cg=; b=eIMuBJVwtVfMfFCUv6Cxh0naRVo3YuFo1ZkpngwEFjpQBZZRjtJ+gVhEdfmW03eYXR Cssmh5S6dlRMt085c/xnTci08bTJzlqFlWZ1S6ggs/VUq9xHo1buDnoqMb2cF25aUboF jWF+sz4LvIZl2EJ718TRrXTFjPlrNNe6Ixsh3+Iexvx0RJMjYpH7GxRJtaOfRYbmNMcw GtJ0nYLTcsyICwDCY2JNXNvSQJWmXFIsq54HQONTHnI4DrL+iLVYLHDh3quNIDr2UmCJ 2jLwcsHIV1mcVwOxu5gAP2PzWQlTOvIHZvnwvNs8NRGePDP5TSn4zhwWRWKD9UU3Z8dy FYbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=DfeLSauo; 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 1-20020a631741000000b0046ec058379bsi16324384pgx.99.2022.11.16.12.55.28; Wed, 16 Nov 2022 12:55:40 -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=DfeLSauo; 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 S238095AbiKPUyi (ORCPT + 99 others); Wed, 16 Nov 2022 15:54:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234639AbiKPUxu (ORCPT ); Wed, 16 Nov 2022 15:53:50 -0500 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DEBC26F6 for ; Wed, 16 Nov 2022 12:53:31 -0800 (PST) Received: by mail-ej1-x632.google.com with SMTP id bj12so47076715ejb.13 for ; Wed, 16 Nov 2022 12:53:30 -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=qMp0tWmayQFDCuQozvTUDpU6JW1zD9b9gmw4AkF62cg=; b=DfeLSauoK/xGMIYKQS8dUtNF5Y18jC4Dz7wPaMBhY5Wz7+f37x4ilwFFQVnDpFTXSy RKqXurBocAzbyzMqPdiS6IFjDxXzj+E3RZZQepcFM0ml8inFXsUQmDvg0Hy2EsCOITDH JHZYC75OVUxxK1+3P2am1KYY0AVX41vaxmwed/okFMyJDFu0zoFRlpFGwsO6hKrIPbwS inW4U/bJrq78cR6BOJhNepOxNwuQ/Qzlt8apxkk1uMwSP5visMZepMGF+j0smMOFVL/n NTjVi45THe7cCOGS1X7kkLDZg9X3Ivh5BUibveo9ryklA21H8QR8Gt0Or4XILbIIvTJT 23jg== 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=qMp0tWmayQFDCuQozvTUDpU6JW1zD9b9gmw4AkF62cg=; b=fVLJ7ZIwwaDGE9XNG7ZgN/XDhpegPhS+zLbKU63FoXD2VS5sp6qcEWtVYxupU26UtD wH482xTjL8xHp2g5B3MXipLOoAFuytaYa/m/UEqRtGB8J+kqkIq5BxzTfK0Wi6PxWHp/ YClVCRUvoTRewjFiBfTJL7Ldxx9ulEBKPMyzoDpzKmtubWARjqlU9TVA/JdxSDKLbYuf F7lsAmEItCC7pBFztYhQdPdTn1n9qP/XLOhZ7MfcnTtA05WOk5NzSwU86Pupd1U7ikcD ZwdNzcrrS5mlQQ//cDbTVlcgDFQsqVOCRsq2eizaaMW1hAtRB55nNE7fojm7Vm3FTbvW 2MHg== X-Gm-Message-State: ANoB5plQ9K49PRId9PUeIBcE0oOhpx3v70tmNI/wetRONfeC72slgvjL 7P0K2E+zCjJIB01letWXMLWfsQ== X-Received: by 2002:a17:907:cc9d:b0:7ac:ef6b:1ef4 with SMTP id up29-20020a170907cc9d00b007acef6b1ef4mr20163923ejc.104.1668632009629; Wed, 16 Nov 2022 12:53:29 -0800 (PST) Received: from blmsp.fritz.box ([2001:4090:a244:804b:353b:565:addf:3aa7]) by smtp.gmail.com with ESMTPSA id kv17-20020a17090778d100b007aece68483csm6782828ejc.193.2022.11.16.12.53.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Nov 2022 12:53:29 -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 07/15] can: m_can: Read register PSR only on error Date: Wed, 16 Nov 2022 21:53:00 +0100 Message-Id: <20221116205308.2996556-8-msp@baylibre.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221116205308.2996556-1-msp@baylibre.com> References: <20221116205308.2996556-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=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?1749687616161158852?= X-GMAIL-MSGID: =?utf-8?q?1749687616161158852?= 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 0efa6dee0617..1d15beaea920 100644 --- a/drivers/net/can/m_can/m_can.c +++ b/drivers/net/can/m_can/m_can.c @@ -901,7 +901,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; @@ -927,13 +926,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));