From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: dd diasemi <dd.diasemi@gmail.com>
Cc: lrg@slimlogic.co.uk, linux-kernel@vger.kernel.org
Subject: Re: [PATCHv5 5/11] REGULATOR: Regulator module of DA9052 device driver
Date: Tue, 21 Dec 2010 18:19:49 +0000 [thread overview]
Message-ID: <20101221181949.GA3105@rakim.wolfsonmicro.main> (raw)
In-Reply-To: <AANLkTimCp+q54oO0iKbrgR8q=3an9h0qQ7iLYJtiqcw9@mail.gmail.com>
On Tue, Dec 21, 2010 at 07:10:12PM +0100, dd diasemi wrote:
> Linux Kernel Version: 2.6.34
Always submit drivers against current development kernels, see the git
trees referenced in MAINTAINERS - linux-next is usually a good
approximation. Drivers generated against older kernels will frequently
not even build against current kernels. I'm fairly sure this has been
mentioned to you on previous submissions.
I've *briefly* glanced through the code below but not thoroughly
reviewed due to the old kernel version.
> +struct regulator {
> + struct device *dev;
> + struct list_head list;
> + int uA_load;
> + int min_uV;
> + int max_uV;
> + int enabled;
> + char *supply_name;
> + struct device_attribute dev_attr;
> + struct regulator_dev *rdev;
> +};
Why are you replicating this in your driver? You should never even look
at the interenals of this structure...
> + da9052_lock(priv->da9052);
> + ret = priv->da9052->read(priv->da9052, &ssc_msg);
> + if (ret) {
> + da9052_unlock(priv->da9052);
> + return -EIO;
> + }
> +
> + ssc_msg.data = (ssc_msg.data | da9052_regulators[id].en_bit_mask);
> +
> + ret = priv->da9052->write(priv->da9052, &ssc_msg);
> + if (ret) {
> + da9052_unlock(priv->da9052);
> + return -EIO;
> + }
> + da9052_unlock(priv->da9052);
This register manpulation looks like it really should be factored out
into the MFD driver - there's quite a few copies of essentially the same
code in the regulator driver alone.
> + (DA9052_BUCK_PERI_STEP_ABOVE_3000);
> + } else{
checkpatch.pl will spot style issues like this for you.
> + priv->da9052 = da9052;
> + for (i = 0; i < 14; i++) {
14 is a magic number... should be something more meaningful.
> +/* PM Device name and static Major number macros */
> +#define DRIVER_NAME "da9052-regulator"
This shouldn't be in a header where other code might see it.
> +/* PM Device Error Codes */
> +
Remove this empty section.
prev parent reply other threads:[~2010-12-21 18:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-21 18:10 dd diasemi
2010-12-21 18:19 ` Mark Brown [this message]
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=20101221181949.GA3105@rakim.wolfsonmicro.main \
--to=broonie@opensource.wolfsonmicro.com \
--cc=dd.diasemi@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lrg@slimlogic.co.uk \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome