public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ACPI / LPSS: Make condition local to lpt_register_clock_device
@ 2013-03-20 12:14 Andy Shevchenko
  2013-03-20 12:14 ` [PATCH 2/2] ACPI / LPSS: make code less confusing for reader Andy Shevchenko
  2013-03-26 13:37 ` [PATCH 1/2] ACPI / LPSS: Make condition local to lpt_register_clock_device Rafael J. Wysocki
  0 siblings, 2 replies; 4+ messages in thread
From: Andy Shevchenko @ 2013-03-20 12:14 UTC (permalink / raw)
  To: linux-acpi, Rafael J. Wysocki, Mika Westerberg; +Cc: Andy Shevchenko

It seems more logical to have the check of lpss_clk_dev variable in
lpt_register_clock_device() because last one actually assignes the variable.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/acpi/acpi_lpss.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c
index c87db0e..c695841 100644
--- a/drivers/acpi/acpi_lpss.c
+++ b/drivers/acpi/acpi_lpss.c
@@ -84,6 +84,9 @@ static struct platform_device *lpss_clk_dev;
 
 static inline void lpt_register_clock_device(void)
 {
+	if (lpss_clk_dev)
+		return;
+
 	lpss_clk_dev = platform_device_register_simple("clk-lpt", -1, NULL, 0);
 }
 
@@ -92,8 +95,7 @@ static int register_device_clock(struct acpi_device *adev,
 {
 	const struct lpss_device_desc *dev_desc = pdata->dev_desc;
 
-	if (!lpss_clk_dev)
-		lpt_register_clock_device();
+	lpt_register_clock_device();
 
 	if (!dev_desc->clk_parent || !pdata->mmio_base
 	    || pdata->mmio_size < dev_desc->prv_offset + LPSS_CLK_SIZE)
-- 
1.8.2.rc0.22.gb3600c3


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

* [PATCH 2/2] ACPI / LPSS: make code less confusing for reader
  2013-03-20 12:14 [PATCH 1/2] ACPI / LPSS: Make condition local to lpt_register_clock_device Andy Shevchenko
@ 2013-03-20 12:14 ` Andy Shevchenko
  2013-03-26 13:36   ` Rafael J. Wysocki
  2013-03-26 13:37 ` [PATCH 1/2] ACPI / LPSS: Make condition local to lpt_register_clock_device Rafael J. Wysocki
  1 sibling, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2013-03-20 12:14 UTC (permalink / raw)
  To: linux-acpi, Rafael J. Wysocki, Mika Westerberg; +Cc: Andy Shevchenko

The excerpt like this:

	if (err) {
		err = 0;
		goto error_out;
	}

makes a reader confused even if it's commented. Let's do necessary actions and
return no error explicitly.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/acpi/acpi_lpss.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c
index c695841..5d7ded2 100644
--- a/drivers/acpi/acpi_lpss.c
+++ b/drivers/acpi/acpi_lpss.c
@@ -152,8 +152,8 @@ static int acpi_lpss_create_device(struct acpi_device *adev,
 			 * Skip the device, but don't terminate the namespace
 			 * scan.
 			 */
-			ret = 0;
-			goto err_out;
+			kfree(pdata);
+			return 0;
 		}
 	}
 
-- 
1.8.2.rc0.22.gb3600c3


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

* Re: [PATCH 2/2] ACPI / LPSS: make code less confusing for reader
  2013-03-20 12:14 ` [PATCH 2/2] ACPI / LPSS: make code less confusing for reader Andy Shevchenko
@ 2013-03-26 13:36   ` Rafael J. Wysocki
  0 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2013-03-26 13:36 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-acpi, Mika Westerberg

On Wednesday, March 20, 2013 02:14:30 PM Andy Shevchenko wrote:
> The excerpt like this:
> 
> 	if (err) {
> 		err = 0;
> 		goto error_out;
> 	}
> 
> makes a reader confused even if it's commented. Let's do necessary actions and
> return no error explicitly.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Applied to linux-pm.git/linux-next.

Thanks,
Rafael


> ---
>  drivers/acpi/acpi_lpss.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c
> index c695841..5d7ded2 100644
> --- a/drivers/acpi/acpi_lpss.c
> +++ b/drivers/acpi/acpi_lpss.c
> @@ -152,8 +152,8 @@ static int acpi_lpss_create_device(struct acpi_device *adev,
>  			 * Skip the device, but don't terminate the namespace
>  			 * scan.
>  			 */
> -			ret = 0;
> -			goto err_out;
> +			kfree(pdata);
> +			return 0;
>  		}
>  	}
>  
> 
-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

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

* Re: [PATCH 1/2] ACPI / LPSS: Make condition local to lpt_register_clock_device
  2013-03-20 12:14 [PATCH 1/2] ACPI / LPSS: Make condition local to lpt_register_clock_device Andy Shevchenko
  2013-03-20 12:14 ` [PATCH 2/2] ACPI / LPSS: make code less confusing for reader Andy Shevchenko
@ 2013-03-26 13:37 ` Rafael J. Wysocki
  1 sibling, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2013-03-26 13:37 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-acpi, Mika Westerberg

On Wednesday, March 20, 2013 02:14:29 PM Andy Shevchenko wrote:
> It seems more logical to have the check of lpss_clk_dev variable in
> lpt_register_clock_device() because last one actually assignes the variable.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Actually, I came to the opposite conclusion when I was working on the code
in question. :-)

Not applied.

Thanks,
Rafael


> ---
>  drivers/acpi/acpi_lpss.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c
> index c87db0e..c695841 100644
> --- a/drivers/acpi/acpi_lpss.c
> +++ b/drivers/acpi/acpi_lpss.c
> @@ -84,6 +84,9 @@ static struct platform_device *lpss_clk_dev;
>  
>  static inline void lpt_register_clock_device(void)
>  {
> +	if (lpss_clk_dev)
> +		return;
> +
>  	lpss_clk_dev = platform_device_register_simple("clk-lpt", -1, NULL, 0);
>  }
>  
> @@ -92,8 +95,7 @@ static int register_device_clock(struct acpi_device *adev,
>  {
>  	const struct lpss_device_desc *dev_desc = pdata->dev_desc;
>  
> -	if (!lpss_clk_dev)
> -		lpt_register_clock_device();
> +	lpt_register_clock_device();
>  
>  	if (!dev_desc->clk_parent || !pdata->mmio_base
>  	    || pdata->mmio_size < dev_desc->prv_offset + LPSS_CLK_SIZE)
> 
-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

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

end of thread, other threads:[~2013-03-26 13:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-20 12:14 [PATCH 1/2] ACPI / LPSS: Make condition local to lpt_register_clock_device Andy Shevchenko
2013-03-20 12:14 ` [PATCH 2/2] ACPI / LPSS: make code less confusing for reader Andy Shevchenko
2013-03-26 13:36   ` Rafael J. Wysocki
2013-03-26 13:37 ` [PATCH 1/2] ACPI / LPSS: Make condition local to lpt_register_clock_device Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox