]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
mfd: Free tps6586x allocated resources when unload the module
authorAxel Lin <axel.lin@gmail.com>
Tue, 24 Aug 2010 07:18:58 +0000 (15:18 +0800)
committerSamuel Ortiz <sameo@linux.intel.com>
Thu, 28 Oct 2010 22:28:53 +0000 (00:28 +0200)
For the resources allocated in tps6586x_i2c_probe(),
we need to free it in tps6586x_i2c_remove().

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
drivers/mfd/tps6586x.c

index 4cde31e6a2521863b434260e5651f340f4bfec58..bc6587194de9aeef7273d9a62e95eb5d55a123f7 100644 (file)
@@ -338,6 +338,19 @@ err_add_devs:
 
 static int __devexit tps6586x_i2c_remove(struct i2c_client *client)
 {
+       struct tps6586x *tps6586x = i2c_get_clientdata(client);
+       struct tps6586x_platform_data *pdata = client->dev.platform_data;
+       int ret;
+
+       if (pdata->gpio_base) {
+               ret = gpiochip_remove(&tps6586x->gpio);
+               if (ret)
+                       dev_err(&client->dev, "Can't remove gpio chip: %d\n",
+                               ret);
+       }
+
+       tps6586x_remove_subdevs(tps6586x);
+       kfree(tps6586x);
        return 0;
 }