public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] phy: hix5hd2-sata: Convert to use devm_ioremap_resource
@ 2015-03-02  6:32 Axel Lin
  2015-03-02  7:42 ` zhangfei
  0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2015-03-02  6:32 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: Jiancheng Xue, Zhangfei Gao, linux-kernel@vger.kernel.org

devm_ioremap_resource() also has sanity check for the res argument which is
missed in current code.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/phy/phy-hix5hd2-sata.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/phy/phy-hix5hd2-sata.c b/drivers/phy/phy-hix5hd2-sata.c
index 34915b4..798adcf 100644
--- a/drivers/phy/phy-hix5hd2-sata.c
+++ b/drivers/phy/phy-hix5hd2-sata.c
@@ -147,9 +147,9 @@ static int hix5hd2_sata_phy_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	priv->base = devm_ioremap(dev, res->start, resource_size(res));
-	if (!priv->base)
-		return -ENOMEM;
+	priv->base = devm_ioremap_resource(dev, res);
+	if (IS_ERR(priv->base))
+		return PTR_ERR(priv->base);
 
 	priv->peri_ctrl = syscon_regmap_lookup_by_phandle(dev->of_node,
 					"hisilicon,peripheral-syscon");
-- 
1.9.1




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

* Re: [PATCH] phy: hix5hd2-sata: Convert to use devm_ioremap_resource
  2015-03-02  6:32 [PATCH] phy: hix5hd2-sata: Convert to use devm_ioremap_resource Axel Lin
@ 2015-03-02  7:42 ` zhangfei
  0 siblings, 0 replies; 2+ messages in thread
From: zhangfei @ 2015-03-02  7:42 UTC (permalink / raw)
  To: Axel Lin, Kishon Vijay Abraham I
  Cc: Jiancheng Xue, linux-kernel@vger.kernel.org



On 03/02/2015 02:32 PM, Axel Lin wrote:
> devm_ioremap_resource() also has sanity check for the res argument which is
> missed in current code.

I remember we can not use devm_ioremap_resource here, because the memory 
region is shared with sata controller.
And devm_request_mem_region would fail.
So we directly use devm_ioremap here.

>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
>   drivers/phy/phy-hix5hd2-sata.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/phy/phy-hix5hd2-sata.c b/drivers/phy/phy-hix5hd2-sata.c
> index 34915b4..798adcf 100644
> --- a/drivers/phy/phy-hix5hd2-sata.c
> +++ b/drivers/phy/phy-hix5hd2-sata.c
> @@ -147,9 +147,9 @@ static int hix5hd2_sata_phy_probe(struct platform_device *pdev)
>   		return -ENOMEM;
>
>   	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	priv->base = devm_ioremap(dev, res->start, resource_size(res));
> -	if (!priv->base)
> -		return -ENOMEM;
> +	priv->base = devm_ioremap_resource(dev, res);
> +	if (IS_ERR(priv->base))
> +		return PTR_ERR(priv->base);
>
>   	priv->peri_ctrl = syscon_regmap_lookup_by_phandle(dev->of_node,
>   					"hisilicon,peripheral-syscon");
>

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

end of thread, other threads:[~2015-03-02  7:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-02  6:32 [PATCH] phy: hix5hd2-sata: Convert to use devm_ioremap_resource Axel Lin
2015-03-02  7:42 ` zhangfei

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