[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160110124014.GZ6588@sirena.org.uk>
Date: Sun, 10 Jan 2016 12:40:14 +0000
From: Mark Brown <broonie@...nel.org>
To: Laxman Dewangan <ldewangan@...dia.com>
Cc: robh+dt@...nel.org, pawel.moll@....com, mark.rutland@....com,
ijc+devicetree@...lion.org.uk, galak@...eaurora.org,
linus.walleij@...aro.org, gnurou@...il.com, lee.jones@...aro.org,
a.zummo@...ertech.it, alexandre.belloni@...e-electrons.com,
lgirdwood@...il.com, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-gpio@...r.kernel.org,
rtc-linux@...glegroups.com, swarren@...dia.com, treding@...dia.com,
Mallikarjun Kasoju <mkasoju@...dia.com>
Subject: Re: [PATCH 6/6] regulator: max77620: add regulator driver for
max77620/max20024
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.
Download attachment "signature.asc" of type "application/pgp-signature" (474 bytes)
Powered by blists - more mailing lists