Re: [PATCH 6.1.y-cip 20/32] spi: rzv2h-rspi: use device-managed APIs

Pavel Machek <[email protected]>
Newsgroups org.cip-project.lists.cip-dev
Message-ID <[email protected]>
Hi!

> From: Cosmin Tanislav <[email protected]>
> 
> commit b73ac782828f27c2217a17bd26aa8710769f032d upstream.
> 
> Non-device-managed APIs were initially used here to avoid the buggy
> interaction between PM domains and device-managed actions.
> 
> Commit f99508074e78 ("PM: domains: Detach on device_unbind_cleanup()")
> fixed the interaction between PM domains and device-managed actions.
> 
> Simplify the code by using device-managed actions to unregister the SPI
> controller and to assert and release the resets.

> +++ b/drivers/spi/spi-rzv2h-rspi.c

>  static int rzv2h_rspi_probe(struct platform_device *pdev)
>  {
>  	struct spi_controller *controller;
>  	struct device *dev = &pdev->dev;
>  	struct rzv2h_rspi_priv *rspi;
> +	struct reset_control *reset;
>  	struct clk_bulk_data *clks;
>  	int irq_rx, ret, i;
>  	long tclk_rate;
...
>  	irq_rx = platform_get_irq_byname(pdev, "rx");
>  	if (irq_rx < 0)
>  		return dev_err_probe(dev, irq_rx, "cannot get IRQ 'rx'\n");
>  
> -	ret = reset_control_bulk_deassert(RSPI_RESET_NUM, rspi->resets);
> -	if (ret)
> -		return dev_err_probe(dev, ret, "failed to deassert resets\n");
> -
>  	init_waitqueue_head(&rspi->wait);
>  
>  	ret = devm_request_irq(dev, irq_rx, rzv2h_rx_irq_handler, 0,
>  			       dev_name(dev), rspi);
>  	if (ret) {
>  		dev_err(dev, "cannot request `rx` IRQ\n");
> -		goto quit_resets;
> +		return ret;
>  	}

I guess that for consistency, and to avoid spamming log in case of
PROBE_DEFER, this should be "return dev_err_probe()".

> @@ -622,31 +638,13 @@ static int rzv2h_rspi_probe(struct platform_device *pdev)
>  
>  	device_set_node(&controller->dev, dev_fwnode(dev));
>  
> -	ret = spi_register_controller(controller);
> -	if (ret) {
> +	ret = devm_spi_register_controller(dev, controller);
> +	if (ret)
>  		dev_err(dev, "register controller failed\n");
> -		goto quit_resets;
> -	}

Probably same here.

Thanks and best regards,
								Pavel
signature.asc (application/pgp-signature, 195 B)
-----BEGIN PGP SIGNATURE-----

iF0EABECAB0WIQRPfPO7r0eAhk010v0w5/Bqldv68gUCaj+zrQAKCRAw5/Bqldv6
8mM+AJ9nYo14Ug3PIa0np/BpJFEjnvy0GACeNWIvqkhXAS0dx4DJ6Hgt0wjtyos=
=1beT
-----END PGP SIGNATURE-----
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.