Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fded2f4f authored by Mark Brown's avatar Mark Brown
Browse files

regulator: Convert wm831x regulator drivers to devm_kzalloc()

parent 6242eae9
Loading
Loading
Loading
Loading
+4 −6
Original line number Original line Diff line number Diff line
@@ -511,7 +511,8 @@ static __devinit int wm831x_buckv_probe(struct platform_device *pdev)
	if (pdata == NULL || pdata->dcdc[id] == NULL)
	if (pdata == NULL || pdata->dcdc[id] == NULL)
		return -ENODEV;
		return -ENODEV;


	dcdc = kzalloc(sizeof(struct wm831x_dcdc), GFP_KERNEL);
	dcdc = devm_kzalloc(&pdev->dev,  sizeof(struct wm831x_dcdc),
			    GFP_KERNEL);
	if (dcdc == NULL) {
	if (dcdc == NULL) {
		dev_err(&pdev->dev, "Unable to allocate private data\n");
		dev_err(&pdev->dev, "Unable to allocate private data\n");
		return -ENOMEM;
		return -ENOMEM;
@@ -590,7 +591,6 @@ static __devinit int wm831x_buckv_probe(struct platform_device *pdev)
err:
err:
	if (dcdc->dvs_gpio)
	if (dcdc->dvs_gpio)
		gpio_free(dcdc->dvs_gpio);
		gpio_free(dcdc->dvs_gpio);
	kfree(dcdc);
	return ret;
	return ret;
}
}


@@ -605,7 +605,6 @@ static __devexit int wm831x_buckv_remove(struct platform_device *pdev)
	regulator_unregister(dcdc->regulator);
	regulator_unregister(dcdc->regulator);
	if (dcdc->dvs_gpio)
	if (dcdc->dvs_gpio)
		gpio_free(dcdc->dvs_gpio);
		gpio_free(dcdc->dvs_gpio);
	kfree(dcdc);


	return 0;
	return 0;
}
}
@@ -722,7 +721,8 @@ static __devinit int wm831x_buckp_probe(struct platform_device *pdev)
	if (pdata == NULL || pdata->dcdc[id] == NULL)
	if (pdata == NULL || pdata->dcdc[id] == NULL)
		return -ENODEV;
		return -ENODEV;


	dcdc = kzalloc(sizeof(struct wm831x_dcdc), GFP_KERNEL);
	dcdc = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_dcdc),
			    GFP_KERNEL);
	if (dcdc == NULL) {
	if (dcdc == NULL) {
		dev_err(&pdev->dev, "Unable to allocate private data\n");
		dev_err(&pdev->dev, "Unable to allocate private data\n");
		return -ENOMEM;
		return -ENOMEM;
@@ -771,7 +771,6 @@ static __devinit int wm831x_buckp_probe(struct platform_device *pdev)
err_regulator:
err_regulator:
	regulator_unregister(dcdc->regulator);
	regulator_unregister(dcdc->regulator);
err:
err:
	kfree(dcdc);
	return ret;
	return ret;
}
}


@@ -783,7 +782,6 @@ static __devexit int wm831x_buckp_remove(struct platform_device *pdev)


	free_irq(platform_get_irq_byname(pdev, "UV"), dcdc);
	free_irq(platform_get_irq_byname(pdev, "UV"), dcdc);
	regulator_unregister(dcdc->regulator);
	regulator_unregister(dcdc->regulator);
	kfree(dcdc);


	return 0;
	return 0;
}
}
+2 −3
Original line number Original line Diff line number Diff line
@@ -162,7 +162,8 @@ static __devinit int wm831x_isink_probe(struct platform_device *pdev)
	if (pdata == NULL || pdata->isink[id] == NULL)
	if (pdata == NULL || pdata->isink[id] == NULL)
		return -ENODEV;
		return -ENODEV;


	isink = kzalloc(sizeof(struct wm831x_isink), GFP_KERNEL);
	isink = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_isink),
			     GFP_KERNEL);
	if (isink == NULL) {
	if (isink == NULL) {
		dev_err(&pdev->dev, "Unable to allocate private data\n");
		dev_err(&pdev->dev, "Unable to allocate private data\n");
		return -ENOMEM;
		return -ENOMEM;
@@ -213,7 +214,6 @@ static __devinit int wm831x_isink_probe(struct platform_device *pdev)
err_regulator:
err_regulator:
	regulator_unregister(isink->regulator);
	regulator_unregister(isink->regulator);
err:
err:
	kfree(isink);
	return ret;
	return ret;
}
}


