linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ACPI / platform: drop redundant ACPI_HANDLE check
@ 2014-02-14  4:00 Josh Cartwright
  2014-02-14 13:45 ` Rafael J. Wysocki
  0 siblings, 1 reply; 3+ messages in thread
From: Josh Cartwright @ 2014-02-14  4:00 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-acpi, Len Brown, Rafael J. Wysocki, linux-kernel

The acpi_dev_pm_attach/_detach functions perform their own checks to
ensure the device has an ACPI companion.  It is not necessary for the
caller to do so.

This mirrors what other busses with ACPI dev PM support do (i2c, spi,
sdio).

Cc: Len Brown <lenb@kernel.org>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Josh Cartwright <joshc@codeaurora.org>
---
 drivers/base/platform.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index bc78848..e714709 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -481,11 +481,10 @@ static int platform_drv_probe(struct device *_dev)
 	struct platform_device *dev = to_platform_device(_dev);
 	int ret;
 
-	if (ACPI_HANDLE(_dev))
-		acpi_dev_pm_attach(_dev, true);
+	acpi_dev_pm_attach(_dev, true);
 
 	ret = drv->probe(dev);
-	if (ret && ACPI_HANDLE(_dev))
+	if (ret)
 		acpi_dev_pm_detach(_dev, true);
 
 	if (drv->prevent_deferred_probe && ret == -EPROBE_DEFER) {
@@ -508,8 +507,7 @@ static int platform_drv_remove(struct device *_dev)
 	int ret;
 
 	ret = drv->remove(dev);
-	if (ACPI_HANDLE(_dev))
-		acpi_dev_pm_detach(_dev, true);
+	acpi_dev_pm_detach(_dev, true);
 
 	return ret;
 }
@@ -520,8 +518,7 @@ static void platform_drv_shutdown(struct device *_dev)
 	struct platform_device *dev = to_platform_device(_dev);
 
 	drv->shutdown(dev);
-	if (ACPI_HANDLE(_dev))
-		acpi_dev_pm_detach(_dev, true);
+	acpi_dev_pm_detach(_dev, true);
 }
 
 /**
-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation


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

* Re: [PATCH] ACPI / platform: drop redundant ACPI_HANDLE check
  2014-02-14  4:00 [PATCH] ACPI / platform: drop redundant ACPI_HANDLE check Josh Cartwright
@ 2014-02-14 13:45 ` Rafael J. Wysocki
  2014-02-14 22:06   ` Greg Kroah-Hartman
  0 siblings, 1 reply; 3+ messages in thread
From: Rafael J. Wysocki @ 2014-02-14 13:45 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Josh Cartwright, linux-acpi, Len Brown, Rafael J. Wysocki, linux-kernel

On Thursday, February 13, 2014 10:00:43 PM Josh Cartwright wrote:
> The acpi_dev_pm_attach/_detach functions perform their own checks to
> ensure the device has an ACPI companion.  It is not necessary for the
> caller to do so.
> 
> This mirrors what other busses with ACPI dev PM support do (i2c, spi,
> sdio).
> 
> Cc: Len Brown <lenb@kernel.org>
> Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Signed-off-by: Josh Cartwright <joshc@codeaurora.org>

Hi Greg,

If you want to take this, please feel free to add:

Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

to it.  If you want me to take it, please let me know.

Rafael


> ---
>  drivers/base/platform.c | 11 ++++-------
>  1 file changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/base/platform.c b/drivers/base/platform.c
> index bc78848..e714709 100644
> --- a/drivers/base/platform.c
> +++ b/drivers/base/platform.c
> @@ -481,11 +481,10 @@ static int platform_drv_probe(struct device *_dev)
>  	struct platform_device *dev = to_platform_device(_dev);
>  	int ret;
>  
> -	if (ACPI_HANDLE(_dev))
> -		acpi_dev_pm_attach(_dev, true);
> +	acpi_dev_pm_attach(_dev, true);
>  
>  	ret = drv->probe(dev);
> -	if (ret && ACPI_HANDLE(_dev))
> +	if (ret)
>  		acpi_dev_pm_detach(_dev, true);
>  
>  	if (drv->prevent_deferred_probe && ret == -EPROBE_DEFER) {
> @@ -508,8 +507,7 @@ static int platform_drv_remove(struct device *_dev)
>  	int ret;
>  
>  	ret = drv->remove(dev);
> -	if (ACPI_HANDLE(_dev))
> -		acpi_dev_pm_detach(_dev, true);
> +	acpi_dev_pm_detach(_dev, true);
>  
>  	return ret;
>  }
> @@ -520,8 +518,7 @@ static void platform_drv_shutdown(struct device *_dev)
>  	struct platform_device *dev = to_platform_device(_dev);
>  
>  	drv->shutdown(dev);
> -	if (ACPI_HANDLE(_dev))
> -		acpi_dev_pm_detach(_dev, true);
> +	acpi_dev_pm_detach(_dev, true);
>  }
>  
>  /**
> 

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

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

* Re: [PATCH] ACPI / platform: drop redundant ACPI_HANDLE check
  2014-02-14 13:45 ` Rafael J. Wysocki
@ 2014-02-14 22:06   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2014-02-14 22:06 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Josh Cartwright, linux-acpi, Len Brown, Rafael J. Wysocki, linux-kernel

On Fri, Feb 14, 2014 at 02:45:29PM +0100, Rafael J. Wysocki wrote:
> On Thursday, February 13, 2014 10:00:43 PM Josh Cartwright wrote:
> > The acpi_dev_pm_attach/_detach functions perform their own checks to
> > ensure the device has an ACPI companion.  It is not necessary for the
> > caller to do so.
> > 
> > This mirrors what other busses with ACPI dev PM support do (i2c, spi,
> > sdio).
> > 
> > Cc: Len Brown <lenb@kernel.org>
> > Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > Signed-off-by: Josh Cartwright <joshc@codeaurora.org>
> 
> Hi Greg,
> 
> If you want to take this, please feel free to add:
> 
> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> to it.  If you want me to take it, please let me know.

Thanks, I'll go take it through my tree.

greg k-h

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

end of thread, other threads:[~2014-02-14 22:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-14  4:00 [PATCH] ACPI / platform: drop redundant ACPI_HANDLE check Josh Cartwright
2014-02-14 13:45 ` Rafael J. Wysocki
2014-02-14 22:06   ` Greg Kroah-Hartman

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