Skip to content

Commit d5ed76a

Browse files
Syed Nayyar Warisjic23
authored andcommitted
counter: 104-quad-8: Add lock guards - filter clock prescaler
Add lock protection from race conditions to the 104-quad-8 counter driver for filter clock prescaler code changes. Mutex calls used for protection. Signed-off-by: Syed Nayyar Waris <[email protected]> Fixes: de65d05 ("counter: 104-quad-8: Support Filter Clock Prescaler") Signed-off-by: Jonathan Cameron <[email protected]>
1 parent 708d989 commit d5ed76a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/counter/104-quad-8.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1365,6 +1365,8 @@ static ssize_t quad8_signal_fck_prescaler_write(struct counter_device *counter,
13651365
if (ret)
13661366
return ret;
13671367

1368+
mutex_lock(&priv->lock);
1369+
13681370
priv->fck_prescaler[channel_id] = prescaler;
13691371

13701372
/* Reset Byte Pointer */
@@ -1375,6 +1377,8 @@ static ssize_t quad8_signal_fck_prescaler_write(struct counter_device *counter,
13751377
outb(QUAD8_CTR_RLD | QUAD8_RLD_RESET_BP | QUAD8_RLD_PRESET_PSC,
13761378
base_offset + 1);
13771379

1380+
mutex_unlock(&priv->lock);
1381+
13781382
return len;
13791383
}
13801384

0 commit comments

Comments
 (0)