X86 platform drivers
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Luke Jones <luke@ljones.dev>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Hans de Goede <hdegoede@redhat.com>,
	 platform-driver-x86@vger.kernel.org,
	 Mario Limonciello <mario.limonciello@amd.com>,
	 Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	 kernel test robot <lkp@intel.com>
Subject: Re: [PATCH 1/1] platform/x86: asus-wmi: fix build without CONFIG_SUSPEND
Date: Sun, 25 May 2025 23:52:40 +0300 (EEST)	[thread overview]
Message-ID: <560511d7-06da-2afb-07e2-1589a6b55a16@linux.intel.com> (raw)
In-Reply-To: <5128b201-ab6e-4536-8c24-8263789a3d78@app.fastmail.com>

[-- Attachment #1: Type: text/plain, Size: 3322 bytes --]

On Fri, 23 May 2025, Luke Jones wrote:

> On Fri, 23 May 2025, at 3:25 PM, Ilpo Järvinen wrote:
> > On Fri, 23 May 2025, Luke Jones wrote:
> >
> >> The patch "Refactor Ally suspend/resume" introduced an
> >
> > The commit feea7bd6b02d ("...")
> >
> >> acpi_s2idle_dev_ops for use with ROG Ally which caused a build error
> >> if CONFIG_SUSPEND was not defined.
> >> 
> >> Signed-off-by: Luke Jones <luke@ljones.dev>
> >> Reported-by: kernel test robot <lkp@intel.com>
> >> Closes: https://lore.kernel.org/oe-kbuild-all/202505090418.DaeaXe4i-lkp@intel.com/
> >> Fixes: feea7bd6b02d ("platform/x86: asus-wmi: Refactor Ally suspend/resume")
> >> ---
> >>  drivers/platform/x86/asus-wmi.c | 9 +++++++++
> >>  1 file changed, 9 insertions(+)
> >> 
> >> diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
> >> index 27f11643a00d..087318e0d595 100644
> >> --- a/drivers/platform/x86/asus-wmi.c
> >> +++ b/drivers/platform/x86/asus-wmi.c
> >> @@ -5005,6 +5005,7 @@ static int asus_hotk_restore(struct device *device)
> >>  	return 0;
> >>  }
> >>  
> >> +#if defined(CONFIG_SUSPEND)
> >>  static void asus_ally_s2idle_restore(void)
> >>  {
> >>  	if (use_ally_mcu_hack == ASUS_WMI_ALLY_MCU_HACK_ENABLED) {
> >> @@ -5013,6 +5014,7 @@ static void asus_ally_s2idle_restore(void)
> >>  		msleep(ASUS_USB0_PWR_EC0_CSEE_WAIT);
> >>  	}
> >>  }
> >> +#endif /* CONFIG_SUSPEND */
> >
> > Move this function below asus_hotk_prepare() next to ops, so that only one 
> > #if block is needed for them.
> >
> 
> Done
> 
> >>  
> >>  static int asus_hotk_prepare(struct device *device)
> >>  {
> >> @@ -5025,9 +5027,11 @@ static int asus_hotk_prepare(struct device *device)
> >>  }
> >>  
> >>  /* Use only for Ally devices due to the wake_on_ac */
> >> +#if defined(CONFIG_SUSPEND)
> >>  static struct acpi_s2idle_dev_ops asus_ally_s2idle_dev_ops = {
> >>  	.restore = asus_ally_s2idle_restore,
> >>  };
> >> +#endif /* CONFIG_SUSPEND */
> >>  
> >>  static const struct dev_pm_ops asus_pm_ops = {
> >>  	.thaw = asus_hotk_thaw,
> >> @@ -5060,9 +5064,11 @@ static int asus_wmi_probe(struct platform_device *pdev)
> >>  			return ret;
> >>  	}
> >>  
> >> +	#if defined(CONFIG_SUSPEND)
> >>  	ret = acpi_register_lps0_dev(&asus_ally_s2idle_dev_ops);
> >>  	if (ret)
> >>  		pr_warn("failed to register LPS0 sleep handler in asus-wmi\n");
> >> +	#endif /* CONFIG_SUSPEND */
> >>  
> >>  	return asus_wmi_add(pdev);
> >>  }
> >> @@ -5096,7 +5102,10 @@ EXPORT_SYMBOL_GPL(asus_wmi_register_driver);
> >>  
> >>  void asus_wmi_unregister_driver(struct asus_wmi_driver *driver)
> >>  {
> >> +	#if defined(CONFIG_SUSPEND)
> >>  	acpi_unregister_lps0_dev(&asus_ally_s2idle_dev_ops);
> >> +	#endif /* CONFIG_SUSPEND */
> >
> > I'd have preferred these reg/unreg be solved with wrappers (see 
> > pmc_atom.c).
> 
> Can do, but I don't really understand the difference it makes in this context. Should I log that  CONFIG_SUSPEND was not enabled? Otherwise it's just as good as not there, right?

I just want to limit the use of ifdeffery to minimum and prefer using 
#else + a stub over sprinkling ifdefs all over the place. And it's 
orthogonal whether the CONFIG_SUSPEND=n should print a warning or not.

I'll take the v3.

-- 
 i.

      reply	other threads:[~2025-05-25 20:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-23 13:14 [PATCH 0/1] platform/x86: asus-wmi: fix build without CONFIG_SUSPEND Luke Jones
2025-05-23 13:14 ` [PATCH 1/1] " Luke Jones
2025-05-23 13:25   ` Ilpo Järvinen
2025-05-23 18:44     ` Luke Jones
2025-05-25 20:52       ` Ilpo Järvinen [this message]

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=560511d7-06da-2afb-07e2-1589a6b55a16@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=hdegoede@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=luke@ljones.dev \
    --cc=mario.limonciello@amd.com \
    --cc=platform-driver-x86@vger.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