]> Pileus Git - ~andy/linux/blobdiff - drivers/regulator/wm831x-ldo.c
wl12xx: don't release/claim sdio on suspend/resume
[~andy/linux] / drivers / regulator / wm831x-ldo.c
index 6709710a059e6e78c2267c376903b04ea26820fa..f1e4ab0f9fda8e02d6857c705f8fc1032fc7f23b 100644 (file)
@@ -326,7 +326,7 @@ static __devinit int wm831x_gp_ldo_probe(struct platform_device *pdev)
        if (pdata == NULL || pdata->ldo[id] == NULL)
                return -ENODEV;
 
-       ldo = kzalloc(sizeof(struct wm831x_ldo), GFP_KERNEL);
+       ldo = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_ldo), GFP_KERNEL);
        if (ldo == NULL) {
                dev_err(&pdev->dev, "Unable to allocate private data\n");
                return -ENOMEM;
@@ -351,7 +351,7 @@ static __devinit int wm831x_gp_ldo_probe(struct platform_device *pdev)
        ldo->desc.owner = THIS_MODULE;
 
        ldo->regulator = regulator_register(&ldo->desc, &pdev->dev,
-                                            pdata->ldo[id], ldo);
+                                            pdata->ldo[id], ldo, NULL);
        if (IS_ERR(ldo->regulator)) {
                ret = PTR_ERR(ldo->regulator);
                dev_err(wm831x->dev, "Failed to register LDO%d: %d\n",
@@ -376,7 +376,6 @@ static __devinit int wm831x_gp_ldo_probe(struct platform_device *pdev)
 err_regulator:
        regulator_unregister(ldo->regulator);
 err:
-       kfree(ldo);
        return ret;
 }
 
@@ -388,7 +387,6 @@ static __devexit int wm831x_gp_ldo_remove(struct platform_device *pdev)
 
        free_irq(platform_get_irq_byname(pdev, "UV"), ldo);
        regulator_unregister(ldo->regulator);
-       kfree(ldo);
 
        return 0;
 }
@@ -596,7 +594,7 @@ static __devinit int wm831x_aldo_probe(struct platform_device *pdev)
        if (pdata == NULL || pdata->ldo[id] == NULL)
                return -ENODEV;
 
-       ldo = kzalloc(sizeof(struct wm831x_ldo), GFP_KERNEL);
+       ldo = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_ldo), GFP_KERNEL);
        if (ldo == NULL) {
                dev_err(&pdev->dev, "Unable to allocate private data\n");
                return -ENOMEM;
@@ -621,7 +619,7 @@ static __devinit int wm831x_aldo_probe(struct platform_device *pdev)
        ldo->desc.owner = THIS_MODULE;
 
        ldo->regulator = regulator_register(&ldo->desc, &pdev->dev,
-                                            pdata->ldo[id], ldo);
+                                            pdata->ldo[id], ldo, NULL);
        if (IS_ERR(ldo->regulator)) {
                ret = PTR_ERR(ldo->regulator);
                dev_err(wm831x->dev, "Failed to register LDO%d: %d\n",
@@ -645,7 +643,6 @@ static __devinit int wm831x_aldo_probe(struct platform_device *pdev)
 err_regulator:
        regulator_unregister(ldo->regulator);
 err:
-       kfree(ldo);
        return ret;
 }
 
@@ -655,7 +652,6 @@ static __devexit int wm831x_aldo_remove(struct platform_device *pdev)
 
        free_irq(platform_get_irq_byname(pdev, "UV"), ldo);
        regulator_unregister(ldo->regulator);
-       kfree(ldo);
 
        return 0;
 }
@@ -793,7 +789,7 @@ static __devinit int wm831x_alive_ldo_probe(struct platform_device *pdev)
        if (pdata == NULL || pdata->ldo[id] == NULL)
                return -ENODEV;
 
-       ldo = kzalloc(sizeof(struct wm831x_ldo), GFP_KERNEL);
+       ldo = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_ldo), GFP_KERNEL);
        if (ldo == NULL) {
                dev_err(&pdev->dev, "Unable to allocate private data\n");
                return -ENOMEM;
@@ -818,7 +814,7 @@ static __devinit int wm831x_alive_ldo_probe(struct platform_device *pdev)
        ldo->desc.owner = THIS_MODULE;
 
        ldo->regulator = regulator_register(&ldo->desc, &pdev->dev,
-                                            pdata->ldo[id], ldo);
+                                            pdata->ldo[id], ldo, NULL);
        if (IS_ERR(ldo->regulator)) {
                ret = PTR_ERR(ldo->regulator);
                dev_err(wm831x->dev, "Failed to register LDO%d: %d\n",
@@ -831,7 +827,6 @@ static __devinit int wm831x_alive_ldo_probe(struct platform_device *pdev)
        return 0;
 
 err:
-       kfree(ldo);
        return ret;
 }
 
@@ -840,7 +835,6 @@ static __devexit int wm831x_alive_ldo_remove(struct platform_device *pdev)
        struct wm831x_ldo *ldo = platform_get_drvdata(pdev);
 
        regulator_unregister(ldo->regulator);
-       kfree(ldo);
 
        return 0;
 }