Re: [PATCH 2/2] spi: qcom-geni: Add panic notifier to suspend controller during panic

Mukesh Savaliya <[email protected]>
Newsgroups org.kernel.vger.linux-spi,org.kernel.vger.linux-arm-msm,org.kernel.vger.linux-kernel
Message-ID <[email protected]>

On 8/5/2026 4:12 PM, Praveen Talari wrote:

[...]
> @@ -1073,6 +1075,23 @@ static void spi_geni_shutdown(struct platform_device *pdev)
>   	spi_controller_suspend(spi);
>   }
>   
> +static int spi_geni_panic_notifier(struct notifier_block *nb,
> +				   unsigned long action, void *data)
> +{
> +	struct spi_geni_master *mas = container_of(nb, struct spi_geni_master, panic_nb);
> +	struct spi_controller *spi = dev_get_drvdata(mas->dev);
> +
> +	spi_controller_suspend(spi);

Add a line space before return

> +	return NOTIFY_OK;
> +}
> +
> +static void spi_geni_unregister_notifiers(void *data)
> +{
> +	struct spi_geni_master *mas = data;
> +
> +	atomic_notifier_chain_unregister(&panic_notifier_list, &mas->panic_nb);
> +}
> +
>   static int spi_geni_probe(struct platform_device *pdev)
>   {
>   	int ret, irq;
> @@ -1161,7 +1180,16 @@ static int spi_geni_probe(struct platform_device *pdev)
>   	if (ret)
>   		return ret;
>   
> -	return devm_spi_register_controller(dev, spi);
> +	ret = devm_spi_register_controller(dev, spi);
> +	if (ret)
Can you add a trace log here and below where ever you get error ?
Hope that will help in case of issue.
> +		return ret;
> +
> +	mas->panic_nb.notifier_call = spi_geni_panic_notifier;
> +	ret = atomic_notifier_chain_register(&panic_notifier_list, &mas->panic_nb);
> +	if (ret)
same here, add trace log
> +		return ret;
> +
> +	return devm_add_action_or_reset(dev, spi_geni_unregister_notifiers, mas);
>   }
>   
>   static int __maybe_unused spi_geni_runtime_suspend(struct device *dev)
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.