LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
To: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Cc: Lee Jones <lee.jones@linaro.org>,
	Gwendal Grignou <gwendal@chromium.org>,
	Sameer Nanda <snanda@chromium.org>,
	linux-pm@vger.kernel.org, Guenter Roeck <groeck@chromium.org>,
	linux-kernel@vger.kernel.org, Benson Leung <bleung@chromium.org>,
	miguel.ojeda.sandonis@gmail.com, kernel@collabora.com
Subject: Re: [PATCH v3 2/3] power: supply: add cros-ec USBPD charger driver.
Date: Wed, 2 May 2018 12:57:10 +0200	[thread overview]
Message-ID: <20180502105710.bi3tztsjkpcby2ui@earth.universe> (raw)
In-Reply-To: <20180502095343.17092-3-enric.balletbo@collabora.com>

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

Hi,

I found one more issue, otherwise the driver looks fine to me.

On Wed, May 02, 2018 at 11:53:42AM +0200, Enric Balletbo i Serra wrote:
> This driver gets various bits of information about what is connected to
> USB PD ports from the EC and converts that into power_supply properties.
> 
> Signed-off-by: Sameer Nanda <snanda@chromium.org>
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> Acked-by: Lee Jones <lee.jones@linaro.org>
> ---
[...]
> +static int cros_usbpd_charger_probe(struct platform_device *pd)
> +{
[...]
> +	for (i = 0; i < charger->num_charger_ports; i++) {
[...]
> +		psy = devm_power_supply_register_no_ws(dev, psy_desc,
> +						       &psy_cfg);
[...]
> +		ec_device->charger = psy;
> + }
[...]
> diff --git a/include/linux/mfd/cros_ec.h b/include/linux/mfd/cros_ec.h
> index f36125ee9245..a1eb39344231 100644
> --- a/include/linux/mfd/cros_ec.h
> +++ b/include/linux/mfd/cros_ec.h
> @@ -19,6 +19,7 @@
>  #include <linux/cdev.h>
>  #include <linux/device.h>
>  #include <linux/notifier.h>
> +#include <linux/power_supply.h>
>  #include <linux/mfd/cros_ec_commands.h>
>  #include <linux/mutex.h>
>  
> @@ -143,6 +144,7 @@ struct cros_ec_device {
>  			struct cros_ec_command *msg);
>  	int (*pkt_xfer)(struct cros_ec_device *ec,
>  			struct cros_ec_command *msg);
> +	struct power_supply *charger;
>  	struct mutex lock;
>  	bool mkbp_event_supported;
>  	struct blocking_notifier_head event_notifier;

I think cros_ec_device->charger can be dropped:

 * It is not cleared on power-supply removal
 * It randomly points to the last registered power-supply
 * It is only set, but never used

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2018-05-02 10:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-02  9:53 [PATCH v3 0/3] mfd/power: cros_ec: add support for " Enric Balletbo i Serra
2018-05-02  9:53 ` [PATCH v3 1/3] mfd: cros_ec: Add USBPD charger commands and struct definitions Enric Balletbo i Serra
2018-05-02 11:02   ` Sebastian Reichel
2018-05-02  9:53 ` [PATCH v3 2/3] power: supply: add cros-ec USBPD charger driver Enric Balletbo i Serra
2018-05-02 10:57   ` Sebastian Reichel [this message]
2018-05-02 15:40     ` Enric Balletbo i Serra
2018-05-02  9:53 ` [PATCH v3 3/3] mfd: cros_ec_dev: Register cros_usbpd-charger driver as a subdevice Enric Balletbo i Serra

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=20180502105710.bi3tztsjkpcby2ui@earth.universe \
    --to=sebastian.reichel@collabora.co.uk \
    --cc=bleung@chromium.org \
    --cc=enric.balletbo@collabora.com \
    --cc=groeck@chromium.org \
    --cc=gwendal@chromium.org \
    --cc=kernel@collabora.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=snanda@chromium.org \
    --subject='Re: [PATCH v3 2/3] power: supply: add cros-ec USBPD charger driver.' \
    /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

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).