linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] platform: surface: Replace acpi_bus_get_device()
@ 2022-01-26 19:41 Rafael J. Wysocki
  2022-01-26 20:03 ` Maximilian Luz
  2022-02-03 10:40 ` Hans de Goede
  0 siblings, 2 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2022-01-26 19:41 UTC (permalink / raw)
  To: Hans de Goede
  Cc: LKML, Linux ACPI, Andy Shevchenko, platform-driver-x86,
	Mark Gross, Maximilian Luz

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>
---
 drivers/platform/surface/surface3-wmi.c        |   12 ++++--------
 drivers/platform/surface/surface_acpi_notify.c |    3 ++-
 2 files changed, 6 insertions(+), 9 deletions(-)

Index: linux-pm/drivers/platform/surface/surface3-wmi.c
===================================================================
--- linux-pm.orig/drivers/platform/surface/surface3-wmi.c
+++ linux-pm/drivers/platform/surface/surface3-wmi.c
@@ -116,15 +116,11 @@ static acpi_status s3_wmi_attach_spi_dev
 					    void *data,
 					    void **return_value)
 {
-	struct acpi_device *adev, **ts_adev;
+	struct acpi_device *adev = acpi_fetch_acpi_dev(handle);
+	struct acpi_device **ts_adev = data;
 
-	if (acpi_bus_get_device(handle, &adev))
-		return AE_OK;
-
-	ts_adev = data;
-
-	if (strncmp(acpi_device_bid(adev), SPI_TS_OBJ_NAME,
-	    strlen(SPI_TS_OBJ_NAME)))
+	if (!adev || strncmp(acpi_device_bid(adev), SPI_TS_OBJ_NAME,
+			     strlen(SPI_TS_OBJ_NAME)))
 		return AE_OK;
 
 	if (*ts_adev) {
Index: linux-pm/drivers/platform/surface/surface_acpi_notify.c
===================================================================
--- linux-pm.orig/drivers/platform/surface/surface_acpi_notify.c
+++ linux-pm/drivers/platform/surface/surface_acpi_notify.c
@@ -770,7 +770,8 @@ static acpi_status san_consumer_setup(ac
 		return AE_OK;
 
 	/* Ignore ACPI devices that are not present. */
-	if (acpi_bus_get_device(handle, &adev) != 0)
+	adev = acpi_fetch_acpi_dev(handle);
+	if (!adev)
 		return AE_OK;
 
 	san_consumer_dbg(&pdev->dev, handle, "creating device link\n");




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] platform: surface: Replace acpi_bus_get_device()
  2022-01-26 19:41 [PATCH] platform: surface: Replace acpi_bus_get_device() Rafael J. Wysocki
@ 2022-01-26 20:03 ` Maximilian Luz
  2022-02-03 10:40 ` Hans de Goede
  1 sibling, 0 replies; 3+ messages in thread
From: Maximilian Luz @ 2022-01-26 20:03 UTC (permalink / raw)
  To: Rafael J. Wysocki, Hans de Goede
  Cc: LKML, Linux ACPI, Andy Shevchenko, platform-driver-x86, Mark Gross

On 1/26/22 20:41, 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>

Looks good to me.

Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com>

> ---
>   drivers/platform/surface/surface3-wmi.c        |   12 ++++--------
>   drivers/platform/surface/surface_acpi_notify.c |    3 ++-
>   2 files changed, 6 insertions(+), 9 deletions(-)
> 
> Index: linux-pm/drivers/platform/surface/surface3-wmi.c
> ===================================================================
> --- linux-pm.orig/drivers/platform/surface/surface3-wmi.c
> +++ linux-pm/drivers/platform/surface/surface3-wmi.c
> @@ -116,15 +116,11 @@ static acpi_status s3_wmi_attach_spi_dev
>   					    void *data,
>   					    void **return_value)
>   {
> -	struct acpi_device *adev, **ts_adev;
> +	struct acpi_device *adev = acpi_fetch_acpi_dev(handle);
> +	struct acpi_device **ts_adev = data;
>   
> -	if (acpi_bus_get_device(handle, &adev))
> -		return AE_OK;
> -
> -	ts_adev = data;
> -
> -	if (strncmp(acpi_device_bid(adev), SPI_TS_OBJ_NAME,
> -	    strlen(SPI_TS_OBJ_NAME)))
> +	if (!adev || strncmp(acpi_device_bid(adev), SPI_TS_OBJ_NAME,
> +			     strlen(SPI_TS_OBJ_NAME)))
>   		return AE_OK;
>   
>   	if (*ts_adev) {
> Index: linux-pm/drivers/platform/surface/surface_acpi_notify.c
> ===================================================================
> --- linux-pm.orig/drivers/platform/surface/surface_acpi_notify.c
> +++ linux-pm/drivers/platform/surface/surface_acpi_notify.c
> @@ -770,7 +770,8 @@ static acpi_status san_consumer_setup(ac
>   		return AE_OK;
>   
>   	/* Ignore ACPI devices that are not present. */
> -	if (acpi_bus_get_device(handle, &adev) != 0)
> +	adev = acpi_fetch_acpi_dev(handle);
> +	if (!adev)
>   		return AE_OK;
>   
>   	san_consumer_dbg(&pdev->dev, handle, "creating device link\n");
> 
> 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] platform: surface: Replace acpi_bus_get_device()
  2022-01-26 19:41 [PATCH] platform: surface: Replace acpi_bus_get_device() Rafael J. Wysocki
  2022-01-26 20:03 ` Maximilian Luz
@ 2022-02-03 10:40 ` Hans de Goede
  1 sibling, 0 replies; 3+ messages in thread
From: Hans de Goede @ 2022-02-03 10:40 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: LKML, Linux ACPI, Andy Shevchenko, platform-driver-x86,
	Mark Gross, Maximilian Luz

Hi,

On 1/26/22 20:41, 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/surface/surface3-wmi.c        |   12 ++++--------
>  drivers/platform/surface/surface_acpi_notify.c |    3 ++-
>  2 files changed, 6 insertions(+), 9 deletions(-)
> 
> Index: linux-pm/drivers/platform/surface/surface3-wmi.c
> ===================================================================
> --- linux-pm.orig/drivers/platform/surface/surface3-wmi.c
> +++ linux-pm/drivers/platform/surface/surface3-wmi.c
> @@ -116,15 +116,11 @@ static acpi_status s3_wmi_attach_spi_dev
>  					    void *data,
>  					    void **return_value)
>  {
> -	struct acpi_device *adev, **ts_adev;
> +	struct acpi_device *adev = acpi_fetch_acpi_dev(handle);
> +	struct acpi_device **ts_adev = data;
>  
> -	if (acpi_bus_get_device(handle, &adev))
> -		return AE_OK;
> -
> -	ts_adev = data;
> -
> -	if (strncmp(acpi_device_bid(adev), SPI_TS_OBJ_NAME,
> -	    strlen(SPI_TS_OBJ_NAME)))
> +	if (!adev || strncmp(acpi_device_bid(adev), SPI_TS_OBJ_NAME,
> +			     strlen(SPI_TS_OBJ_NAME)))
>  		return AE_OK;
>  
>  	if (*ts_adev) {
> Index: linux-pm/drivers/platform/surface/surface_acpi_notify.c
> ===================================================================
> --- linux-pm.orig/drivers/platform/surface/surface_acpi_notify.c
> +++ linux-pm/drivers/platform/surface/surface_acpi_notify.c
> @@ -770,7 +770,8 @@ static acpi_status san_consumer_setup(ac
>  		return AE_OK;
>  
>  	/* Ignore ACPI devices that are not present. */
> -	if (acpi_bus_get_device(handle, &adev) != 0)
> +	adev = acpi_fetch_acpi_dev(handle);
> +	if (!adev)
>  		return AE_OK;
>  
>  	san_consumer_dbg(&pdev->dev, handle, "creating device link\n");
> 
> 
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-02-03 10:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-26 19:41 [PATCH] platform: surface: Replace acpi_bus_get_device() Rafael J. Wysocki
2022-01-26 20:03 ` Maximilian Luz
2022-02-03 10:40 ` Hans de Goede

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).