From: Lee Jones <lee.jones@linaro.org>
To: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Cc: Sebastian Reichel <sre@kernel.org>,
Gwendal Grignou <gwendal@chromium.org>,
Benson Leung <bleung@chromium.org>,
Guenter Roeck <groeck@chromium.org>,
linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
Sameer Nanda <snanda@chromium.org>
Subject: Re: [PATCH 3/3] mfd: cros_ec_dev: Register cros_usbpd-charger driver as a subdevice.
Date: Tue, 23 Jan 2018 11:57:36 +0000 [thread overview]
Message-ID: <20180123115736.2ai5tjgty5ekvrd2@dell> (raw)
In-Reply-To: <20180117175932.20636-4-enric.balletbo@collabora.com>
On Wed, 17 Jan 2018, Enric Balletbo i Serra wrote:
> From: Sameer Nanda <snanda@chromium.org>
>
> Check whether this EC instance has USBPD host command support and
> instatiate the cros_usbpd-charger driver as a subdevice in such case.
>
> Signed-off-by: Sameer Nanda <snanda@chromium.org>
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> ---
> drivers/mfd/cros_ec_dev.c | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c
> index 26a8731499bf..d98f03f3d251 100644
> --- a/drivers/mfd/cros_ec_dev.c
> +++ b/drivers/mfd/cros_ec_dev.c
> @@ -37,6 +37,9 @@ static const struct attribute_group *cros_ec_groups[] = {
> &cros_ec_attr_group,
> &cros_ec_lightbar_attr_group,
> &cros_ec_vbc_attr_group,
> +#if IS_ENABLED(CONFIG_CHARGER_CROS_USB_PD)
> + &cros_usb_pd_charger_attr_group,
> +#endif
I'd rather not introduce #ifery into *.c files.
Please find another way of doing this. Perhaps create a nil-Byte
alternative that you can shove away in a header file somewhere?
> NULL,
> };
>
> @@ -269,6 +272,24 @@ static void __remove(struct device *dev)
> kfree(ec);
> }
>
> +static const struct mfd_cell cros_usb_pd_charger_devs[] = {
> + {
> + .name = "cros-usb-pd-charger",
> + .id = -1,
What are you trying to achieve here?
> + },
> +};
> +
> +static void cros_ec_usb_pd_charger_register(struct cros_ec_dev *ec)
> +{
> + int ret;
> +
> + ret = mfd_add_devices(ec->dev, 0, cros_usb_pd_charger_devs,
What does 0 mean here?
> + ARRAY_SIZE(cros_usb_pd_charger_devs),
> + NULL, 0, NULL);
> + if (ret)
> + dev_err(ec->dev, "failed to add usb-pd-charger device\n");
> +}
> +
> static void cros_ec_sensors_register(struct cros_ec_dev *ec)
> {
> /*
> @@ -451,6 +472,10 @@ static int ec_device_probe(struct platform_device *pdev)
> if (cros_ec_debugfs_init(ec))
> dev_warn(dev, "failed to create debugfs directory\n");
>
> + /* check whether this EC instance has the PD charge manager */
> + if (cros_ec_check_features(ec, EC_FEATURE_USB_PD))
> + cros_ec_usb_pd_charger_register(ec);
> +
> /* check whether this EC is a sensor hub. */
> if (cros_ec_check_features(ec, EC_FEATURE_MOTION_SENSE))
> cros_ec_sensors_register(ec);
--
Lee Jones
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
prev parent reply other threads:[~2018-01-23 11:57 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-17 17:59 [PATCH 0/3] mfd: cros_ec: add support for USBPD charger driver Enric Balletbo i Serra
2018-01-17 17:59 ` [PATCH 1/3] mfd: cros_ec: Add USBPD charger commands and struct definitions Enric Balletbo i Serra
2018-01-23 11:49 ` Lee Jones
2018-01-17 17:59 ` [PATCH 2/3] power: supply: add cros-ec USB PD charger driver Enric Balletbo i Serra
2018-01-18 5:56 ` Aishwarya Pant
2018-01-23 9:54 ` Lee Jones
2018-02-09 11:57 ` Sebastian Reichel
2018-01-17 17:59 ` [PATCH 3/3] mfd: cros_ec_dev: Register cros_usbpd-charger driver as a subdevice Enric Balletbo i Serra
2018-01-23 11:57 ` Lee Jones [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=20180123115736.2ai5tjgty5ekvrd2@dell \
--to=lee.jones@linaro.org \
--cc=bleung@chromium.org \
--cc=enric.balletbo@collabora.com \
--cc=groeck@chromium.org \
--cc=gwendal@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=snanda@chromium.org \
--cc=sre@kernel.org \
/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