Re: [PATCH 1/2] v4l: Use v4l2_get_subdevdata instead of accessing v4l2_subdev::priv
On Friday 30 July 2010 22:24:54 Laurent Pinchart wrote: Replace direct access to the v4l2_subdev priv field with the inline v4l2_get_subdevdata method. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com Acked-by: Hans Verkuil hverk...@xs4all.nl --- drivers/media/video/mt9m001.c| 26 +- drivers/media/video/mt9m111.c| 20 ++-- drivers/media/video/mt9t031.c| 24 drivers/media/video/mt9t112.c| 14 +++--- drivers/media/video/mt9v022.c| 26 +- drivers/media/video/ov772x.c | 18 +- drivers/media/video/ov9640.c | 12 ++-- drivers/media/video/rj54n1cb0c.c | 26 +- drivers/media/video/soc_camera.c |2 +- drivers/media/video/tw9910.c | 20 ++-- 10 files changed, 94 insertions(+), 94 deletions(-) diff --git a/drivers/media/video/mt9m001.c b/drivers/media/video/mt9m001.c index 79f096d..fcb4cd9 100644 --- a/drivers/media/video/mt9m001.c +++ b/drivers/media/video/mt9m001.c @@ -157,7 +157,7 @@ static int mt9m001_init(struct i2c_client *client) static int mt9m001_s_stream(struct v4l2_subdev *sd, int enable) { - struct i2c_client *client = sd-priv; + struct i2c_client *client = v4l2_get_subdevdata(sd); /* Switch to master normal mode or stop sensor readout */ if (reg_write(client, MT9M001_OUTPUT_CONTROL, enable ? 2 : 0) 0) @@ -206,7 +206,7 @@ static unsigned long mt9m001_query_bus_param(struct soc_camera_device *icd) static int mt9m001_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) { - struct i2c_client *client = sd-priv; + struct i2c_client *client = v4l2_get_subdevdata(sd); struct mt9m001 *mt9m001 = to_mt9m001(client); struct v4l2_rect rect = a-c; struct soc_camera_device *icd = client-dev.platform_data; @@ -271,7 +271,7 @@ static int mt9m001_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) static int mt9m001_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) { - struct i2c_client *client = sd-priv; + struct i2c_client *client = v4l2_get_subdevdata(sd); struct mt9m001 *mt9m001 = to_mt9m001(client); a-c= mt9m001-rect; @@ -297,7 +297,7 @@ static int mt9m001_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a) static int mt9m001_g_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) { - struct i2c_client *client = sd-priv; + struct i2c_client *client = v4l2_get_subdevdata(sd); struct mt9m001 *mt9m001 = to_mt9m001(client); mf-width = mt9m001-rect.width; @@ -312,7 +312,7 @@ static int mt9m001_g_fmt(struct v4l2_subdev *sd, static int mt9m001_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) { - struct i2c_client *client = sd-priv; + struct i2c_client *client = v4l2_get_subdevdata(sd); struct mt9m001 *mt9m001 = to_mt9m001(client); struct v4l2_crop a = { .c = { @@ -340,7 +340,7 @@ static int mt9m001_s_fmt(struct v4l2_subdev *sd, static int mt9m001_try_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) { - struct i2c_client *client = sd-priv; + struct i2c_client *client = v4l2_get_subdevdata(sd); struct mt9m001 *mt9m001 = to_mt9m001(client); const struct mt9m001_datafmt *fmt; @@ -367,7 +367,7 @@ static int mt9m001_try_fmt(struct v4l2_subdev *sd, static int mt9m001_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *id) { - struct i2c_client *client = sd-priv; + struct i2c_client *client = v4l2_get_subdevdata(sd); struct mt9m001 *mt9m001 = to_mt9m001(client); if (id-match.type != V4L2_CHIP_MATCH_I2C_ADDR) @@ -386,7 +386,7 @@ static int mt9m001_g_chip_ident(struct v4l2_subdev *sd, static int mt9m001_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg) { - struct i2c_client *client = sd-priv; + struct i2c_client *client = v4l2_get_subdevdata(sd); if (reg-match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg-reg 0xff) return -EINVAL; @@ -406,7 +406,7 @@ static int mt9m001_g_register(struct v4l2_subdev *sd, static int mt9m001_s_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg) { - struct i2c_client *client = sd-priv; + struct i2c_client *client = v4l2_get_subdevdata(sd); if (reg-match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg-reg 0xff) return -EINVAL; @@ -468,7 +468,7 @@ static struct soc_camera_ops mt9m001_ops = { static int mt9m001_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) { - struct i2c_client *client = sd-priv; + struct i2c_client *client = v4l2_get_subdevdata(sd); struct
[PATCH 1/2] v4l: Use v4l2_get_subdevdata instead of accessing v4l2_subdev::priv
Replace direct access to the v4l2_subdev priv field with the inline v4l2_get_subdevdata method. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/media/video/mt9m001.c| 26 +- drivers/media/video/mt9m111.c| 20 ++-- drivers/media/video/mt9t031.c| 24 drivers/media/video/mt9t112.c| 14 +++--- drivers/media/video/mt9v022.c| 26 +- drivers/media/video/ov772x.c | 18 +- drivers/media/video/ov9640.c | 12 ++-- drivers/media/video/rj54n1cb0c.c | 26 +- drivers/media/video/soc_camera.c |2 +- drivers/media/video/tw9910.c | 20 ++-- 10 files changed, 94 insertions(+), 94 deletions(-) diff --git a/drivers/media/video/mt9m001.c b/drivers/media/video/mt9m001.c index 79f096d..fcb4cd9 100644 --- a/drivers/media/video/mt9m001.c +++ b/drivers/media/video/mt9m001.c @@ -157,7 +157,7 @@ static int mt9m001_init(struct i2c_client *client) static int mt9m001_s_stream(struct v4l2_subdev *sd, int enable) { - struct i2c_client *client = sd-priv; + struct i2c_client *client = v4l2_get_subdevdata(sd); /* Switch to master normal mode or stop sensor readout */ if (reg_write(client, MT9M001_OUTPUT_CONTROL, enable ? 2 : 0) 0) @@ -206,7 +206,7 @@ static unsigned long mt9m001_query_bus_param(struct soc_camera_device *icd) static int mt9m001_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) { - struct i2c_client *client = sd-priv; + struct i2c_client *client = v4l2_get_subdevdata(sd); struct mt9m001 *mt9m001 = to_mt9m001(client); struct v4l2_rect rect = a-c; struct soc_camera_device *icd = client-dev.platform_data; @@ -271,7 +271,7 @@ static int mt9m001_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) static int mt9m001_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) { - struct i2c_client *client = sd-priv; + struct i2c_client *client = v4l2_get_subdevdata(sd); struct mt9m001 *mt9m001 = to_mt9m001(client); a-c= mt9m001-rect; @@ -297,7 +297,7 @@ static int mt9m001_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a) static int mt9m001_g_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) { - struct i2c_client *client = sd-priv; + struct i2c_client *client = v4l2_get_subdevdata(sd); struct mt9m001 *mt9m001 = to_mt9m001(client); mf-width = mt9m001-rect.width; @@ -312,7 +312,7 @@ static int mt9m001_g_fmt(struct v4l2_subdev *sd, static int mt9m001_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) { - struct i2c_client *client = sd-priv; + struct i2c_client *client = v4l2_get_subdevdata(sd); struct mt9m001 *mt9m001 = to_mt9m001(client); struct v4l2_crop a = { .c = { @@ -340,7 +340,7 @@ static int mt9m001_s_fmt(struct v4l2_subdev *sd, static int mt9m001_try_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) { - struct i2c_client *client = sd-priv; + struct i2c_client *client = v4l2_get_subdevdata(sd); struct mt9m001 *mt9m001 = to_mt9m001(client); const struct mt9m001_datafmt *fmt; @@ -367,7 +367,7 @@ static int mt9m001_try_fmt(struct v4l2_subdev *sd, static int mt9m001_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *id) { - struct i2c_client *client = sd-priv; + struct i2c_client *client = v4l2_get_subdevdata(sd); struct mt9m001 *mt9m001 = to_mt9m001(client); if (id-match.type != V4L2_CHIP_MATCH_I2C_ADDR) @@ -386,7 +386,7 @@ static int mt9m001_g_chip_ident(struct v4l2_subdev *sd, static int mt9m001_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg) { - struct i2c_client *client = sd-priv; + struct i2c_client *client = v4l2_get_subdevdata(sd); if (reg-match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg-reg 0xff) return -EINVAL; @@ -406,7 +406,7 @@ static int mt9m001_g_register(struct v4l2_subdev *sd, static int mt9m001_s_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg) { - struct i2c_client *client = sd-priv; + struct i2c_client *client = v4l2_get_subdevdata(sd); if (reg-match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg-reg 0xff) return -EINVAL; @@ -468,7 +468,7 @@ static struct soc_camera_ops mt9m001_ops = { static int mt9m001_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) { - struct i2c_client *client = sd-priv; + struct i2c_client *client = v4l2_get_subdevdata(sd); struct mt9m001 *mt9m001 = to_mt9m001(client); int data; @@ -494,7 +494,7 @@ static int mt9m001_g_ctrl(struct