Skip to content

Commit 94f8995

Browse files
plbossartvinodkoul
authored andcommitted
soundwire: cadence: revisit parity injection
We want to wait for the CONFIG_UPDATE bit to clear before doing something else. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@intel.com> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Link: https://lore.kernel.org/r/20230518024119.164160-4-yung-chuan.liao@linux.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent ffc363d commit 94f8995

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

drivers/soundwire/cadence_master.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -456,9 +456,9 @@ static int cdns_parity_error_injection(void *data, u64 value)
456456
CDNS_IP_MCP_CMDCTRL_INSERT_PARITY_ERR);
457457

458458
/* commit changes */
459-
cdns_updatel(cdns, CDNS_MCP_CONFIG_UPDATE,
460-
CDNS_MCP_CONFIG_UPDATE_BIT,
461-
CDNS_MCP_CONFIG_UPDATE_BIT);
459+
ret = cdns_clear_bit(cdns, CDNS_MCP_CONFIG_UPDATE, CDNS_MCP_CONFIG_UPDATE_BIT);
460+
if (ret < 0)
461+
goto unlock;
462462

463463
/* do a broadcast dummy read to avoid bus clashes */
464464
ret = sdw_bread_no_pm_unlocked(&cdns->bus, 0xf, SDW_SCP_DEVID_0);
@@ -470,16 +470,17 @@ static int cdns_parity_error_injection(void *data, u64 value)
470470
0);
471471

472472
/* commit changes */
473-
cdns_updatel(cdns, CDNS_MCP_CONFIG_UPDATE,
474-
CDNS_MCP_CONFIG_UPDATE_BIT,
475-
CDNS_MCP_CONFIG_UPDATE_BIT);
476-
477-
/* Continue bus operation with parity error injection disabled */
478-
mutex_unlock(&bus->bus_lock);
473+
ret = cdns_clear_bit(cdns, CDNS_MCP_CONFIG_UPDATE, CDNS_MCP_CONFIG_UPDATE_BIT);
474+
if (ret < 0)
475+
goto unlock;
479476

480477
/* Userspace changed the hardware state behind the kernel's back */
481478
add_taint(TAINT_USER, LOCKDEP_STILL_OK);
482479

480+
unlock:
481+
/* Continue bus operation with parity error injection disabled */
482+
mutex_unlock(&bus->bus_lock);
483+
483484
/*
484485
* allow Master device to enter pm_runtime suspend. This may
485486
* also result in Slave devices suspending.

0 commit comments

Comments
 (0)