Commit 85f7ff97 authored by Sakari Ailus's avatar Sakari Ailus Committed by Mauro Carvalho Chehab

media: v4l2-flash: Use led_classdev instead of led_classdev_flash for indicator

The V4L2 flash class initialisation expects struct led_classdev_flash that
describes an indicator but only uses struct led_classdev which is a field
iled_cdev in the struct. Use struct iled_cdev only.
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: default avatarJacek Anaszewski <jacek.anaszewski@gmail.com>
Reviewed-by: default avatarSebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 06f81520
...@@ -110,7 +110,7 @@ static void v4l2_flash_set_led_brightness(struct v4l2_flash *v4l2_flash, ...@@ -110,7 +110,7 @@ static void v4l2_flash_set_led_brightness(struct v4l2_flash *v4l2_flash,
led_set_brightness_sync(&v4l2_flash->fled_cdev->led_cdev, led_set_brightness_sync(&v4l2_flash->fled_cdev->led_cdev,
brightness); brightness);
} else { } else {
led_set_brightness_sync(&v4l2_flash->iled_cdev->led_cdev, led_set_brightness_sync(v4l2_flash->iled_cdev,
brightness); brightness);
} }
} }
...@@ -133,7 +133,7 @@ static int v4l2_flash_update_led_brightness(struct v4l2_flash *v4l2_flash, ...@@ -133,7 +133,7 @@ static int v4l2_flash_update_led_brightness(struct v4l2_flash *v4l2_flash,
return 0; return 0;
led_cdev = &v4l2_flash->fled_cdev->led_cdev; led_cdev = &v4l2_flash->fled_cdev->led_cdev;
} else { } else {
led_cdev = &v4l2_flash->iled_cdev->led_cdev; led_cdev = v4l2_flash->iled_cdev;
} }
ret = led_update_brightness(led_cdev); ret = led_update_brightness(led_cdev);
...@@ -529,8 +529,7 @@ static int v4l2_flash_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) ...@@ -529,8 +529,7 @@ static int v4l2_flash_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
struct v4l2_flash *v4l2_flash = v4l2_subdev_to_v4l2_flash(sd); struct v4l2_flash *v4l2_flash = v4l2_subdev_to_v4l2_flash(sd);
struct led_classdev_flash *fled_cdev = v4l2_flash->fled_cdev; struct led_classdev_flash *fled_cdev = v4l2_flash->fled_cdev;
struct led_classdev *led_cdev = &fled_cdev->led_cdev; struct led_classdev *led_cdev = &fled_cdev->led_cdev;
struct led_classdev_flash *iled_cdev = v4l2_flash->iled_cdev; struct led_classdev *led_cdev_ind = v4l2_flash->iled_cdev;
struct led_classdev *led_cdev_ind = NULL;
int ret = 0; int ret = 0;
if (!v4l2_fh_is_singular(&fh->vfh)) if (!v4l2_fh_is_singular(&fh->vfh))
...@@ -543,9 +542,7 @@ static int v4l2_flash_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) ...@@ -543,9 +542,7 @@ static int v4l2_flash_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
mutex_unlock(&led_cdev->led_access); mutex_unlock(&led_cdev->led_access);
if (iled_cdev) { if (led_cdev_ind) {
led_cdev_ind = &iled_cdev->led_cdev;
mutex_lock(&led_cdev_ind->led_access); mutex_lock(&led_cdev_ind->led_access);
led_sysfs_disable(led_cdev_ind); led_sysfs_disable(led_cdev_ind);
...@@ -578,7 +575,7 @@ static int v4l2_flash_close(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) ...@@ -578,7 +575,7 @@ static int v4l2_flash_close(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
struct v4l2_flash *v4l2_flash = v4l2_subdev_to_v4l2_flash(sd); struct v4l2_flash *v4l2_flash = v4l2_subdev_to_v4l2_flash(sd);
struct led_classdev_flash *fled_cdev = v4l2_flash->fled_cdev; struct led_classdev_flash *fled_cdev = v4l2_flash->fled_cdev;
struct led_classdev *led_cdev = &fled_cdev->led_cdev; struct led_classdev *led_cdev = &fled_cdev->led_cdev;
struct led_classdev_flash *iled_cdev = v4l2_flash->iled_cdev; struct led_classdev *led_cdev_ind = v4l2_flash->iled_cdev;
int ret = 0; int ret = 0;
if (!v4l2_fh_is_singular(&fh->vfh)) if (!v4l2_fh_is_singular(&fh->vfh))
...@@ -593,9 +590,7 @@ static int v4l2_flash_close(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) ...@@ -593,9 +590,7 @@ static int v4l2_flash_close(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
mutex_unlock(&led_cdev->led_access); mutex_unlock(&led_cdev->led_access);
if (iled_cdev) { if (led_cdev_ind) {
struct led_classdev *led_cdev_ind = &iled_cdev->led_cdev;
mutex_lock(&led_cdev_ind->led_access); mutex_lock(&led_cdev_ind->led_access);
led_sysfs_enable(led_cdev_ind); led_sysfs_enable(led_cdev_ind);
mutex_unlock(&led_cdev_ind->led_access); mutex_unlock(&led_cdev_ind->led_access);
...@@ -614,7 +609,7 @@ static const struct v4l2_subdev_ops v4l2_flash_subdev_ops; ...@@ -614,7 +609,7 @@ static const struct v4l2_subdev_ops v4l2_flash_subdev_ops;
struct v4l2_flash *v4l2_flash_init( struct v4l2_flash *v4l2_flash_init(
struct device *dev, struct fwnode_handle *fwn, struct device *dev, struct fwnode_handle *fwn,
struct led_classdev_flash *fled_cdev, struct led_classdev_flash *fled_cdev,
struct led_classdev_flash *iled_cdev, struct led_classdev *iled_cdev,
const struct v4l2_flash_ops *ops, const struct v4l2_flash_ops *ops,
struct v4l2_flash_config *config) struct v4l2_flash_config *config)
{ {
......
...@@ -536,7 +536,7 @@ static int gb_lights_light_v4l2_register(struct gb_light *light) ...@@ -536,7 +536,7 @@ static int gb_lights_light_v4l2_register(struct gb_light *light)
struct device *dev = &connection->bundle->dev; struct device *dev = &connection->bundle->dev;
struct v4l2_flash_config *sd_cfg; struct v4l2_flash_config *sd_cfg;
struct led_classdev_flash *fled; struct led_classdev_flash *fled;
struct led_classdev_flash *iled = NULL; struct led_classdev *iled = NULL;
struct gb_channel *channel_torch, *channel_ind, *channel_flash; struct gb_channel *channel_torch, *channel_ind, *channel_flash;
int ret = 0; int ret = 0;
...@@ -553,7 +553,7 @@ static int gb_lights_light_v4l2_register(struct gb_light *light) ...@@ -553,7 +553,7 @@ static int gb_lights_light_v4l2_register(struct gb_light *light)
if (channel_ind) { if (channel_ind) {
__gb_lights_channel_v4l2_config(&channel_ind->intensity_uA, __gb_lights_channel_v4l2_config(&channel_ind->intensity_uA,
&sd_cfg->indicator_intensity); &sd_cfg->indicator_intensity);
iled = &channel_ind->fled; iled = &channel_ind->fled.led_cdev;
} }
channel_flash = get_channel_from_mode(light, GB_CHANNEL_MODE_FLASH); channel_flash = get_channel_from_mode(light, GB_CHANNEL_MODE_FLASH);
......
...@@ -85,7 +85,7 @@ struct v4l2_flash_config { ...@@ -85,7 +85,7 @@ struct v4l2_flash_config {
*/ */
struct v4l2_flash { struct v4l2_flash {
struct led_classdev_flash *fled_cdev; struct led_classdev_flash *fled_cdev;
struct led_classdev_flash *iled_cdev; struct led_classdev *iled_cdev;
const struct v4l2_flash_ops *ops; const struct v4l2_flash_ops *ops;
struct v4l2_subdev sd; struct v4l2_subdev sd;
...@@ -124,7 +124,7 @@ static inline struct v4l2_flash *v4l2_ctrl_to_v4l2_flash(struct v4l2_ctrl *c) ...@@ -124,7 +124,7 @@ static inline struct v4l2_flash *v4l2_ctrl_to_v4l2_flash(struct v4l2_ctrl *c)
struct v4l2_flash *v4l2_flash_init( struct v4l2_flash *v4l2_flash_init(
struct device *dev, struct fwnode_handle *fwn, struct device *dev, struct fwnode_handle *fwn,
struct led_classdev_flash *fled_cdev, struct led_classdev_flash *fled_cdev,
struct led_classdev_flash *iled_cdev, struct led_classdev *iled_cdev,
const struct v4l2_flash_ops *ops, const struct v4l2_flash_ops *ops,
struct v4l2_flash_config *config); struct v4l2_flash_config *config);
...@@ -140,7 +140,7 @@ void v4l2_flash_release(struct v4l2_flash *v4l2_flash); ...@@ -140,7 +140,7 @@ void v4l2_flash_release(struct v4l2_flash *v4l2_flash);
static inline struct v4l2_flash *v4l2_flash_init( static inline struct v4l2_flash *v4l2_flash_init(
struct device *dev, struct fwnode_handle *fwn, struct device *dev, struct fwnode_handle *fwn,
struct led_classdev_flash *fled_cdev, struct led_classdev_flash *fled_cdev,
struct led_classdev_flash *iled_cdev, struct led_classdev *iled_cdev,
const struct v4l2_flash_ops *ops, const struct v4l2_flash_ops *ops,
struct v4l2_flash_config *config) struct v4l2_flash_config *config)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment