aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/video/v4l2-subdev.c41
-rw-r--r--include/media/v4l2-subdev.h15
2 files changed, 30 insertions, 26 deletions
diff --git a/drivers/media/video/v4l2-subdev.c b/drivers/media/video/v4l2-subdev.c
index 037aa28a5ed1..460b33697c9b 100644
--- a/drivers/media/video/v4l2-subdev.c
+++ b/drivers/media/video/v4l2-subdev.c
@@ -1,22 +1,23 @@
1/* 1/*
2 * V4L2 subdevice support. 2 * V4L2 sub-device
3 * 3 *
4 * Copyright (C) 2010 Nokia Corporation 4 * Copyright (C) 2010 Nokia Corporation
5 * 5 *
6 * Contact: Laurent Pinchart <laurent.pinchart@ideasonboard.com> 6 * Contact: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
7 * Sakari Ailus <sakari.ailus@iki.fi>
7 * 8 *
8 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 10 * it under the terms of the GNU General Public License version 2 as
10 * the Free Software Foundation. 11 * published by the Free Software Foundation.
11 * 12 *
12 * This program is distributed in the hope that it will be useful, 13 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details. 16 * GNU General Public License for more details.
16 * 17 *
17 * You should have received a copy of the GNU General Public License 18 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software 19 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */ 21 */
21 22
22#include <linux/types.h> 23#include <linux/types.h>
@@ -58,3 +59,17 @@ const struct v4l2_file_operations v4l2_subdev_fops = {
58 .unlocked_ioctl = subdev_ioctl, 59 .unlocked_ioctl = subdev_ioctl,
59 .release = subdev_close, 60 .release = subdev_close,
60}; 61};
62
63void v4l2_subdev_init(struct v4l2_subdev *sd, const struct v4l2_subdev_ops *ops)
64{
65 INIT_LIST_HEAD(&sd->list);
66 BUG_ON(!ops);
67 sd->ops = ops;
68 sd->v4l2_dev = NULL;
69 sd->flags = 0;
70 sd->name[0] = '\0';
71 sd->grp_id = 0;
72 sd->dev_priv = NULL;
73 sd->host_priv = NULL;
74}
75EXPORT_SYMBOL(v4l2_subdev_init);
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 474ef009fd3d..3276065022ef 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -487,19 +487,8 @@ static inline void *v4l2_get_subdev_hostdata(const struct v4l2_subdev *sd)
487 return sd->host_priv; 487 return sd->host_priv;
488} 488}
489 489
490static inline void v4l2_subdev_init(struct v4l2_subdev *sd, 490void v4l2_subdev_init(struct v4l2_subdev *sd,
491 const struct v4l2_subdev_ops *ops) 491 const struct v4l2_subdev_ops *ops);
492{
493 INIT_LIST_HEAD(&sd->list);
494 BUG_ON(!ops);
495 sd->ops = ops;
496 sd->v4l2_dev = NULL;
497 sd->flags = 0;
498 sd->name[0] = '\0';
499 sd->grp_id = 0;
500 sd->dev_priv = NULL;
501 sd->host_priv = NULL;
502}
503 492
504/* Call an ops of a v4l2_subdev, doing the right checks against 493/* Call an ops of a v4l2_subdev, doing the right checks against
505 NULL pointers. 494 NULL pointers.