Re: [PATCH 15/24] ASoC: codecs: cs42l43: Use guard() and PM runtime scope helpers

From: Charles Keepax

Date: Fri Jun 26 2026 - 06:58:11 EST


On Fri, Jun 26, 2026 at 01:13:20PM +0700, phucduc.bui@xxxxxxxxx wrote:
> From: bui duc phuc <phucduc.bui@xxxxxxxxx>
>
> Convert mutex locking to guard(mutex) and replace explicit runtime
> PM handling with runtime PM scope helpers.
> This simplifies the control flow by removing explicit cleanup paths
> and unnecessary 'goto' labels.
>
> Signed-off-by: bui duc phuc <phucduc.bui@xxxxxxxxx>
> ---
> - if (!jack)
> - goto done;
> + if (!jack) {
> + regmap_update_bits(cs42l43->regmap, CS42L43_HS_BIAS_SENSE_AND_CLAMP_AUTOCONTROL,
> + CS42L43_JACKDET_MODE_MASK |
> + CS42L43_S0_AUTO_ADCMUTE_DISABLE_MASK |
> + CS42L43_HSBIAS_SENSE_TRIP_MASK, autocontrol);
> + regmap_update_bits(cs42l43->regmap, CS42L43_PDNCNTL,
> + CS42L43_RING_SENSE_EN_MASK, pdncntl);
> + dev_dbg(priv->dev, "Successfully configured accessory detect\n");
> +
> + return 0;

I really don't like this duplicating of code blocks, it takes us
to a situation we always need to remember to update both blocks
in sync which feels like it makes reviewing future patches very
error prone.

Thanks,
Charles