@@ -226,7 +226,6 @@ static __devexit int wm831x_isink_remove(struct platform_device *pdev)
	free_irq(platform_get_irq(pdev, 0), isink);
	free_irq(platform_get_irq(pdev, 0), isink);


	regulator_unregister(isink->regulator);
	regulator_unregister(isink->regulator);
	kfree(isink);


	return 0;
	return 0;
}
}
+3 −9
Original line number Original line Diff line number Diff line
@@ -326,7 +326,7 @@ static __devinit int wm831x_gp_ldo_probe(struct platform_device *pdev)
	if (pdata == NULL || pdata->ldo[id] == NULL)
	if (pdata == NULL || pdata->ldo[id] == NULL)
		return -ENODEV;
		return -ENODEV;


	ldo = kzalloc(sizeof(struct wm831x_ldo), GFP_KERNEL);
	ldo = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_ldo), GFP_KERNEL);
	if (ldo == NULL) {
	if (ldo == NULL) {
		dev_err(&pdev->dev, "Unable to allocate private data\n");
		dev_err(&pdev->dev, "Unable to allocate private data\n");
		return -ENOMEM;
		return -ENOMEM;
@@ -376,7 +376,6 @@ static __devinit int wm831x_gp_ldo_probe(struct platform_device *pdev)
err_regulator:
err_regulator:
	regulator_unregister(ldo->regulator);
	regulator_unregister(ldo->regulator);
err:
err:
	kfree(ldo);
	return ret;
	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);
	free_irq(platform_get_irq_byname(pdev, "UV"), ldo);
	regulator_unregister(ldo->regulator);
	regulator_unregister(ldo->regulator);
	kfree(ldo);


	return 0;
	return 0;
}
}
@@ -596,7 +594,7 @@ static __devinit int wm831x_aldo_probe(struct platform_device *pdev)
	if (pdata == NULL || pdata->ldo[id] == NULL)
	if (pdata == NULL || pdata->ldo[id] == NULL)
		return -ENODEV;
		return -ENODEV;


	ldo = kzalloc(sizeof(struct wm831x_ldo), GFP_KERNEL);
	ldo = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_ldo), GFP_KERNEL);
	if (ldo == NULL) {
	if (ldo == NULL) {
		dev_err(&pdev->dev, "Unable to allocate private data\n");
		dev_err(&pdev->dev, "Unable to allocate private data\n");
		return -ENOMEM;
		return -ENOMEM;
@@ -645,7 +643,6 @@ static __devinit int wm831x_aldo_probe(struct platform_device *pdev)
err_regulator:
err_regulator:
	regulator_unregister(ldo->regulator);
	regulator_unregister(ldo->regulator);
err:
err:
	kfree(ldo);
	return ret;
	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);
	free_irq(platform_get_irq_byname(pdev, "UV"), ldo);
	regulator_unregister(ldo->regulator);
	regulator_unregister(ldo->regulator);
	kfree(ldo);


	return 0;
	return 0;
}
}
@@ -793,7 +789,7 @@ static __devinit int wm831x_alive_ldo_probe(struct platform_device *pdev)
	if (pdata == NULL || pdata->ldo[id] == NULL)
	if (pdata == NULL || pdata->ldo[id] == NULL)
		return -ENODEV;
		return -ENODEV;


	ldo = kzalloc(sizeof(struct wm831x_ldo), GFP_KERNEL);
	ldo = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_ldo), GFP_KERNEL);
	if (ldo == NULL) {
	if (ldo == NULL) {
		dev_err(&pdev->dev, "Unable to allocate private data\n");
		dev_err(&pdev->dev, "Unable to allocate private data\n");
		return -ENOMEM;
		return -ENOMEM;
@@ -831,7 +827,6 @@ static __devinit int wm831x_alive_ldo_probe(struct platform_device *pdev)
	return 0;
	return 0;


err:
err:
	kfree(ldo);
	return ret;
	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);
	struct wm831x_ldo *ldo = platform_get_drvdata(pdev);


	regulator_unregister(ldo->regulator);
	regulator_unregister(ldo->regulator);
	kfree(ldo);


	return 0;
	return 0;
}
}