Skip to content

Commit

Permalink
V4L/DVB (9788): soc-camera: simplify naming
Browse files Browse the repository at this point in the history
We anyway don't follow the s_fmt_vid_cap / g_fmt_vid_cap / try_fmt_vid_cap
naming, and soc-camera is so far only about video capture, let's simplify
operation names a bit further. set_fmt_cap / try_fmt_cap wasn't a very good
choice too.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Guennadi Liakhovetski authored and Mauro Carvalho Chehab committed Dec 30, 2008
1 parent 25c4d74 commit d8fac21
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 58 deletions.
14 changes: 7 additions & 7 deletions drivers/media/video/mt9m001.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,8 @@ static unsigned long mt9m001_query_bus_param(struct soc_camera_device *icd)
width_flag;
}

static int mt9m001_set_fmt_cap(struct soc_camera_device *icd,
__u32 pixfmt, struct v4l2_rect *rect)
static int mt9m001_set_fmt(struct soc_camera_device *icd,
__u32 pixfmt, struct v4l2_rect *rect)
{
struct mt9m001 *mt9m001 = container_of(icd, struct mt9m001, icd);
int ret;
Expand All @@ -298,7 +298,7 @@ static int mt9m001_set_fmt_cap(struct soc_camera_device *icd,
ret = reg_write(icd, MT9M001_VERTICAL_BLANKING, vblank);

/* The caller provides a supported format, as verified per
* call to icd->try_fmt_cap() */
* call to icd->try_fmt() */
if (!ret)
ret = reg_write(icd, MT9M001_COLUMN_START, rect->left);
if (!ret)
Expand All @@ -325,8 +325,8 @@ static int mt9m001_set_fmt_cap(struct soc_camera_device *icd,
return ret;
}

static int mt9m001_try_fmt_cap(struct soc_camera_device *icd,
struct v4l2_format *f)
static int mt9m001_try_fmt(struct soc_camera_device *icd,
struct v4l2_format *f)
{
if (f->fmt.pix.height < 32 + icd->y_skip_top)
f->fmt.pix.height = 32 + icd->y_skip_top;
Expand Down Expand Up @@ -447,8 +447,8 @@ static struct soc_camera_ops mt9m001_ops = {
.release = mt9m001_release,
.start_capture = mt9m001_start_capture,
.stop_capture = mt9m001_stop_capture,
.set_fmt_cap = mt9m001_set_fmt_cap,
.try_fmt_cap = mt9m001_try_fmt_cap,
.set_fmt = mt9m001_set_fmt,
.try_fmt = mt9m001_try_fmt,
.set_bus_param = mt9m001_set_bus_param,
.query_bus_param = mt9m001_query_bus_param,
.controls = mt9m001_controls,
Expand Down
12 changes: 6 additions & 6 deletions drivers/media/video/mt9m111.c
Original file line number Diff line number Diff line change
Expand Up @@ -452,8 +452,8 @@ static int mt9m111_set_pixfmt(struct soc_camera_device *icd, u32 pixfmt)
return ret;
}

static int mt9m111_set_fmt_cap(struct soc_camera_device *icd,
__u32 pixfmt, struct v4l2_rect *rect)
static int mt9m111_set_fmt(struct soc_camera_device *icd,
__u32 pixfmt, struct v4l2_rect *rect)
{
struct mt9m111 *mt9m111 = container_of(icd, struct mt9m111, icd);
int ret;
Expand All @@ -473,8 +473,8 @@ static int mt9m111_set_fmt_cap(struct soc_camera_device *icd,
return ret;
}

static int mt9m111_try_fmt_cap(struct soc_camera_device *icd,
struct v4l2_format *f)
static int mt9m111_try_fmt(struct soc_camera_device *icd,
struct v4l2_format *f)
{
if (f->fmt.pix.height > MT9M111_MAX_HEIGHT)
f->fmt.pix.height = MT9M111_MAX_HEIGHT;
Expand Down Expand Up @@ -597,8 +597,8 @@ static struct soc_camera_ops mt9m111_ops = {
.release = mt9m111_release,
.start_capture = mt9m111_start_capture,
.stop_capture = mt9m111_stop_capture,
.set_fmt_cap = mt9m111_set_fmt_cap,
.try_fmt_cap = mt9m111_try_fmt_cap,
.set_fmt = mt9m111_set_fmt,
.try_fmt = mt9m111_try_fmt,
.query_bus_param = mt9m111_query_bus_param,
.set_bus_param = mt9m111_set_bus_param,
.controls = mt9m111_controls,
Expand Down
14 changes: 7 additions & 7 deletions drivers/media/video/mt9v022.c
Original file line number Diff line number Diff line change
Expand Up @@ -337,14 +337,14 @@ static unsigned long mt9v022_query_bus_param(struct soc_camera_device *icd)
width_flag;
}

static int mt9v022_set_fmt_cap(struct soc_camera_device *icd,
__u32 pixfmt, struct v4l2_rect *rect)
static int mt9v022_set_fmt(struct soc_camera_device *icd,
__u32 pixfmt, struct v4l2_rect *rect)
{
struct mt9v022 *mt9v022 = container_of(icd, struct mt9v022, icd);
int ret;

/* The caller provides a supported format, as verified per call to
* icd->try_fmt_cap(), datawidth is from our supported format list */
* icd->try_fmt(), datawidth is from our supported format list */
switch (pixfmt) {
case V4L2_PIX_FMT_GREY:
case V4L2_PIX_FMT_Y16:
Expand Down Expand Up @@ -400,8 +400,8 @@ static int mt9v022_set_fmt_cap(struct soc_camera_device *icd,
return 0;
}

static int mt9v022_try_fmt_cap(struct soc_camera_device *icd,
struct v4l2_format *f)
static int mt9v022_try_fmt(struct soc_camera_device *icd,
struct v4l2_format *f)
{
if (f->fmt.pix.height < 32 + icd->y_skip_top)
f->fmt.pix.height = 32 + icd->y_skip_top;
Expand Down Expand Up @@ -538,8 +538,8 @@ static struct soc_camera_ops mt9v022_ops = {
.release = mt9v022_release,
.start_capture = mt9v022_start_capture,
.stop_capture = mt9v022_stop_capture,
.set_fmt_cap = mt9v022_set_fmt_cap,
.try_fmt_cap = mt9v022_try_fmt_cap,
.set_fmt = mt9v022_set_fmt,
.try_fmt = mt9v022_try_fmt,
.set_bus_param = mt9v022_set_bus_param,
.query_bus_param = mt9v022_query_bus_param,
.controls = mt9v022_controls,
Expand Down
14 changes: 7 additions & 7 deletions drivers/media/video/ov772x.c
Original file line number Diff line number Diff line change
Expand Up @@ -755,9 +755,9 @@ static int ov772x_set_register(struct soc_camera_device *icd,
}
#endif

static int ov772x_set_fmt_cap(struct soc_camera_device *icd,
__u32 pixfmt,
struct v4l2_rect *rect)
static int ov772x_set_fmt(struct soc_camera_device *icd,
__u32 pixfmt,
struct v4l2_rect *rect)
{
struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd);
int ret = -EINVAL;
Expand All @@ -778,8 +778,8 @@ static int ov772x_set_fmt_cap(struct soc_camera_device *icd,
return ret;
}

static int ov772x_try_fmt_cap(struct soc_camera_device *icd,
struct v4l2_format *f)
static int ov772x_try_fmt(struct soc_camera_device *icd,
struct v4l2_format *f)
{
struct v4l2_pix_format *pix = &f->fmt.pix;
struct ov772x_priv *priv;
Expand Down Expand Up @@ -868,8 +868,8 @@ static struct soc_camera_ops ov772x_ops = {
.release = ov772x_release,
.start_capture = ov772x_start_capture,
.stop_capture = ov772x_stop_capture,
.set_fmt_cap = ov772x_set_fmt_cap,
.try_fmt_cap = ov772x_try_fmt_cap,
.set_fmt = ov772x_set_fmt,
.try_fmt = ov772x_try_fmt,
.set_bus_param = ov772x_set_bus_param,
.query_bus_param = ov772x_query_bus_param,
.get_chip_id = ov772x_get_chip_id,
Expand Down
16 changes: 8 additions & 8 deletions drivers/media/video/pxa_camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -904,8 +904,8 @@ static int pxa_camera_try_bus_param(struct soc_camera_device *icd, __u32 pixfmt)
return soc_camera_bus_param_compatible(camera_flags, bus_flags) ? 0 : -EINVAL;
}

static int pxa_camera_set_fmt_cap(struct soc_camera_device *icd,
__u32 pixfmt, struct v4l2_rect *rect)
static int pxa_camera_set_fmt(struct soc_camera_device *icd,
__u32 pixfmt, struct v4l2_rect *rect)
{
const struct soc_camera_data_format *cam_fmt;
int ret;
Expand All @@ -920,15 +920,15 @@ static int pxa_camera_set_fmt_cap(struct soc_camera_device *icd,
return -EINVAL;
}

ret = icd->ops->set_fmt_cap(icd, pixfmt, rect);
ret = icd->ops->set_fmt(icd, pixfmt, rect);
if (pixfmt && !ret)
icd->current_fmt = cam_fmt;

return ret;
}

static int pxa_camera_try_fmt_cap(struct soc_camera_device *icd,
struct v4l2_format *f)
static int pxa_camera_try_fmt(struct soc_camera_device *icd,
struct v4l2_format *f)
{
const struct soc_camera_data_format *cam_fmt;
int ret = pxa_camera_try_bus_param(icd, f->fmt.pix.pixelformat);
Expand Down Expand Up @@ -960,7 +960,7 @@ static int pxa_camera_try_fmt_cap(struct soc_camera_device *icd,
f->fmt.pix.sizeimage = f->fmt.pix.height * f->fmt.pix.bytesperline;

/* limit to sensor capabilities */
return icd->ops->try_fmt_cap(icd, f);
return icd->ops->try_fmt(icd, f);
}

static int pxa_camera_reqbufs(struct soc_camera_file *icf,
Expand Down Expand Up @@ -1068,8 +1068,8 @@ static struct soc_camera_host_ops pxa_soc_camera_host_ops = {
.remove = pxa_camera_remove_device,
.suspend = pxa_camera_suspend,
.resume = pxa_camera_resume,
.set_fmt_cap = pxa_camera_set_fmt_cap,
.try_fmt_cap = pxa_camera_try_fmt_cap,
.set_fmt = pxa_camera_set_fmt,
.try_fmt = pxa_camera_try_fmt,
.init_videobuf = pxa_camera_init_videobuf,
.reqbufs = pxa_camera_reqbufs,
.poll = pxa_camera_poll,
Expand Down
16 changes: 8 additions & 8 deletions drivers/media/video/sh_mobile_ceu_camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -450,8 +450,8 @@ static int sh_mobile_ceu_try_bus_param(struct soc_camera_device *icd,
return 0;
}

static int sh_mobile_ceu_set_fmt_cap(struct soc_camera_device *icd,
__u32 pixfmt, struct v4l2_rect *rect)
static int sh_mobile_ceu_set_fmt(struct soc_camera_device *icd,
__u32 pixfmt, struct v4l2_rect *rect)
{
const struct soc_camera_data_format *cam_fmt;
int ret;
Expand All @@ -466,15 +466,15 @@ static int sh_mobile_ceu_set_fmt_cap(struct soc_camera_device *icd,
return -EINVAL;
}

ret = icd->ops->set_fmt_cap(icd, pixfmt, rect);
ret = icd->ops->set_fmt(icd, pixfmt, rect);
if (pixfmt && !ret)
icd->current_fmt = cam_fmt;

return ret;
}

static int sh_mobile_ceu_try_fmt_cap(struct soc_camera_device *icd,
struct v4l2_format *f)
static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd,
struct v4l2_format *f)
{
const struct soc_camera_data_format *cam_fmt;
int ret = sh_mobile_ceu_try_bus_param(icd, f->fmt.pix.pixelformat);
Expand Down Expand Up @@ -508,7 +508,7 @@ static int sh_mobile_ceu_try_fmt_cap(struct soc_camera_device *icd,
f->fmt.pix.sizeimage = f->fmt.pix.height * f->fmt.pix.bytesperline;

/* limit to sensor capabilities */
return icd->ops->try_fmt_cap(icd, f);
return icd->ops->try_fmt(icd, f);
}

static int sh_mobile_ceu_reqbufs(struct soc_camera_file *icf,
Expand Down Expand Up @@ -576,8 +576,8 @@ static struct soc_camera_host_ops sh_mobile_ceu_host_ops = {
.owner = THIS_MODULE,
.add = sh_mobile_ceu_add_device,
.remove = sh_mobile_ceu_remove_device,
.set_fmt_cap = sh_mobile_ceu_set_fmt_cap,
.try_fmt_cap = sh_mobile_ceu_try_fmt_cap,
.set_fmt = sh_mobile_ceu_set_fmt,
.try_fmt = sh_mobile_ceu_try_fmt,
.reqbufs = sh_mobile_ceu_reqbufs,
.poll = sh_mobile_ceu_poll,
.querycap = sh_mobile_ceu_querycap,
Expand Down
6 changes: 3 additions & 3 deletions drivers/media/video/soc_camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ static int soc_camera_try_fmt_vid_cap(struct file *file, void *priv,
}

/* limit format to hardware capabilities */
ret = ici->ops->try_fmt_cap(icd, f);
ret = ici->ops->try_fmt(icd, f);

return ret;
}
Expand Down Expand Up @@ -324,7 +324,7 @@ static int soc_camera_s_fmt_vid_cap(struct file *file, void *priv,
rect.top = icd->y_current;
rect.width = f->fmt.pix.width;
rect.height = f->fmt.pix.height;
ret = ici->ops->set_fmt_cap(icd, f->fmt.pix.pixelformat, &rect);
ret = ici->ops->set_fmt(icd, f->fmt.pix.pixelformat, &rect);
if (ret < 0) {
return ret;
} else if (!icd->current_fmt ||
Expand Down Expand Up @@ -553,7 +553,7 @@ static int soc_camera_s_crop(struct file *file, void *fh,
if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
return -EINVAL;

ret = ici->ops->set_fmt_cap(icd, 0, &a->c);
ret = ici->ops->set_fmt(icd, 0, &a->c);
if (!ret) {
icd->width = a->c.width;
icd->height = a->c.height;
Expand Down
12 changes: 6 additions & 6 deletions drivers/media/video/soc_camera_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ soc_camera_platform_query_bus_param(struct soc_camera_device *icd)
return p->bus_param;
}

static int soc_camera_platform_set_fmt_cap(struct soc_camera_device *icd,
__u32 pixfmt, struct v4l2_rect *rect)
static int soc_camera_platform_set_fmt(struct soc_camera_device *icd,
__u32 pixfmt, struct v4l2_rect *rect)
{
return 0;
}

static int soc_camera_platform_try_fmt_cap(struct soc_camera_device *icd,
struct v4l2_format *f)
static int soc_camera_platform_try_fmt(struct soc_camera_device *icd,
struct v4l2_format *f)
{
struct soc_camera_platform_info *p = soc_camera_platform_get_info(icd);

Expand Down Expand Up @@ -124,8 +124,8 @@ static struct soc_camera_ops soc_camera_platform_ops = {
.release = soc_camera_platform_release,
.start_capture = soc_camera_platform_start_capture,
.stop_capture = soc_camera_platform_stop_capture,
.set_fmt_cap = soc_camera_platform_set_fmt_cap,
.try_fmt_cap = soc_camera_platform_try_fmt_cap,
.set_fmt = soc_camera_platform_set_fmt,
.try_fmt = soc_camera_platform_try_fmt,
.set_bus_param = soc_camera_platform_set_bus_param,
.query_bus_param = soc_camera_platform_query_bus_param,
};
Expand Down
10 changes: 4 additions & 6 deletions include/media/soc_camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,8 @@ struct soc_camera_host_ops {
void (*remove)(struct soc_camera_device *);
int (*suspend)(struct soc_camera_device *, pm_message_t state);
int (*resume)(struct soc_camera_device *);
int (*set_fmt_cap)(struct soc_camera_device *, __u32,
struct v4l2_rect *);
int (*try_fmt_cap)(struct soc_camera_device *, struct v4l2_format *);
int (*set_fmt)(struct soc_camera_device *, __u32, struct v4l2_rect *);
int (*try_fmt)(struct soc_camera_device *, struct v4l2_format *);
void (*init_videobuf)(struct videobuf_queue *,
struct soc_camera_device *);
int (*reqbufs)(struct soc_camera_file *, struct v4l2_requestbuffers *);
Expand Down Expand Up @@ -125,9 +124,8 @@ struct soc_camera_ops {
int (*release)(struct soc_camera_device *);
int (*start_capture)(struct soc_camera_device *);
int (*stop_capture)(struct soc_camera_device *);
int (*set_fmt_cap)(struct soc_camera_device *, __u32,
struct v4l2_rect *);
int (*try_fmt_cap)(struct soc_camera_device *, struct v4l2_format *);
int (*set_fmt)(struct soc_camera_device *, __u32, struct v4l2_rect *);
int (*try_fmt)(struct soc_camera_device *, struct v4l2_format *);
unsigned long (*query_bus_param)(struct soc_camera_device *);
int (*set_bus_param)(struct soc_camera_device *, unsigned long);
int (*get_chip_id)(struct soc_camera_device *,
Expand Down

0 comments on commit d8fac21

Please sign in to comment.