Skip to content

Commit

Permalink
[media] exynos4-is: Don't overwrite subdevdata in the fimc-is sensor …
Browse files Browse the repository at this point in the history
…driver

It's an I2C client driver and it must not overwrite the struct v4l2_subdev
dev_priv field, which is used by the v4l2 core to store a pointer to
struct i2c_client.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Sylwester Nawrocki authored and Mauro Carvalho Chehab committed Apr 25, 2013
1 parent b2afa23 commit 1bc515a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 1 addition & 7 deletions drivers/media/platform/exynos4-is/fimc-is-sensor.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@ static const struct v4l2_mbus_framefmt fimc_is_sensor_formats[] = {
}
};

static struct fimc_is_sensor *sd_to_fimc_is_sensor(struct v4l2_subdev *sd)
{
return container_of(sd, struct fimc_is_sensor, subdev);
}

static const struct v4l2_mbus_framefmt *find_sensor_format(
struct v4l2_mbus_framefmt *mf)
{
Expand Down Expand Up @@ -147,7 +142,7 @@ static const struct v4l2_subdev_internal_ops fimc_is_sensor_sd_internal_ops = {

static int fimc_is_sensor_s_power(struct v4l2_subdev *sd, int on)
{
struct fimc_is_sensor *sensor = v4l2_get_subdevdata(sd);
struct fimc_is_sensor *sensor = sd_to_fimc_is_sensor(sd);
int gpio = sensor->gpio_reset;
int ret;

Expand Down Expand Up @@ -252,7 +247,6 @@ static int fimc_is_sensor_probe(struct i2c_client *client,
if (ret < 0)
return ret;

v4l2_set_subdevdata(sd, sensor);
pm_runtime_no_callbacks(dev);
pm_runtime_enable(dev);

Expand Down
6 changes: 6 additions & 0 deletions drivers/media/platform/exynos4-is/fimc-is-sensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ struct fimc_is_sensor {
struct v4l2_mbus_framefmt format;
};

static inline
struct fimc_is_sensor *sd_to_fimc_is_sensor(struct v4l2_subdev *sd)
{
return container_of(sd, struct fimc_is_sensor, subdev);
}

int fimc_is_register_sensor_driver(void);
void fimc_is_unregister_sensor_driver(void);

Expand Down
2 changes: 1 addition & 1 deletion drivers/media/platform/exynos4-is/fimc-is.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ static int fimc_is_register_subdevs(struct fimc_is *is)
if (WARN_ON(is->sensor))
continue;

is->sensor = v4l2_get_subdevdata(sd);
is->sensor = sd_to_fimc_is_sensor(sd);

if (fimc_is_parse_sensor_config(is->sensor, child)) {
dev_warn(&is->pdev->dev, "DT parse error: %s\n",
Expand Down

0 comments on commit 1bc515a

Please sign in to comment.