diff options
| -rw-r--r-- | drivers/i2c/busses/i2c-s3c2410.c | 35 |
1 files changed, 7 insertions, 28 deletions
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c index f01cdf35f4c9..f82d11f9b8f2 100644 --- a/drivers/i2c/busses/i2c-s3c2410.c +++ b/drivers/i2c/busses/i2c-s3c2410.c | |||
| @@ -78,7 +78,6 @@ struct s3c24xx_i2c { | |||
| 78 | void __iomem *regs; | 78 | void __iomem *regs; |
| 79 | struct clk *clk; | 79 | struct clk *clk; |
| 80 | struct device *dev; | 80 | struct device *dev; |
| 81 | struct resource *ioarea; | ||
| 82 | struct i2c_adapter adap; | 81 | struct i2c_adapter adap; |
| 83 | 82 | ||
| 84 | struct s3c2410_platform_i2c *pdata; | 83 | struct s3c2410_platform_i2c *pdata; |
| @@ -988,25 +987,16 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) | |||
| 988 | goto err_clk; | 987 | goto err_clk; |
| 989 | } | 988 | } |
| 990 | 989 | ||
| 991 | i2c->ioarea = request_mem_region(res->start, resource_size(res), | 990 | i2c->regs = devm_request_and_ioremap(&pdev->dev, res); |
| 992 | pdev->name); | ||
| 993 | |||
| 994 | if (i2c->ioarea == NULL) { | ||
| 995 | dev_err(&pdev->dev, "cannot request IO\n"); | ||
| 996 | ret = -ENXIO; | ||
| 997 | goto err_clk; | ||
| 998 | } | ||
| 999 | |||
| 1000 | i2c->regs = ioremap(res->start, resource_size(res)); | ||
| 1001 | 991 | ||
| 1002 | if (i2c->regs == NULL) { | 992 | if (i2c->regs == NULL) { |
| 1003 | dev_err(&pdev->dev, "cannot map IO\n"); | 993 | dev_err(&pdev->dev, "cannot map IO\n"); |
| 1004 | ret = -ENXIO; | 994 | ret = -ENXIO; |
| 1005 | goto err_ioarea; | 995 | goto err_clk; |
| 1006 | } | 996 | } |
| 1007 | 997 | ||
| 1008 | dev_dbg(&pdev->dev, "registers %p (%p, %p)\n", | 998 | dev_dbg(&pdev->dev, "registers %p (%p)\n", |
| 1009 | i2c->regs, i2c->ioarea, res); | 999 | i2c->regs, res); |
| 1010 | 1000 | ||
| 1011 | /* setup info block for the i2c core */ | 1001 | /* setup info block for the i2c core */ |
| 1012 | 1002 | ||
| @@ -1017,7 +1007,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) | |||
| 1017 | 1007 | ||
| 1018 | ret = s3c24xx_i2c_init(i2c); | 1008 | ret = s3c24xx_i2c_init(i2c); |
| 1019 | if (ret != 0) | 1009 | if (ret != 0) |
| 1020 | goto err_iomap; | 1010 | goto err_clk; |
| 1021 | 1011 | ||
| 1022 | /* find the IRQ for this unit (note, this relies on the init call to | 1012 | /* find the IRQ for this unit (note, this relies on the init call to |
| 1023 | * ensure no current IRQs pending | 1013 | * ensure no current IRQs pending |
| @@ -1026,7 +1016,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) | |||
| 1026 | i2c->irq = ret = platform_get_irq(pdev, 0); | 1016 | i2c->irq = ret = platform_get_irq(pdev, 0); |
| 1027 | if (ret <= 0) { | 1017 | if (ret <= 0) { |
| 1028 | dev_err(&pdev->dev, "cannot find IRQ\n"); | 1018 | dev_err(&pdev->dev, "cannot find IRQ\n"); |
| 1029 | goto err_iomap; | 1019 | goto err_clk; |
| 1030 | } | 1020 | } |
| 1031 | 1021 | ||
| 1032 | ret = request_irq(i2c->irq, s3c24xx_i2c_irq, 0, | 1022 | ret = request_irq(i2c->irq, s3c24xx_i2c_irq, 0, |
| @@ -1034,7 +1024,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) | |||
| 1034 | 1024 | ||
| 1035 | if (ret != 0) { | 1025 | if (ret != 0) { |
| 1036 | dev_err(&pdev->dev, "cannot claim IRQ %d\n", i2c->irq); | 1026 | dev_err(&pdev->dev, "cannot claim IRQ %d\n", i2c->irq); |
| 1037 | goto err_iomap; | 1027 | goto err_clk; |
| 1038 | } | 1028 | } |
| 1039 | 1029 | ||
| 1040 | ret = s3c24xx_i2c_register_cpufreq(i2c); | 1030 | ret = s3c24xx_i2c_register_cpufreq(i2c); |
| @@ -1074,13 +1064,6 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) | |||
| 1074 | err_irq: | 1064 | err_irq: |
| 1075 | free_irq(i2c->irq, i2c); | 1065 | free_irq(i2c->irq, i2c); |
| 1076 | 1066 | ||
| 1077 | err_iomap: | ||
| 1078 | iounmap(i2c->regs); | ||
| 1079 | |||
| 1080 | err_ioarea: | ||
| 1081 | release_resource(i2c->ioarea); | ||
| 1082 | kfree(i2c->ioarea); | ||
| 1083 | |||
| 1084 | err_clk: | 1067 | err_clk: |
| 1085 | clk_disable_unprepare(i2c->clk); | 1068 | clk_disable_unprepare(i2c->clk); |
| 1086 | clk_put(i2c->clk); | 1069 | clk_put(i2c->clk); |
| @@ -1109,11 +1092,7 @@ static int s3c24xx_i2c_remove(struct platform_device *pdev) | |||
| 1109 | clk_disable_unprepare(i2c->clk); | 1092 | clk_disable_unprepare(i2c->clk); |
| 1110 | clk_put(i2c->clk); | 1093 | clk_put(i2c->clk); |
| 1111 | 1094 | ||
| 1112 | iounmap(i2c->regs); | ||
| 1113 | |||
| 1114 | release_resource(i2c->ioarea); | ||
| 1115 | s3c24xx_i2c_dt_gpio_free(i2c); | 1095 | s3c24xx_i2c_dt_gpio_free(i2c); |
| 1116 | kfree(i2c->ioarea); | ||
| 1117 | 1096 | ||
| 1118 | return 0; | 1097 | return 0; |
| 1119 | } | 1098 | } |
