diff mbox

[1/2] ACPI / LPSS: Make condition local to lpt_register_clock_device

Message ID 1363781670-28775-1-git-send-email-andriy.shevchenko@linux.intel.com (mailing list archive)
State Rejected, archived
Headers show

Commit Message

Andy Shevchenko March 20, 2013, 12:14 p.m. UTC
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(-)

Comments

Rafael Wysocki March 26, 2013, 1:37 p.m. UTC | #1
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)
>
diff mbox

Patch

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)