Skip to content

Commit

Permalink
i2c: uniphier(-f): use devm_platform_ioremap_resource()
Browse files Browse the repository at this point in the history
Replace the chain of platform_get_resource() and devm_ioremap_resource()
with devm_platform_ioremap_resource().

This allows to remove the local variable for (struct resource *), and
have one function call less.

Signed-off-by: Masahiro Yamada <[email protected]>
Signed-off-by: Wolfram Sang <[email protected]>
  • Loading branch information
masahir0y authored and Wolfram Sang committed Sep 5, 2019
1 parent fe050f9 commit 22ac74a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 1 addition & 3 deletions drivers/i2c/busses/i2c-uniphier-f.c
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,6 @@ static int uniphier_fi2c_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct uniphier_fi2c_priv *priv;
struct resource *regs;
u32 bus_speed;
unsigned long clk_rate;
int irq, ret;
Expand All @@ -547,8 +546,7 @@ static int uniphier_fi2c_probe(struct platform_device *pdev)
if (!priv)
return -ENOMEM;

regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
priv->membase = devm_ioremap_resource(dev, regs);
priv->membase = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(priv->membase))
return PTR_ERR(priv->membase);

Expand Down
4 changes: 1 addition & 3 deletions drivers/i2c/busses/i2c-uniphier.c
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,6 @@ static int uniphier_i2c_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct uniphier_i2c_priv *priv;
struct resource *regs;
u32 bus_speed;
unsigned long clk_rate;
int irq, ret;
Expand All @@ -335,8 +334,7 @@ static int uniphier_i2c_probe(struct platform_device *pdev)
if (!priv)
return -ENOMEM;

regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
priv->membase = devm_ioremap_resource(dev, regs);
priv->membase = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(priv->membase))
return PTR_ERR(priv->membase);

Expand Down

0 comments on commit 22ac74a

Please sign in to comment.