public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Dhruva Gole <d-gole@ti.com>
To: Jonas Gorski <jonas.gorski@gmail.com>,
	Florian Fainelli <f.fainelli@gmail.com>
Cc: Mark Brown <broonie@kernel.org>,
	Vaishnav Achath <vaishnav.a@ti.com>, Vignesh <vigneshr@ti.com>,
	Apurva Nandan <a-nandan@ti.com>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-spi@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Grant Likely <grant.likely@secretlab.ca>,
	Tanguy Bouzeloc <tanguy.bouzeloc@efixo.com>
Subject: Re: [PATCH] spi: bcm63xx: remove PM_SLEEP based conditional compilation
Date: Mon, 24 Apr 2023 15:56:06 +0530	[thread overview]
Message-ID: <3a28e15a-ba67-3dfa-6445-bd21e523980b@ti.com> (raw)
In-Reply-To: <CAOiHx==7TV3879ADbiWGbHT0NysNck4FUQXkXEocjkD2BzEoRA@mail.gmail.com>

Hi Jonas,

On 24/04/23 13:50, Jonas Gorski wrote:
> On Fri, 21 Apr 2023 at 19:17, Florian Fainelli <f.fainelli@gmail.com> wrote:
>>
>> On 4/20/23 05:16, Dhruva Gole wrote:
>>> Get rid of conditional compilation based on CONFIG_PM_SLEEP because
>>> it may introduce build issues with certain configs where it maybe disabled
>>> This is because if above config is not enabled the suspend-resume
>>> functions are never part of the code but the bcm63xx_spi_pm_ops struct
>>> still inits them to non-existent suspend-resume functions.
>>>
>>> Fixes: b42dfed83d95 ("spi: add Broadcom BCM63xx SPI controller driver")
>>>
>>> Signed-off-by: Dhruva Gole <d-gole@ti.com>
>>> ---
>>>    drivers/spi/spi-bcm63xx.c | 2 --
>>>    1 file changed, 2 deletions(-)
>>>
>>> diff --git a/drivers/spi/spi-bcm63xx.c b/drivers/spi/spi-bcm63xx.c
>>> index 96633a0051b1..99395932074c 100644
>>> --- a/drivers/spi/spi-bcm63xx.c
>>> +++ b/drivers/spi/spi-bcm63xx.c
>>> @@ -617,7 +617,6 @@ static void bcm63xx_spi_remove(struct platform_device *pdev)
>>>        clk_disable_unprepare(bs->clk);
>>>    }
>>>
>>> -#ifdef CONFIG_PM_SLEEP
>>>    static int bcm63xx_spi_suspend(struct device *dev)
>>
>> Don't we need a __maybe_unused here?
> 
> Actually the premise of this patch is wrong, and should rather be reverted.
> 
> The bcm63xx_spi_pm_ops struct is initialized with
> SET_SYSTEM_SLEEP_PM_OPS(), which is defined as
> 
> #ifdef CONFIG_PM_SLEEP
> #define SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
> SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
> #else
> #define SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
> #endif
> 

Thanks for pointing this out, I must have missed this.
Anyway, I have sent another patch to migrate to using
DEFINE_SIMPLE_DEV_PM_OPS as per Mark's suggestion [0]. There I think it
would be necessary to remove the CONFIG_PM_SLEEP checks in the driver.
So no need to revert this patch.


> so for !CONFIG_PM_SLEEP it won't initialize the struct at all (or
> reference non-existing functions), and therefore there will be no
> build issues.
> 
> Regards,
> Jonas


[0] 
https://lore.kernel.org/all/e65683c1-9f1b-4cfb-8e14-087ef7d69595@sirena.org.uk/

-- 
Thanks and Regards,
Dhruva Gole

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2023-04-24 10:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-20 12:16 [PATCH] spi: bcm63xx: remove PM_SLEEP based conditional compilation Dhruva Gole
2023-04-21 16:06 ` Mark Brown
2023-04-21 17:13 ` Florian Fainelli
2023-04-24  8:20   ` Jonas Gorski
2023-04-24 10:26     ` Dhruva Gole [this message]
2023-04-25 15:08 ` Guenter Roeck
2023-04-25 17:18   ` Gole, Dhruva
2023-04-25 17:37     ` Guenter Roeck
2023-04-25 18:00       ` 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=3a28e15a-ba67-3dfa-6445-bd21e523980b@ti.com \
    --to=d-gole@ti.com \
    --cc=a-nandan@ti.com \
    --cc=broonie@kernel.org \
    --cc=f.fainelli@gmail.com \
    --cc=grant.likely@secretlab.ca \
    --cc=jonas.gorski@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=tanguy.bouzeloc@efixo.com \
    --cc=vaishnav.a@ti.com \
    --cc=vigneshr@ti.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox