mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 22:14:04 +02:00
UPSTREAM: [media] v4l: flash led class: Use fwnode_handle instead of device_node in init
Pass the more generic fwnode_handle to the init function than the
device_node.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Hans Verkuil <hans.verkuil@cisco.com>
Tested-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
(cherry picked from commit 048ea05b4f)
BUG=b:62359918
TEST=No regression in camera functionality
TEST=Kernel builds and boots
Change-Id: Ied9439f2b96be3afe047b54877703d35074bf455
Signed-off-by: Nathan Ciobanu <nathan.d.ciobanu@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/528620
Commit-Ready: Nathan D Ciobanu <nathan.d.ciobanu@intel.com>
Tested-by: Yong Zhi <yong.zhi@intel.com>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
This commit is contained in:
parent
d99d484173
commit
aed4e07a75
|
|
@ -525,8 +525,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;
|
||||
|
|
|
|||
|
|
@ -966,8 +966,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;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
#include <linux/led-class-flash.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/property.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/types.h>
|
||||
#include <media/v4l2-flash-led-class.h>
|
||||
|
|
@ -619,7 +619,7 @@ 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,
|
||||
|
|
@ -645,7 +645,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_init(sd, &v4l2_flash_subdev_ops);
|
||||
sd->internal_ops = &v4l2_flash_subdev_internal_ops;
|
||||
sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
|
||||
|
|
@ -661,7 +661,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)
|
||||
|
|
@ -670,7 +670,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);
|
||||
|
|
@ -690,7 +690,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);
|
||||
|
|
|
|||
|
|
@ -101,7 +101,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
|
||||
|
|
@ -115,7 +115,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,
|
||||
|
|
@ -131,7 +131,7 @@ void v4l2_flash_release(struct v4l2_flash *v4l2_flash);
|
|||
|
||||
#else
|
||||
static inline 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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user