[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <76c3f352-a0fc-f72f-e66e-594f9249cb8c@kaod.org>
Date: Tue, 15 Feb 2022 10:07:51 +0100
From: Cédric Le Goater <clg@...d.org>
To: Lukas Wunner <lukas@...ner.de>
CC: <linux-spi@...r.kernel.org>, <linux-mtd@...ts.infradead.org>,
Mark Brown <broonie@...nel.org>,
Tudor Ambarus <tudor.ambarus@...rochip.com>,
Pratyush Yadav <p.yadav@...com>,
Miquel Raynal <miquel.raynal@...tlin.com>,
Richard Weinberger <richard@....at>,
Vignesh Raghavendra <vigneshr@...com>,
<linux-aspeed@...ts.ozlabs.org>, Joel Stanley <joel@....id.au>,
Andrew Jeffery <andrew@...id.au>,
Chin-Ting Kuo <chin-ting_kuo@...eedtech.com>,
<devicetree@...r.kernel.org>, Rob Herring <robh+dt@...nel.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 03/10] spi: spi-mem: Add driver for Aspeed SMC controllers
Hello Lukas,
On 2/15/22 07:27, Lukas Wunner wrote:
> On Mon, Feb 14, 2022 at 10:42:24AM +0100, Cédric Le Goater wrote:
>> +static int aspeed_spi_probe(struct platform_device *pdev)
>> +{
> [...]
>> + ctlr = spi_alloc_master(dev, sizeof(*aspi));
>> + if (!ctlr)
>> + return -ENOMEM;
>
> Use devm_spi_alloc_master() and remove the "put_controller" error path
> for simplicity.
yes.
>> + ret = devm_spi_register_controller(dev, ctlr);
> [...]
>> +static int aspeed_spi_remove(struct platform_device *pdev)
>> +{
>> + struct spi_controller *ctlr = platform_get_drvdata(pdev);
>> + struct aspeed_spi *aspi = spi_controller_get_devdata(ctlr);
>> +
>> + aspeed_spi_enable(aspi, false);
>> + spi_unregister_controller(ctlr);
>> + clk_disable_unprepare(aspi->clk);
>> + return 0;
>> +}
>
> You need to move the call to spi_unregister_controller() *before*
> the call to aspeed_spi_enable(). The controller must be fully
> operational until spi_unregister_controller() returns.
>
> You also need to replace the call to devm_spi_register_controller()
> in aspeed_spi_probe() with spi_register_controller().
> Otherwise you'll unregister the controller twice because you're
> calling spi_unregister_controller() in aspeed_spi_remove().
ok. Understood. Done in v2.
Thanks,
C.
Powered by blists - more mailing lists