Skip to content

Commit 67727a1

Browse files
scosumarckleinebudde
authored andcommitted
can: tcan4x5x: Fix use of register error status mask
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: 5443c22 ("can: tcan4x5x: Add tcan4x5x driver to the kernel") Signed-off-by: Markus Schneider-Pargmann <[email protected]> Link: https://lore.kernel.org/all/[email protected] Signed-off-by: Marc Kleine-Budde <[email protected]>
1 parent 40c9e4f commit 67727a1

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

drivers/net/can/m_can/tcan4x5x-core.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#define TCAN4X5X_DEV_ID1 0x04
1111
#define TCAN4X5X_REV 0x08
1212
#define TCAN4X5X_STATUS 0x0C
13-
#define TCAN4X5X_ERROR_STATUS 0x10
13+
#define TCAN4X5X_ERROR_STATUS_MASK 0x10
1414
#define TCAN4X5X_CONTROL 0x14
1515

1616
#define TCAN4X5X_CONFIG 0x800
@@ -204,12 +204,7 @@ static int tcan4x5x_clear_interrupts(struct m_can_classdev *cdev)
204204
if (ret)
205205
return ret;
206206

207-
ret = tcan4x5x_write_tcan_reg(cdev, TCAN4X5X_INT_FLAGS,
208-
TCAN4X5X_CLEAR_ALL_INT);
209-
if (ret)
210-
return ret;
211-
212-
return tcan4x5x_write_tcan_reg(cdev, TCAN4X5X_ERROR_STATUS,
207+
return tcan4x5x_write_tcan_reg(cdev, TCAN4X5X_INT_FLAGS,
213208
TCAN4X5X_CLEAR_ALL_INT);
214209
}
215210

@@ -229,6 +224,11 @@ static int tcan4x5x_init(struct m_can_classdev *cdev)
229224
if (ret)
230225
return ret;
231226

227+
ret = tcan4x5x_write_tcan_reg(cdev, TCAN4X5X_ERROR_STATUS_MASK,
228+
TCAN4X5X_CLEAR_ALL_INT);
229+
if (ret)
230+
return ret;
231+
232232
ret = regmap_update_bits(tcan4x5x->regmap, TCAN4X5X_CONFIG,
233233
TCAN4X5X_MODE_SEL_MASK, TCAN4X5X_MODE_NORMAL);
234234
if (ret)

0 commit comments

Comments
 (0)