Re: [PATCH v3 6/6] regulator: bd71837: BD71837 PMIC regulator driver

From: Andy Shevchenko
Date: Tue Jun 05 2018 - 09:58:50 EST


On Tue, May 29, 2018 at 1:02 PM, Matti Vaittinen
<matti.vaittinen@xxxxxxxxxxxxxxxxx> wrote:
> Support for controlling the 8 bucks and 7 LDOs the PMIC contains.

> +#include <linux/kernel.h>

> +#include <linux/module.h>
> +#include <linux/init.h>

One of these is redundant.

> +#include <linux/err.h>
> +#include <linux/interrupt.h>
> +#include <linux/platform_device.h>
> +#include <linux/regulator/driver.h>
> +#include <linux/regulator/machine.h>
> +#include <linux/delay.h>
> +#include <linux/slab.h>
> +#include <linux/gpio.h>
> +#include <linux/mfd/bd71837.h>
> +#include <linux/regulator/of_regulator.h>

Can you keep the list ordered?

> + dev_dbg(&(pmic->pdev->dev), "Buck[%d] Set Ramp = %d\n", id + 1,
> + ramp_delay);

Redundant parens.

> +static int bd71837_regulator_set_regmap(struct regulator_dev *rdev, int set)
> +{

> + int ret = -EINVAL;

Redundant assignment.

> + if (!set)
> + ret = regulator_disable_regmap(rdev);
> + else
> + ret = regulator_enable_regmap(rdev);

> + return ret;
> +}

> +static int bd71837_probe(struct platform_device *pdev)
> +{

> + pmic = devm_kzalloc(&pdev->dev, sizeof(struct bd71837_pmic),
> + GFP_KERNEL);

sizeof(*pmic) and one line as result?

> + if (!pmic)
> + return -ENOMEM;

> + if (!pmic->mfd) {
> + dev_err(&pdev->dev, "No MFD driver data\n");

> + err = -EINVAL;
> + goto err;

Plain return?

> + }

> + dev_dbg(&pmic->pdev->dev, "%s: Unlocked lock register 0x%x\n",
> + __func__, BD71837_REG_REGLOCK);

__func__ part is redundant.

> + for (i = 0; i < ARRAY_SIZE(pmic_regulator_inits); i++) {

> +

Redundant blank line.

> + rdev = devm_regulator_register(&pdev->dev, desc, &config);
> + if (IS_ERR(rdev)) {
> + dev_err(pmic->mfd->dev,
> + "failed to register %s regulator\n",
> + desc->name);

> + err = PTR_ERR(rdev);
> + goto err;

Plain return ...

> +err:
> + return err;

Redundant.

> +}

> +static struct platform_driver bd71837_regulator = {
> + .driver = {
> + .name = "bd71837-pmic",

> + .owner = THIS_MODULE,

This done by macro you are using below. Thus, redundant.

> + },
> + .probe = bd71837_probe,
> +};
> +
> +module_platform_driver(bd71837_regulator);

--
With Best Regards,
Andy Shevchenko