Re: [PATCH v9 2/8] media: Add registration helpers for V4L2 flash sub-devices
From: Jacek Anaszewski <hidden>
Date: 2015-06-19 06:27:17
Also in:
linux-leds, linux-media
Hi Alexey, On 06/18/2015 07:45 PM, Alexey Klimov wrote:
Hi Jacek, On Mon, May 25, 2015 at 6:13 PM, Jacek Anaszewski [off-list ref] wrote:quoted
This patch adds helper functions for registering/unregistering LED Flash class devices as V4L2 sub-devices. The functions should be called from the LED subsystem device driver. In case the support for V4L2 Flash sub-devices is disabled in the kernel config the functions' empty versions will be used. Signed-off-by: Jacek Anaszewski <redacted> Acked-by: Kyungmin Park <kyungmin.park@samsung.com> Cc: Sakari Ailus <sakari.ailus@iki.fi> Cc: Hans Verkuil <redacted> --- drivers/media/v4l2-core/Kconfig | 11 + drivers/media/v4l2-core/Makefile | 2 + drivers/media/v4l2-core/v4l2-flash-led-class.c | 671 ++++++++++++++++++++++++ include/media/v4l2-flash-led-class.h | 148 ++++++ 4 files changed, 832 insertions(+) create mode 100644 drivers/media/v4l2-core/v4l2-flash-led-class.c create mode 100644 include/media/v4l2-flash-led-class.h
[...]
quoted
+struct v4l2_flash *v4l2_flash_init( + struct device *dev, struct device_node *of_node, + struct led_classdev_flash *fled_cdev, + struct led_classdev_flash *iled_cdev, + const struct v4l2_flash_ops *ops, + struct v4l2_flash_config *config) +{ + struct v4l2_flash *v4l2_flash;quoted
+ struct led_classdev *led_cdev = &fled_cdev->led_cdev; + struct v4l2_subdev *sd; + int ret; + + if (!fled_cdev || !ops || !config) + return ERR_PTR(-EINVAL);Could you please if it is correct? You're checking fled_cdev but four lines above you're using fled_cdev and taking led_cdev pointer from there. Maybe it's better to move calculation of led_cdev down and place after if-check?
Thanks for spotting this. I'll submit fixed version soon. -- Best Regards, Jacek Anaszewski