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

Janne Grunau j at jannau.net
Wed Aug 5 05:25:12 PDT 2026


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

Missing '.' a the end of the sentence.
 
> Signed-off-by: Alba Mendez <me at alba.sh>
> Signed-off-by: Sasha Finkelstein <k at chaosmail.tech>
> ---
>  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 at jannau.net>

Janne



More information about the linux-arm-kernel mailing list