aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mfd/ti_am335x_tscadc.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
index e947dd8bbcc3..8ca3bf023fb2 100644
--- a/drivers/mfd/ti_am335x_tscadc.c
+++ b/drivers/mfd/ti_am335x_tscadc.c
@@ -65,7 +65,6 @@ static int __devinit ti_tscadc_probe(struct platform_device *pdev)
65 struct clk *clk; 65 struct clk *clk;
66 struct mfd_tscadc_board *pdata = pdev->dev.platform_data; 66 struct mfd_tscadc_board *pdata = pdev->dev.platform_data;
67 struct mfd_cell *cell; 67 struct mfd_cell *cell;
68 int irq;
69 int err, ctrl; 68 int err, ctrl;
70 int clk_value, clock_rate; 69 int clk_value, clock_rate;
71 int tsc_wires, adc_channels = 0, total_channels; 70 int tsc_wires, adc_channels = 0, total_channels;
@@ -92,12 +91,6 @@ static int __devinit ti_tscadc_probe(struct platform_device *pdev)
92 return -EINVAL; 91 return -EINVAL;
93 } 92 }
94 93
95 irq = platform_get_irq(pdev, 0);
96 if (irq < 0) {
97 dev_err(&pdev->dev, "no irq ID is specified.\n");
98 return -EINVAL;
99 }
100
101 /* Allocate memory for device */ 94 /* Allocate memory for device */
102 tscadc = devm_kzalloc(&pdev->dev, 95 tscadc = devm_kzalloc(&pdev->dev,
103 sizeof(struct ti_tscadc_dev), GFP_KERNEL); 96 sizeof(struct ti_tscadc_dev), GFP_KERNEL);
@@ -106,22 +99,26 @@ static int __devinit ti_tscadc_probe(struct platform_device *pdev)
106 return -ENOMEM; 99 return -ENOMEM;
107 } 100 }
108 tscadc->dev = &pdev->dev; 101 tscadc->dev = &pdev->dev;
109 tscadc->irq = irq; 102
103 err = platform_get_irq(pdev, 0);
104 if (err < 0) {
105 dev_err(&pdev->dev, "no irq ID is specified.\n");
106 goto ret;
107 } else
108 tscadc->irq = err;
110 109
111 res = devm_request_mem_region(&pdev->dev, 110 res = devm_request_mem_region(&pdev->dev,
112 res->start, resource_size(res), pdev->name); 111 res->start, resource_size(res), pdev->name);
113 if (!res) { 112 if (!res) {
114 dev_err(&pdev->dev, "failed to reserve registers.\n"); 113 dev_err(&pdev->dev, "failed to reserve registers.\n");
115 err = -EBUSY; 114 return -EBUSY;
116 goto err;
117 } 115 }
118 116
119 tscadc->tscadc_base = devm_ioremap(&pdev->dev, 117 tscadc->tscadc_base = devm_ioremap(&pdev->dev,
120 res->start, resource_size(res)); 118 res->start, resource_size(res));
121 if (!tscadc->tscadc_base) { 119 if (!tscadc->tscadc_base) {
122 dev_err(&pdev->dev, "failed to map registers.\n"); 120 dev_err(&pdev->dev, "failed to map registers.\n");
123 err = -ENOMEM; 121 return -ENOMEM;
124 goto err;
125 } 122 }
126 123
127 tscadc->regmap_tscadc = devm_regmap_init_mmio(&pdev->dev, 124 tscadc->regmap_tscadc = devm_regmap_init_mmio(&pdev->dev,
@@ -129,7 +126,7 @@ static int __devinit ti_tscadc_probe(struct platform_device *pdev)
129 if (IS_ERR(tscadc->regmap_tscadc)) { 126 if (IS_ERR(tscadc->regmap_tscadc)) {
130 dev_err(&pdev->dev, "regmap init failed\n"); 127 dev_err(&pdev->dev, "regmap init failed\n");
131 err = PTR_ERR(tscadc->regmap_tscadc); 128 err = PTR_ERR(tscadc->regmap_tscadc);
132 goto err; 129 goto ret;
133 } 130 }
134 131
135 pm_runtime_enable(&pdev->dev); 132 pm_runtime_enable(&pdev->dev);
@@ -201,7 +198,7 @@ static int __devinit ti_tscadc_probe(struct platform_device *pdev)
201err_disable_clk: 198err_disable_clk:
202 pm_runtime_put_sync(&pdev->dev); 199 pm_runtime_put_sync(&pdev->dev);
203 pm_runtime_disable(&pdev->dev); 200 pm_runtime_disable(&pdev->dev);
204err: 201ret:
205 return err; 202 return err;
206} 203}
207 204