aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@ti.com>2011-09-15 08:39:23 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-09-19 18:15:29 -0400
commit2d7c957e2ec0aebdd595a32b884a51270d34d28d (patch)
treec493eadd20a7bbc37740eb49d1f100612cf44198 /drivers/mfd
parent76067540c642b1a14679ab74bd027a074c23e63b (diff)
MFD: twl6040: Remove global pointer for platform_device
There is no need to keep global pointer for the platform device, since it is only used for dev_* prints, and the device pointer available within the twl6040 structure. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Acked-by: Samuel Ortiz <sameo@linux.intel.com> Acked-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/twl6040-core.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/drivers/mfd/twl6040-core.c b/drivers/mfd/twl6040-core.c
index 24d436c2fe4a..b0519e663be9 100644
--- a/drivers/mfd/twl6040-core.c
+++ b/drivers/mfd/twl6040-core.c
@@ -34,8 +34,6 @@
34#include <linux/mfd/core.h> 34#include <linux/mfd/core.h>
35#include <linux/mfd/twl6040.h> 35#include <linux/mfd/twl6040.h>
36 36
37static struct platform_device *twl6040_dev;
38
39int twl6040_reg_read(struct twl6040 *twl6040, unsigned int reg) 37int twl6040_reg_read(struct twl6040 *twl6040, unsigned int reg)
40{ 38{
41 int ret; 39 int ret;
@@ -203,11 +201,11 @@ static irqreturn_t twl6040_naudint_handler(int irq, void *data)
203 if (intid & TWL6040_THINT) { 201 if (intid & TWL6040_THINT) {
204 status = twl6040_reg_read(twl6040, TWL6040_REG_STATUS); 202 status = twl6040_reg_read(twl6040, TWL6040_REG_STATUS);
205 if (status & TWL6040_TSHUTDET) { 203 if (status & TWL6040_TSHUTDET) {
206 dev_warn(&twl6040_dev->dev, 204 dev_warn(twl6040->dev,
207 "Thermal shutdown, powering-off"); 205 "Thermal shutdown, powering-off");
208 twl6040_power(twl6040, 0); 206 twl6040_power(twl6040, 0);
209 } else { 207 } else {
210 dev_warn(&twl6040_dev->dev, 208 dev_warn(twl6040->dev,
211 "Leaving thermal shutdown, powering-on"); 209 "Leaving thermal shutdown, powering-on");
212 twl6040_power(twl6040, 1); 210 twl6040_power(twl6040, 1);
213 } 211 }
@@ -227,7 +225,7 @@ static int twl6040_power_up_completion(struct twl6040 *twl6040,
227 if (!time_left) { 225 if (!time_left) {
228 intid = twl6040_reg_read(twl6040, TWL6040_REG_INTID); 226 intid = twl6040_reg_read(twl6040, TWL6040_REG_INTID);
229 if (!(intid & TWL6040_READYINT)) { 227 if (!(intid & TWL6040_READYINT)) {
230 dev_err(&twl6040_dev->dev, 228 dev_err(twl6040->dev,
231 "timeout waiting for READYINT\n"); 229 "timeout waiting for READYINT\n");
232 return -ETIMEDOUT; 230 return -ETIMEDOUT;
233 } 231 }
@@ -255,7 +253,7 @@ int twl6040_power(struct twl6040 *twl6040, int on)
255 /* wait for power-up completion */ 253 /* wait for power-up completion */
256 ret = twl6040_power_up_completion(twl6040, naudint); 254 ret = twl6040_power_up_completion(twl6040, naudint);
257 if (ret) { 255 if (ret) {
258 dev_err(&twl6040_dev->dev, 256 dev_err(twl6040->dev,
259 "automatic power-down failed\n"); 257 "automatic power-down failed\n");
260 twl6040->power_count = 0; 258 twl6040->power_count = 0;
261 goto out; 259 goto out;
@@ -264,7 +262,7 @@ int twl6040_power(struct twl6040 *twl6040, int on)
264 /* use manual power-up sequence */ 262 /* use manual power-up sequence */
265 ret = twl6040_power_up(twl6040); 263 ret = twl6040_power_up(twl6040);
266 if (ret) { 264 if (ret) {
267 dev_err(&twl6040_dev->dev, 265 dev_err(twl6040->dev,
268 "manual power-up failed\n"); 266 "manual power-up failed\n");
269 twl6040->power_count = 0; 267 twl6040->power_count = 0;
270 goto out; 268 goto out;
@@ -276,7 +274,7 @@ int twl6040_power(struct twl6040 *twl6040, int on)
276 } else { 274 } else {
277 /* already powered-down */ 275 /* already powered-down */
278 if (!twl6040->power_count) { 276 if (!twl6040->power_count) {
279 dev_err(&twl6040_dev->dev, 277 dev_err(twl6040->dev,
280 "device is already powered-off\n"); 278 "device is already powered-off\n");
281 ret = -EPERM; 279 ret = -EPERM;
282 goto out; 280 goto out;
@@ -326,7 +324,7 @@ int twl6040_set_pll(struct twl6040 *twl6040, int pll_id,
326 lppllctl &= ~TWL6040_LPLLFIN; 324 lppllctl &= ~TWL6040_LPLLFIN;
327 break; 325 break;
328 default: 326 default:
329 dev_err(&twl6040_dev->dev, 327 dev_err(twl6040->dev,
330 "freq_out %d not supported\n", freq_out); 328 "freq_out %d not supported\n", freq_out);
331 ret = -EINVAL; 329 ret = -EINVAL;
332 goto pll_out; 330 goto pll_out;
@@ -347,7 +345,7 @@ int twl6040_set_pll(struct twl6040 *twl6040, int pll_id,
347 hppllctl); 345 hppllctl);
348 break; 346 break;
349 default: 347 default:
350 dev_err(&twl6040_dev->dev, 348 dev_err(twl6040->dev,
351 "freq_in %d not supported\n", freq_in); 349 "freq_in %d not supported\n", freq_in);
352 ret = -EINVAL; 350 ret = -EINVAL;
353 goto pll_out; 351 goto pll_out;
@@ -356,7 +354,7 @@ int twl6040_set_pll(struct twl6040 *twl6040, int pll_id,
356 case TWL6040_SYSCLK_SEL_HPPLL: 354 case TWL6040_SYSCLK_SEL_HPPLL:
357 /* high-performance PLL can provide only 19.2 MHz */ 355 /* high-performance PLL can provide only 19.2 MHz */
358 if (freq_out != 19200000) { 356 if (freq_out != 19200000) {
359 dev_err(&twl6040_dev->dev, 357 dev_err(twl6040->dev,
360 "freq_out %d not supported\n", freq_out); 358 "freq_out %d not supported\n", freq_out);
361 ret = -EINVAL; 359 ret = -EINVAL;
362 goto pll_out; 360 goto pll_out;
@@ -389,7 +387,7 @@ int twl6040_set_pll(struct twl6040 *twl6040, int pll_id,
389 TWL6040_HPLLENA; 387 TWL6040_HPLLENA;
390 break; 388 break;
391 default: 389 default:
392 dev_err(&twl6040_dev->dev, 390 dev_err(twl6040->dev,
393 "freq_in %d not supported\n", freq_in); 391 "freq_in %d not supported\n", freq_in);
394 ret = -EINVAL; 392 ret = -EINVAL;
395 goto pll_out; 393 goto pll_out;
@@ -406,7 +404,7 @@ int twl6040_set_pll(struct twl6040 *twl6040, int pll_id,
406 twl6040_reg_write(twl6040, TWL6040_REG_LPPLLCTL, lppllctl); 404 twl6040_reg_write(twl6040, TWL6040_REG_LPPLLCTL, lppllctl);
407 break; 405 break;
408 default: 406 default:
409 dev_err(&twl6040_dev->dev, "unknown pll id %d\n", pll_id); 407 dev_err(twl6040->dev, "unknown pll id %d\n", pll_id);
410 ret = -EINVAL; 408 ret = -EINVAL;
411 goto pll_out; 409 goto pll_out;
412 } 410 }
@@ -471,7 +469,6 @@ static int __devinit twl6040_probe(struct platform_device *pdev)
471 469
472 platform_set_drvdata(pdev, twl6040); 470 platform_set_drvdata(pdev, twl6040);
473 471
474 twl6040_dev = pdev;
475 twl6040->dev = &pdev->dev; 472 twl6040->dev = &pdev->dev;
476 twl6040->audpwron = pdata->audpwron_gpio; 473 twl6040->audpwron = pdata->audpwron_gpio;
477 twl6040->irq = pdata->naudint_irq; 474 twl6040->irq = pdata->naudint_irq;
@@ -566,7 +563,6 @@ gpio2_err:
566gpio1_err: 563gpio1_err:
567 platform_set_drvdata(pdev, NULL); 564 platform_set_drvdata(pdev, NULL);
568 kfree(twl6040); 565 kfree(twl6040);
569 twl6040_dev = NULL;
570 return ret; 566 return ret;
571} 567}
572 568
@@ -586,7 +582,6 @@ static int __devexit twl6040_remove(struct platform_device *pdev)
586 mfd_remove_devices(&pdev->dev); 582 mfd_remove_devices(&pdev->dev);
587 platform_set_drvdata(pdev, NULL); 583 platform_set_drvdata(pdev, NULL);
588 kfree(twl6040); 584 kfree(twl6040);
589 twl6040_dev = NULL;
590 585
591 return 0; 586 return 0;
592} 587}