linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: linux-acpi@vger.kernel.org
Subject: Re: [PATCH v1] ACPI / sleep: Switch to use acpi_dev_get_first_match_dev()
Date: Thu, 27 Jun 2019 23:47:24 +0200	[thread overview]
Message-ID: <1695720.PHZDijW4vG@kreacher> (raw)
In-Reply-To: <20190612100702.53736-1-andriy.shevchenko@linux.intel.com>

On Wednesday, June 12, 2019 12:07:02 PM CEST Andy Shevchenko wrote:
> Switch the acpi_pm_finish() to use acpi_dev_get_first_match_dev() instead of
> custom approach.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/acpi/sleep.c | 20 ++++++--------------
>  1 file changed, 6 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
> index 8ff08e531443..a94519207dc8 100644
> --- a/drivers/acpi/sleep.c
> +++ b/drivers/acpi/sleep.c
> @@ -452,14 +452,6 @@ static int acpi_pm_prepare(void)
>  	return error;
>  }
>  
> -static int find_powerf_dev(struct device *dev, void *data)
> -{
> -	struct acpi_device *device = to_acpi_device(dev);
> -	const char *hid = acpi_device_hid(device);
> -
> -	return !strcmp(hid, ACPI_BUTTON_HID_POWERF);
> -}
> -
>  /**
>   *	acpi_pm_finish - Instruct the platform to leave a sleep state.
>   *
> @@ -468,7 +460,7 @@ static int find_powerf_dev(struct device *dev, void *data)
>   */
>  static void acpi_pm_finish(void)
>  {
> -	struct device *pwr_btn_dev;
> +	struct acpi_device *pwr_btn_adev;
>  	u32 acpi_state = acpi_target_sleep_state;
>  
>  	acpi_ec_unblock_transactions();
> @@ -499,11 +491,11 @@ static void acpi_pm_finish(void)
>  		return;
>  
>  	pwr_btn_event_pending = false;
> -	pwr_btn_dev = bus_find_device(&acpi_bus_type, NULL, NULL,
> -				      find_powerf_dev);
> -	if (pwr_btn_dev) {
> -		pm_wakeup_event(pwr_btn_dev, 0);
> -		put_device(pwr_btn_dev);
> +	pwr_btn_adev = acpi_dev_get_first_match_dev(ACPI_BUTTON_HID_POWERF,
> +						    NULL, -1);
> +	if (pwr_btn_adev) {
> +		pm_wakeup_event(&pwr_btn_adev->dev, 0);
> +		acpi_dev_put(pwr_btn_adev);
>  	}
>  }
>  
> 

Applied, thanks!





      reply	other threads:[~2019-06-27 21:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-12 10:07 [PATCH v1] ACPI / sleep: Switch to use acpi_dev_get_first_match_dev() Andy Shevchenko
2019-06-27 21:47 ` Rafael J. Wysocki [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=1695720.PHZDijW4vG@kreacher \
    --to=rjw@rjwysocki.net \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=linux-acpi@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;
as well as URLs for NNTP newsgroup(s).