diff options
author | Ezequiel Garcia <ezequiel.garcia@free-electrons.com> | 2013-07-29 22:46:03 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2013-07-30 09:03:01 -0400 |
commit | e0067f0b71a2b5d1c5d8df556830db253aa1b264 (patch) | |
tree | bb6b3b18aa10016e43183a6f5338adea2e47fb7e /drivers/ata/sata_mv.c | |
parent | 61b8c345aa8c50c6a99a90560a107d02124f0293 (diff) |
sata_mv: Remove unneeded CONFIG_HAVE_CLK ifdefs
If CONFIG_HAVE_CLK is not selected, then all the clk API turn out
into no-ops. In other words, there's no need to have the ifdefs.
The only side-effect of this patch is the extra tiny kmalloc,
but that's not enough reason to have such ugly ifdefs all around
the code.
tj: Slightly massaged comment as per Andrew Lunn.
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Acked-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'drivers/ata/sata_mv.c')
-rw-r--r-- | drivers/ata/sata_mv.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index 88e08515cf46..56be31819897 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c | |||
@@ -553,10 +553,15 @@ struct mv_host_priv { | |||
553 | u32 irq_mask_offset; | 553 | u32 irq_mask_offset; |
554 | u32 unmask_all_irqs; | 554 | u32 unmask_all_irqs; |
555 | 555 | ||
556 | #if defined(CONFIG_HAVE_CLK) | 556 | /* |
557 | * Needed on some devices that require their clocks to be enabled. | ||
558 | * These are optional: if the platform device does not have any | ||
559 | * clocks, they won't be used. Also, if the underlying hardware | ||
560 | * does not support the common clock framework (CONFIG_HAVE_CLK=n), | ||
561 | * all the clock operations become no-ops (see clk.h). | ||
562 | */ | ||
557 | struct clk *clk; | 563 | struct clk *clk; |
558 | struct clk **port_clks; | 564 | struct clk **port_clks; |
559 | #endif | ||
560 | /* | 565 | /* |
561 | * These consistent DMA memory pools give us guaranteed | 566 | * These consistent DMA memory pools give us guaranteed |
562 | * alignment for hardware-accessed data structures, | 567 | * alignment for hardware-accessed data structures, |
@@ -4032,9 +4037,7 @@ static int mv_platform_probe(struct platform_device *pdev) | |||
4032 | struct resource *res; | 4037 | struct resource *res; |
4033 | int n_ports = 0, irq = 0; | 4038 | int n_ports = 0, irq = 0; |
4034 | int rc; | 4039 | int rc; |
4035 | #if defined(CONFIG_HAVE_CLK) | ||
4036 | int port; | 4040 | int port; |
4037 | #endif | ||
4038 | 4041 | ||
4039 | ata_print_version_once(&pdev->dev, DRV_VERSION); | 4042 | ata_print_version_once(&pdev->dev, DRV_VERSION); |
4040 | 4043 | ||
@@ -4068,13 +4071,11 @@ static int mv_platform_probe(struct platform_device *pdev) | |||
4068 | 4071 | ||
4069 | if (!host || !hpriv) | 4072 | if (!host || !hpriv) |
4070 | return -ENOMEM; | 4073 | return -ENOMEM; |
4071 | #if defined(CONFIG_HAVE_CLK) | ||
4072 | hpriv->port_clks = devm_kzalloc(&pdev->dev, | 4074 | hpriv->port_clks = devm_kzalloc(&pdev->dev, |
4073 | sizeof(struct clk *) * n_ports, | 4075 | sizeof(struct clk *) * n_ports, |
4074 | GFP_KERNEL); | 4076 | GFP_KERNEL); |
4075 | if (!hpriv->port_clks) | 4077 | if (!hpriv->port_clks) |
4076 | return -ENOMEM; | 4078 | return -ENOMEM; |
4077 | #endif | ||
4078 | host->private_data = hpriv; | 4079 | host->private_data = hpriv; |
4079 | hpriv->n_ports = n_ports; | 4080 | hpriv->n_ports = n_ports; |
4080 | hpriv->board_idx = chip_soc; | 4081 | hpriv->board_idx = chip_soc; |
@@ -4084,7 +4085,6 @@ static int mv_platform_probe(struct platform_device *pdev) | |||
4084 | resource_size(res)); | 4085 | resource_size(res)); |
4085 | hpriv->base -= SATAHC0_REG_BASE; | 4086 | hpriv->base -= SATAHC0_REG_BASE; |
4086 | 4087 | ||
4087 | #if defined(CONFIG_HAVE_CLK) | ||
4088 | hpriv->clk = clk_get(&pdev->dev, NULL); | 4088 | hpriv->clk = clk_get(&pdev->dev, NULL); |
4089 | if (IS_ERR(hpriv->clk)) | 4089 | if (IS_ERR(hpriv->clk)) |
4090 | dev_notice(&pdev->dev, "cannot get optional clkdev\n"); | 4090 | dev_notice(&pdev->dev, "cannot get optional clkdev\n"); |
@@ -4098,7 +4098,6 @@ static int mv_platform_probe(struct platform_device *pdev) | |||
4098 | if (!IS_ERR(hpriv->port_clks[port])) | 4098 | if (!IS_ERR(hpriv->port_clks[port])) |
4099 | clk_prepare_enable(hpriv->port_clks[port]); | 4099 | clk_prepare_enable(hpriv->port_clks[port]); |
4100 | } | 4100 | } |
4101 | #endif | ||
4102 | 4101 | ||
4103 | /* | 4102 | /* |
4104 | * (Re-)program MBUS remapping windows if we are asked to. | 4103 | * (Re-)program MBUS remapping windows if we are asked to. |
@@ -4124,7 +4123,6 @@ static int mv_platform_probe(struct platform_device *pdev) | |||
4124 | return 0; | 4123 | return 0; |
4125 | 4124 | ||
4126 | err: | 4125 | err: |
4127 | #if defined(CONFIG_HAVE_CLK) | ||
4128 | if (!IS_ERR(hpriv->clk)) { | 4126 | if (!IS_ERR(hpriv->clk)) { |
4129 | clk_disable_unprepare(hpriv->clk); | 4127 | clk_disable_unprepare(hpriv->clk); |
4130 | clk_put(hpriv->clk); | 4128 | clk_put(hpriv->clk); |
@@ -4135,7 +4133,6 @@ err: | |||
4135 | clk_put(hpriv->port_clks[port]); | 4133 | clk_put(hpriv->port_clks[port]); |
4136 | } | 4134 | } |
4137 | } | 4135 | } |
4138 | #endif | ||
4139 | 4136 | ||
4140 | return rc; | 4137 | return rc; |
4141 | } | 4138 | } |
@@ -4151,13 +4148,10 @@ err: | |||
4151 | static int mv_platform_remove(struct platform_device *pdev) | 4148 | static int mv_platform_remove(struct platform_device *pdev) |
4152 | { | 4149 | { |
4153 | struct ata_host *host = platform_get_drvdata(pdev); | 4150 | struct ata_host *host = platform_get_drvdata(pdev); |
4154 | #if defined(CONFIG_HAVE_CLK) | ||
4155 | struct mv_host_priv *hpriv = host->private_data; | 4151 | struct mv_host_priv *hpriv = host->private_data; |
4156 | int port; | 4152 | int port; |
4157 | #endif | ||
4158 | ata_host_detach(host); | 4153 | ata_host_detach(host); |
4159 | 4154 | ||
4160 | #if defined(CONFIG_HAVE_CLK) | ||
4161 | if (!IS_ERR(hpriv->clk)) { | 4155 | if (!IS_ERR(hpriv->clk)) { |
4162 | clk_disable_unprepare(hpriv->clk); | 4156 | clk_disable_unprepare(hpriv->clk); |
4163 | clk_put(hpriv->clk); | 4157 | clk_put(hpriv->clk); |
@@ -4168,7 +4162,6 @@ static int mv_platform_remove(struct platform_device *pdev) | |||
4168 | clk_put(hpriv->port_clks[port]); | 4162 | clk_put(hpriv->port_clks[port]); |
4169 | } | 4163 | } |
4170 | } | 4164 | } |
4171 | #endif | ||
4172 | return 0; | 4165 | return 0; |
4173 | } | 4166 | } |
4174 | 4167 | ||