Re: [PATCH v4 5/6] spmi: apple: lock around FIFOs

From: Janne Grunau

Date: Wed Aug 05 2026 - 08:37:22 EST


On Wed, Aug 05, 2026 at 12:11:15PM +0200, Sasha Finkelstein wrote:
> From: Alba Mendez <me@xxxxxxx>
>
> The driver was missing locking around register interactions

Missing '.' a the end of the sentence.

> Signed-off-by: Alba Mendez <me@xxxxxxx>
> Signed-off-by: Sasha Finkelstein <k@xxxxxxxxxxxxxx>
> ---
> drivers/spmi/spmi-apple-controller.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/spmi/spmi-apple-controller.c b/drivers/spmi/spmi-apple-controller.c
> index 49827e51e93e..c3bc1f6d5741 100644
> --- a/drivers/spmi/spmi-apple-controller.c
> +++ b/drivers/spmi/spmi-apple-controller.c
> @@ -16,6 +16,7 @@
> #include <linux/io.h>
> #include <linux/iopoll.h>
> #include <linux/module.h>
> +#include <linux/mutex.h>
> #include <linux/platform_device.h>
> #include <linux/spmi.h>
>
> @@ -39,6 +40,7 @@
>
> struct apple_spmi {
> void __iomem *regs;
> + struct mutex fifo_lock;
> bool prev_fail;
> };
>
> @@ -79,6 +81,8 @@ static int spmi_raw_cmd(struct spmi_controller *ctrl, u8 opc, u8 sid,
> size_t i = 0, j;
> int ret;
>
> + guard(mutex)(&spmi->fifo_lock);
> +
> if (spmi->prev_fail) {
> writel(SPMI_ACT_FIFO_FLUSH, spmi->regs + SPMI_RSP_REG);
> spmi->prev_fail = false;
> @@ -195,6 +199,7 @@ static int apple_spmi_probe(struct platform_device *pdev)
> return -ENOMEM;
>
> spmi = spmi_controller_get_drvdata(ctrl);
> + mutex_init(&spmi->fifo_lock);
>
> spmi->regs = devm_platform_ioremap_resource(pdev, 0);
> if (IS_ERR(spmi->regs))

Reviewed-by: Janne Grunau <j@xxxxxxxxxx>

Janne