devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Reichel <sre@kernel.org>
To: Enric Balletbo i Serra <eballetbo@gmail.com>
Cc: devicetree@vger.kernel.org, linux-omap@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
	robh+dt@kernel.org, pawel.moll@arm.com, mark.rutland@arm.com,
	ijc+devicetree@hellion.org.uk, galak@codeaurora.org,
	dbaryshkov@gmail.com, dwmw2@infradead.org, tony@atomide.com,
	sameo@linux.intel.com, lee.jones@linaro.org,
	sjoerd.simons@collabora.co.uk, javier@dowhile0.org
Subject: Re: [PATCH 2/3] power_supply: Add support for tps65217-charger.
Date: Tue, 22 Sep 2015 15:44:32 +0200	[thread overview]
Message-ID: <20150922134432.GG23334@earth> (raw)
In-Reply-To: <1441699779-22189-3-git-send-email-enric.balletbo@collabora.com>

[-- Attachment #1: Type: text/plain, Size: 1283 bytes --]

Hi,

On Tue, Sep 08, 2015 at 10:09:38AM +0200, Enric Balletbo i Serra wrote:
> This patch adds support for the tps65217 charger driver. This driver is
> responsible for controlling the charger aspect of the tps65217 mfd.
> Currently, this mainly consists of turning on and off the charger, but
> some other features of the charger can be supported through this driver.

Driver looks mostly fine. I have two comments though:

> [...]
>
> +static int tps65217_ac_get_property(struct power_supply *psy,
> +			enum power_supply_property psp,
> +			union power_supply_propval *val)
> +{
> +	struct tps65217_charger *charger = power_supply_get_drvdata(psy);
> +
> +	if (psp == POWER_SUPPLY_PROP_ONLINE) {
> +		val->intval = charger->ac_online;
> +		charger->prev_ac_online = charger->ac_online;

I think prev_ac_online should be set at the beginning of
tps65217_charger_irq().

> [...]
>
> +static int tps65217_charger_probe(struct platform_device *pdev)
> +{
>
> [...]
>
> +	charger->ac = power_supply_register(&pdev->dev,
> +					&tps65217_charger_desc, NULL);
> +	if (IS_ERR(charger->ac)) {
> +		dev_err(&pdev->dev, "failed: power supply register\n");
> +		return PTR_ERR(charger->ac);
> +	}

You can use devm_power_supply_register(...) to simplify the driver
a bit more.

-- Sebastian

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2015-09-22 13:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-08  8:09 [PATCH 0/3] Add support for tps65217 charger Enric Balletbo i Serra
2015-09-08  8:09 ` [PATCH 1/3] devicetree: Add TPS65217 charger binding Enric Balletbo i Serra
2015-09-08  8:09 ` [PATCH 2/3] power_supply: Add support for tps65217-charger Enric Balletbo i Serra
2015-09-22 13:44   ` Sebastian Reichel [this message]
2015-09-08  8:09 ` [PATCH 3/3] mfd: Add battery charger as subdevice to the tps65217 Enric Balletbo i Serra
2015-09-20  4:19   ` Lee Jones
2015-09-22  7:43     ` Enric Balletbo Serra
     [not found]       ` <CAFqH_51hUMH=1MMWQ3uSz1yJ=i6upNAHJrhD78Ocp9EWRqXW5w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-09-22 11:37         ` Sebastian Reichel

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=20150922134432.GG23334@earth \
    --to=sre@kernel.org \
    --cc=dbaryshkov@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dwmw2@infradead.org \
    --cc=eballetbo@gmail.com \
    --cc=galak@codeaurora.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=javier@dowhile0.org \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=pawel.moll@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=sameo@linux.intel.com \
    --cc=sjoerd.simons@collabora.co.uk \
    --cc=tony@atomide.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;
as well as URLs for NNTP newsgroup(s).