Re: [PATCH v3 2/5] platform/chrome: cros_ec_lpc: MEC access can use an AML mutex
From: Tzung-Bi Shih
Date: Wed Jun 05 2024 - 23:13:15 EST
On Wed, Jun 05, 2024 at 07:33:48AM +0100, Ben Walsh wrote:
> @@ -93,7 +146,9 @@ int cros_ec_lpc_io_bytes_mec(enum cros_ec_lpc_mec_io_type io_type,
> else
> access = ACCESS_TYPE_LONG_AUTO_INCREMENT;
>
> - mutex_lock(&io_mutex);
> + ret = cros_ec_lpc_mec_lock();
> + if (ret)
> + return ret;
>
> /* Initialize I/O at desired address */
> cros_ec_lpc_mec_emi_write_address(offset, access);
> @@ -135,7 +190,9 @@ int cros_ec_lpc_io_bytes_mec(enum cros_ec_lpc_mec_io_type io_type,
> }
>
> done:
> - mutex_unlock(&io_mutex);
> + ret = cros_ec_lpc_mec_unlock();
> + if (ret < 0)
> + return ret;
A nit haven't caught in previous round review:
- `if (ret)` for cros_ec_lpc_mec_lock().
- `if (ret < 0)` for cros_ec_lpc_mec_unlock().
If I see the inconsistency when reading the code, it would take me further
cycles for seeking why. We should fix it.
No need to resend for this; I will fix it for you.