Re: [PATCH 6/6] regulator: max77620: add regulator driver for max77620/max20024

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Thu, Jan 07, 2016 at 08:08:44PM +0530, Laxman Dewangan wrote:

This looks mostly good, a few fairly small things:

> +	if (rinfo->type == MAX77620_REGULATOR_TYPE_SD)
> +		addr = rinfo->cfg_addr;

Please write things like this as switch statement so if we end up adding
more variants the code looks more natural.

> +	case REGULATOR_MODE_IDLE:
> +	case REGULATOR_MODE_STANDBY:
> +		if (rpdata->glpm_enable)
> +			power_mode = MAX77620_POWER_MODE_GLPM;
> +		else
> +			power_mode = MAX77620_POWER_MODE_LPM;
> +		break;

If there's no difference between two modes just don't implement one of
the modes and let the framework worry about what to do for the other
one.

> +static int max77620_get_regulator_dt_data(struct platform_device *pdev,
> +		struct max77620_regulator *max77620_regs)
> +{
> +	struct device_node *np;
> +	u32 prop;
> +	int id;
> +	int ret;
> +
> +	np = of_get_child_by_name(pdev->dev.parent->of_node, "regulators");
> +	if (!np) {
> +		dev_err(&pdev->dev, "Device is not having regulators node\n");
> +		return -ENODEV;
> +	}
> +	pdev->dev.of_node = np;
> +
> +	ret = of_regulator_match(&pdev->dev, np, max77620_regulator_matches,
> +			ARRAY_SIZE(max77620_regulator_matches));
> +	if (ret < 0) {
> +		dev_err(&pdev->dev, "Parsing of regulator node failed: %d\n",
> +			ret);
> +		return ret;
> +	}

Don't open code this, use the core support via regulators and of_match.

> +		if (reg_pdata->disable_remote_sense_on_suspend &&
> +				(rinfo->remote_sense_addr != 0xFF)) {

Weird indentation here, the second line doesn't seem to be aligned with
anything.

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux