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: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
This commit is contained in:
Sakari Ailus 2017-06-02 05:30:02 -04:00 committed by Mauro Carvalho Chehab
parent 06f8152027
commit 85f7ff9702
3 changed files with 12 additions and 17 deletions

View File

@ -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,
brightness);
} else {
led_set_brightness_sync(&v4l2_flash->iled_cdev->led_cdev,
led_set_brightness_sync(v4l2_flash->iled_cdev,
brightness);
}
}
@ -133,7 +133,7 @@ static int v4l2_flash_update_led_brightness(struct v4l2_flash *v4l2_flash,
return 0;
led_cdev = &v4l2_flash->fled_cdev->led_cdev;
} else {
led_cdev = &v4l2_flash->iled_cdev->led_cdev;
led_cdev = v4l2_flash->iled_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)
struct v4l2_flash *v4l2_flash = v4l2_subdev_to_v4l2_flash(sd);
struct led_classdev_flash *fled_cdev = v4l2_flash->fled_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 = NULL;
struct led_classdev *led_cdev_ind = v4l2_flash->iled_cdev;
int ret = 0;
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)
mutex_unlock(&led_cdev->led_access);
if (iled_cdev) {
led_cdev_ind = &iled_cdev->led_cdev;
if (led_cdev_ind) {
mutex_lock(&led_cdev_ind->led_access);
led_sysfs_disable(led_cdev_ind);
@ -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 led_classdev_flash *fled_cdev = v4l2_flash->fled_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;
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)
mutex_unlock(&led_cdev->led_access);
if (iled_cdev) {
struct led_classdev *led_cdev_ind = &iled_cdev->led_cdev;
if (led_cdev_ind) {
mutex_lock(&led_cdev_ind->led_access);
led_sysfs_enable(led_cdev_ind);
mutex_unlock(&led_cdev_ind->led_access);
@ -614,7 +609,7 @@ static const struct v4l2_subdev_ops v4l2_flash_subdev_ops;
struct v4l2_flash *v4l2_flash_init(
struct device *dev, struct fwnode_handle *fwn,
struct led_classdev_flash *fled_cdev,
struct led_classdev_flash *iled_cdev,
struct led_classdev *iled_cdev,
const struct v4l2_flash_ops *ops,
struct v4l2_flash_config *config)
{

View File

@ -536,7 +536,7 @@ static int gb_lights_light_v4l2_register(struct gb_light *light)
struct device *dev = &connection->bundle->dev;
struct v4l2_flash_config *sd_cfg;
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;
int ret = 0;
@ -553,7 +553,7 @@ static int gb_lights_light_v4l2_register(struct gb_light *light)
if (channel_ind) {
__gb_lights_channel_v4l2_config(&channel_ind->intensity_uA,
&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);

View File

@ -85,7 +85,7 @@ struct v4l2_flash_config {
*/
struct v4l2_flash {
struct led_classdev_flash *fled_cdev;
struct led_classdev_flash *iled_cdev;
struct led_classdev *iled_cdev;
const struct v4l2_flash_ops *ops;
struct v4l2_subdev sd;
@ -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 device *dev, struct fwnode_handle *fwn,
struct led_classdev_flash *fled_cdev,
struct led_classdev_flash *iled_cdev,
struct led_classdev *iled_cdev,
const struct v4l2_flash_ops *ops,
struct v4l2_flash_config *config);
@ -140,7 +140,7 @@ void v4l2_flash_release(struct v4l2_flash *v4l2_flash);
static inline struct v4l2_flash *v4l2_flash_init(
struct device *dev, struct fwnode_handle *fwn,
struct led_classdev_flash *fled_cdev,
struct led_classdev_flash *iled_cdev,
struct led_classdev *iled_cdev,
const struct v4l2_flash_ops *ops,
struct v4l2_flash_config *config)
{