Patchwork [V3,07/12] ata/sata_mv: Remove conditional compilation of clk code

login
register
mail settings
Submitter viresh kumar
Date April 24, 2012, 5:02 p.m.
Message ID <CAOh2x=kOww+K-VrNJU_v6XXANQUGyBtZ-ekoCAEQV5kEdah7jQ@mail.gmail.com>
Download mbox | patch
Permalink /patch/154726/
State Not Applicable
Delegated to: David Miller
Headers show

Comments

viresh kumar - April 24, 2012, 5:02 p.m.
On 4/24/12, Andrew Lunn <andrew@lunn.ch> wrote:
>    This is wrong. Not having the clk is not fatal. The old code would
>    carefully not call clk_enable(), since it has an error pointer, not
>    have a valid clk, and would also not call clk_disable during
>    removal.

Whatever i wrote was intentional, because i didn't had this expectation
of yours. :(
Please see if following is fine:

From: Viresh Kumar <viresh.kumar@st.com>
Date: Sat, 21 Apr 2012 11:16:53 +0530
Subject: [PATCH V3 Resend] ata/sata_mv: Remove conditional compilation
of clk code

With addition of dummy clk_*() calls for non CONFIG_HAVE_CLK cases in clk.h,
there is no need to have clk code enclosed in #ifdef CONFIG_HAVE_CLK, #endif
macros.

Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
Cc: Jeff Garzik <jgarzik@redhat.com>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: linux-ide@vger.kernel.org
---
 drivers/ata/sata_mv.c |   10 ----------
 1 files changed, 0 insertions(+), 10 deletions(-)

 	 * (Re-)program MBUS remapping windows if we are asked to.
@@ -4096,12 +4092,10 @@ static int mv_platform_probe(struct
platform_device *pdev)
 		return 0;

 err:
-#if defined(CONFIG_HAVE_CLK)
 	if (!IS_ERR(hpriv->clk)) {
 		clk_disable(hpriv->clk);
 		clk_put(hpriv->clk);
 	}
-#endif

 	return rc;
 }
@@ -4117,17 +4111,13 @@ err:
 static int __devexit mv_platform_remove(struct platform_device *pdev)
 {
 	struct ata_host *host = platform_get_drvdata(pdev);
-#if defined(CONFIG_HAVE_CLK)
 	struct mv_host_priv *hpriv = host->private_data;
-#endif
 	ata_host_detach(host);

-#if defined(CONFIG_HAVE_CLK)
 	if (!IS_ERR(hpriv->clk)) {
 		clk_disable(hpriv->clk);
 		clk_put(hpriv->clk);
 	}
-#endif
 	return 0;
 }
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Andrew Lunn - April 25, 2012, 5:42 a.m.
> Please see if following is fine:

Hi Viresh

This looks good. Thanks

     Andrew

> Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
> Cc: Jeff Garzik <jgarzik@redhat.com>
> Cc: Andrew Lunn <andrew@lunn.ch>
> Cc: linux-ide@vger.kernel.org
> ---
>  drivers/ata/sata_mv.c |   10 ----------
>  1 files changed, 0 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
> index 7336d4a..37503b8 100644
> --- a/drivers/ata/sata_mv.c
> +++ b/drivers/ata/sata_mv.c
> @@ -551,9 +551,7 @@ struct mv_host_priv {
>  	u32			irq_mask_offset;
>  	u32			unmask_all_irqs;
> 
> -#if defined(CONFIG_HAVE_CLK)
>  	struct clk		*clk;
> -#endif
>  	/*
>  	 * These consistent DMA memory pools give us guaranteed
>  	 * alignment for hardware-accessed data structures,
> @@ -4063,13 +4061,11 @@ static int mv_platform_probe(struct
> platform_device *pdev)
>  				   resource_size(res));
>  	hpriv->base -= SATAHC0_REG_BASE;
> 
> -#if defined(CONFIG_HAVE_CLK)
>  	hpriv->clk = clk_get(&pdev->dev, NULL);
>  	if (IS_ERR(hpriv->clk))
>  		dev_notice(&pdev->dev, "cannot get clkdev\n");
>  	else
>  		clk_enable(hpriv->clk);
> -#endif
> 
>  	/*
>  	 * (Re-)program MBUS remapping windows if we are asked to.
> @@ -4096,12 +4092,10 @@ static int mv_platform_probe(struct
> platform_device *pdev)
>  		return 0;
> 
>  err:
> -#if defined(CONFIG_HAVE_CLK)
>  	if (!IS_ERR(hpriv->clk)) {
>  		clk_disable(hpriv->clk);
>  		clk_put(hpriv->clk);
>  	}
> -#endif
> 
>  	return rc;
>  }
> @@ -4117,17 +4111,13 @@ err:
>  static int __devexit mv_platform_remove(struct platform_device *pdev)
>  {
>  	struct ata_host *host = platform_get_drvdata(pdev);
> -#if defined(CONFIG_HAVE_CLK)
>  	struct mv_host_priv *hpriv = host->private_data;
> -#endif
>  	ata_host_detach(host);
> 
> -#if defined(CONFIG_HAVE_CLK)
>  	if (!IS_ERR(hpriv->clk)) {
>  		clk_disable(hpriv->clk);
>  		clk_put(hpriv->clk);
>  	}
> -#endif
>  	return 0;
>  }
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index 7336d4a..37503b8 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -551,9 +551,7 @@  struct mv_host_priv {
 	u32			irq_mask_offset;
 	u32			unmask_all_irqs;

-#if defined(CONFIG_HAVE_CLK)
 	struct clk		*clk;
-#endif
 	/*
 	 * These consistent DMA memory pools give us guaranteed
 	 * alignment for hardware-accessed data structures,
@@ -4063,13 +4061,11 @@  static int mv_platform_probe(struct
platform_device *pdev)
 				   resource_size(res));
 	hpriv->base -= SATAHC0_REG_BASE;

-#if defined(CONFIG_HAVE_CLK)
 	hpriv->clk = clk_get(&pdev->dev, NULL);
 	if (IS_ERR(hpriv->clk))
 		dev_notice(&pdev->dev, "cannot get clkdev\n");
 	else
 		clk_enable(hpriv->clk);
-#endif

 	/*