Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

authored by

Sakari Ailus and committed by
Mauro Carvalho Chehab
048ea05b ecdf0cfe

+15 -13
+3 -2
drivers/leds/leds-aat1290.c
··· 503 503 aat1290_init_v4l2_flash_config(led, &led_cfg, &v4l2_sd_cfg); 504 504 505 505 /* Create V4L2 Flash subdev. */ 506 - led->v4l2_flash = v4l2_flash_init(dev, sub_node, fled_cdev, NULL, 507 - &v4l2_flash_ops, &v4l2_sd_cfg); 506 + led->v4l2_flash = v4l2_flash_init(dev, of_fwnode_handle(sub_node), 507 + fled_cdev, NULL, &v4l2_flash_ops, 508 + &v4l2_sd_cfg); 508 509 if (IS_ERR(led->v4l2_flash)) { 509 510 ret = PTR_ERR(led->v4l2_flash); 510 511 goto error_v4l2_flash_init;
+3 -2
drivers/leds/leds-max77693.c
··· 930 930 max77693_init_v4l2_flash_config(sub_led, led_cfg, &v4l2_sd_cfg); 931 931 932 932 /* Register in the V4L2 subsystem. */ 933 - sub_led->v4l2_flash = v4l2_flash_init(dev, sub_node, fled_cdev, NULL, 934 - &v4l2_flash_ops, &v4l2_sd_cfg); 933 + sub_led->v4l2_flash = v4l2_flash_init(dev, of_fwnode_handle(sub_node), 934 + fled_cdev, NULL, &v4l2_flash_ops, 935 + &v4l2_sd_cfg); 935 936 if (IS_ERR(sub_led->v4l2_flash)) { 936 937 ret = PTR_ERR(sub_led->v4l2_flash); 937 938 goto err_v4l2_flash_init;
+6 -6
drivers/media/v4l2-core/v4l2-flash-led-class.c
··· 12 12 #include <linux/led-class-flash.h> 13 13 #include <linux/module.h> 14 14 #include <linux/mutex.h> 15 - #include <linux/of.h> 15 + #include <linux/property.h> 16 16 #include <linux/slab.h> 17 17 #include <linux/types.h> 18 18 #include <media/v4l2-flash-led-class.h> ··· 612 612 static const struct v4l2_subdev_ops v4l2_flash_subdev_ops; 613 613 614 614 struct v4l2_flash *v4l2_flash_init( 615 - struct device *dev, struct device_node *of_node, 615 + struct device *dev, struct fwnode_handle *fwn, 616 616 struct led_classdev_flash *fled_cdev, 617 617 struct led_classdev_flash *iled_cdev, 618 618 const struct v4l2_flash_ops *ops, ··· 638 638 v4l2_flash->iled_cdev = iled_cdev; 639 639 v4l2_flash->ops = ops; 640 640 sd->dev = dev; 641 - sd->of_node = of_node ? of_node : led_cdev->dev->of_node; 641 + sd->fwnode = fwn ? fwn : dev_fwnode(led_cdev->dev); 642 642 v4l2_subdev_init(sd, &v4l2_flash_subdev_ops); 643 643 sd->internal_ops = &v4l2_flash_subdev_internal_ops; 644 644 sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; ··· 654 654 if (ret < 0) 655 655 goto err_init_controls; 656 656 657 - of_node_get(sd->of_node); 657 + fwnode_handle_get(sd->fwnode); 658 658 659 659 ret = v4l2_async_register_subdev(sd); 660 660 if (ret < 0) ··· 663 663 return v4l2_flash; 664 664 665 665 err_async_register_sd: 666 - of_node_put(sd->of_node); 666 + fwnode_handle_put(sd->fwnode); 667 667 v4l2_ctrl_handler_free(sd->ctrl_handler); 668 668 err_init_controls: 669 669 media_entity_cleanup(&sd->entity); ··· 683 683 684 684 v4l2_async_unregister_subdev(sd); 685 685 686 - of_node_put(sd->of_node); 686 + fwnode_handle_put(sd->fwnode); 687 687 688 688 v4l2_ctrl_handler_free(sd->ctrl_handler); 689 689 media_entity_cleanup(&sd->entity);
+3 -3
include/media/v4l2-flash-led-class.h
··· 108 108 /** 109 109 * v4l2_flash_init - initialize V4L2 flash led sub-device 110 110 * @dev: flash device, e.g. an I2C device 111 - * @of_node: of_node of the LED, may be NULL if the same as device's 111 + * @fwn: fwnode_handle of the LED, may be NULL if the same as device's 112 112 * @fled_cdev: LED flash class device to wrap 113 113 * @iled_cdev: LED flash class device representing indicator LED associated 114 114 * with fled_cdev, may be NULL ··· 122 122 * PTR_ERR() to obtain the numeric return value. 123 123 */ 124 124 struct v4l2_flash *v4l2_flash_init( 125 - struct device *dev, struct device_node *of_node, 125 + struct device *dev, struct fwnode_handle *fwn, 126 126 struct led_classdev_flash *fled_cdev, 127 127 struct led_classdev_flash *iled_cdev, 128 128 const struct v4l2_flash_ops *ops, ··· 138 138 139 139 #else 140 140 static inline struct v4l2_flash *v4l2_flash_init( 141 - struct device *dev, struct device_node *of_node, 141 + struct device *dev, struct fwnode_handle *fwn, 142 142 struct led_classdev_flash *fled_cdev, 143 143 struct led_classdev_flash *iled_cdev, 144 144 const struct v4l2_flash_ops *ops,