aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJohan Hovold <jhovold@gmail.com>2012-05-15 13:24:53 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2012-05-20 11:27:08 -0400
commitfa648e51f84d060ef991eeee4d7bacec45d7fbfd (patch)
tree4e36211ddf91e03047eca30e9b37d508026441c6 /drivers
parent16e5e204c92800aad4e7db52d289565cc82240ce (diff)
mfd: Convert lm3533 to use devres
Use devres to manage core driver data and regmap. Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mfd/lm3533-core.c22
1 files changed, 5 insertions, 17 deletions
diff --git a/drivers/mfd/lm3533-core.c b/drivers/mfd/lm3533-core.c
index 1627472ecc0..09019c65da1 100644
--- a/drivers/mfd/lm3533-core.c
+++ b/drivers/mfd/lm3533-core.c
@@ -603,33 +603,24 @@ static int __devinit lm3533_i2c_probe(struct i2c_client *i2c,
603 603
604 dev_dbg(&i2c->dev, "%s\n", __func__); 604 dev_dbg(&i2c->dev, "%s\n", __func__);
605 605
606 lm3533 = kzalloc(sizeof(*lm3533), GFP_KERNEL); 606 lm3533 = devm_kzalloc(&i2c->dev, sizeof(*lm3533), GFP_KERNEL);
607 if (!lm3533) 607 if (!lm3533)
608 return -ENOMEM; 608 return -ENOMEM;
609 609
610 i2c_set_clientdata(i2c, lm3533); 610 i2c_set_clientdata(i2c, lm3533);
611 611
612 lm3533->regmap = regmap_init_i2c(i2c, &regmap_config); 612 lm3533->regmap = devm_regmap_init_i2c(i2c, &regmap_config);
613 if (IS_ERR(lm3533->regmap)) { 613 if (IS_ERR(lm3533->regmap))
614 ret = PTR_ERR(lm3533->regmap); 614 return PTR_ERR(lm3533->regmap);
615 goto err_regmap;
616 }
617 615
618 lm3533->dev = &i2c->dev; 616 lm3533->dev = &i2c->dev;
619 lm3533->irq = i2c->irq; 617 lm3533->irq = i2c->irq;
620 618
621 ret = lm3533_device_init(lm3533); 619 ret = lm3533_device_init(lm3533);
622 if (ret) 620 if (ret)
623 goto err_dev; 621 return ret;
624 622
625 return 0; 623 return 0;
626
627err_dev:
628 regmap_exit(lm3533->regmap);
629err_regmap:
630 kfree(lm3533);
631
632 return ret;
633} 624}
634 625
635static int __devexit lm3533_i2c_remove(struct i2c_client *i2c) 626static int __devexit lm3533_i2c_remove(struct i2c_client *i2c)
@@ -639,9 +630,6 @@ static int __devexit lm3533_i2c_remove(struct i2c_client *i2c)
639 dev_dbg(&i2c->dev, "%s\n", __func__); 630 dev_dbg(&i2c->dev, "%s\n", __func__);
640 631
641 lm3533_device_exit(lm3533); 632 lm3533_device_exit(lm3533);
642 regmap_exit(lm3533->regmap);
643
644 kfree(lm3533);
645 633
646 return 0; 634 return 0;
647} 635}