From: Jacek Anaszewski <jacek.anaszewski-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Sakari Ailus
<sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
linux-media-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: niklas.soderlund-1zkq55x86MTxsAP9Fp7wbw@public.gmane.org,
robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
hverkuil-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org,
laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org,
linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
mika.westerberg-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
pavel-+ZI9xUNit7I@public.gmane.org,
sre-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
Subject: Re: [PATCH v9 18/24] as3645a: Switch to fwnode property API
Date: Sat, 9 Sep 2017 21:06:41 +0200 [thread overview]
Message-ID: <f6c79aff-dcc7-ee7d-e224-1f9bc6af1fee@gmail.com> (raw)
In-Reply-To: <20170908131822.31020-14-sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Hi Sakari,
I've come across this patch only by a chance. I believe that merging
leds-as3645a.c patches via media tree is not going to be a persistent
pattern. At least we haven't agreed on that, and in any case I should
have a possibility to give my ack for this patch.
Would you mind also adding linux-leds list on cc when touching areas
related to LED/flash devices?
Thanks in advance.
Best regards,
Jacek Anaszewski
On 09/08/2017 03:18 PM, Sakari Ailus wrote:
> Switch the as3645a from OF to the fwnode property API. Also add ACPI
> support.
>
> Signed-off-by: Sakari Ailus <sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> ---
> drivers/leds/leds-as3645a.c | 81 +++++++++++++++++++++++++--------------------
> 1 file changed, 46 insertions(+), 35 deletions(-)
>
> diff --git a/drivers/leds/leds-as3645a.c b/drivers/leds/leds-as3645a.c
> index 605e0c64e974..2e73c3f818f1 100644
> --- a/drivers/leds/leds-as3645a.c
> +++ b/drivers/leds/leds-as3645a.c
> @@ -25,7 +25,7 @@
> #include <linux/leds.h>
> #include <linux/module.h>
> #include <linux/mutex.h>
> -#include <linux/of.h>
> +#include <linux/property.h>
> #include <linux/slab.h>
>
> #include <media/v4l2-flash-led-class.h>
> @@ -148,8 +148,8 @@ struct as3645a {
> struct v4l2_flash *vf;
> struct v4l2_flash *vfind;
>
> - struct device_node *flash_node;
> - struct device_node *indicator_node;
> + struct fwnode_handle *flash_node;
> + struct fwnode_handle *indicator_node;
>
> struct as3645a_config cfg;
>
> @@ -492,30 +492,33 @@ static int as3645a_detect(struct as3645a *flash)
>
> static int as3645a_parse_node(struct as3645a *flash,
> struct as3645a_names *names,
> - struct device_node *node)
> + struct fwnode_handle *fwnode)
> {
> struct as3645a_config *cfg = &flash->cfg;
> - struct device_node *child;
> + struct fwnode_handle *child;
> const char *name;
> + const char *str;
> int rval;
>
> - for_each_child_of_node(node, child) {
> + fwnode_for_each_child_node(fwnode, child) {
> u32 id = 0;
>
> - of_property_read_u32(child, "reg", &id);
> + fwnode_property_read_u32(
> + child, is_of_node(child) ? "reg" : "led", &id);
>
> switch (id) {
> case AS_LED_FLASH:
> - flash->flash_node = of_node_get(child);
> + flash->flash_node = child;
> break;
> case AS_LED_INDICATOR:
> - flash->indicator_node = of_node_get(child);
> + flash->indicator_node = child;
> break;
> default:
> dev_warn(&flash->client->dev,
> "unknown LED %u encountered, ignoring\n", id);
> break;
> }
> + fwnode_handle_get(child);
> }
>
> if (!flash->flash_node) {
> @@ -523,14 +526,18 @@ static int as3645a_parse_node(struct as3645a *flash,
> return -ENODEV;
> }
>
> - rval = of_property_read_string(flash->flash_node, "label", &name);
> - if (!rval)
> + rval = fwnode_property_read_string(flash->flash_node, "label", &name);
> + if (!rval) {
> strlcpy(names->flash, name, sizeof(names->flash));
> - else
> + } else if (is_of_node(fwnode)) {
> snprintf(names->flash, sizeof(names->flash),
> - "%s:flash", node->name);
> + "%s:flash", to_of_node(fwnode)->name);
> + } else {
> + dev_err(&flash->client->dev, "flash node has no label!\n");
> + return -EINVAL;
> + }
>
> - rval = of_property_read_u32(flash->flash_node, "flash-timeout-us",
> + rval = fwnode_property_read_u32(flash->flash_node, "flash-timeout-us",
> &cfg->flash_timeout_us);
> if (rval < 0) {
> dev_err(&flash->client->dev,
> @@ -538,7 +545,7 @@ static int as3645a_parse_node(struct as3645a *flash,
> goto out_err;
> }
>
> - rval = of_property_read_u32(flash->flash_node, "flash-max-microamp",
> + rval = fwnode_property_read_u32(flash->flash_node, "flash-max-microamp",
> &cfg->flash_max_ua);
> if (rval < 0) {
> dev_err(&flash->client->dev,
> @@ -546,7 +553,7 @@ static int as3645a_parse_node(struct as3645a *flash,
> goto out_err;
> }
>
> - rval = of_property_read_u32(flash->flash_node, "led-max-microamp",
> + rval = fwnode_property_read_u32(flash->flash_node, "led-max-microamp",
> &cfg->assist_max_ua);
> if (rval < 0) {
> dev_err(&flash->client->dev,
> @@ -554,10 +561,10 @@ static int as3645a_parse_node(struct as3645a *flash,
> goto out_err;
> }
>
> - of_property_read_u32(flash->flash_node, "voltage-reference",
> + fwnode_property_read_u32(flash->flash_node, "voltage-reference",
> &cfg->voltage_reference);
>
> - of_property_read_u32(flash->flash_node, "ams,input-max-microamp",
> + fwnode_property_read_u32(flash->flash_node, "ams,input-max-microamp",
> &cfg->peak);
> cfg->peak = AS_PEAK_mA_TO_REG(cfg->peak);
>
> @@ -567,14 +574,18 @@ static int as3645a_parse_node(struct as3645a *flash,
> goto out_err;
> }
>
> - rval = of_property_read_string(flash->indicator_node, "label", &name);
> - if (!rval)
> + rval = fwnode_property_read_string(flash->indicator_node, "label", &name);
> + if (!rval) {
> strlcpy(names->indicator, name, sizeof(names->indicator));
> - else
> + } else if (is_of_node(fwnode)) {
> snprintf(names->indicator, sizeof(names->indicator),
> - "%s:indicator", node->name);
> + "%s:indicator", to_of_node(fwnode)->name);
> + } else {
> + dev_err(&flash->client->dev, "flash node has no label!\n");
> + return -EINVAL;
> + }
>
> - rval = of_property_read_u32(flash->indicator_node, "led-max-microamp",
> + rval = fwnode_property_read_u32(flash->indicator_node, "led-max-microamp",
> &cfg->indicator_max_ua);
> if (rval < 0) {
> dev_err(&flash->client->dev,
> @@ -585,8 +596,8 @@ static int as3645a_parse_node(struct as3645a *flash,
> return 0;
>
> out_err:
> - of_node_put(flash->flash_node);
> - of_node_put(flash->indicator_node);
> + fwnode_handle_put(flash->flash_node);
> + fwnode_handle_put(flash->indicator_node);
>
> return rval;
> }
> @@ -667,14 +678,14 @@ static int as3645a_v4l2_setup(struct as3645a *flash)
> strlcpy(cfgind.dev_name, flash->iled_cdev.name, sizeof(cfg.dev_name));
>
> flash->vf = v4l2_flash_init(
> - &flash->client->dev, of_fwnode_handle(flash->flash_node),
> - &flash->fled, NULL, &cfg);
> + &flash->client->dev, flash->flash_node, &flash->fled, NULL,
> + &cfg);
> if (IS_ERR(flash->vf))
> return PTR_ERR(flash->vf);
>
> flash->vfind = v4l2_flash_indicator_init(
> - &flash->client->dev, of_fwnode_handle(flash->indicator_node),
> - &flash->iled_cdev, &cfgind);
> + &flash->client->dev, flash->indicator_node, &flash->iled_cdev,
> + &cfgind);
> if (IS_ERR(flash->vfind)) {
> v4l2_flash_release(flash->vf);
> return PTR_ERR(flash->vfind);
> @@ -689,7 +700,7 @@ static int as3645a_probe(struct i2c_client *client)
> struct as3645a *flash;
> int rval;
>
> - if (client->dev.of_node == NULL)
> + if (!dev_fwnode(&client->dev))
> return -ENODEV;
>
> flash = devm_kzalloc(&client->dev, sizeof(*flash), GFP_KERNEL);
> @@ -698,7 +709,7 @@ static int as3645a_probe(struct i2c_client *client)
>
> flash->client = client;
>
> - rval = as3645a_parse_node(flash, &names, client->dev.of_node);
> + rval = as3645a_parse_node(flash, &names, dev_fwnode(&client->dev));
> if (rval < 0)
> return rval;
>
> @@ -730,8 +741,8 @@ static int as3645a_probe(struct i2c_client *client)
> mutex_destroy(&flash->mutex);
>
> out_put_nodes:
> - of_node_put(flash->flash_node);
> - of_node_put(flash->indicator_node);
> + fwnode_handle_put(flash->flash_node);
> + fwnode_handle_put(flash->indicator_node);
>
> return rval;
> }
> @@ -749,8 +760,8 @@ static int as3645a_remove(struct i2c_client *client)
>
> mutex_destroy(&flash->mutex);
>
> - of_node_put(flash->flash_node);
> - of_node_put(flash->indicator_node);
> + fwnode_handle_put(flash->flash_node);
> + fwnode_handle_put(flash->indicator_node);
>
> return 0;
> }
>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2017-09-09 19:06 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-08 13:11 [PATCH v9 00/23] Unified fwnode endpoint parser, async sub-device notifier support, N9 flash DTS Sakari Ailus
2017-09-08 13:11 ` [PATCH v9 01/24] v4l: fwnode: Move KernelDoc documentation to the header Sakari Ailus
2017-09-08 13:11 ` [PATCH v9 03/24] v4l: async: Use more intuitive names for internal functions Sakari Ailus
2017-09-09 9:15 ` Pavel Machek
2017-09-09 15:34 ` Laurent Pinchart
2017-09-11 7:51 ` Hans Verkuil
2017-09-08 13:11 ` [PATCH v9 04/24] v4l: async: Add V4L2 async documentation to the documentation build Sakari Ailus
[not found] ` <20170908131235.30294-5-sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-09-09 15:37 ` Laurent Pinchart
2017-09-08 13:18 ` [PATCH v9 05/24] v4l: fwnode: Support generic parsing of graph endpoints in a device Sakari Ailus
[not found] ` <20170908131822.31020-1-sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-09-11 7:59 ` Hans Verkuil
2017-09-08 13:18 ` [PATCH v9 06/24] omap3isp: Use generic parser for parsing fwnode endpoints Sakari Ailus
2017-09-08 13:18 ` [PATCH v9 07/24] rcar-vin: " Sakari Ailus
2017-09-08 13:18 ` [PATCH v9 08/24] omap3isp: Fix check for our own sub-devices Sakari Ailus
2017-09-09 9:16 ` Pavel Machek
2017-09-08 13:18 ` [PATCH v9 09/24] omap3isp: Print the name of the entity where no source pads could be found Sakari Ailus
2017-09-09 9:16 ` Pavel Machek
2017-09-08 13:18 ` [PATCH v9 10/24] v4l: async: Move async subdev notifier operations to a separate structure Sakari Ailus
2017-09-08 13:18 ` [PATCH v9 11/24] v4l: async: Introduce helpers for calling async ops callbacks Sakari Ailus
[not found] ` <20170908131235.30294-1-sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-09-08 13:11 ` [PATCH v9 02/24] v4l: async: Remove re-probing support Sakari Ailus
2017-09-09 15:36 ` Laurent Pinchart
[not found] ` <20170908131235.30294-3-sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-09-11 7:47 ` Hans Verkuil
[not found] ` <787019fe-7402-7edb-3de6-9a683de78d71-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>
2017-09-11 7:51 ` Sakari Ailus
2017-09-08 13:18 ` [PATCH v9 12/24] v4l: async: Register sub-devices before calling bound callback Sakari Ailus
2017-09-08 13:18 ` [PATCH v9 15/24] dt: bindings: Add a binding for flash LED devices associated to a sensor Sakari Ailus
2017-09-09 9:08 ` Pavel Machek
2017-09-08 13:18 ` [PATCH v9 16/24] dt: bindings: Add lens-focus binding for image sensors Sakari Ailus
2017-09-08 13:18 ` [PATCH v9 24/24] arm: dts: omap3: N9/N950: Add flash references to the camera Sakari Ailus
2017-09-09 18:32 ` Pavel Machek
2017-09-09 22:13 ` Sakari Ailus
2017-09-08 13:18 ` [PATCH v9 13/24] v4l: async: Allow async notifier register call succeed with no subdevs Sakari Ailus
2017-09-11 8:05 ` Hans Verkuil
[not found] ` <beb494e4-44f7-2eec-8d24-8d92e23dafd2-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>
2017-09-11 8:21 ` Sakari Ailus
2017-09-08 13:18 ` [PATCH v9 14/24] v4l: async: Allow binding notifiers to sub-devices Sakari Ailus
2017-09-08 13:18 ` [PATCH v9 17/24] ACPI: Document how to refer to LEDs from remote nodes Sakari Ailus
2017-09-08 13:43 ` Mika Westerberg
2017-09-08 13:54 ` Sakari Ailus
2017-09-08 13:58 ` Mika Westerberg
2017-09-09 9:08 ` Pavel Machek
2017-09-08 13:18 ` [PATCH v9 18/24] as3645a: Switch to fwnode property API Sakari Ailus
2017-09-09 9:19 ` Pavel Machek
[not found] ` <20170908131822.31020-14-sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-09-09 19:06 ` Jacek Anaszewski [this message]
2017-09-09 21:36 ` Sakari Ailus
2017-09-11 21:10 ` Jacek Anaszewski
2017-09-08 13:18 ` [PATCH v9 19/24] v4l: fwnode: Add a helper function for parsing generic references Sakari Ailus
2017-09-08 13:18 ` [PATCH v9 20/24] v4l: fwnode: Add a helper function to obtain device / interger references Sakari Ailus
2017-09-08 13:18 ` [PATCH v9 21/24] v4l: fwnode: Add convenience function for parsing common external refs Sakari Ailus
2017-09-08 13:18 ` [PATCH v9 22/24] smiapp: Add support for flash and lens devices Sakari Ailus
2017-09-09 21:47 ` [RFC] et8ek8: " Pavel Machek
2017-09-09 22:06 ` Sakari Ailus
2017-09-11 13:18 ` [PATCH] " Pavel Machek
2017-09-12 11:06 ` Sakari Ailus
2017-09-08 13:18 ` [PATCH v9 23/24] dt: bindings: smiapp: Document lens-focus and flash properties Sakari Ailus
[not found] ` <20170908131822.31020-19-sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-09-08 13:36 ` Pavel Machek
2017-09-08 13:42 ` Sakari Ailus
2017-09-08 21:45 ` Pavel Machek
2017-09-11 7:45 ` Sakari Ailus
2017-09-08 13:25 ` [PATCH v9 00/23] Unified fwnode endpoint parser, async sub-device notifier support, N9 flash DTS Sakari Ailus
[not found] ` <20170908132507.nqofkw2g43m7ydux-S+BSfZ9RZZmRSg0ZkenSGLdO1Tsj/99ntUK59QYPAWc@public.gmane.org>
2017-09-09 9:34 ` Pavel Machek
2017-09-11 8:24 ` Sakari Ailus
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=f6c79aff-dcc7-ee7d-e224-1f9bc6af1fee@gmail.com \
--to=jacek.anaszewski-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=hverkuil-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org \
--cc=laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org \
--cc=linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-media-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mika.westerberg-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=niklas.soderlund-1zkq55x86MTxsAP9Fp7wbw@public.gmane.org \
--cc=pavel-+ZI9xUNit7I@public.gmane.org \
--cc=robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
--cc=sre-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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;
as well as URLs for NNTP newsgroup(s).