mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jinjie Ruan <ruanjinjie@huawei.com>
To: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: <broonie@kernel.org>, <akashast@codeaurora.org>,
	<dianders@chromium.org>, <vkoul@kernel.org>,
	<linux-arm-msm@vger.kernel.org>, <linux-spi@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 3/3] spi: geni-qcom: Use devm functions to simplify code
Date: Mon, 9 Sep 2024 19:46:20 +0800	[thread overview]
Message-ID: <5487bcb2-7792-e3b3-5972-d224df61b9da@huawei.com> (raw)
In-Reply-To: <45m7oruivszoiesijmdr66oeatvr3ff6ores4lx4kbus2ti552@5sobv4hk7laa>



On 2024/9/9 17:49, Dmitry Baryshkov wrote:
> On Mon, Sep 09, 2024 at 03:31:41PM GMT, Jinjie Ruan wrote:
>> Use devm_pm_runtime_enable(), devm_request_irq() and
>> devm_spi_register_controller() to simplify code.
>>
>> And also register a callback spi_geni_release_dma_chan() with
>> devm_add_action_or_reset(), to release dma channel in both error
>> and device detach path, which can make sure the release sequence is
>> consistent with the original one.
>>
>> 1. Unregister spi controller.
>> 2. Free the IRQ.
>> 3. Free DMA chans
>> 4. Disable runtime PM.
>>
>> So the remove function can also be removed.
>>
>> Suggested-by: Doug Anderson <dianders@chromium.org>
>> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
>> ---
>> v3:
>> - Land the rest of the cleanups afterwards.
>> ---
>>  drivers/spi/spi-geni-qcom.c | 37 +++++++++++++------------------------
>>  1 file changed, 13 insertions(+), 24 deletions(-)
>>
>> diff --git a/drivers/spi/spi-geni-qcom.c b/drivers/spi/spi-geni-qcom.c
>> index 6f4057330444..8b0039d14605 100644
>> --- a/drivers/spi/spi-geni-qcom.c
>> +++ b/drivers/spi/spi-geni-qcom.c
>> @@ -632,8 +632,10 @@ static int spi_geni_grab_gpi_chan(struct spi_geni_master *mas)
>>  	return ret;
>>  }
>>  
>> -static void spi_geni_release_dma_chan(struct spi_geni_master *mas)
>> +static void spi_geni_release_dma_chan(void *data)
>>  {
>> +	struct spi_geni_master *mas = data;
>> +
>>  	if (mas->rx) {
>>  		dma_release_channel(mas->rx);
>>  		mas->rx = NULL;
>> @@ -1132,6 +1134,12 @@ static int spi_geni_probe(struct platform_device *pdev)
>>  	if (ret)
>>  		return ret;
>>  
>> +	ret = devm_add_action_or_reset(dev, spi_geni_release_dma_chan, spi);
> 
> This should be mas, not spi.
> 
> Doesn't looks like this was tested. Please correct me if I'm wrong.

Yes, you are right, the data should be struct spi_geni_master, which is
mas. Sorry, only compile passed.

> 
> 

  reply	other threads:[~2024-09-09 11:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-09  7:31 [PATCH v3 0/3] spi: geni-qcom: Undo runtime PM changes at driver exit time Jinjie Ruan
2024-09-09  7:31 ` [PATCH v3 1/3] " Jinjie Ruan
2024-09-09  9:45   ` Dmitry Baryshkov
2024-09-09  7:31 ` [PATCH v3 2/3] spi: geni-qcom: Fix incorrect free_irq() sequence Jinjie Ruan
2024-09-09  9:47   ` Dmitry Baryshkov
2024-09-09  7:31 ` [PATCH v3 3/3] spi: geni-qcom: Use devm functions to simplify code Jinjie Ruan
2024-09-09  9:49   ` Dmitry Baryshkov
2024-09-09 11:46     ` Jinjie Ruan [this message]
2024-09-09 11:51       ` Dmitry Baryshkov
2024-09-09 12:01         ` Jinjie Ruan
2024-09-09 17:43 ` (subset) [PATCH v3 0/3] spi: geni-qcom: Undo runtime PM changes at driver exit time Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5487bcb2-7792-e3b3-5972-d224df61b9da@huawei.com \
    --to=ruanjinjie@huawei.com \
    --cc=akashast@codeaurora.org \
    --cc=broonie@kernel.org \
    --cc=dianders@chromium.org \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®