public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Linux ACPI <linux-acpi@vger.kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	platform-driver-x86@vger.kernel.org
Subject: Re: [PATCH] platform: x86: Replace acpi_bus_get_device()
Date: Thu, 3 Feb 2022 11:39:58 +0100	[thread overview]
Message-ID: <7350e94c-9df9-d195-193a-534a86ae3074@redhat.com> (raw)
In-Reply-To: <2631712.mvXUDI8C0e@kreacher>

Hi,

On 1/26/22 20:38, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> Replace acpi_bus_get_device() that is going to be dropped with
> acpi_fetch_acpi_dev().
> 
> No intentional functional impact.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Thank you for your patch, I've applied this patch to my review-hans 
branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans

Note it will show up in my review-hans branch once I've pushed my
local branch there, which might take a while.

Once I've run some tests on this branch the patches there will be
added to the platform-drivers-x86/for-next branch and eventually
will be included in the pdx86 pull-request to Linus for the next
merge-window.

Regards,

Hans


> ---
>  drivers/platform/x86/intel/hid.c              |    7 ++-----
>  drivers/platform/x86/intel/int3472/discrete.c |    5 ++---
>  drivers/platform/x86/intel/vbtn.c             |    7 ++-----
>  drivers/platform/x86/thinkpad_acpi.c          |   17 ++++++++---------
>  drivers/platform/x86/x86-android-tablets.c    |    2 +-
>  5 files changed, 15 insertions(+), 23 deletions(-)
> 
> Index: linux-pm/drivers/platform/x86/intel/vbtn.c
> ===================================================================
> --- linux-pm.orig/drivers/platform/x86/intel/vbtn.c
> +++ linux-pm/drivers/platform/x86/intel/vbtn.c
> @@ -384,12 +384,9 @@ static acpi_status __init
>  check_acpi_dev(acpi_handle handle, u32 lvl, void *context, void **rv)
>  {
>  	const struct acpi_device_id *ids = context;
> -	struct acpi_device *dev;
> +	struct acpi_device *dev = acpi_fetch_acpi_dev(handle);
>  
> -	if (acpi_bus_get_device(handle, &dev) != 0)
> -		return AE_OK;
> -
> -	if (acpi_match_device_ids(dev, ids) == 0)
> +	if (dev && acpi_match_device_ids(dev, ids) == 0)
>  		if (!IS_ERR_OR_NULL(acpi_create_platform_device(dev, NULL)))
>  			dev_info(&dev->dev,
>  				 "intel-vbtn: created platform device\n");
> Index: linux-pm/drivers/platform/x86/intel/hid.c
> ===================================================================
> --- linux-pm.orig/drivers/platform/x86/intel/hid.c
> +++ linux-pm/drivers/platform/x86/intel/hid.c
> @@ -726,12 +726,9 @@ static acpi_status __init
>  check_acpi_dev(acpi_handle handle, u32 lvl, void *context, void **rv)
>  {
>  	const struct acpi_device_id *ids = context;
> -	struct acpi_device *dev;
> +	struct acpi_device *dev = acpi_fetch_acpi_dev(handle);
>  
> -	if (acpi_bus_get_device(handle, &dev) != 0)
> -		return AE_OK;
> -
> -	if (acpi_match_device_ids(dev, ids) == 0)
> +	if (dev && acpi_match_device_ids(dev, ids) == 0)
>  		if (!IS_ERR_OR_NULL(acpi_create_platform_device(dev, NULL)))
>  			dev_info(&dev->dev,
>  				 "intel-hid: created platform device\n");
> Index: linux-pm/drivers/platform/x86/thinkpad_acpi.c
> ===================================================================
> --- linux-pm.orig/drivers/platform/x86/thinkpad_acpi.c
> +++ linux-pm/drivers/platform/x86/thinkpad_acpi.c
> @@ -728,11 +728,10 @@ static void __init drv_acpi_handle_init(
>  static acpi_status __init tpacpi_acpi_handle_locate_callback(acpi_handle handle,
>  			u32 level, void *context, void **return_value)
>  {
> -	struct acpi_device *dev;
>  	if (!strcmp(context, "video")) {
> -		if (acpi_bus_get_device(handle, &dev))
> -			return AE_OK;
> -		if (strcmp(ACPI_VIDEO_HID, acpi_device_hid(dev)))
> +		struct acpi_device *dev = acpi_fetch_acpi_dev(handle);
> +
> +		if (!dev || strcmp(ACPI_VIDEO_HID, acpi_device_hid(dev)))
>  			return AE_OK;
>  	}
>  
> @@ -786,7 +785,6 @@ static void dispatch_acpi_notify(acpi_ha
>  static int __init setup_acpi_notify(struct ibm_struct *ibm)
>  {
>  	acpi_status status;
> -	int rc;
>  
>  	BUG_ON(!ibm->acpi);
>  
> @@ -796,9 +794,9 @@ static int __init setup_acpi_notify(stru
>  	vdbg_printk(TPACPI_DBG_INIT,
>  		"setting up ACPI notify for %s\n", ibm->name);
>  
> -	rc = acpi_bus_get_device(*ibm->acpi->handle, &ibm->acpi->device);
> -	if (rc < 0) {
> -		pr_err("acpi_bus_get_device(%s) failed: %d\n", ibm->name, rc);
> +	ibm->acpi->device = acpi_fetch_acpi_dev(*ibm->acpi->handle);
> +	if (!ibm->acpi->device) {
> +		pr_err("acpi_fetch_acpi_dev(%s) failed\n", ibm->name);
>  		return -ENODEV;
>  	}
>  
> @@ -6723,7 +6721,8 @@ static int __init tpacpi_query_bcl_level
>  	struct acpi_device *device, *child;
>  	int rc;
>  
> -	if (acpi_bus_get_device(handle, &device))
> +	device = acpi_fetch_acpi_dev(handle);
> +	if (!device)
>  		return 0;
>  
>  	rc = 0;
> Index: linux-pm/drivers/platform/x86/intel/int3472/discrete.c
> ===================================================================
> --- linux-pm.orig/drivers/platform/x86/intel/int3472/discrete.c
> +++ linux-pm/drivers/platform/x86/intel/int3472/discrete.c
> @@ -112,7 +112,6 @@ static int skl_int3472_map_gpio_to_senso
>  	struct acpi_device *adev;
>  	acpi_handle handle;
>  	acpi_status status;
> -	int ret;
>  
>  	if (int3472->n_sensor_gpios >= INT3472_MAX_SENSOR_GPIOS) {
>  		dev_warn(int3472->dev, "Too many GPIOs mapped\n");
> @@ -139,8 +138,8 @@ static int skl_int3472_map_gpio_to_senso
>  	if (ACPI_FAILURE(status))
>  		return -EINVAL;
>  
> -	ret = acpi_bus_get_device(handle, &adev);
> -	if (ret)
> +	adev = acpi_fetch_acpi_dev(handle);
> +	if (!adev)
>  		return -ENODEV;
>  
>  	table_entry = &int3472->gpios.table[int3472->n_sensor_gpios];
> Index: linux-pm/drivers/platform/x86/x86-android-tablets.c
> ===================================================================
> --- linux-pm.orig/drivers/platform/x86/x86-android-tablets.c
> +++ linux-pm/drivers/platform/x86/x86-android-tablets.c
> @@ -104,7 +104,7 @@ static int x86_acpi_irq_helper_get(const
>  			return -ENODEV;
>  		}
>  
> -		acpi_bus_get_device(handle, &adev);
> +		adev = acpi_fetch_acpi_dev(handle);
>  		if (!adev) {
>  			pr_err("error could not get %s adev\n", data->chip);
>  			return -ENODEV;
> 
> 
> 


      reply	other threads:[~2022-02-03 10:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-26 19:38 [PATCH] platform: x86: Replace acpi_bus_get_device() Rafael J. Wysocki
2022-02-03 10:39 ` Hans de Goede [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=7350e94c-9df9-d195-193a-534a86ae3074@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    /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