Skip to content

Commit

Permalink
apps: machine: update cleanup of rpmsg and virtio devices
Browse files Browse the repository at this point in the history
update to clean up devices and not just (void)<var>

Signed-off-by: Ben Levinsky <ben.levinsky@xilinx.com>
  • Loading branch information
Ben Levinsky authored and edmooring committed Oct 26, 2020
1 parent 7be7065 commit dc6ee46
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 13 deletions.
12 changes: 12 additions & 0 deletions apps/machine/microblaze_generic/platform_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,18 @@ int platform_poll(void *priv)
return 0;
}

void platform_release_rpmsg_vdev(struct rpmsg_device *rpdev, void *platform)
{
struct rpmsg_virtio_device *rpvdev;
struct remoteproc *rproc;

rpvdev = metal_container_of(rpdev, struct rpmsg_virtio_device, rdev);
rproc = platform;

rpmsg_deinit_vdev(rpvdev);
remoteproc_remove_virtio(rproc, rpvdev->vdev);
}

void platform_release_rpmsg_vdev(struct rpmsg_device *rpdev)
{
if (rpdev->
Expand Down
2 changes: 1 addition & 1 deletion apps/machine/microblaze_generic/platform_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ int platform_poll(void *platform);
*
* @rpdev: pointer to the rpmsg device
*/
void platform_release_rpmsg_vdev(struct rpmsg_device *rpdev);
void platform_release_rpmsg_vdev(struct rpmsg_device *rpdev, void *platform);

/**
* platform_cleanup - clean up the platform resource
Expand Down
11 changes: 9 additions & 2 deletions apps/machine/zynq7/platform_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,16 @@ int platform_poll(void *priv)
return 0;
}

void platform_release_rpmsg_vdev(struct rpmsg_device *rpdev)
void platform_release_rpmsg_vdev(struct rpmsg_device *rpdev, void *platform)
{
(void)rpdev;
struct rpmsg_virtio_device *rpvdev;
struct remoteproc *rproc;

rpvdev = metal_container_of(rpdev, struct rpmsg_virtio_device, rdev);
rproc = platform;

rpmsg_deinit_vdev(rpvdev);
remoteproc_remove_virtio(rproc, rpvdev->vdev);
}

void platform_cleanup(void *platform)
Expand Down
2 changes: 1 addition & 1 deletion apps/machine/zynq7/platform_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ int platform_poll(void *platform);
*
* @rpdev: pointer to the rpmsg device
*/
void platform_release_rpmsg_vdev(struct rpmsg_device *rpdev);
void platform_release_rpmsg_vdev(struct rpmsg_device *rpdev, void *platform);

/**
* platform_cleanup - clean up the platform resource
Expand Down
11 changes: 9 additions & 2 deletions apps/machine/zynqmp/platform_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,16 @@ int platform_poll(void *priv)
return 0;
}

void platform_release_rpmsg_vdev(struct rpmsg_device *rpdev)
void platform_release_rpmsg_vdev(struct rpmsg_device *rpdev, void *platform)
{
(void)rpdev;
struct rpmsg_virtio_device *rpvdev;
struct remoteproc *rproc;

rpvdev = metal_container_of(rpdev, struct rpmsg_virtio_device, rdev);
rproc = platform;

rpmsg_deinit_vdev(rpvdev);
remoteproc_remove_virtio(rproc, rpvdev->vdev);
}

void platform_cleanup(void *platform)
Expand Down
2 changes: 1 addition & 1 deletion apps/machine/zynqmp/platform_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ int platform_poll(void *platform);
*
* @rpdev: pointer to the rpmsg device
*/
void platform_release_rpmsg_vdev(struct rpmsg_device *rpdev);
void platform_release_rpmsg_vdev(struct rpmsg_device *rpdev, void *platform);

/**
* platform_cleanup - clean up the platform resource
Expand Down
11 changes: 9 additions & 2 deletions apps/machine/zynqmp_r5/platform_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,16 @@ int platform_poll(void *priv)
return 0;
}

void platform_release_rpmsg_vdev(struct rpmsg_device *rpdev)
void platform_release_rpmsg_vdev(struct rpmsg_device *rpdev, void *platform)
{
(void)rpdev;
struct rpmsg_virtio_device *rpvdev;
struct remoteproc *rproc;

rpvdev = metal_container_of(rpdev, struct rpmsg_virtio_device, rdev);
rproc = platform;

rpmsg_deinit_vdev(rpvdev);
remoteproc_remove_virtio(rproc, rpvdev->vdev);
}

void platform_cleanup(void *platform)
Expand Down
2 changes: 1 addition & 1 deletion apps/machine/zynqmp_r5/platform_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ int platform_poll(void *platform);
*
* @rpdev: pointer to the rpmsg device
*/
void platform_release_rpmsg_vdev(struct rpmsg_device *rpdev);
void platform_release_rpmsg_vdev(struct rpmsg_device *rpdev, void *platform);

/**
* platform_cleanup - clean up the platform resource
Expand Down
11 changes: 9 additions & 2 deletions apps/system/linux/machine/generic/platform_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -539,9 +539,16 @@ int platform_poll(void *priv)
return 0;
}

void platform_release_rpmsg_vdev(struct rpmsg_device *rpdev)
void platform_release_rpmsg_vdev(struct rpmsg_device *rpdev, void *platform)
{
(void)rpdev;
struct rpmsg_virtio_device *rpvdev;
struct remoteproc *rproc;

rpvdev = metal_container_of(rpdev, struct rpmsg_virtio_device, rdev);
rproc = platform;

rpmsg_deinit_vdev(rpvdev);
remoteproc_remove_virtio(rproc, rpvdev->vdev);
}

void platform_cleanup(void *platform)
Expand Down
2 changes: 1 addition & 1 deletion apps/system/linux/machine/generic/platform_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ int platform_poll(void *platform);
*
* @rpdev: pointer to the rpmsg device
*/
void platform_release_rpmsg_vdev(struct rpmsg_device *rpdev);
void platform_release_rpmsg_vdev(struct rpmsg_device *rpdev, void *platform);

/**
* platform_cleanup - clean up the platform resource
Expand Down

0 comments on commit dc6ee46

Please sign in to comment.