mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: aliaksei.katovich@nokia.com
Cc: sameo@linux.intel.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] mfd: bq2415x charger driver
Date: Tue, 6 Dec 2011 11:14:58 +0000	[thread overview]
Message-ID: <20111206111458.GA17194@sirena.org.uk> (raw)
In-Reply-To: <af9ea8649257cedcdcc531ce918fa4fba5b4e4a7.1299679848.git.aliaksei.katovich@nokia.com>

On Wed, Mar 09, 2011 at 04:48:03PM +0200, aliaksei.katovich@nokia.com wrote:

> +	file = debugfs_create_file("regdump", 0444, root, cli, &bq2415x_ops);
> +	if (IS_ERR(file))
> +		return;

Rather than create a custom register dump interface I'd suggest
converting to the regmap API which provides standard code to do this.

> +
> +/**
> + * bq2415x_exec - execute charger specific command
> + *
> + * Returns result of command execution upon success or negative otherwise
> + */
> +int bq2415x_exec(enum bq2415x_cmd cmd)
> +{
> +	int res;

> +	if (!bq2415x_cli)
> +		return -ENODEV;

> +	switch (cmd) {
> +	case BQ2415X_ENABLE_CHARGER:
> +		res = bq2415x_enable_charger(true);
> +		break;

...

> +EXPORT_SYMBOL(bq2415x_exec);

This should clearly be going through kernel frameworks and even if
defining a custom in kernel API for this device there's no reason to
emulate ioctl().

> +static int bq2415x_list_voltage(struct regulator_dev *rdev, unsigned i)
> +{
> +	struct bq2415x_regulator *r = rdev_get_drvdata(rdev);
> +
> +	if (i >= r->desc.n_voltages)
> +		return 0;
> +
> +	return bq2415x_vmap_calc(i, r->val_summ, r->init.constraints.min_uV);
> +}

MFDs should put their subfunction drivers within the appropriate
subsystem.

> +static int
> +bq2415x_set_voltage(struct regulator_dev *rdev, int min_uV, int max_uV)
> +{

This won't compile against current kernels, always submit against the
latest development versions (though in this case it won't compile with
3.0...)


> +	/* populate my consumers table */
> +	for (i = 0, j = 0; i < init->num_consumer_supplies && j < n; i++) {

No, this is all wrong - just pass the init data (including consumers)
straight through from the machine driver like all the other regulator
drivers.

  parent reply	other threads:[~2011-12-06 11:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <"cover.1299679848.git.aliaksei.katovich@nokia.com">
2011-03-09 14:48 ` [PATCH v2 0/2] " aliaksei.katovich
2011-03-09 14:48   ` [PATCH 1/2] " aliaksei.katovich
2011-12-05 22:49     ` Felipe Contreras
2011-12-06 11:14     ` Mark Brown [this message]
2011-03-09 14:48   ` [PATCH 2/2] mfd: bq2415x compilation enablers aliaksei.katovich
2011-12-05 22:50     ` Felipe Contreras
     [not found] <"cover.1298918741.git.aliaksei.katovich@nokia.com">
2011-02-28 21:36 ` [PATCH 0/2] mfd: bq2415x charger driver aliaksei.katovich
2011-02-28 21:36   ` [PATCH 1/2] " aliaksei.katovich

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=20111206111458.GA17194@sirena.org.uk \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=aliaksei.katovich@nokia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sameo@linux.intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®