From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Daniel Jeong <gshark.jeong@gmail.com>
Cc: Liam Gridwood <lrg@ti.com>, Daniel Jeong <daniel.jeong@ti.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] regulator: new driver for LP8755
Date: Mon, 3 Dec 2012 15:36:48 +0900 [thread overview]
Message-ID: <20121203063642.GB9848@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1354509864-30001-2-git-send-email-gshark.jeong@gmail.com>
On Mon, Dec 03, 2012 at 01:44:24PM +0900, Daniel Jeong wrote:
> + regval &= ~(0x01 << id);
> +
> + /* mode fast means forced pwm mode.
> + mode normal means not forced pwm mode, according to
> + current load it could be one of modes, PWM/PFM/LPPFM. */
> + return regval ? REGULATOR_MODE_FAST : REGULATOR_MODE_NORMAL;
Your set_mode() implemented an idle mode as well but it can't be read
back..
> +err_i2c:
> + dev_err(pchip->dev, "i2c acceess error %s\n", __func__);
> + return -EINVAL;
Your approach to errors throughout the driver is very unhelpful - the
code returned by regmap will be discarded entirely, it's neither
displayed nor returned to the caller. I'd also be inclined to avoid the
goto idiom, it normally means there's some unwinding to be done but
that's not the case here, just return.
> +/* buck voltage table */
> +static const int lp8755_buck_vtbl[] = {
> + 500000, 510000, 520000, 530000, 540000,
> + 550000, 560000, 570000, 580000, 590000,
There is no point in this being a table, as far as I can see it's a
nice linear map of values with some extras at the end which could just
be dropped.
> + /* check vendor id and write init value */
There's no writes...
> + ret = lp8755_read(pchip, 0x18, ®val);
Magic numbers!
> + if (ret < 0)
> + goto out_i2c_error;
> + dev_info(pchip->dev, "lp8755 : chip ID is 0x%x\n", regval);
This isn't actually checking anything except the I/O. Can the chip ID
really vary?
> + }
> +
> + dev_info(pchip->dev, "regulator init Done %s\n", __func__);
This isn't adding anything, drop it.
> + /* read & clear flag register */
> + ret = lp8755_read(pchip, 0x0D, &flag0);
> + ret |= lp8755_write(pchip, 0x0D, 0x00);
More magic numbers.
> + if (pdata == NULL) {
> + dev_err(&client->dev, "platform data is NULL.\n");
> + return -ENOMEM;
> + }
Platform data should be optional, you should be able to read back the
current regulator state even if you can't set it.
> + dev_info(&client->dev, "lp8755 init done.\n");
> + return ret;
Again, drop these noisy prints. They're not adding anything.
> +/**
> + * struct lp8755_platform_data
> + * @mphase_type : Multiphase Switcher Configurations 0~8
> + * @buck_init_volt : buck0~6 init voltage in uV.
> + */
> +struct lp8755_platform_data {
> + int mphase;
> + struct regulator_init_data *buck_data[LP8755_BUCK_MAX];
> +};
The comments don't match the struct.
next prev parent reply other threads:[~2012-12-03 6:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-03 4:44 [PATCH 0/1] regulator: new driver for LP8755 Daniel Jeong
2012-12-03 4:44 ` [PATCH 1/1] " Daniel Jeong
2012-12-03 6:25 ` Wanlong Gao
2012-12-03 6:36 ` Mark Brown [this message]
[not found] ` <CAPqQCJW6TLhxRkOdw6JVe1qkepDDKdt+wagAgd5VCCsE3y6Qog@mail.gmail.com>
2012-12-03 7:27 ` Mark Brown
2012-12-03 6:11 ` [PATCH 0/1] " Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20121203063642.GB9848@opensource.wolfsonmicro.com \
--to=broonie@opensource.wolfsonmicro.com \
--cc=daniel.jeong@ti.com \
--cc=gshark.jeong@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lrg@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.