Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vc-sm-cma tidy ups, and one for bcm2835_codec #2889

Merged
merged 5 commits into from
Mar 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ enum bcm2835_codec_role {
ISP,
};

const static char *roles[] = {
"decode",
"encode",
"isp"
};

static const char * const components[] = {
"ril.video_decode",
"ril.video_encode",
Expand Down Expand Up @@ -2511,7 +2517,6 @@ static int bcm2835_codec_create(struct platform_device *pdev,
struct video_device *vfd;
int video_nr;
int ret;
const static char *roles[] = {"decode", "encode", "isp"};

dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL);
if (!dev)
Expand Down Expand Up @@ -2604,7 +2609,8 @@ static int bcm2835_codec_destroy(struct bcm2835_codec_dev *dev)
if (!dev)
return -ENODEV;

v4l2_info(&dev->v4l2_dev, "Removing " MEM2MEM_NAME);
v4l2_info(&dev->v4l2_dev, "Removing " MEM2MEM_NAME ", %s\n",
roles[dev->role]);
v4l2_m2m_release(dev->m2m_dev);
video_unregister_device(&dev->vfd);
v4l2_device_unregister(&dev->v4l2_dev);
Expand Down
24 changes: 8 additions & 16 deletions drivers/staging/vc04_services/vc-sm-cma/vc_sm.c
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ static void vc_sm_connected_init(void)
__func__, ret);

ret = -EIO;
goto err_free_mem;
goto err_failed;
}

ret = vchi_connect(NULL, 0, vchi_instance);
Expand All @@ -665,7 +665,7 @@ static void vc_sm_connected_init(void)
__func__, ret);

ret = -EIO;
goto err_free_mem;
goto err_failed;
}

/* Initialize an instance of the shared memory service. */
Expand All @@ -676,18 +676,11 @@ static void vc_sm_connected_init(void)
__func__);

ret = -EPERM;
goto err_free_mem;
goto err_failed;
}

/* Create a debug fs directory entry (root). */
sm_state->dir_root = debugfs_create_dir(VC_SM_DIR_ROOT_NAME, NULL);
if (!sm_state->dir_root) {
pr_err("[%s]: failed to create \'%s\' directory entry\n",
__func__, VC_SM_DIR_ROOT_NAME);

ret = -EPERM;
goto err_stop_sm_service;
}

sm_state->dir_state.show = &vc_sm_cma_global_state_show;
sm_state->dir_state.dir_entry =
Expand Down Expand Up @@ -720,10 +713,8 @@ static void vc_sm_connected_init(void)

err_remove_shared_memory:
debugfs_remove_recursive(sm_state->dir_root);
err_stop_sm_service:
vc_sm_cma_vchi_stop(&sm_state->sm_handle);
err_free_mem:
kfree(sm_state);
err_failed:
pr_info("[%s]: failed, ret %d\n", __func__, ret);
}

Expand All @@ -732,7 +723,7 @@ static int bcm2835_vc_sm_cma_probe(struct platform_device *pdev)
{
pr_info("%s: Videocore shared memory driver\n", __func__);

sm_state = kzalloc(sizeof(*sm_state), GFP_KERNEL);
sm_state = devm_kzalloc(&pdev->dev, sizeof(*sm_state), GFP_KERNEL);
if (!sm_state)
return -ENOMEM;
sm_state->pdev = pdev;
Expand All @@ -757,16 +748,17 @@ static int bcm2835_vc_sm_cma_remove(struct platform_device *pdev)
pr_debug("[%s]: start\n", __func__);
if (sm_inited) {
/* Remove all proc entries. */
//debugfs_remove_recursive(sm_state->dir_root);
debugfs_remove_recursive(sm_state->dir_root);

/* Stop the videocore shared memory service. */
vc_sm_cma_vchi_stop(&sm_state->sm_handle);
}

if (sm_state) {
6by9 marked this conversation as resolved.
Show resolved Hide resolved
idr_destroy(&sm_state->kernelid_map);

/* Free the memory for the state structure. */
mutex_destroy(&sm_state->map_lock);
kfree(sm_state);
}

pr_debug("[%s]: end\n", __func__);
Expand Down