From patchwork Tue Dec 6 11:57:26 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: 30256 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2774944wrr; Tue, 6 Dec 2022 03:59:54 -0800 (PST) X-Google-Smtp-Source: AA0mqf4TEcZKNZtTCQLpiif9Z52ygrt/4L/S9rsTg6HmB+4mQbTSJEGazEjZB1k7Kmf7Yz70JweH X-Received: by 2002:a17:90a:d987:b0:219:e3de:676f with SMTP id d7-20020a17090ad98700b00219e3de676fmr5396739pjv.80.1670327994119; Tue, 06 Dec 2022 03:59:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670327994; cv=none; d=google.com; s=arc-20160816; b=KQlg7Oz6XNwcc4nSC1eOB5WcVP6eYhZCeQrrw11pkC46w3F4kjB9u/H+6TfWecgmDz 6S2SW1MJdwBmZwF2O21b2INXZYWvfoRX0+8Bb3F1MAg9G9XKBZKaMOHKFzVuHaFg9Rv0 gcAwQBViD2rPzaB6iZF9Es+nE1Q1J7p8E/x8gqGdXsUIS4GNYSKHllZqzbL65xQ5mhb3 flpPTzMxW8IPQFSeSehpaEQWc1pHUxjEB5YafasSGyptAw6ZSJBxb7qYnblovQ1PsIB3 Sk82iw0jVym2Sx0ZvQdFUd47EK9esZ3Z2gwxkxdsUtc6qhqX+qe/QkY2W7GyEJhZjvaq hIWQ== 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=JjYuBcD7jZlcMi+USU++Fjz73CmyNYItk4pm8+k3tKw=; b=vychz+XDyflO03VlBdxFXgW0YO1UL+G0HFX4vSkZymW3R2Y6sz7Sry/GBiaJglulVL 5C/xMH33Ur+AMkJrZO3wRUoMp5wskh55ikLV7g4PDnlhpDG6a8LUbE8RV65yNaxzribI Ng1AGp4723NBENhClR16YV9dzivUDu+nUIn6Hk8vB7Oi5pBWOh1ohQIg996Sq06ETQe0 jO2q85/fR2nNvO8R2ziJSYzyBFb6mNkptHke9i8eyQDkFUH+oBqJax8u2WTcXyW2AmP8 IpQYEmSD+l1ryJFRRyhELWhnDR0zoa2N4L8Qr8iHyevsYDsMQ+vI0gOy85EyMcqPZzoP Lc1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=nkfae4PG; 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 bd33-20020a056a0027a100b0056b972a8cfasi17466825pfb.121.2022.12.06.03.59.40; Tue, 06 Dec 2022 03:59:54 -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=nkfae4PG; 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 S235176AbiLFL6Z (ORCPT + 99 others); Tue, 6 Dec 2022 06:58:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235112AbiLFL5s (ORCPT ); Tue, 6 Dec 2022 06:57:48 -0500 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2EEE8388C for ; Tue, 6 Dec 2022 03:57:44 -0800 (PST) Received: by mail-ej1-x62c.google.com with SMTP id ud5so5618297ejc.4 for ; Tue, 06 Dec 2022 03:57:43 -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=JjYuBcD7jZlcMi+USU++Fjz73CmyNYItk4pm8+k3tKw=; b=nkfae4PG+fak6KgW7NpaTgVTR1s5fmIbeyaIHwuH6k6RzMXAcjRf4MZT4xkRwBQJvj GC4TH5ZEFsU42Ruukc7h0vli299sxiDdAhBkQ4wX4fY7fcgXmAWumToF8jK9v2jFdG+n GdPFMB6sK4dF2HTrx1qpp1ZRdhkWvHYzTw5ic2CwPjRXKivWRPwE5sQvOwOXsJadgVH5 lElzZBdn6EJSHoirNtkAofdxX97Rc0cxtv+D63IXnow4sGs7WmmlYffD/Zs1wGPLxvCl 8QzqR6vE9los4tFcq91h3yrIGoQwVURZobC/WaKt09LqfZUtYZLZ63nskdeTStzoclAg SdQA== 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=JjYuBcD7jZlcMi+USU++Fjz73CmyNYItk4pm8+k3tKw=; b=QNHcNUO0J1TBd8QdonIGbMiaV5ZyYfF8lx9mOUxO20sl45Rh6x7kxhKrdjM0801Ygy 6AIGCpMJS7IkEOPxe2lHcwT/ZqZ6k7J9QvUrcjcVJwotrxcsdLLdC0B/IBr1iB6mJ5Od rc1b/32niE8kAw8SO17UA/9WPsrTkVMx1S3ZJY/3y+HJL8TWTxFb/HGv0XcoyKabQg/t 8G/0i0d7dEmnE48PcLu5vKRBNWjwNUHRfJ8uVPEhQMYHiNb8vQPPjjBLmv9Oc44O4suH IoElAyYZFlxeC7r6W7HmkO5X7ngGuaCqqAMtGoAMzlVzmG9LT8A774u0j5/oiZTEEEs3 XPfw== X-Gm-Message-State: ANoB5plMDlaxkMmM7aQx4xNPFcMuaAHsDQ8o6K8dq3aJOqpZUo6LbqTj vB6DyuFR5n9Y9o9iVx4m5G7YrA== X-Received: by 2002:a17:907:7884:b0:7c0:e6d8:6f22 with SMTP id ku4-20020a170907788400b007c0e6d86f22mr9275118ejc.670.1670327863538; Tue, 06 Dec 2022 03:57:43 -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.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Dec 2022 03:57:43 -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 09/11] can: tcan4x5x: Fix use of register error status mask Date: Tue, 6 Dec 2022 12:57:26 +0100 Message-Id: <20221206115728.1056014-10-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=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?1751465846496325114?= X-GMAIL-MSGID: =?utf-8?q?1751465846496325114?= TCAN4X5X_ERROR_STATUS is not a status register that needs clearing during interrupt handling. Instead this is a masking register that masks error interrupts. Writing TCAN4X5X_CLEAR_ALL_INT to this register effectively masks everything. Rename the register and mask all error interrupts only once by writing to the register in tcan4x5x_init. Fixes: 5443c226ba91 ("can: tcan4x5x: Add tcan4x5x driver to the kernel") Signed-off-by: Markus Schneider-Pargmann --- Notes: v2: - Add fixes tag drivers/net/can/m_can/tcan4x5x-core.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/can/m_can/tcan4x5x-core.c b/drivers/net/can/m_can/tcan4x5x-core.c index 1fec394b3517..efa2381bf85b 100644 --- a/drivers/net/can/m_can/tcan4x5x-core.c +++ b/drivers/net/can/m_can/tcan4x5x-core.c @@ -10,7 +10,7 @@ #define TCAN4X5X_DEV_ID1 0x04 #define TCAN4X5X_REV 0x08 #define TCAN4X5X_STATUS 0x0C -#define TCAN4X5X_ERROR_STATUS 0x10 +#define TCAN4X5X_ERROR_STATUS_MASK 0x10 #define TCAN4X5X_CONTROL 0x14 #define TCAN4X5X_CONFIG 0x800 @@ -204,12 +204,7 @@ static int tcan4x5x_clear_interrupts(struct m_can_classdev *cdev) if (ret) return ret; - ret = tcan4x5x_write_tcan_reg(cdev, TCAN4X5X_INT_FLAGS, - TCAN4X5X_CLEAR_ALL_INT); - if (ret) - return ret; - - return tcan4x5x_write_tcan_reg(cdev, TCAN4X5X_ERROR_STATUS, + return tcan4x5x_write_tcan_reg(cdev, TCAN4X5X_INT_FLAGS, TCAN4X5X_CLEAR_ALL_INT); } @@ -229,6 +224,11 @@ static int tcan4x5x_init(struct m_can_classdev *cdev) if (ret) return ret; + ret = tcan4x5x_write_tcan_reg(cdev, TCAN4X5X_ERROR_STATUS_MASK, + TCAN4X5X_CLEAR_ALL_INT); + if (ret) + return ret; + /* Zero out the MCAN buffers */ ret = m_can_init_ram(cdev); if (ret)