devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
To: Sakari Ailus <sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Cc: linux-media-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v2 1/8] v4l: flash led class: Use fwnode_handle instead of device_node in init
Date: Fri, 07 Apr 2017 11:49:56 +0300	[thread overview]
Message-ID: <3129720.GhXEqohgpp@avalon> (raw)
In-Reply-To: <1491484330-12040-2-git-send-email-sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>

Hi Sakari,

Thank you for the patch.

On Thursday 06 Apr 2017 16:12:03 Sakari Ailus wrote:
> Pass the more generic fwnode_handle to the init function than the
> device_node.
> 
> Signed-off-by: Sakari Ailus <sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> ---
>  drivers/leds/leds-aat1290.c                    |  5 +++--
>  drivers/leds/leds-max77693.c                   |  5 +++--
>  drivers/media/v4l2-core/v4l2-flash-led-class.c | 11 ++++++-----
>  include/media/v4l2-flash-led-class.h           |  4 ++--
>  4 files changed, 14 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/leds/leds-aat1290.c b/drivers/leds/leds-aat1290.c
> index def3cf9..a21e192 100644
> --- a/drivers/leds/leds-aat1290.c
> +++ b/drivers/leds/leds-aat1290.c
> @@ -503,8 +503,9 @@ static int aat1290_led_probe(struct platform_device
> *pdev) aat1290_init_v4l2_flash_config(led, &led_cfg, &v4l2_sd_cfg);
> 
>  	/* Create V4L2 Flash subdev. */
> -	led->v4l2_flash = v4l2_flash_init(dev, sub_node, fled_cdev, NULL,
> -					  &v4l2_flash_ops, &v4l2_sd_cfg);
> +	led->v4l2_flash = v4l2_flash_init(dev, of_fwnode_handle(sub_node),
> +					  fled_cdev, NULL, &v4l2_flash_ops,
> +					  &v4l2_sd_cfg);
>  	if (IS_ERR(led->v4l2_flash)) {
>  		ret = PTR_ERR(led->v4l2_flash);
>  		goto error_v4l2_flash_init;
> diff --git a/drivers/leds/leds-max77693.c b/drivers/leds/leds-max77693.c
> index 1eb58ef..2d3062d 100644
> --- a/drivers/leds/leds-max77693.c
> +++ b/drivers/leds/leds-max77693.c
> @@ -930,8 +930,9 @@ static int max77693_register_led(struct max77693_sub_led
> *sub_led, max77693_init_v4l2_flash_config(sub_led, led_cfg, &v4l2_sd_cfg);
> 
>  	/* Register in the V4L2 subsystem. */
> -	sub_led->v4l2_flash = v4l2_flash_init(dev, sub_node, fled_cdev, NULL,
> -					      &v4l2_flash_ops, &v4l2_sd_cfg);
> +	sub_led->v4l2_flash = v4l2_flash_init(dev, of_fwnode_handle(sub_node),
> +					      fled_cdev, NULL, 
&v4l2_flash_ops,
> +					      &v4l2_sd_cfg);
>  	if (IS_ERR(sub_led->v4l2_flash)) {
>  		ret = PTR_ERR(sub_led->v4l2_flash);
>  		goto err_v4l2_flash_init;
> diff --git a/drivers/media/v4l2-core/v4l2-flash-led-class.c
> b/drivers/media/v4l2-core/v4l2-flash-led-class.c index 794e563..f430c89
> 100644
> --- a/drivers/media/v4l2-core/v4l2-flash-led-class.c
> +++ b/drivers/media/v4l2-core/v4l2-flash-led-class.c
> @@ -13,6 +13,7 @@
>  #include <linux/module.h>
>  #include <linux/mutex.h>
>  #include <linux/of.h>

I think you can drop linux/of.h.

> +#include <linux/property.h>
>  #include <linux/slab.h>
>  #include <linux/types.h>
>  #include <media/v4l2-flash-led-class.h>
> @@ -612,7 +613,7 @@ static const struct v4l2_subdev_internal_ops
> v4l2_flash_subdev_internal_ops = { static const struct v4l2_subdev_ops
> v4l2_flash_subdev_ops;
> 
>  struct v4l2_flash *v4l2_flash_init(
> -	struct device *dev, struct device_node *of_node,
> +	struct device *dev, struct fwnode_handle *fwn,
>  	struct led_classdev_flash *fled_cdev,
>  	struct led_classdev_flash *iled_cdev,
>  	const struct v4l2_flash_ops *ops,
> @@ -638,7 +639,7 @@ struct v4l2_flash *v4l2_flash_init(
>  	v4l2_flash->iled_cdev = iled_cdev;
>  	v4l2_flash->ops = ops;
>  	sd->dev = dev;
> -	sd->of_node = of_node ? of_node : led_cdev->dev->of_node;
> +	sd->fwnode = fwn ? fwn : dev_fwnode(led_cdev->dev);

v4l2_subdev will only have a fwnode field in patch 3/8.

>  	v4l2_subdev_init(sd, &v4l2_flash_subdev_ops);
>  	sd->internal_ops = &v4l2_flash_subdev_internal_ops;
>  	sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
> @@ -654,7 +655,7 @@ struct v4l2_flash *v4l2_flash_init(
>  	if (ret < 0)
>  		goto err_init_controls;
> 
> -	of_node_get(sd->of_node);
> +	fwnode_handle_get(sd->fwnode);
> 
>  	ret = v4l2_async_register_subdev(sd);
>  	if (ret < 0)
> @@ -663,7 +664,7 @@ struct v4l2_flash *v4l2_flash_init(
>  	return v4l2_flash;
> 
>  err_async_register_sd:
> -	of_node_put(sd->of_node);
> +	fwnode_handle_put(sd->fwnode);
>  	v4l2_ctrl_handler_free(sd->ctrl_handler);
>  err_init_controls:
>  	media_entity_cleanup(&sd->entity);
> @@ -683,7 +684,7 @@ void v4l2_flash_release(struct v4l2_flash *v4l2_flash)
> 
>  	v4l2_async_unregister_subdev(sd);
> 
> -	of_node_put(sd->of_node);
> +	fwnode_handle_put(sd->fwnode);
> 
>  	v4l2_ctrl_handler_free(sd->ctrl_handler);
>  	media_entity_cleanup(&sd->entity);
> diff --git a/include/media/v4l2-flash-led-class.h
> b/include/media/v4l2-flash-led-class.h index b0fe4d6..5695853 100644
> --- a/include/media/v4l2-flash-led-class.h
> +++ b/include/media/v4l2-flash-led-class.h
> @@ -108,7 +108,7 @@ static inline struct v4l2_flash
> *v4l2_ctrl_to_v4l2_flash(struct v4l2_ctrl *c) /**
>   * v4l2_flash_init - initialize V4L2 flash led sub-device
>   * @dev:	flash device, e.g. an I2C device
> - * @of_node:	of_node of the LED, may be NULL if the same as device's
> + * @fwn:	fwnode_handle of the LED, may be NULL if the same as device's
>   * @fled_cdev:	LED flash class device to wrap
>   * @iled_cdev:	LED flash class device representing indicator LED 
associated
> *		with fled_cdev, may be NULL
> @@ -122,7 +122,7 @@ static inline struct v4l2_flash
> *v4l2_ctrl_to_v4l2_flash(struct v4l2_ctrl *c) * PTR_ERR() to obtain the
> numeric return value.
>   */
>  struct v4l2_flash *v4l2_flash_init(
> -	struct device *dev, struct device_node *of_node,
> +	struct device *dev, struct fwnode_handle *fwn,
>  	struct led_classdev_flash *fled_cdev,
>  	struct led_classdev_flash *iled_cdev,
>  	const struct v4l2_flash_ops *ops,

-- 
Regards,

Laurent Pinchart

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

  parent reply	other threads:[~2017-04-07  8:49 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-06 13:12 [PATCH v2 0/9] V4L2 fwnode support Sakari Ailus
2017-04-06 13:12 ` [PATCH v2 1/8] v4l: flash led class: Use fwnode_handle instead of device_node in init Sakari Ailus
     [not found]   ` <1491484330-12040-2-git-send-email-sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-04-07  8:49     ` Laurent Pinchart [this message]
2017-04-07 10:20       ` Sakari Ailus
2017-04-08  1:59   ` kbuild test robot
2017-04-06 13:12 ` [PATCH v2 4/8] v4l: async: Provide interoperability between OF and fwnode matching Sakari Ailus
     [not found]   ` <1491484330-12040-5-git-send-email-sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-04-07 10:07     ` Laurent Pinchart
2017-04-07 22:10       ` Sakari Ailus
     [not found]         ` <20170407221047.GL4192-S+BSfZ9RZZmRSg0ZkenSGLdO1Tsj/99ntUK59QYPAWc@public.gmane.org>
2017-04-10 11:28           ` Sakari Ailus
     [not found] ` <1491484330-12040-1-git-send-email-sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-04-06 13:12   ` [PATCH v2 2/8] v4l: fwnode: Support generic fwnode for parsing standardised properties Sakari Ailus
2017-04-07  9:44     ` Laurent Pinchart
2017-04-07 10:36       ` Sakari Ailus
2017-04-07 10:54         ` Laurent Pinchart
2017-04-07 13:03           ` Sakari Ailus
2017-04-07 21:30         ` Sakari Ailus
2017-04-06 13:12   ` [PATCH v2 3/8] v4l: async: Add fwnode match support Sakari Ailus
2017-04-07  9:49     ` Laurent Pinchart
2017-04-07 10:39       ` Sakari Ailus
2017-04-07 10:04     ` Laurent Pinchart
2017-04-07 10:45       ` Sakari Ailus
2017-04-07 10:47         ` Laurent Pinchart
2017-04-07 22:08           ` Sakari Ailus
2017-04-06 13:12   ` [PATCH v2 5/8] v4l: Switch from V4L2 OF not V4L2 fwnode API Sakari Ailus
2017-04-07 10:32     ` Laurent Pinchart
2017-04-07 10:58       ` Sakari Ailus
     [not found]         ` <20170407105805.GG4192-S+BSfZ9RZZmRSg0ZkenSGLdO1Tsj/99ntUK59QYPAWc@public.gmane.org>
2017-04-07 11:09           ` Laurent Pinchart
2017-04-07 22:55             ` Sakari Ailus
2017-04-10  9:21               ` Mika Westerberg
2017-04-10  9:59                 ` Sakari Ailus
2017-04-10 10:11                   ` Mika Westerberg
2017-04-10 10:17                     ` Sakari Ailus
2017-04-06 13:12 ` [PATCH v2 6/8] v4l: media/drv-intf/soc_mediabus.h: include dependent header file Sakari Ailus
     [not found]   ` <1491484330-12040-7-git-send-email-sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-04-07 10:01     ` Laurent Pinchart
2017-04-07 22:56       ` Sakari Ailus
2017-04-06 13:12 ` [PATCH v2 7/8] docs-rst: media: Switch documentation to V4L2 fwnode API Sakari Ailus
     [not found]   ` <1491484330-12040-8-git-send-email-sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-04-07  9:59     ` Laurent Pinchart
2017-04-07 23:02       ` Sakari Ailus
2017-04-06 13:12 ` [PATCH v2 8/8] v4l: Remove V4L2 OF framework in favour of V4L2 fwnode framework Sakari Ailus
2017-04-07  9:58   ` Laurent Pinchart
  -- strict thread matches above, loose matches on Subject: below --
2017-04-06 13:10 [PATCH v2 0/9] V4L2 fwnode support Sakari Ailus
     [not found] ` <1491484249-11964-1-git-send-email-sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-04-06 13:10   ` [PATCH v2 1/8] v4l: flash led class: Use fwnode_handle instead of device_node in init Sakari Ailus
2017-04-07  6:27     ` kbuild test robot
2017-04-07  6:35     ` kbuild test robot

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=3129720.GhXEqohgpp@avalon \
    --to=laurent.pinchart-rylnwiuwjnjg/c1bvhzhaw@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-media-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=sakari.ailus-VuQAYsv1563Yd54FQh9/CA@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).