lkml.org 
[lkml]   [2022]   [Feb]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH -next] misc: rtsx: fix build for CONFIG_PM not set
On Sun, Feb 27, 2022 at 5:57 PM Randy Dunlap <rdunlap@infradead.org> wrote:
> On 2/27/22 04:04, Arnd Bergmann wrote:
> > On Sat, Feb 26, 2022 at 11:24 PM Randy Dunlap <rdunlap@infradead.org> wrote:
> >
> >> ---
> >> drivers/misc/cardreader/rtsx_pcr.c | 2 ++
> >> 1 file changed, 2 insertions(+)
> >>
> >> --- linux-next-20220225.orig/drivers/misc/cardreader/rtsx_pcr.c
> >> +++ linux-next-20220225/drivers/misc/cardreader/rtsx_pcr.c
> >> @@ -1054,6 +1054,7 @@ static int rtsx_pci_acquire_irq(struct r
> >> return 0;
> >> }
> >>
> >> +#ifdef CONFIG_PM
> >> static void rtsx_enable_aspm(struct rtsx_pcr *pcr)
> >> {
> >> if (pcr->ops->set_aspm)
> >> @@ -1085,6 +1086,7 @@ static void rtsx_pm_power_saving(struct
> >> {
> >> rtsx_comm_pm_power_saving(pcr);
> >> }
> >> +#endif
> >
> > Now that we have DEFINE_SIMPLE_DEV_PM_OPS() etc, I think we should
> > no longer add more __maybe_unused annotations or #ifdef CONFIG_PM checks
> > but just use the new macros for any new files or whenever a warning like
> > this shows up.
>
> In this case it looks like DEFINE_RUNTIME_DEV_PM_OPS() is better.
> Using DEFINE_SIMPLE_DEV_PM_OPS() still produces build warnings/errors
> for unused functions. And I do see 4 drivers that are already using
> DEFINE_RUNTIME_DEV_PM_OPS().
>
> Patch coming right up.

DEFINE_RUNTIME_DEV_PM_OPS() only references the three runtime functions
(rtsx_pci_runtime_suspend, rtsx_pci_runtime_resume and rtsx_pci_runtime_idle)
but not the pm-sleep functions (rtsx_pci_suspend and rtsx_pci_resume), so your
second patch doesn't look correct either.

I see there is a _DEFINE_DEV_PM_OPS() helper that appears to do
what we want here, but I'm not sure this is considered an official API. Adding
Rafael, Paul and Jonathan to Cc for extra input. As the macros are still
fairly new, I suspect the idea was to add more as needed, so maybe should
add a DEFINE_DEV_PM_OPS() to wrap _DEFINE_DEV_PM_OPS()?

Arnd

\
 
 \ /
  Last update: 2022-02-27 18:31    [W:0.136 / U:0.088 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site