summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/camera.c
diff options
context:
space:
mode:
authorGjorgji Rosikopulos2016-03-14 17:44:53 +0100
committerGreg Kroah-Hartman2016-03-17 23:17:59 +0100
commitc3d77f71308e38ef98909c317c57d906f4d51cb9 (patch)
tree8b5b70fb81edcc439fa2f376b4f3dcb494ab04ca /drivers/staging/greybus/camera.c
parentgreybus: camera: Register capabilities operation (diff)
downloadkernel-qcow2-linux-c3d77f71308e38ef98909c317c57d906f4d51cb9.tar.gz
kernel-qcow2-linux-c3d77f71308e38ef98909c317c57d906f4d51cb9.tar.xz
kernel-qcow2-linux-c3d77f71308e38ef98909c317c57d906f4d51cb9.zip
greybus: camera: Improve module registration mechanism
Registering more then one module at same time was not possible with previous implementation. Also unregistering of the module was missing leading to many instability issues when camera module is ejected when camera is still active. Signed-off-by: Gjorgji Rosikopulos <grosikopulos@mm-sol.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/camera.c')
-rw-r--r--drivers/staging/greybus/camera.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/drivers/staging/greybus/camera.c b/drivers/staging/greybus/camera.c
index e862659a5ccc..722f2b4fe54d 100644
--- a/drivers/staging/greybus/camera.c
+++ b/drivers/staging/greybus/camera.c
@@ -38,6 +38,7 @@ struct gb_camera_debugfs_buffer {
* @connection: the greybus connection for camera control
* @data_connected: whether the data connection has been established
* @debugfs: debugfs entries for camera protocol operations testing
+ * @module: Greybus camera module registered to HOST processor.
*/
struct gb_camera {
struct gb_connection *connection;
@@ -47,6 +48,8 @@ struct gb_camera {
struct dentry *root;
struct gb_camera_debugfs_buffer *buffers;
} debugfs;
+
+ struct gb_camera_module module;
};
struct gb_camera_stream_config {
@@ -504,16 +507,20 @@ static int gb_camera_op_flush(void *priv, u32 *request_id)
return gb_camera_flush(priv, request_id);
}
-struct gb_camera_ops gb_cam_ops = {
- .capabilities = gb_camera_op_capabilities,
- .configure_streams = gb_camera_op_configure_streams,
- .capture = gb_camera_op_capture,
- .flush = gb_camera_op_flush,
-};
-
static int gb_camera_register_intf_ops(struct gb_camera *gcam)
{
- return gb_camera_register(&gb_cam_ops, gcam);
+ gcam->module.priv = gcam;
+ gcam->module.ops.capabilities = gb_camera_op_capabilities;
+ gcam->module.ops.configure_streams = gb_camera_op_configure_streams;
+ gcam->module.ops.capture = gb_camera_op_capture;
+ gcam->module.ops.flush = gb_camera_op_flush;
+
+ return gb_camera_register(&gcam->module);
+}
+
+static int gb_camera_unregister_intf_ops(struct gb_camera *gcam)
+{
+ return gb_camera_unregister(&gcam->module);
}
/* -----------------------------------------------------------------------------
@@ -931,6 +938,8 @@ static void gb_camera_connection_exit(struct gb_connection *connection)
{
struct gb_camera *gcam = connection->private;
+ gb_camera_unregister_intf_ops(gcam);
+
gb_camera_cleanup(gcam);
}