All of lore.kernel.org
 help / color / mirror / Atom feed
From: Claudiu Beznea <Claudiu.Beznea@microchip.com>
To: Harini Katakam <harinik@xilinx.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>,
	David Miller <davem@davemloft.net>, <netdev@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <michals@xilinx.com>,
	<appanad@xilinx.com>,
	Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Subject: Re: [RFC PATCH 3/5] net: macb: Add pm runtime support
Date: Thu, 3 May 2018 15:59:01 +0300	[thread overview]
Message-ID: <87bd6e9f-be18-b267-a01d-c4efc2adc55d@microchip.com> (raw)
In-Reply-To: <CAFcVECKWz6bGZpg7UF=4hObUjca12Oq5NbE0SBL+v=1grJP8YA@mail.gmail.com>



On 03.05.2018 14:13, Harini Katakam wrote:
> Hi Claudiu,
> 
> On Thu, May 3, 2018 at 3:39 PM, Claudiu Beznea
> <Claudiu.Beznea@microchip.com> wrote:
>>
>>
>> On 22.03.2018 15:51, harinikatakamlinux@gmail.com wrote:
>>> From: Harini Katakam <harinik@xilinx.com>
> <snip>
>> I would use a "goto" instruction, e.g.:
>>                 value = -ETIMEDOUT;
>>                 goto out;
>>
> 
> Will do
> 
>>
>> Below, in macb_open() you have a return err; case:
>>         err = macb_alloc_consistent(bp);
>>         if (err) {
>>                 netdev_err(dev, "Unable to allocate DMA memory (error %d)\n",
>>                            err);
>>                 return err;
>>         }
>>
>> You have to undo pm_runtime_get_sync() with pm_runtime_put_sync() or something
>> similar to decrement dev->power.usage_count.
> 
> Will do
> 
> <snip>
>>> @@ -4104,11 +4145,16 @@ static int macb_remove(struct platform_device *pdev)
>>>               mdiobus_free(bp->mii_bus);
>>>
>>>               unregister_netdev(dev);
>>> -             clk_disable_unprepare(bp->tx_clk);
>>> -             clk_disable_unprepare(bp->hclk);
>>> -             clk_disable_unprepare(bp->pclk);
>>> -             clk_disable_unprepare(bp->rx_clk);
>>> -             clk_disable_unprepare(bp->tsu_clk);
>>> +             pm_runtime_disable(&pdev->dev);
>>> +             pm_runtime_dont_use_autosuspend(&pdev->dev);
>>> +             if (!pm_runtime_suspended(&pdev->dev)) {
>>> +                     clk_disable_unprepare(bp->tx_clk);
>>> +                     clk_disable_unprepare(bp->hclk);
>>> +                     clk_disable_unprepare(bp->pclk);
>>> +                     clk_disable_unprepare(bp->rx_clk);
>>> +                     clk_disable_unprepare(bp->tsu_clk);
>>> +                     pm_runtime_set_suspended(&pdev->dev);
>>
>> This is driver remove function. Shouldn't clocks be removed?
> 
> clk_disable_unprepare IS being done here.
> The check for !pm_runtime_suspended is just to make sure the
> clocks are not already removed (in runtime_suspend).

Could this happen? Looking over code, starting with 
platform_driver_unregister() it looks to me that the runtime resume
is called just before driver remove is called.

platform_driver_unregister() ->
driver_unregister() ->
bus_remove_driver() ->
driver_detach() ->
device_release_driver_internal() ->
__device_release_driver()
{
	// ...
        pm_runtime_get_sync(dev);		// runtime resume                                       
        pm_runtime_clean_up_links(dev);                                 
 
	// ...

	pm_runtime_put_sync(dev);                                       
                                                                                
        if (dev->bus && dev->bus->remove)                               
        	dev->bus->remove(dev);                                  
        else if (drv->remove)                                           
                drv->remove(dev);                                       

	// ...
}

Thank you,
Claudiu

> 
> Regards,
> Harini
> 

  reply	other threads:[~2018-05-03 12:59 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-22 13:51 [RFC PATCH 0/5] Macb power management support for ZynqMP harinikatakamlinux
2018-03-22 13:51 ` [RFC PATCH 1/5] net: macb: Check MDIO state before read/write and use timeouts harinikatakamlinux
2018-03-22 14:47   ` Andrew Lunn
2018-05-03 10:08   ` Claudiu Beznea
2018-05-03 10:58     ` Harini Katakam
2018-03-22 13:51 ` [RFC PATCH 2/5] net: macb: Support clock management for tsu_clk harinikatakamlinux
2018-03-22 13:51 ` [RFC PATCH 3/5] net: macb: Add pm runtime support harinikatakamlinux
2018-05-03 10:09   ` Claudiu Beznea
2018-05-03 11:13     ` Harini Katakam
2018-05-03 12:59       ` Claudiu Beznea [this message]
2018-03-22 13:51 ` [RFC PATCH 4/5] net: macb: Add support for suspend/resume with full power down harinikatakamlinux
2018-05-03 10:09   ` Claudiu Beznea
2018-05-03 11:20     ` Harini Katakam
2018-05-03 12:23       ` Claudiu Beznea
2018-03-22 13:51 ` [RFC PATCH 5/5] net: macb: Add WOL support with ARP harinikatakamlinux
2018-05-04 12:17   ` Claudiu Beznea
2018-05-10 10:37     ` Harini Katakam
2018-05-15  8:39       ` Claudiu Beznea

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=87bd6e9f-be18-b267-a01d-c4efc2adc55d@microchip.com \
    --to=claudiu.beznea@microchip.com \
    --cc=appanad@xilinx.com \
    --cc=davem@davemloft.net \
    --cc=harinik@xilinx.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michals@xilinx.com \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.ferre@atmel.com \
    --cc=shubhrajyoti.datta@xilinx.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.