[PATCH v10] Regulator: Add Anatop regulator driver

Axel Lin axel.lin at gmail.com
Thu Mar 8 21:59:56 EST 2012


> +       if (anatop_reg->control_reg) {
> +               sel = (uv - anatop_reg->min_voltage) / 25000;

sel = DIV_ROUND_UP(uv - anatop_reg->min_voltage, 25000);

Use DIV_ROUND_UP to avoid the possible truncate of integer division.
This ensures the selected volatge falls within the specified range.


> +static int __devexit anatop_regulator_remove(struct platform_device *pdev)
> +{
> +       struct regulator_dev *rdev = platform_get_drvdata(pdev);
> +       struct anatop_regulator *sreg = rdev_get_drvdata(rdev);
> +       kfree(sreg->name);
> +       regulator_unregister(rdev);
Do regulator_unregister before kfree sreg->name.



More information about the linux-arm-kernel mailing list