summaryrefslogtreecommitdiffstats
path: root/drivers/media/video/gspca/stv06xx
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2012-05-09 11:19:00 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-05-14 09:42:34 -0300
commita8a478601ac1d8877e23cb832fe4b44042ce6f20 (patch)
treec2a0074e12c85ba852f340bbf83ec5fbd0ec348c /drivers/media/video/gspca/stv06xx
parent98684298f9ed89554cdaa4afe2554fca8276d1e9 (diff)
downloadlinux-a8a478601ac1d8877e23cb832fe4b44042ce6f20.tar.gz
linux-a8a478601ac1d8877e23cb832fe4b44042ce6f20.tar.bz2
linux-a8a478601ac1d8877e23cb832fe4b44042ce6f20.zip
[media] gscpa: Move ctrl_handler to gspca_dev
We intend to eventually port all sub-drivers to the control-framework. At which point it will make more sense to have the ctrl_handler in gspca_dev then to have it in the subdrivers. Lets move it there now, to avoid a lot of work to move it later. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/gspca/stv06xx')
-rw-r--r--drivers/media/video/gspca/stv06xx/stv06xx.c2
-rw-r--r--drivers/media/video/gspca/stv06xx/stv06xx.h3
-rw-r--r--drivers/media/video/gspca/stv06xx/stv06xx_hdcs.c9
-rw-r--r--drivers/media/video/gspca/stv06xx/stv06xx_pb0100.c14
-rw-r--r--drivers/media/video/gspca/stv06xx/stv06xx_st6422.c6
-rw-r--r--drivers/media/video/gspca/stv06xx/stv06xx_vv6410.c13
6 files changed, 25 insertions, 22 deletions
diff --git a/drivers/media/video/gspca/stv06xx/stv06xx.c b/drivers/media/video/gspca/stv06xx/stv06xx.c
index cebd615effeb..999ec7764449 100644
--- a/drivers/media/video/gspca/stv06xx/stv06xx.c
+++ b/drivers/media/video/gspca/stv06xx/stv06xx.c
@@ -268,7 +268,7 @@ static int stv06xx_init_controls(struct gspca_dev *gspca_dev)
PDEBUG(D_PROBE, "Initializing controls");
- gspca_dev->vdev.ctrl_handler = &sd->ctrl_handler;
+ gspca_dev->vdev.ctrl_handler = &gspca_dev->ctrl_handler;
return sd->sensor->init_controls(sd);
}
diff --git a/drivers/media/video/gspca/stv06xx/stv06xx.h b/drivers/media/video/gspca/stv06xx/stv06xx.h
index b7cbc6b878d3..34957a4ec150 100644
--- a/drivers/media/video/gspca/stv06xx/stv06xx.h
+++ b/drivers/media/video/gspca/stv06xx/stv06xx.h
@@ -89,9 +89,6 @@ struct sd {
/* A pointer to the currently connected sensor */
const struct stv06xx_sensor *sensor;
- /* Control handler */
- struct v4l2_ctrl_handler ctrl_handler;
-
/* Sensor private data */
void *sensor_priv;
diff --git a/drivers/media/video/gspca/stv06xx/stv06xx_hdcs.c b/drivers/media/video/gspca/stv06xx/stv06xx_hdcs.c
index 74cbd386600b..06fa54c5efb2 100644
--- a/drivers/media/video/gspca/stv06xx/stv06xx_hdcs.c
+++ b/drivers/media/video/gspca/stv06xx/stv06xx_hdcs.c
@@ -335,15 +335,16 @@ static int hdcs_set_size(struct sd *sd,
static int hdcs_s_ctrl(struct v4l2_ctrl *ctrl)
{
- struct sd *sd = container_of(ctrl->handler, struct sd, ctrl_handler);
+ struct gspca_dev *gspca_dev =
+ container_of(ctrl->handler, struct gspca_dev, ctrl_handler);
int err = -EINVAL;
switch (ctrl->id) {
case V4L2_CID_GAIN:
- err = hdcs_set_gain(&sd->gspca_dev, ctrl->val);
+ err = hdcs_set_gain(gspca_dev, ctrl->val);
break;
case V4L2_CID_EXPOSURE:
- err = hdcs_set_exposure(&sd->gspca_dev, ctrl->val);
+ err = hdcs_set_exposure(gspca_dev, ctrl->val);
break;
}
return err;
@@ -355,7 +356,7 @@ static const struct v4l2_ctrl_ops hdcs_ctrl_ops = {
static int hdcs_init_controls(struct sd *sd)
{
- struct v4l2_ctrl_handler *hdl = &sd->ctrl_handler;
+ struct v4l2_ctrl_handler *hdl = &sd->gspca_dev.ctrl_handler;
v4l2_ctrl_handler_init(hdl, 2);
v4l2_ctrl_new_std(hdl, &hdcs_ctrl_ops,
diff --git a/drivers/media/video/gspca/stv06xx/stv06xx_pb0100.c b/drivers/media/video/gspca/stv06xx/stv06xx_pb0100.c
index c03b13e70b56..cdfc3d05ab6b 100644
--- a/drivers/media/video/gspca/stv06xx/stv06xx_pb0100.c
+++ b/drivers/media/video/gspca/stv06xx/stv06xx_pb0100.c
@@ -87,24 +87,26 @@ static struct v4l2_pix_format pb0100_mode[] = {
static int pb0100_s_ctrl(struct v4l2_ctrl *ctrl)
{
- struct sd *sd = container_of(ctrl->handler, struct sd, ctrl_handler);
+ struct gspca_dev *gspca_dev =
+ container_of(ctrl->handler, struct gspca_dev, ctrl_handler);
+ struct sd *sd = (struct sd *)gspca_dev;
struct pb0100_ctrls *ctrls = sd->sensor_priv;
int err = -EINVAL;
switch (ctrl->id) {
case V4L2_CID_AUTOGAIN:
- err = pb0100_set_autogain(&sd->gspca_dev, ctrl->val);
+ err = pb0100_set_autogain(gspca_dev, ctrl->val);
if (err)
break;
if (ctrl->val)
break;
- err = pb0100_set_gain(&sd->gspca_dev, ctrls->gain->val);
+ err = pb0100_set_gain(gspca_dev, ctrls->gain->val);
if (err)
break;
- err = pb0100_set_exposure(&sd->gspca_dev, ctrls->exposure->val);
+ err = pb0100_set_exposure(gspca_dev, ctrls->exposure->val);
break;
case V4L2_CTRL_CLASS_USER + 0x1001:
- err = pb0100_set_autogain_target(&sd->gspca_dev, ctrl->val);
+ err = pb0100_set_autogain_target(gspca_dev, ctrl->val);
break;
}
return err;
@@ -116,7 +118,7 @@ static const struct v4l2_ctrl_ops pb0100_ctrl_ops = {
static int pb0100_init_controls(struct sd *sd)
{
- struct v4l2_ctrl_handler *hdl = &sd->ctrl_handler;
+ struct v4l2_ctrl_handler *hdl = &sd->gspca_dev.ctrl_handler;
struct pb0100_ctrls *ctrls;
static const struct v4l2_ctrl_config autogain_target = {
.ops = &pb0100_ctrl_ops,
diff --git a/drivers/media/video/gspca/stv06xx/stv06xx_st6422.c b/drivers/media/video/gspca/stv06xx/stv06xx_st6422.c
index bbfe8210d590..8a57990dfe0f 100644
--- a/drivers/media/video/gspca/stv06xx/stv06xx_st6422.c
+++ b/drivers/media/video/gspca/stv06xx/stv06xx_st6422.c
@@ -67,7 +67,9 @@ static int setexposure(struct sd *sd, s16 expo);
static int st6422_s_ctrl(struct v4l2_ctrl *ctrl)
{
- struct sd *sd = container_of(ctrl->handler, struct sd, ctrl_handler);
+ struct gspca_dev *gspca_dev =
+ container_of(ctrl->handler, struct gspca_dev, ctrl_handler);
+ struct sd *sd = (struct sd *)gspca_dev;
int err = -EINVAL;
switch (ctrl->id) {
@@ -98,7 +100,7 @@ static const struct v4l2_ctrl_ops st6422_ctrl_ops = {
static int st6422_init_controls(struct sd *sd)
{
- struct v4l2_ctrl_handler *hdl = &sd->ctrl_handler;
+ struct v4l2_ctrl_handler *hdl = &sd->gspca_dev.ctrl_handler;
v4l2_ctrl_handler_init(hdl, 4);
v4l2_ctrl_new_std(hdl, &st6422_ctrl_ops,
diff --git a/drivers/media/video/gspca/stv06xx/stv06xx_vv6410.c b/drivers/media/video/gspca/stv06xx/stv06xx_vv6410.c
index 1b7a68a5a43d..748e1421d6d8 100644
--- a/drivers/media/video/gspca/stv06xx/stv06xx_vv6410.c
+++ b/drivers/media/video/gspca/stv06xx/stv06xx_vv6410.c
@@ -46,21 +46,22 @@ static struct v4l2_pix_format vv6410_mode[] = {
static int vv6410_s_ctrl(struct v4l2_ctrl *ctrl)
{
- struct sd *sd = container_of(ctrl->handler, struct sd, ctrl_handler);
+ struct gspca_dev *gspca_dev =
+ container_of(ctrl->handler, struct gspca_dev, ctrl_handler);
int err = -EINVAL;
switch (ctrl->id) {
case V4L2_CID_HFLIP:
- err = vv6410_set_hflip(&sd->gspca_dev, ctrl->val);
+ err = vv6410_set_hflip(gspca_dev, ctrl->val);
break;
case V4L2_CID_VFLIP:
- err = vv6410_set_vflip(&sd->gspca_dev, ctrl->val);
+ err = vv6410_set_vflip(gspca_dev, ctrl->val);
break;
case V4L2_CID_GAIN:
- err = vv6410_set_analog_gain(&sd->gspca_dev, ctrl->val);
+ err = vv6410_set_analog_gain(gspca_dev, ctrl->val);
break;
case V4L2_CID_EXPOSURE:
- err = vv6410_set_exposure(&sd->gspca_dev, ctrl->val);
+ err = vv6410_set_exposure(gspca_dev, ctrl->val);
break;
}
return err;
@@ -91,7 +92,7 @@ static int vv6410_probe(struct sd *sd)
static int vv6410_init_controls(struct sd *sd)
{
- struct v4l2_ctrl_handler *hdl = &sd->ctrl_handler;
+ struct v4l2_ctrl_handler *hdl = &sd->gspca_dev.ctrl_handler;
v4l2_ctrl_handler_init(hdl, 4);
v4l2_ctrl_new_std(hdl, &vv6410_ctrl_ops,