Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c85bb69a authored by Guennadi Liakhovetski's avatar Guennadi Liakhovetski Committed by Mauro Carvalho Chehab
Browse files

[media] v4l: ov772x: simplify pointer dereference



Use a more direct way to obtain a pointer to struct ov772x_priv, where the
subdevice is available.

Signed-off-by: default avatarGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 63c9718c
Loading
Loading
Loading
Loading
+7 −10
Original line number Original line Diff line number Diff line
@@ -600,7 +600,7 @@ static int ov772x_reset(struct i2c_client *client)
static int ov772x_s_stream(struct v4l2_subdev *sd, int enable)
static int ov772x_s_stream(struct v4l2_subdev *sd, int enable)
{
{
	struct i2c_client *client = v4l2_get_subdevdata(sd);
	struct i2c_client *client = v4l2_get_subdevdata(sd);
	struct ov772x_priv *priv = to_ov772x(client);
	struct ov772x_priv *priv = container_of(sd, struct ov772x_priv, subdev);


	if (!enable) {
	if (!enable) {
		ov772x_mask_set(client, COM2, SOFT_SLEEP_MODE, SOFT_SLEEP_MODE);
		ov772x_mask_set(client, COM2, SOFT_SLEEP_MODE, SOFT_SLEEP_MODE);
@@ -645,8 +645,7 @@ static unsigned long ov772x_query_bus_param(struct soc_camera_device *icd)


static int ov772x_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
static int ov772x_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
{
{
	struct i2c_client *client = v4l2_get_subdevdata(sd);
	struct ov772x_priv *priv = container_of(sd, struct ov772x_priv, subdev);
	struct ov772x_priv *priv = to_ov772x(client);


	switch (ctrl->id) {
	switch (ctrl->id) {
	case V4L2_CID_VFLIP:
	case V4L2_CID_VFLIP:
@@ -665,7 +664,7 @@ static int ov772x_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
static int ov772x_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
static int ov772x_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
{
{
	struct i2c_client *client = v4l2_get_subdevdata(sd);
	struct i2c_client *client = v4l2_get_subdevdata(sd);
	struct ov772x_priv *priv = to_ov772x(client);
	struct ov772x_priv *priv = container_of(sd, struct ov772x_priv, subdev);
	int ret = 0;
	int ret = 0;
	u8 val;
	u8 val;


@@ -715,8 +714,7 @@ static int ov772x_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
static int ov772x_g_chip_ident(struct v4l2_subdev *sd,
static int ov772x_g_chip_ident(struct v4l2_subdev *sd,
			       struct v4l2_dbg_chip_ident *id)
			       struct v4l2_dbg_chip_ident *id)
{
{
	struct i2c_client *client = v4l2_get_subdevdata(sd);
	struct ov772x_priv *priv = container_of(sd, struct ov772x_priv, subdev);
	struct ov772x_priv *priv = to_ov772x(client);


	id->ident    = priv->model;
	id->ident    = priv->model;
	id->revision = 0;
	id->revision = 0;
@@ -955,7 +953,7 @@ static int ov772x_g_fmt(struct v4l2_subdev *sd,
			struct v4l2_mbus_framefmt *mf)
			struct v4l2_mbus_framefmt *mf)
{
{
	struct i2c_client *client = v4l2_get_subdevdata(sd);
	struct i2c_client *client = v4l2_get_subdevdata(sd);
	struct ov772x_priv *priv = to_ov772x(client);
	struct ov772x_priv *priv = container_of(sd, struct ov772x_priv, subdev);


	if (!priv->win || !priv->cfmt) {
	if (!priv->win || !priv->cfmt) {
		u32 width = VGA_WIDTH, height = VGA_HEIGHT;
		u32 width = VGA_WIDTH, height = VGA_HEIGHT;
@@ -978,7 +976,7 @@ static int ov772x_s_fmt(struct v4l2_subdev *sd,
			struct v4l2_mbus_framefmt *mf)
			struct v4l2_mbus_framefmt *mf)
{
{
	struct i2c_client *client = v4l2_get_subdevdata(sd);
	struct i2c_client *client = v4l2_get_subdevdata(sd);
	struct ov772x_priv *priv = to_ov772x(client);
	struct ov772x_priv *priv = container_of(sd, struct ov772x_priv, subdev);
	int ret = ov772x_set_params(client, &mf->width, &mf->height,
	int ret = ov772x_set_params(client, &mf->width, &mf->height,
				    mf->code);
				    mf->code);


@@ -991,8 +989,7 @@ static int ov772x_s_fmt(struct v4l2_subdev *sd,
static int ov772x_try_fmt(struct v4l2_subdev *sd,
static int ov772x_try_fmt(struct v4l2_subdev *sd,
			  struct v4l2_mbus_framefmt *mf)
			  struct v4l2_mbus_framefmt *mf)
{
{
	struct i2c_client *client = v4l2_get_subdevdata(sd);
	struct ov772x_priv *priv = container_of(sd, struct ov772x_priv, subdev);
	struct ov772x_priv *priv = to_ov772x(client);
	const struct ov772x_win_size *win;
	const struct ov772x_win_size *win;
	int i;
	int i;